Search in sources :

Example 1 with SpoofSession

use of org.csploit.android.plugins.mitm.SpoofSession 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)

Aggregations

Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 OnItemLongClickListener (android.widget.AdapterView.OnItemLongClickListener)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 IOException (java.io.IOException)1 ConfirmDialog (org.csploit.android.gui.dialogs.ConfirmDialog)1 ConfirmDialogListener (org.csploit.android.gui.dialogs.ConfirmDialog.ConfirmDialogListener)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 OnRequestListener (org.csploit.android.net.http.proxy.Proxy.OnRequestListener)1 SpoofSession (org.csploit.android.plugins.mitm.SpoofSession)1