Search in sources :

Example 1 with InputDialogListener

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

the class MainFragment method targetAliasPrompt.

private void targetAliasPrompt(final Target target) {
    new InputDialog(getString(R.string.target_alias), getString(R.string.set_alias), target.hasAlias() ? target.getAlias() : "", true, false, getActivity(), new InputDialogListener() {

        @Override
        public void onInputEntered(String input) {
            target.setAlias(input);
            mTargetAdapter.notifyDataSetChanged();
        }
    }).show();
}
Also used : InputDialogListener(org.csploit.android.gui.dialogs.InputDialog.InputDialogListener) InputDialog(org.csploit.android.gui.dialogs.InputDialog)

Example 2 with InputDialogListener

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

the class MainFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
    switch(item.getItemId()) {
        case R.id.add:
            new InputDialog(getString(R.string.add_custom_target), getString(R.string.enter_url), getActivity(), new InputDialogListener() {

                @Override
                public void onInputEntered(String input) {
                    final Target target = Target.getFromString(input);
                    if (target != null) {
                        ThreadHelper.getSharedExecutor().execute(new Runnable() {

                            @Override
                            public void run() {
                                System.addOrderedTarget(target);
                            }
                        });
                    } else
                        new ErrorDialog(getString(R.string.error), getString(R.string.invalid_target), getActivity()).show();
                }
            }).show();
            return true;
        case R.id.scan:
            startNetworkRadar();
            return true;
        case R.id.wifi_ifaces:
            displayNetworkInterfaces(true);
            return true;
        case R.id.wifi_scan:
            stopNetworkRadar();
            mRadarReceiver.unregister();
            mUpdateReceiver.unregister();
            startActivityForResult(new Intent(getActivity(), WifiScannerActivity.class), WIFI_CONNECTION_REQUEST);
            getActivity().overridePendingTransition(R.anim.fadeout, R.anim.fadein);
            return true;
        case R.id.new_session:
            new ConfirmDialog(getString(R.string.warning), getString(R.string.warning_new_session), getActivity(), new ConfirmDialogListener() {

                @Override
                public void onConfirm() {
                    try {
                        System.reset();
                        Toast.makeText(getActivity(), getString(R.string.new_session_started), Toast.LENGTH_SHORT).show();
                    } catch (Exception e) {
                        new FatalDialog(getString(R.string.error), e.toString(), getActivity()).show();
                    }
                }

                @Override
                public void onCancel() {
                }
            }).show();
            return true;
        case R.id.save_session:
            new InputDialog(getString(R.string.save_session), getString(R.string.enter_session_name), System.getSessionName(), true, false, getActivity(), new InputDialogListener() {

                @Override
                public void onInputEntered(String input) {
                    String name = input.trim().replace("/", "").replace("..", "");
                    if (!name.isEmpty()) {
                        try {
                            String filename = System.saveSession(name);
                            Toast.makeText(getActivity(), getString(R.string.session_saved_to) + filename + " .", Toast.LENGTH_SHORT).show();
                        } catch (IOException e) {
                            new ErrorDialog(getString(R.string.error), e.toString(), getActivity()).show();
                        }
                    } else
                        new ErrorDialog(getString(R.string.error), getString(R.string.invalid_session), getActivity()).show();
                }
            }).show();
            return true;
        case R.id.restore_session:
            final ArrayList<String> sessions = System.getAvailableSessionFiles();
            if (sessions != null && sessions.size() > 0) {
                new SpinnerDialog(getString(R.string.select_session), getString(R.string.select_session_file), sessions.toArray(new String[sessions.size()]), getActivity(), new SpinnerDialogListener() {

                    @Override
                    public void onItemSelected(int index) {
                        String session = sessions.get(index);
                        try {
                            System.loadSession(session);
                        } catch (Exception e) {
                            e.printStackTrace();
                            new ErrorDialog(getString(R.string.error), e.getMessage(), getActivity()).show();
                        }
                    }
                }).show();
            } else
                new ErrorDialog(getString(R.string.error), getString(R.string.no_session_found), getActivity()).show();
            return true;
        case R.id.settings:
            startActivity(new Intent(getActivity(), SettingsActivity.class));
            getActivity().overridePendingTransition(R.anim.fadeout, R.anim.fadein);
            return true;
        case R.id.ss_monitor:
            new Thread(new Runnable() {

                @Override
                public void run() {
                    Services.getNetworkRadar().onMenuClick(getActivity(), item);
                }
            }).start();
            return true;
        case R.id.ss_msfrpcd:
            new Thread(new Runnable() {

                @Override
                public void run() {
                    Services.getMsfRpcdService().onMenuClick(getActivity(), item);
                }
            }).start();
            return true;
        case R.id.submit_issue:
            String uri = getString(R.string.github_new_issue_url);
            Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
            startActivity(browser);
            //   String.format(getString(R.string.issue_message), getString(R.string.github_issues_url), getString(R.string.github_new_issue_url));
            return true;
        case R.id.about:
            new AboutDialog(getActivity()).show();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
Also used : InputDialog(org.csploit.android.gui.dialogs.InputDialog) AboutDialog(org.csploit.android.gui.dialogs.AboutDialog) ErrorDialog(org.csploit.android.gui.dialogs.ErrorDialog) Intent(android.content.Intent) IOException(java.io.IOException) NoRouteToHostException(java.net.NoRouteToHostException) IOException(java.io.IOException) InputDialogListener(org.csploit.android.gui.dialogs.InputDialog.InputDialogListener) Target(org.csploit.android.net.Target) SpinnerDialog(org.csploit.android.gui.dialogs.SpinnerDialog) SpinnerDialogListener(org.csploit.android.gui.dialogs.SpinnerDialog.SpinnerDialogListener) FatalDialog(org.csploit.android.gui.dialogs.FatalDialog) ConfirmDialogListener(org.csploit.android.gui.dialogs.ConfirmDialog.ConfirmDialogListener) ConfirmDialog(org.csploit.android.gui.dialogs.ConfirmDialog)

Example 3 with InputDialogListener

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

the class Hijacker 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);
    setTitle(System.getCurrentTarget() + " > MITM > " + getString(R.string.session_sniffer));
    setContentView(R.layout.plugin_mitm_hijacker);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mHijackToggleButton = (ToggleButton) findViewById(R.id.hijackToggleButton);
    mHijackProgress = (ProgressBar) findViewById(R.id.hijackActivity);
    ListView mListView = (ListView) findViewById(R.id.listView);
    mAdapter = new SessionListAdapter(R.layout.plugin_mitm_hijacker_list_item);
    mSpoof = new SpoofSession();
    mListView.setAdapter(mAdapter);
    mListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            final Session session = mAdapter.getByPosition(position);
            if (session != null) {
                new ConfirmDialog(getString(R.string.hijack_session), mRunning ? getString(R.string.start_hijacking) : getString(R.string.start_hijacking2), Hijacker.this, new ConfirmDialogListener() {

                    @Override
                    public void onConfirm() {
                        if (mRunning)
                            setStoppedState();
                        System.setCustomData(session);
                        startActivity(new Intent(Hijacker.this, HijackerWebView.class));
                    }

                    @Override
                    public void onCancel() {
                    }
                }).show();
            }
        }
    });
    mListView.setOnItemLongClickListener(new OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            final Session session = mAdapter.getByPosition(position);
            if (session != null) {
                new InputDialog(getString(R.string.save_session), getString(R.string.set_session_filename), session.getFileName(), true, false, Hijacker.this, new InputDialogListener() {

                    @Override
                    public void onInputEntered(String name) {
                        if (!name.isEmpty()) {
                            try {
                                String filename = session.save(name);
                                Toast.makeText(Hijacker.this, getString(R.string.session_saved_to) + filename + " .", Toast.LENGTH_SHORT).show();
                            } catch (IOException e) {
                                new ErrorDialog(getString(R.string.error), e.toString(), Hijacker.this).show();
                            }
                        } else
                            new ErrorDialog(getString(R.string.error), getString(R.string.invalid_session), Hijacker.this).show();
                    }
                }).show();
            }
            return true;
        }
    });
    mHijackToggleButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (mRunning) {
                setStoppedState();
            } else {
                setStartedState();
            }
        }
    });
    mRequestListener = new RequestListener();
}
Also used : InputDialog(org.csploit.android.gui.dialogs.InputDialog) OnRequestListener(org.csploit.android.net.http.proxy.Proxy.OnRequestListener) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) SharedPreferences(android.content.SharedPreferences) SpoofSession(org.csploit.android.plugins.mitm.SpoofSession) ErrorDialog(org.csploit.android.gui.dialogs.ErrorDialog) Intent(android.content.Intent) IOException(java.io.IOException) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) OnItemLongClickListener(android.widget.AdapterView.OnItemLongClickListener) InputDialogListener(org.csploit.android.gui.dialogs.InputDialog.InputDialogListener) ListView(android.widget.ListView) OnClickListener(android.view.View.OnClickListener) ConfirmDialogListener(org.csploit.android.gui.dialogs.ConfirmDialog.ConfirmDialogListener) ConfirmDialog(org.csploit.android.gui.dialogs.ConfirmDialog) SpoofSession(org.csploit.android.plugins.mitm.SpoofSession)

