Skip to content
This repository was archived by the owner on Nov 24, 2018. It is now read-only.

Commit 4339890

Browse files
authored
Merge pull request #42 from C0mm4nd/master
Some changes
2 parents 588536b + ca60c91 commit 4339890

File tree

11 files changed

+502
-104
lines changed

11 files changed

+502
-104
lines changed

pom.xml

Lines changed: 55 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,56 @@
1-
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3-
<modelVersion>4.0.0</modelVersion>
4-
<groupId>vhack</groupId>
5-
<artifactId>vhack</artifactId>
6-
<version>0.0.1-SNAPSHOT</version>
7-
<name>VHackAPI</name>
8-
<repositories>
9-
<repository>
10-
<id>oss.sonatype.org</id>
11-
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
12-
</repository>
13-
</repositories>
14-
<dependencies>
15-
<dependency>
16-
<groupId>org.json</groupId>
17-
<artifactId>json</artifactId>
18-
<version>20160810</version>
19-
</dependency>
20-
<dependency>
21-
<groupId>com.jcabi</groupId>
22-
<artifactId>jcabi-aspects</artifactId>
23-
<version>0.22.6</version>
24-
</dependency>
25-
</dependencies>
26-
<properties>
27-
<maven.compiler.source>1.8</maven.compiler.source>
28-
<maven.compiler.target>1.8</maven.compiler.target>
29-
</properties>
30-
<build>
31-
<plugins>
32-
<plugin>
33-
<artifactId>maven-assembly-plugin</artifactId>
34-
<executions>
35-
<execution>
36-
<phase>package</phase>
37-
<goals>
38-
<goal>single</goal>
39-
</goals>
40-
</execution>
41-
</executions>
42-
<configuration>
43-
<descriptorRefs>
44-
<descriptorRef>jar-with-dependencies</descriptorRef>
45-
</descriptorRefs>
46-
</configuration>
47-
</plugin>
48-
</plugins>
49-
</build>
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>vhack</groupId>
4+
<artifactId>vhack</artifactId>
5+
<version>0.0.1-SNAPSHOT</version>
6+
<name>vHackAPI</name>
7+
<parent>
8+
<groupId>org.springframework.boot</groupId>
9+
<artifactId>spring-boot-starter-parent</artifactId>
10+
<version>1.5.1.RELEASE</version>
11+
</parent>
12+
<dependencies>
13+
<dependency>
14+
<groupId>org.json</groupId>
15+
<artifactId>json</artifactId>
16+
<version>20160810</version>
17+
</dependency>
18+
<dependency>
19+
<groupId>org.springframework.boot</groupId>
20+
<artifactId>spring-boot-starter</artifactId>
21+
</dependency>
22+
<dependency>
23+
<groupId>org.springframework</groupId>
24+
<artifactId>spring-context</artifactId>
25+
<version>4.3.6.RELEASE</version>
26+
</dependency>
27+
</dependencies>
28+
<properties>
29+
<maven.compiler.source>1.8</maven.compiler.source>
30+
<maven.compiler.target>1.8</maven.compiler.target>
31+
</properties>
32+
<build>
33+
<plugins>
34+
<plugin>
35+
<artifactId>maven-assembly-plugin</artifactId>
36+
<executions>
37+
<execution>
38+
<phase>package</phase>
39+
<goals>
40+
<goal>single</goal>
41+
</goals>
42+
</execution>
43+
</executions>
44+
<configuration>
45+
<descriptorRefs>
46+
<descriptorRef>jar-with-dependencies</descriptorRef>
47+
</descriptorRefs>
48+
</configuration>
49+
</plugin>
50+
<plugin>
51+
<groupId>org.springframework.boot</groupId>
52+
<artifactId>spring-boot-maven-plugin</artifactId>
53+
</plugin>
54+
</plugins>
55+
</build>
5056
</project>

src/main/java/examples/PackageExample.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
import me.checkium.vhackapi.vHackAPI;
44
import me.checkium.vhackapi.vHackAPIBuilder;
5-
import me.checkium.vhackapi.others.PackageResult;
5+
import me.checkium.vhackapi.packages.PackageResult;
66

