Skip to content

Commit 4496bb3

Browse files
committed
Merge pull request #264 from gainan/dns_spoof_improvements
dns spoof module improvements
2 parents a0c93ea + 64074b5 commit 4496bb3

4 files changed

Lines changed: 23 additions & 6 deletions

File tree

cSploit/res/layout/plugin_mitm_dns_spoofing.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
<?xml version="1.0" encoding="utf-8"?>
21
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
32
android:focusable="true" android:focusableInTouchMode="true"
4-
android:layout_width="fill_parent"
5-
android:layout_height="fill_parent"
6-
android:orientation="vertical"
7-
android:padding="8dp">
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:padding="6dp">
86

97
<ToggleButton
108
android:id="@+id/sniffToggleButton"
@@ -59,6 +57,7 @@
5957
android:layout_alignParentRight="true"
6058
android:layout_alignParentEnd="true"
6159
android:scrollbars="vertical|horizontal"
60+
android:scrollHorizontally="true"
6261
android:editable="true" />
6362

6463
</RelativeLayout>

cSploit/src/org/csploit/android/plugins/mitm/DNSSpoofing.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.csploit.android.core.ChildManager;
3434
import org.csploit.android.core.Logger;
3535
import org.csploit.android.core.System;
36+
import org.csploit.android.gui.dialogs.ErrorDialog;
3637
import org.csploit.android.tools.Ettercap;
3738

3839
import java.io.BufferedReader;
@@ -71,6 +72,7 @@ public void onCreate(Bundle savedInstanceState) {
7172
mCmdSave = (Button) findViewById(R.id.cmd_save);
7273
mSniffToggleButton = (ToggleButton) findViewById(R.id.sniffToggleButton);
7374
mSniffProgress = (ProgressBar) findViewById(R.id.sniffActivity);
75+
mTextDnsList.setHorizontallyScrolling(true);
7476

7577
mSpoofSession = new SpoofSession(false, false, null, null);
7678

@@ -193,6 +195,20 @@ public void run() {
193195
});
194196
}
195197

198+
@Override
199+
public void onError(final String error) {
200+
DNSSpoofing.this.runOnUiThread(new Runnable() {
201+
@Override
202+
public void run() {
203+
if (!DNSSpoofing.this.isFinishing()) {
204+
new ErrorDialog(getString(R.string.error), error,
205+
DNSSpoofing.this).show();
206+
setStoppedState();
207+
}
208+
}
209+
});
210+
}
211+
196212
@Override
197213
public void onDeath(final int signal) {
198214
DNSSpoofing.this.runOnUiThread(new Runnable() {

cSploit/src/org/csploit/android/plugins/mitm/SpoofSession.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ public void start(final OnDNSSpoofedReceiver listener) throws ChildManager.Child
138138
@Override
139139
public void onError(String line) {
140140
SpoofSession.this.stop();
141+
listener.onError(line);
141142
}
142143
});
143144

cSploit/src/org/csploit/android/tools/Ettercap.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ else if(e instanceof Message) {
6868
Logger.info("OnDNSSpooferReceiver() message: " + e);
6969
Message m = (Message)e;
7070
if (m.severity == Message.Severity.ERROR)
71-
onEnd(0);
71+
onError(((Message) e).message);
7272
}
7373
else if (e instanceof Newline){
7474
Logger.info("OnDNSSpooferReceiver() Newline: " + e.toString());
@@ -81,6 +81,7 @@ else if (e instanceof Newline){
8181
public abstract void onEnd(int exitValue);
8282
public abstract void onSpoofed(String line);
8383
public abstract void onStderr(String line);
84+
public abstract void onError(String error);
8485
public abstract void onReady();
8586
}
8687

0 commit comments

Comments
 (0)