Search in sources :

Example 1 with Ettercap

use of org.csploit.android.tools.Ettercap in project android by cSploit.

the class DNSSpoofing method setStartedState.

private void setStartedState() {
    try {
        mSpoofSession.start(new Ettercap.OnDNSSpoofedReceiver() {

            @Override
            public void onSpoofed(String line) {
                Logger.info("DNSSpoofing.onevent() line: " + line);
                if (line.contains("spoofed to"))
                    Toast.makeText(DNSSpoofing.this, line, Toast.LENGTH_LONG).show();
            }

            @Override
            public void onStderr(String line) {
                if (line.contains("spoofed to"))
                    Toast.makeText(DNSSpoofing.this, line, Toast.LENGTH_LONG).show();
            }

            @Override
            public void onReady() {
            }

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

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

            @Override
            public void onError(final String error) {
                DNSSpoofing.this.runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        if (!DNSSpoofing.this.isFinishing()) {
                            new ErrorDialog(getString(R.string.error), error, DNSSpoofing.this).show();
                            setStoppedState();
                        }
                    }
                });
            }

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

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

Aggregations

ChildManager (org.csploit.android.core.ChildManager)1 ErrorDialog (org.csploit.android.gui.dialogs.ErrorDialog)1 Ettercap (org.csploit.android.tools.Ettercap)1