Search in sources :

Example 1 with FinishDialog

use of org.csploit.android.gui.dialogs.FinishDialog in project android by cSploit.

the class ExploitFinder method setStartedState.

private void setStartedState() {
    mSearchProgress.setVisibility(View.VISIBLE);
    final Target target = System.getCurrentTarget();
    mSearchFloatingActionButton.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_stop_24dp));
    buttonPlayed = true;
    job = Search.searchExploitForServices(target, new Search.Receiver<Exploit>() {

        private boolean somethingFound = false;

        @Override
        public void onItemFound(final Exploit exploit) {
            somethingFound = true;
            ExploitFinder.this.runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    target.addExploit(exploit);
                    mAdapter.notifyDataSetChanged();
                }
            });
        }

        @Override
        public void onFoundItemChanged(Exploit exploit) {
            ExploitFinder.this.runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    mAdapter.notifyDataSetChanged();
                }
            });
        }

        @Override
        public void onEnd() {
            ExploitFinder.this.runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    mSearchProgress.setVisibility(View.GONE);
                    mSearchFloatingActionButton.setImageDrawable(ContextCompat.getDrawable(getBaseContext(), R.drawable.ic_play_arrow_24dp));
                    buttonPlayed = false;
                    if (System.getCurrentExploits().size() == 0) {
                        new FinishDialog(getString(R.string.warning), getString(R.string.no_exploits_found), ExploitFinder.this).show();
                    } else if (!somethingFound) {
                        new ErrorDialog(getString(R.string.warning), getString(R.string.no_exploits_found), ExploitFinder.this).show();
                    }
                }
            });
        }
    });
}
Also used : Target(org.csploit.android.net.Target) FinishDialog(org.csploit.android.gui.dialogs.FinishDialog) ErrorDialog(org.csploit.android.gui.dialogs.ErrorDialog) Exploit(org.csploit.android.net.Target.Exploit) MsfExploit(org.csploit.android.net.metasploit.MsfExploit)

Example 2 with FinishDialog

use of org.csploit.android.gui.dialogs.FinishDialog in project android by cSploit.

the class ExploitFinder method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    SharedPreferences themePrefs = getSharedPreferences("THEME", 0);
    Boolean isDark = themePrefs.getBoolean("isDark", false);
    if (isDark)
        setTheme(R.style.DarkTheme);
    else
        setTheme(R.style.AppTheme);
    super.onCreate(savedInstanceState);
    Target t = System.getCurrentTarget();
    if (!t.hasOpenPorts())
        new FinishDialog(getString(R.string.warning), getString(R.string.no_open_ports), this).show();
    else if (!t.hasOpenPortsWithService())
        new FinishDialog(getString(R.string.warning), getString(R.string.no_infos_on_target), this).show();
    mSearchFloatingActionButton = (FloatingActionButton) findViewById(R.id.searchToggleButton);
    mSearchProgress = (ProgressBar) findViewById(R.id.searchActivity);
    mListView = (ListView) findViewById(android.R.id.list);
    mAdapter = new ExploitAdapter();
    UIThread = this;
    mListView.setAdapter(mAdapter);
    mListView.setOnItemClickListener(listener);
    mSearchFloatingActionButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (buttonPlayed) {
                setStoppedState();
            } else {
                setStartedState();
            }
        }
    });
}
Also used : Target(org.csploit.android.net.Target) SharedPreferences(android.content.SharedPreferences) FinishDialog(org.csploit.android.gui.dialogs.FinishDialog) OnClickListener(android.view.View.OnClickListener) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 3 with FinishDialog

use of org.csploit.android.gui.dialogs.FinishDialog in project android by cSploit.

the class LoginCracker method onCreate.

