use of org.csploit.android.tools.Ettercap.OnAccountListener 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();
}
}
Aggregations