77
public class PackageExample {
88

99
vHackAPI api = new vHackAPIBuilder().password("pass").username("user").getAPI();
1010

1111
public void openPackage() {
12-
PackageResult openresult = api.getPackageOpener().openPackage();
12+
PackageResult openresult = api.getPackageManager().openPackage();
1313
System.out.println("Got " + openresult.getResultAmount() + api.humanizeString(openresult.getResultType().toString()));
1414
}
1515
}

src/main/java/me/checkium/vhackapi/Utils.java

Lines changed: 99 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99
import java.nio.charset.Charset;
1010
import java.security.MessageDigest;
1111
import java.security.NoSuchAlgorithmException;
12+
import java.util.concurrent.Future;
13+
import java.util.concurrent.TimeUnit;
1214

1315
import org.json.JSONException;
1416
import org.json.JSONObject;
17+
import org.springframework.scheduling.annotation.Async;
18+
import org.springframework.scheduling.annotation.AsyncResult;
1519

16-
import com.jcabi.aspects.Async;
1720

1821
public class Utils {
19-
20-
private static String jText = null;
22+
2123
/**
2224
* The url of the current api.<br>
2325
* As of now it is {@value url}.
@@ -81,9 +83,31 @@ public static String readJson(Reader rd) throws IOException {
8183
*/
8284
public static JSONObject JSONRequest(String format, String data, String php){
8385
JSONObject json = null;
84-
String jsonText = StringRequest(format, data, php);
85-
if("".equals(jsonText))
86-
{
86+
Future<String> jsonTextC = Request(format, data, php);
87+
String jsonText = "";
88+
try{
89+
if(jsonTextC.isDone() /*|| jsonTextC.get() != ""*/){
90+
91+
jsonText = jsonTextC.get(2000, TimeUnit.MILLISECONDS);
92+
93+
} else {
94+
95+
Thread.sleep(1000);
96+
jsonText = jsonTextC.get(2000, TimeUnit.MILLISECONDS);
97+
98+
}
99+
} catch(Exception e) {
100+
101+
try {
102+
Thread.sleep(1000);
103+
} catch (InterruptedException e1) {
104+
105+
}
106+
JSONRequest(format,data,php);
107+
108+
}
109+
if("".equals(jsonText))
110+
{
87111
throw new RuntimeException("Old API URL");
88112
}
89113
else if("8".equals(jsonText))
@@ -109,12 +133,14 @@ else if (jsonText.length() == 1) {
109133
* Example: "vHackAPI::::123456::::aaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnoooopppp::::1"
110134
* @param php This is the api endpoint that the request will be sent to. In the case of the vHackAPI it are php documents.<br>
111135
* Example "vh_network.php"
112-
* @return The resulte Json as a String.
136+
* @return The resulte Json as a Future<String>.
113137
*/
138+
//JDOC needs rewriting
114139
@Async
115-
public static String StringRequest(String format, String data, String php)
140+
public static Future<String> Request(String format, String data, String php)
116141
{
117142

143+
Future<String> jText;
118144
System.setProperty("http.agent", "Chrome");
119145
InputStream is;
120146
try {
@@ -125,12 +151,74 @@ public static String StringRequest(String format, String data, String php)
125151
System.out.println(url.toString());
126152

127153
}
154+
Thread.sleep(1000);
128155
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
129-
jText = Utils.readJson(rd);
156+
jText = new AsyncResult<String>(Utils.readJson(rd));
157+
return jText;
130158
} catch (Exception e) {
131-
e.printStackTrace();
159+
try {
160+
Thread.sleep(1000);
161+
} catch (InterruptedException e1) {
162+
e1.printStackTrace();
163+
}
164+
Request(format,data,php);
165+
}
166+
return null;
167+
}
168+
169+
public static String StringRequest(String format, String data, String php)
170+
{
171+
172+
Future<String> jsonTextC = Request(format, data, php);
173+
String jsonText = "";
174+
try{
175+
if(jsonTextC.isDone()){
176+
177+
jsonText = jsonTextC.get();
178+
return jsonText;
179+
180+
} else {
181+
182+
Thread.sleep(1000);
183+
jsonText = jsonTextC.get(1000, TimeUnit.MILLISECONDS);
184+
return jsonText;
185+
186+
}
187+
} catch(Exception e) {
188+
189+
StringRequest(format,data,php);
190+
132191
}
133-
return jText;
192+
return null;
193+
194+
}
195+
196+
/**
197+
* Sets a proxy for the system
198+
* @param proxyUrl The proxy's IP/URL
199+
* @param proxyPort The proxy's port
200+
*/
201+
public static void useProxy(String proxyUrl, int proxyPort){
202+
203+
System.setProperty("http.proxyHost", proxyUrl);
204+
System.setProperty("http.proxyPort", String.valueOf(proxyPort));
205+
206+
}
207+
208+
/**
209+
* Sets a proxy that requires auth for the system
210+
* @param proxyUrl The proxy's IP/URL
211+
* @param proxyPort The proxy's port
212+
* @param username The proxy's username
213+
* @param password The proxy's password
214+
*/
215+
public static void useProxy(String proxyUrl, int proxyPort, String username, String password){
216+
217+
System.setProperty("http.proxyHost", proxyUrl);
218+
System.setProperty("http.proxyPort", String.valueOf(proxyPort));
219+
System.setProperty("http.proxyUser", username);
220+
System.setProperty("http.proxyPassword", password);
221+
134222
}
135223

136224
private static byte[] m9179a(byte[] arrby, int n2, int n3, byte[] arrby2, int n4, byte[] arrby3) {

src/main/java/me/checkium/vhackapi/console/Console.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.io.StringReader;
55
import java.util.ArrayList;
66
import java.util.List;
7-
import java.util.concurrent.TimeUnit;
87

98
import org.json.JSONArray;
109
import org.json.JSONException;
@@ -74,20 +73,20 @@ public ArrayList<String> getIPs(int number, boolean attacked, boolean global) th
7473
return result;
7574
}
7675

77-
@SuppressWarnings("unused")
7876
public ScannedNode scanIP(String ip) {
7977
ScannedNode result = null;
8078

81-
System.out.println("scanning " + ip);
79+
System.out.println("Scanning [" + ip + "]");
8280

83-
try {
81+
/*try {
8482
TimeUnit.MILLISECONDS.sleep(100);
8583
} catch (InterruptedException e) {
8684
e.printStackTrace();
8785
}
8886
87+
//IDK Why it's here.... it makes the scan slower
8988
String resultString = Utils.StringRequest("user::::pass::::target", username + "::::" + password + "::::" + ip, "vh_scan.php");
90-
String[] tempParsedResultString = parseScanResult(Utils.StringRequest("user::::pass::::target", username + "::::" + password + "::::" + ip, "vh_scan.php"));
89+
String[] tempParsedResultString = parseScanResult(Utils.StringRequest("user::::pass::::target", username + "::::" + password + "::::" + ip, "vh_scan.php")); */
9190
result = new ScannedNode(parseScanResult(Utils.StringRequest("user::::pass::::target", username + "::::" + password + "::::" + ip, "vh_scan.php")));
9291
result.setIP(ip);
9392

@@ -103,12 +102,12 @@ public ArrayList<ScannedNode> scanIPs(List<String> ips) {
103102
}
104103

105104
public TransferResult transferTrojanTo(ScannedNode node) throws JSONException {
106-
System.out.println("transfering " + node.getIP());
107-
try {
105+
System.out.println("Transfering trojan [" + node.getIP() + "]");
106+
/*try {
108107
TimeUnit.MILLISECONDS.sleep(100);
109108
} catch (InterruptedException e) {
110109
e.printStackTrace();
111-
}
110+
}*/
112111

113112
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::target", username + "::::" + password + "::::" + userHash + "::::" + node.getIP(), "vh_trTransfer.php");
114113

0 commit comments

Comments
 (0)