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

Commit 3215855

Browse files
author
Checkium
authored
Merge pull request #12 from Qup42/API_Change
Merged pull request #12 from Qup42/API_Change
2 parents 8ca541a + 25d177f commit 3215855

File tree

8 files changed

+75
-156
lines changed

8 files changed

+75
-156
lines changed

src/examples/ConsoleExample.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,7 @@ public static void main(String[] args) {
1919
if(transfer.get(0).getSuccess()){
2020
System.out.println("Got $" + transfer.get(0).getMoneyAmount());
2121
System.out.println("Gained " + transfer.get(0).getRepGained() + " rep.");
22-
}
23-
if(api.getAdwareManager().uploadAdware(ip.get(0))){
24-
System.out.println("Adware uploaded successfully.");
25-
}
26-
else{
27-
System.out.println("Failed to upload Adware.");
28-
}
29-
22+
}
3023
}
3124

3225
}

src/me/checkium/vhackapi/Stats.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
public enum Stats {
44

5-
money, ip, inet, hdd, cpu, ram, fw, av, sdk, ipsp, spam, scan, adw, netcoins, bonus, elo, hash, id
5+
money, ip, inet, hdd, cpu, ram, fw, av, sdk, ipsp, spam, scan, adw, netcoins, bonus, elo, hash, id, uhash
66

77
}

src/me/checkium/vhackapi/Utils.java

