Search in sources :

Example 1 with FatalDialog

use of org.csploit.android.gui.dialogs.FatalDialog 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 2 with FatalDialog

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

the class System method checkNetworking.

public static boolean checkNetworking(final Activity current) {
    if (!Network.isWifiConnected(mContext)) {
        Intent intent = new Intent();
        intent.putExtra(WifiScannerActivity.CONNECTED, false);
        current.setResult(Activity.RESULT_OK, intent);
        String title = current.getString(R.string.error);
        String message = current.getString(R.string.wifi_went_down);
        new FatalDialog(title, message, current).show();
        return false;
    }
    return true;
}
Also used : Intent(android.content.Intent) FatalDialog(org.csploit.android.gui.dialogs.FatalDialog)

Example 3 with FatalDialog

use of org.csploit.android.gui.dialogs.FatalDialog 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)

Example 4 with FatalDialog

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

the class PasswordSniffer method setStartedState.

private void setStartedState() {
    try {
        // open file in appending mode
        mFileWriter = new FileWriter(mFileOutput, true);
        mBufferedWriter = new BufferedWriter(mFileWriter);
    } catch (IOException e) {
        new FatalDialog("Error", e.toString(), PasswordSniffer.this).show();
    }
    try {
        mSpoofSession.start(new OnAccountListener() {

            @Override
            public void onAccount(final String protocol, final String address, final String username, final String password) {
                final String line = username + ": " + password;
                PasswordSniffer.this.runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        if (mAdapter.hasChild(protocol, line) == false) {
                            try {
                                mBufferedWriter.write(line + "\n");
                            } catch (IOException e) {
                                System.errorLogging(e);
                            }
                            mAdapter.addChild(protocol, line);
                        }
                    }
                });
            }

            @Override
            public void onReady() {
            }

            @Override
            public void onEnd(final int exitValue) {
                PasswordSniffer.this.runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        if (exitValue != 0) {
                            Toast.makeText(PasswordSniffer.this, "ettercap returned #" + exitValue, Toast.LENGTH_LONG).show();
                        }
                        setStoppedState();
                    }
                });
            }

            @Override
            public void onDeath(final int signal) {
                PasswordSniffer.this.runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        Toast.makeText(PasswordSniffer.this, "ettercap killed by signal #" + signal, Toast.LENGTH_LONG).show();
                        setStoppedState();
                    }
                });
            }
        });
        Toast.makeText(PasswordSniffer.this, "Logging to " + mFileOutput, Toast.LENGTH_LONG).show();
        mSniffProgress.setVisibility(View.VISIBLE);
        mRunning = true;
    } catch (ChildManager.ChildNotStartedException e) {
        System.errorLogging(e);
        mSniffToggleButton.setChecked(false);
        Toast.makeText(PasswordSniffer.this, getString(R.string.child_not_started), Toast.LENGTH_LONG).show();
    }
}
Also used : OnAccountListener(org.csploit.android.tools.Ettercap.OnAccountListener) FileWriter(java.io.FileWriter) IOException(java.io.IOException) FatalDialog(org.csploit.android.gui.dialogs.FatalDialog) ChildManager(org.csploit.android.core.ChildManager) BufferedWriter(java.io.BufferedWriter)

Aggregations

FatalDialog (org.csploit.android.gui.dialogs.FatalDialog)4 Intent (android.content.Intent)3 IOException (java.io.IOException)3 NoRouteToHostException (java.net.NoRouteToHostException)2 AboutDialog (org.csploit.android.gui.dialogs.AboutDialog)2 ConfirmDialog (org.csploit.android.gui.dialogs.ConfirmDialog)2 ConfirmDialogListener (org.csploit.android.gui.dialogs.ConfirmDialog.ConfirmDialogListener)2 ErrorDialog (org.csploit.android.gui.dialogs.ErrorDialog)2 InputDialog (org.csploit.android.gui.dialogs.InputDialog)2 InputDialogListener (org.csploit.android.gui.dialogs.InputDialog.InputDialogListener)2 SpinnerDialog (org.csploit.android.gui.dialogs.SpinnerDialog)2 SpinnerDialogListener (org.csploit.android.gui.dialogs.SpinnerDialog.SpinnerDialogListener)2 Target (org.csploit.android.net.Target)2 BufferedWriter (java.io.BufferedWriter)1 FileWriter (java.io.FileWriter)1 ChildManager (org.csploit.android.core.ChildManager)1 OnAccountListener (org.csploit.android.tools.Ettercap.OnAccountListener)1