Example 4 with InputDialogListener

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

the class WifiScannerFragment method onListItemClick.

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    final ScanResult result = mAdapter.getItem(position);
    if (result != null) {
        final Keygen keygen = mWifiMatcher.getKeygen(result);
        mPreviousConfig = NetworkManager.getWifiConfiguration(mWifiManager, result);
        if (mPreviousConfig != null) {
            mWifiManager.removeNetwork(mPreviousConfig.networkId);
        }
        if (keygen != null && (result.capabilities.contains("WEP") || result.capabilities.contains("WPA"))) {
            mKeyList.clear();
            new WifiCrackDialog(result.SSID, getResources().getString(R.string.enter_key_or_crack), getActivity(), new WifiCrackDialogListener() {

                @Override
                public void onManualConnect(String key) {
                    mCurrentNetworkId = performConnection(result, key);
                    if (mCurrentNetworkId != -1)
                        mConnectionReceiver.register(getActivity());
                    else
                        mConnectionReceiver.unregister();
                }

                @Override
                public void onCrack() {
                    performCracking(keygen, result);
                }
            }).show();
        } else {
            if (result.capabilities.contains("WEP") || result.capabilities.contains("WPA")) {
                new InputDialog(result.SSID, getString(R.string.enter_wifi_key), null, true, true, getActivity(), new InputDialogListener() {

                    @Override
                    public void onInputEntered(String input) {
                        mCurrentNetworkId = performConnection(result, input);
                        if (mCurrentNetworkId != -1)
                            mConnectionReceiver.register(getActivity());
                        else
                            mConnectionReceiver.unregister();
                    }
                }).show();
            } else
                performConnection(result, null);
        }
    }
}
Also used : InputDialogListener(org.csploit.android.gui.dialogs.InputDialog.InputDialogListener) ScanResult(android.net.wifi.ScanResult) Keygen(org.csploit.android.wifi.Keygen) InputDialog(org.csploit.android.gui.dialogs.InputDialog) WifiCrackDialog(org.csploit.android.gui.dialogs.WifiCrackDialog) WifiCrackDialogListener(org.csploit.android.gui.dialogs.WifiCrackDialog.WifiCrackDialogListener)