Lines changed: 47 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class Utils {
2929

3030
static {
3131
assertionstatus = !Utils.class.desiredAssertionStatus();
32-
url = "https://vhackxt.com/v/1/";
32+
url = "https://api.vhack.cc/v/7/";
3333
md5s = "MD5";
3434
secret = "aeffl";
3535
byt = new byte[]{(byte) 65, (byte) 66, (byte) 67, (byte) 68, (byte) 69, (byte) 70, (byte) 71, (byte) 72, (byte) 73, (byte) 74, (byte) 75, (byte) 76, (byte) 77, (byte) 78, (byte) 79, (byte) 80, (byte) 81, (byte) 82, (byte) 83, (byte) 84, (byte) 85, (byte) 86, (byte) 87, (byte) 88, (byte) 89, (byte) 90, (byte) 97, (byte) 98, (byte) 99, (byte) 100, (byte) 101, (byte) 102, (byte) 103, (byte) 104, (byte) 105, (byte) 106, (byte) 107, (byte) 108, (byte) 109, (byte) 110, (byte) 111, (byte) 112, (byte) 113, (byte) 114, (byte) 115, (byte) 116, (byte) 117, (byte) 118, (byte) 119, (byte) 120, (byte) 121, (byte) 122, (byte) 48, (byte) 49, (byte) 50, (byte) 51, (byte) 52, (byte) 53, (byte) 54, (byte) 55, (byte) 56, (byte) 57, (byte) 45, (byte) 95};
@@ -68,35 +68,42 @@ public static JSONObject JSONRequest(String format, String data, String php){
6868
}
6969
return json;
7070
}
71-
72-
private static byte[] m9179a(byte[] bArr, int i, int i2, byte[] bArr2, int i3, byte[] bArr3) {
73-
int i4 = 0;
74-
int i5 = (i2 > 1 ? (bArr[i + 1] << 24) >>> 16 : 0) | (i2 > 0 ? (bArr[i] << 24) >>> 8 : 0);
75-
if (i2 > 2) {
76-
i4 = (bArr[i + 2] << 24) >>> 24;
71+
72+
//I sometimes get "Request Failed"
73+
private static byte[] m9179a(byte[] arrby, int n2, int n3, byte[] arrby2, int n4, byte[] arrby3) {
74+
int n5 = n3 > 0 ? arrby[n2] << 24 >>> 8 : 0;
75+
int n6 = n3 > 1 ? arrby[n2 + 1] << 24 >>> 16 : 0;
76+
int n7 = n6 | n5;
77+
int n8 = 0;
78+
if (n3 > 2) {
79+
n8 = arrby[n2 + 2] << 24 >>> 24;
7780
}
78-
i4 |= i5;
79-
switch (i2) {
81+
int n9 = n8 | n7;
82+
switch (n3) {
83+
default: {
84+
return arrby2;
85+
}
86+
case 3: {
87+
arrby2[n4] = arrby3[n9 >>> 18];
88+
arrby2[n4 + 1] = arrby3[63 & n9 >>> 12];
89+
arrby2[n4 + 2] = arrby3[63 & n9 >>> 6];
90+
arrby2[n4 + 3] = arrby3[n9 & 63];
91+
return arrby2;
92+
}
93+
case 2: {
94+
arrby2[n4] = arrby3[n9 >>> 18];
95+
arrby2[n4 + 1] = arrby3[63 & n9 >>> 12];
96+
arrby2[n4 + 2] = arrby3[63 & n9 >>> 6];
97+
arrby2[n4 + 3] = 61;
98+
return arrby2;
99+
}
80100
case 1:
81-
bArr2[i3] = bArr3[i4 >>> 18];
82-
bArr2[i3 + 1] = bArr3[(i4 >>> 12) & 63];
83-
bArr2[i3 + 2] = (byte) 61;
84-
bArr2[i3 + 3] = (byte) 61;
85-
break;
86-
case 2:
87-
bArr2[i3] = bArr3[i4 >>> 18];
88-
bArr2[i3 + 1] = bArr3[(i4 >>> 12) & 63];
89-
bArr2[i3 + 2] = bArr3[(i4 >>> 6) & 63];
90-
bArr2[i3 + 3] = (byte) 61;
91-
break;
92-
case 3:
93-
bArr2[i3] = bArr3[i4 >>> 18];
94-
bArr2[i3 + 1] = bArr3[(i4 >>> 12) & 63];
95-
bArr2[i3 + 2] = bArr3[(i4 >>> 6) & 63];
96-
bArr2[i3 + 3] = bArr3[i4 & 63];
97-
break;
98101
}
99-
return bArr2;
102+
arrby2[n4] = arrby3[n9 >>> 18];
103+
arrby2[n4 + 1] = arrby3[63 & n9 >>> 12];
104+
arrby2[n4 + 2] = 61;
105+
arrby2[n4 + 3] = 61;
106+
return arrby2;
100107
}
101108

102109
public static String generateUser(byte[] bArr, int i, int i2, byte[] bArr2, boolean z) {
@@ -108,7 +115,7 @@ public static String generateUser(byte[] bArr, int i, int i2, byte[] bArr2, bool
108115
return new String(a, 0, length);
109116
}
110117

111-
public static final String encryptString(String str) {
118+
public static final String hashString(String str) {
112119
try {
113120
MessageDigest instance = MessageDigest.getInstance(md5s);
114121
instance.update(str.getBytes());
@@ -181,11 +188,9 @@ public void checkServerTrusted(
181188

182189

183190
public static String generateURL(String str, String str2, String str3) {
184-
String[] strArr = new String[2];
185191
String[] split = str.split("::::");
186192
String[] split2 = str2.split("::::");
187193
long currentTimeMillis = System.currentTimeMillis() / 1000;
188-
String str4 = "{";
189194
JSONObject jSONObject = new JSONObject();
190195
for (int i = 0; i < split.length; i++) {
191196
try {
@@ -199,21 +204,20 @@ public static String generateURL(String str, String str2, String str3) {
199204
} catch (JSONException e2) {
200205
e2.printStackTrace();
201206
}
202-
str4 = jSONObject.toString();
203-
byte[] bytes = str4.getBytes();
204-
String a = generateUser(bytes, 0, bytes.length, byt, false);
205-
String a2 = encryptString(str4.length() + encryptString(currentTimeMillis + ""));
206-
String str5 = split2[0] + "" + encryptString(encryptString(split2[1]));
207-
str4 = encryptString(currentTimeMillis + "" + str4);
207+
String jsonString = jSONObject.toString();
208+
byte[] jsonStringBytes = jsonString.getBytes();
209+
String a = generateUser(jsonStringBytes, 0, jsonStringBytes.length, byt, false);
210+
String a2 = hashString(jsonString.length() + hashString(currentTimeMillis + ""));
211+
String str5 = split2[0] + "" + hashString(hashString(split2[1]));
212+
String str6 = hashString(currentTimeMillis + "" + jsonString);
208213
byte[] bytes2 = a2.getBytes();
209214
byte[] bytes3 = str5.getBytes();
210-
byte[] bytes4 = str4.getBytes();
211-
a2 = encryptString(secret + encryptString(encryptString(generateUser(bytes2, 0, bytes2.length, byt, false))));
212-
str5 = generateUser(bytes3, 0, bytes3.length, byt, false);
213-
str4 = encryptString(encryptString(a2 + encryptString(encryptString(str5) + generateUser(bytes4, 0, bytes4.length, byt, false))));
214-
strArr[0] = a;
215-
strArr[1] = str4;
216-
return url + str3 + "?user=" + a + "&pass=" + str4;
215+
byte[] bytes4 = str6.getBytes();
216+
String a3 = hashString(secret + hashString(hashString(generateUser(bytes2, 0, bytes2.length, byt, false))));
217+
String str9 = generateUser(bytes3, 0, bytes3.length, byt, false);
218+
String str7 = generateUser(bytes4, 0, bytes4.length, byt, false);
219+
String str8 = hashString(hashString(a3 + hashString(hashString(str9) + str7)));
220+
return url + str3 + "?user=" + a + "&pass=" + str8;
217221
}
218222

219223
}

src/me/checkium/vhackapi/console/AdwareManager.java

Lines changed: 0 additions & 80 deletions
This file was deleted.

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ public class Console {
2020

2121
protected String password;
2222
protected String username;
23+
protected String userHash;
2324

24-
public Console(String user, String pass) {
25+
public Console(String user, String pass, String uHash) {
2526
username = user;
2627
password = pass;
28+
userHash = uHash;
2729
//return this;
2830
}
2931

@@ -44,7 +46,7 @@ public ArrayList<String> getIPs(int number, boolean attacked, boolean global){
4446
}
4547
if (number > 10) {
4648
for (int i = 10; i <= number + 9; i = i + 10) {
47-
JSONObject json = Utils.JSONRequest("user::::pass::::global", username + "::::" + password + "::::" + Integer.toString(globali), "vh_network.php");
49+
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::global", username + "::::" + password + "::::" + userHash + "::::" + Integer.toString(globali), "vh_network.php");
4850
JSONArray jSONArray = json.getJSONArray("data");
4951
for (int j = 0; j <= jSONArray.length() - 1; j++) {
5052
JSONObject ip = jSONArray.getJSONObject(j);
@@ -56,7 +58,7 @@ public ArrayList<String> getIPs(int number, boolean attacked, boolean global){
5658
result.add(temporary.get(k));
5759
}
5860
} else {
59-
JSONObject json = Utils.JSONRequest("user::::pass::::global", username + "::::" + password + "::::" + Integer.toString(globali), "vh_network.php");
61+
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::global", username + "::::" + password + "::::" + userHash + "::::" + Integer.toString(globali), "vh_network.php");
6062
JSONArray jSONArray = json.getJSONArray("data");
6163
for (int k = 0; k < number; k++) {
6264
result.add(jSONArray.getJSONObject(k).getString("ip"));
@@ -89,7 +91,7 @@ public List<ScannedNode> scanIPs(List<String> ips) {
8991
}
9092

9193
public TransferResult transferTrojanTo(ScannedNode node) throws JSONException {
92-
JSONObject json = Utils.JSONRequest("user::::pass::::target", username + "::::" + password + "::::" + node.getIP(), "vh_trTransfer.php");
94+
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::target", username + "::::" + password + "::::" + userHash + "::::" + node.getIP(), "vh_trTransfer.php");
9395
return new TransferResult(json, node.getIP());
9496
}
9597

@@ -99,7 +101,7 @@ public ArrayList<TransferResult> trTransferIPs(ArrayList<String> ips) {
99101
TransferResult result;
100102
for (int j = 0; j < ips.size(); j++) {
101103

102-
JSONObject json = Utils.JSONRequest("user::::pass::::target", username + "::::" + password + "::::" + ips.get(j), "vh_trTransfer.php");
104+
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::target", username + "::::" + password + "::::" + userHash + "::::" + ips.get(j), "vh_trTransfer.php");
103105
result = new TransferResult(json, ips.get(j));
104106
array.add(result);
105107
}

src/me/checkium/vhackapi/others/Others.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
public class Others {
1010
protected String username;
1111
protected String password;
12-
public Others(String user, String pass) {
12+
protected String userHash;
13+
public Others(String user, String pass, String uhash) {
1314
username = user;
1415
password = pass;
16+
userHash = uhash;
1517
}
1618
public PackageResult openPackage() {
1719

@@ -25,7 +27,7 @@ public PackageResult openPackage() {
2527

2628

2729

28-
JSONObject json = Utils.JSONRequest("user::::pass", username + "::::" + password, "vh_openFreeBonus.php");
30+
JSONObject json = Utils.JSONRequest("user::::pass::::uhash", username + "::::" + password + "::::" + userHash, "vh_openFreeBonus.php");
2931
if (json == null) {
3032
return result;
3133
}

src/me/checkium/vhackapi/upgrades/UpgradeManager.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,20 @@ public class UpgradeManager {
2020

2121
protected String username;
2222
protected String password;
23+
protected String userHash;
2324

24-
public UpgradeManager(String user, String pass) {
25+
public UpgradeManager(String user, String pass, String uhash) {
2526
username = user;
2627
password = pass;
28+
userHash = uhash;
2729
}
2830

2931
public UpgradeResult addUpdate(UpgradeType type) {
3032

3133
JSONObject json = new JSONObject();
3234
try {
3335
TimeUnit.MILLISECONDS.sleep(100);
34-
InputStream is = new URL(Utils.generateURL("user::::pass::::utype", username + "::::" + password + "::::" + type.toString(), "vh_addUpdate.php")).openStream();
36+
InputStream is = new URL(Utils.generateURL("user::::pass::::uhash::::utype", username + "::::" + password + "::::" + userHash + "::::" + type.toString(), "vh_addUpdate.php")).openStream();
3537
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
3638
String jsonText;
3739

@@ -62,7 +64,7 @@ public ArrayList<Task> getTasks() {
6264
JSONObject json = new JSONObject();
6365
try {
6466
TimeUnit.MILLISECONDS.sleep(100);
65-
InputStream is = new URL(Utils.generateURL("user::::pass", username + "::::" + password, "vh_tasks.php")).openStream();
67+
InputStream is = new URL(Utils.generateURL("user::::pass::::uhash", username + "::::" + password + "::::" + userHash, "vh_tasks.php")).openStream();
6668
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
6769
String jsonText;
6870

@@ -95,7 +97,7 @@ public boolean finishTask(Task task) {
9597
URLConnection in;
9698
try {
9799
TimeUnit.MILLISECONDS.sleep(100);
98-
in = new URL(Utils.generateURL("user::::pass::::taskid", username + "::::" + password + "::::" + task.getTaskID(), "vh_finishTask.php")).openConnection();
100+
in = new URL(Utils.generateURL("user::::pass::::uhash::::taskid", username + "::::" + password + "::::" + userHash + "::::" + task.getTaskID(), "vh_finishTask.php")).openConnection();
99101

100102
BufferedReader br = new BufferedReader(new InputStreamReader((in.getInputStream())));
101103
String line = br.readLine();
@@ -125,7 +127,7 @@ public boolean abortTask(Task task) {
125127
URLConnection in;
126128
try {
127129
TimeUnit.MILLISECONDS.sleep(100);
128-
in = new URL(Utils.generateURL("user::::pass::::taskid", username + "::::" + password + "::::" + task.getTaskID(), "vh_abortTask.php")).openConnection();
130+
in = new URL(Utils.generateURL("user::::pass::::uhash::::taskid", username + "::::" + password + "::::" + userHash + "::::" + task.getTaskID(), "vh_abortTask.php")).openConnection();
129131

130132
BufferedReader br = new BufferedReader(new InputStreamReader((in.getInputStream())));
131133
String line = br.readLine();

0 commit comments

Comments
 (0)