public void onCreate(Bundle savedInstanceState) {
    SharedPreferences themePrefs = getSharedPreferences("THEME", 0);
    Boolean isDark = themePrefs.getBoolean("isDark", false);
    if (isDark)
        setTheme(R.style.DarkTheme);
    else
        setTheme(R.style.AppTheme);
    super.onCreate(savedInstanceState);
    if (!System.getCurrentTarget().hasOpenPorts())
        new FinishDialog(getString(R.string.warning), getString(R.string.no_open_ports), this).show();
    final ArrayList<String> ports = new ArrayList<String>();
    for (Port port : System.getCurrentTarget().getOpenPorts()) ports.add(Integer.toString(port.getNumber()));
    mProtocolAdapter = new ProtocolAdapter();
    mPortSpinner = (Spinner) findViewById(R.id.portSpinner);
    mPortSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, ports));
    mPortSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {

        public void onItemSelected(AdapterView<?> adapter, View view, int position, long id) {
            String port = (String) adapter.getItemAtPosition(position);
            int protocolIndex = mProtocolAdapter.getIndexByPort(port);
            if (protocolIndex != -1)
                mProtocolSpinner.setSelection(protocolIndex);
        }

        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });
    mProtocolSpinner = (Spinner) findViewById(R.id.protocolSpinner);
    mProtocolSpinner.setAdapter(new ProtocolAdapter());
    mProtocolSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {

        public void onItemSelected(AdapterView<?> adapter, View view, int position, long id) {
            int portIndex = mProtocolAdapter.getPortIndexByProtocol(position);
            if (portIndex != -1)
                mPortSpinner.setSelection(portIndex);
        }

        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });
    mCharsetSpinner = (Spinner) findViewById(R.id.charsetSpinner);
    mCharsetSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, CHARSETS));
    mCharsetSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {

        public void onItemSelected(AdapterView<?> adapter, View view, int position, long id) {
            if (CHARSETS_MAPPING[position] == null) {
                new InputDialog(getString(R.string.custom_charset), getString(R.string.enter_chars_wanted), LoginCracker.this, new InputDialogListener() {

                    @Override
                    public void onInputEntered(String input) {
                        input = input.trim();
                        if (!input.isEmpty())
                            mCustomCharset = "aA1" + input;
                        else {
                            mCustomCharset = null;
                            mCharsetSpinner.setSelection(0);
                        }
                    }
                }).show();
            } else
                mCustomCharset = null;
        }

        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });
    mUserSpinner = (Spinner) findViewById(R.id.userSpinner);
    mUserSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, USERNAMES));
    mUserSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {

        public void onItemSelected(AdapterView<?> adapter, View view, int position, long id) {
            String user = (String) adapter.getItemAtPosition(position);
            if (user != null && user.equals("-- ADD --")) {
                new InputDialog(getString(R.string.add_username), getString(R.string.enter_username), LoginCracker.this, new InputDialogListener() {

                    @Override
                    public void onInputEntered(String input) {
                        USERNAMES = Arrays.copyOf(USERNAMES, USERNAMES.length + 1);
                        USERNAMES[USERNAMES.length - 1] = "-- ADD --";
                        USERNAMES[USERNAMES.length - 2] = input;
                        mUserSpinner.setAdapter(new ArrayAdapter<String>(LoginCracker.this, android.R.layout.simple_spinner_item, USERNAMES));
                        mUserSpinner.setSelection(USERNAMES.length - 2);
                    }
                }).show();
            }
        }

        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });
    mMaxSpinner = (Spinner) findViewById(R.id.maxSpinner);
    mMaxSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, LENGTHS));
    mMinSpinner = (Spinner) findViewById(R.id.minSpinner);
    mMinSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, LENGTHS));
    mStartButton = (FloatingActionButton) findViewById(R.id.startFAB);
    mStatusText = (TextView) findViewById(R.id.statusText);
    mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
    mActivity = (ProgressBar) findViewById(R.id.activity);
    mProgressBar.setMax(100);
    mReceiver = new AttemptReceiver();
    mStartButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (mRunning) {
                setStoppedState();
            } else {
                setStartedState();
            }
        }
    });
    mWordlistPicker = new Intent();
    mWordlistPicker.addCategory(Intent.CATEGORY_OPENABLE);
    mWordlistPicker.setType("text/*");
    mWordlistPicker.setAction(Intent.ACTION_GET_CONTENT);
    if (Build.VERSION.SDK_INT >= 11)
        mWordlistPicker.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
}
Also used : InputDialog(org.csploit.android.gui.dialogs.InputDialog) SharedPreferences(android.content.SharedPreferences) Port(org.csploit.android.net.Target.Port) ArrayList(java.util.ArrayList) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) InputDialogListener(org.csploit.android.gui.dialogs.InputDialog.InputDialogListener) FinishDialog(org.csploit.android.gui.dialogs.FinishDialog) OnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener) OnClickListener(android.view.View.OnClickListener) ArrayAdapter(android.widget.ArrayAdapter)

Example 4 with FinishDialog

use of org.csploit.android.gui.dialogs.FinishDialog in project android by cSploit.