Example 5 with InputDialogListener

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

the class MainActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
    switch(item.getItemId()) {
        case R.id.add:
            new InputDialog(getString(R.string.add_custom_target), getString(R.string.enter_url), MainActivity.this, new InputDialogListener() {

                @Override
                public void onInputEntered(String input) {
                    final Target target = Target.getFromString(input);
                    if (target != null) {
                        ThreadHelper.getSharedExecutor().execute(new Runnable() {

                            @Override
                            public void run() {
                                System.addOrderedTarget(target);
                                mTargetAdapter.update(null, null);
                            }
                        });
                    } else
                        new ErrorDialog(getString(R.string.error), getString(R.string.invalid_target), MainActivity.this).show();
                }
            }).show();
            return true;
        case R.id.scan:
            startNetworkRadar();
            return true;
        case R.id.wifi_scan:
            stopNetworkRadar();
            mRadarReceiver.unregister();
            mUpdateReceiver.unregister();
            startActivityForResult(new Intent(MainActivity.this, WifiScannerActivity.class), WIFI_CONNECTION_REQUEST);
            overridePendingTransition(R.anim.fadeout, R.anim.fadein);
            return true;
        case R.id.new_session:
            new ConfirmDialog(getString(R.string.warning), getString(R.string.warning_new_session), this, new ConfirmDialogListener() {

                @Override
                public void onConfirm() {
                    try {
                        System.reset();
                        mTargetAdapter.notifyDataSetChanged();
                        Toast.makeText(MainActivity.this, getString(R.string.new_session_started), Toast.LENGTH_SHORT).show();
                    } catch (Exception e) {
                        new FatalDialog(getString(R.string.error), e.toString(), MainActivity.this).show();
                    }
                }

                @Override
                public void onCancel() {
                }
            }).show();
            return true;
        case R.id.save_session:
            new InputDialog(getString(R.string.save_session), getString(R.string.enter_session_name), System.getSessionName(), true, false, MainActivity.this, new InputDialogListener() {

                @Override
                public void onInputEntered(String input) {
                    String name = input.trim().replace("/", "").replace("..", "");
                    if (!name.isEmpty()) {
                        try {
                            String filename = System.saveSession(name);
                            Toast.makeText(MainActivity.this, getString(R.string.session_saved_to) + filename + " .", Toast.LENGTH_SHORT).show();
                        } catch (IOException e) {
                            new ErrorDialog(getString(R.string.error), e.toString(), MainActivity.this).show();
                        }
                    } else
                        new ErrorDialog(getString(R.string.error), getString(R.string.invalid_session), MainActivity.this).show();
                }
            }).show();
            return true;
        case R.id.restore_session:
            final ArrayList<String> sessions = System.getAvailableSessionFiles();
            if (sessions != null && sessions.size() > 0) {
                new SpinnerDialog(getString(R.string.select_session), getString(R.string.select_session_file), sessions.toArray(new String[sessions.size()]), MainActivity.this, new SpinnerDialogListener() {

                    @Override
                    public void onItemSelected(int index) {
                        String session = sessions.get(index);
                        try {
                            System.loadSession(session);
                            mTargetAdapter.notifyDataSetChanged();
                        } catch (Exception e) {
                            e.printStackTrace();
                            new ErrorDialog(getString(R.string.error), e.getMessage(), MainActivity.this).show();
                        }
                    }
                }).show();
            } else
                new ErrorDialog(getString(R.string.error), getString(R.string.no_session_found), MainActivity.this).show();
            return true;
        case R.id.settings:
            startActivity(new Intent(MainActivity.this, SettingsActivity.class));
            overridePendingTransition(R.anim.fadeout, R.anim.fadein);
            return true;
        case R.id.ss_monitor:
            new Thread(new Runnable() {

                @Override
                public void run() {
                    Services.getNetworkRadar().onMenuClick(MainActivity.this, item);
                }
            }).start();
            return true;
        case R.id.ss_msfrpcd:
            new Thread(new Runnable() {

                @Override
                public void run() {
                    Services.getMsfRpcdService().onMenuClick(MainActivity.this, item);
                }
            }).start();
            return true;
        case R.id.submit_issue:
            String uri = getString(R.string.github_new_issue_url);
            Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
            startActivity(browser);
            // String.format(getString(R.string.issue_message), getString(R.string.github_issues_url), getString(R.string.github_new_issue_url));
            return true;
        case R.id.about:
            new AboutDialog(this).show();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
Also used : InputDialog(org.csploit.android.gui.dialogs.InputDialog) AboutDialog(org.csploit.android.gui.dialogs.AboutDialog) ErrorDialog(org.csploit.android.gui.dialogs.ErrorDialog) Intent(android.content.Intent) IOException(java.io.IOException) NoRouteToHostException(java.net.NoRouteToHostException) IOException(java.io.IOException) InputDialogListener(org.csploit.android.gui.dialogs.InputDialog.InputDialogListener) Target(org.csploit.android.net.Target) SpinnerDialog(org.csploit.android.gui.dialogs.SpinnerDialog) SpinnerDialogListener(org.csploit.android.gui.dialogs.SpinnerDialog.SpinnerDialogListener) FatalDialog(org.csploit.android.gui.dialogs.FatalDialog) ConfirmDialogListener(org.csploit.android.gui.dialogs.ConfirmDialog.ConfirmDialogListener) ConfirmDialog(org.csploit.android.gui.dialogs.ConfirmDialog)

Aggregations

InputDialog (org.csploit.android.gui.dialogs.InputDialog)10 InputDialogListener (org.csploit.android.gui.dialogs.InputDialog.InputDialogListener)10 Intent (android.content.Intent)5 ErrorDialog (org.csploit.android.gui.dialogs.ErrorDialog)5 SharedPreferences (android.content.SharedPreferences)3 View (android.view.View)3 OnClickListener (android.view.View.OnClickListener)3 TextView (android.widget.TextView)3 IOException (java.io.IOException)3 ConfirmDialog (org.csploit.android.gui.dialogs.ConfirmDialog)3 ConfirmDialogListener (org.csploit.android.gui.dialogs.ConfirmDialog.ConfirmDialogListener)3 ActivityNotFoundException (android.content.ActivityNotFoundException)2 ScanResult (android.net.wifi.ScanResult)2 AdapterView (android.widget.AdapterView)2 ImageView (android.widget.ImageView)2 ListView (android.widget.ListView)2 NoRouteToHostException (java.net.NoRouteToHostException)2 ArrayList (java.util.ArrayList)2 AboutDialog (org.csploit.android.gui.dialogs.AboutDialog)2 FatalDialog (org.csploit.android.gui.dialogs.FatalDialog)2