Skip to content

Commit

Permalink
Merge pull request #2 from John-Doggett/v1.1
Browse files Browse the repository at this point in the history
Add files via upload
  • Loading branch information
John-Doggett authored Oct 5, 2020
2 parents 21abf30 + 1a32989 commit e3b82d4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
Binary file modified DNSReflectionStressTest/DNSRST/DNSReflector.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion DNSReflectionStressTest/DNSRST/readme
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Make sure to run as root.
Make sure to run as root and have Nmap installed.
Add a new website or domain server address to DomainServers and Website file on a new line to add custom websites and domain servers. DomainServers and Websites must be in same directory as DNSReflector.jar.
Run with java -jar DNSReflector.jar (arguments)
View help command with java -jar DSNReflector.jar --help
Expand Down
29 changes: 18 additions & 11 deletions DNSReflectionStressTest/src/DNSReflector.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ public static void main(String[] args) throws IOException, InterruptedException
int count = 1;
int rate = 1;
String request = "0001";

String sourcePort = "53";
boolean verbose = false;
int waitTime = 1000;
String sourceIP = Inet4Address.getLocalHost().getHostAddress();

if (sourceIP.contains("127")) {
Expand All @@ -73,18 +75,15 @@ public static void main(String[] args) throws IOException, InterruptedException
}
}

if(System.getProperty("user.name").equals("root") == false) {
if(args.length >= 1) {
if (System.getProperty("user.name").equals("root") == false) {
if (args.length >= 1) {
args[0] = "--help";
}
else {
} else {
args = new String[1];
args[0] = "--help";
}
}

String sourcePort = "53";
boolean verbose = false;

for (int a = 0; a < args.length; a++) {
switch (args[a]) {
case "--count":
Expand All @@ -94,6 +93,13 @@ public static void main(String[] args) throws IOException, InterruptedException
a++;
break;
}
case "--wait":
if (a + 1 < args.length && args[a + 1].matches("^[0-9]*$") && (args[a + 1]).length() >= 1
&& Integer.parseInt(args[a + 1]) >= 0) {
waitTime = Integer.parseInt(args[a + 1]);
a++;
break;
}
case "--rate":
if (a + 1 < args.length && args[a + 1].matches("^[0-9]*$") && (args[a + 1]).length() >= 1
&& Integer.parseInt(args[a + 1]) >= 0) {
Expand All @@ -103,7 +109,7 @@ public static void main(String[] args) throws IOException, InterruptedException
}
case "--iterations":
if (a + 1 < args.length && args[a + 1].matches("^[0-9]*$") && (args[a + 1]).length() >= 1
&& Integer.parseInt(args[a + 1]) >= 0) {
&& Integer.parseInt(args[a + 1]) >= -1) {
numberOfIterations = Integer.parseInt(args[a + 1]);
a++;
break;
Expand All @@ -129,7 +135,6 @@ public static void main(String[] args) throws IOException, InterruptedException
case "--verbose":
verbose = true;
break;

default:
System.out.println("---DNS Reflection Benchmark Stress Test---");
System.out.println("Use with permission of target and DNS servers!");
Expand All @@ -148,10 +153,11 @@ public static void main(String[] args) throws IOException, InterruptedException
System.out.println("--source-port (udp port), will send dns reponse to desired port, default 53");
System.out.println(
"--verbose, will print arguments for every nping thread created. WARNING: CAUSES HEAVY USAGE IF CREATING LOTS OF THREADS!");
System.out.println(
"--wait (mileseconds), will pause making another iteration with length of given miliseconds, default 1000 (1 second)");
numberOfIterations = 0;
a = args.length;
break;

}

}
Expand All @@ -172,6 +178,7 @@ public static void main(String[] args) throws IOException, InterruptedException
Runtime.getRuntime().exec(command);
}
}
Thread.sleep(waitTime);
}
}

Expand Down

0 comments on commit e3b82d4

Please sign in to comment.