the class Sessions method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    SharedPreferences themePrefs = getSharedPreferences("THEME", 0);
    Boolean isDark = themePrefs.getBoolean("isDark", false);
    if (isDark)
        setTheme(R.style.DarkTheme);
    else
        setTheme(R.style.AppTheme);
    super.onCreate(savedInstanceState);
    UIThread = this;
    if (System.getMsfRpc() == null) {
        new FinishDialog(getString(R.string.error), "MSF RPC not connected", Sessions.this).show();
        return;
    }
    mResults = System.getCurrentTarget().getSessions();
    mListView = (ListView) findViewById(android.R.id.list);
    mAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, mResults);
    mListView.setAdapter(mAdapter);
    mListView.setOnItemClickListener(clickListener);
    mListView.setOnItemLongClickListener(longClickListener);
    new Thread(new Runnable() {

        @Override
        public void run() {
            System.getMsfRpc().updateSessions();
            runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    if (mResults.isEmpty()) {
                        new FinishDialog(getString(R.string.warning), getString(R.string.no_opened_sessions), Sessions.this).show();
                    } else {
                        mAdapter.notifyDataSetChanged();
                    }
                }
            });
        }
    }).start();
}
Also used : SharedPreferences(android.content.SharedPreferences) FinishDialog(org.csploit.android.gui.dialogs.FinishDialog)

Example 5 with FinishDialog

use of org.csploit.android.gui.dialogs.FinishDialog in project android by cSploit.

the class ActionFragment method onViewCreated.

@Override
public void onViewCreated(View v, Bundle savedInstanceState) {
    SharedPreferences themePrefs = getActivity().getSharedPreferences("THEME", 0);
    Boolean isDark = themePrefs.getBoolean("isDark", false);
    if (isDark) {
        getActivity().setTheme(R.style.DarkTheme);
        v.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.background_window_dark));
    } else {
        getActivity().setTheme(R.style.AppTheme);
        v.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.background_window));
    }
    mTarget = org.csploit.android.core.System.getCurrentTarget();
    if (mTarget != null) {
        getActivity().setTitle("cSploit > " + mTarget);
        ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        theList = (ListView) getActivity().findViewById(R.id.android_list);
        mAvailable = System.getPluginsForTarget();
        ActionsAdapter mActionsAdapter = new ActionsAdapter();
        theList.setAdapter(mActionsAdapter);
        theList.setOnItemClickListener(new ListView.OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if (System.checkNetworking(getActivity())) {
                    Plugin plugin = mAvailable.get(position);
                    System.setCurrentPlugin(plugin);
                    if (plugin.hasLayoutToShow()) {
                        Toast.makeText(getActivity(), getString(R.string.selected) + getString(plugin.getName()), Toast.LENGTH_SHORT).show();
                        startActivity(new Intent(getActivity(), plugin.getClass()));
                        getActivity().overridePendingTransition(R.anim.fadeout, R.anim.fadein);
                    } else
                        plugin.onActionClick(getActivity().getApplicationContext());
                }
            }
        });
    } else {
        new FinishDialog(getString(R.string.warning), getString(R.string.something_went_wrong), getActivity()).show();
    }
}
Also used : SharedPreferences(android.content.SharedPreferences) Intent(android.content.Intent) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint) ListView(android.widget.ListView) FinishDialog(org.csploit.android.gui.dialogs.FinishDialog) Plugin(org.csploit.android.core.Plugin)

Aggregations

FinishDialog (org.csploit.android.gui.dialogs.FinishDialog)5 SharedPreferences (android.content.SharedPreferences)4 View (android.view.View)3 AdapterView (android.widget.AdapterView)3 TextView (android.widget.TextView)3 Intent (android.content.Intent)2 OnClickListener (android.view.View.OnClickListener)2 ImageView (android.widget.ImageView)2 ListView (android.widget.ListView)2 Target (org.csploit.android.net.Target)2 SuppressLint (android.annotation.SuppressLint)1 OnItemSelectedListener (android.widget.AdapterView.OnItemSelectedListener)1 ArrayAdapter (android.widget.ArrayAdapter)1 ArrayList (java.util.ArrayList)1 Plugin (org.csploit.android.core.Plugin)1 ErrorDialog (org.csploit.android.gui.dialogs.ErrorDialog)1 InputDialog (org.csploit.android.gui.dialogs.InputDialog)1 InputDialogListener (org.csploit.android.gui.dialogs.InputDialog.InputDialogListener)1 Exploit (org.csploit.android.net.Target.Exploit)1 Port (org.csploit.android.net.Target.Port)1