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

Commit 6aea2d1

Browse files
committed
asd
1 parent 42900fa commit 6aea2d1

File tree

6 files changed

+425
-290
lines changed

6 files changed

+425
-290
lines changed

src/me/checkium/vhackapi/Utils.java

Lines changed: 32 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
package me.checkium.vhackapi;
22

3-
import java.io.BufferedReader;
4-
import java.io.IOException;
5-
import java.io.InputStream;
6-
import java.io.InputStreamReader;
7-
import java.io.Reader;
8-
import java.net.MalformedURLException;
3+
import org.json.JSONException;
4+
import org.json.JSONObject;
5+
6+
import java.io.*;
97
import java.net.URL;
108
import java.nio.charset.Charset;
119
import java.security.MessageDigest;
1210
import java.security.NoSuchAlgorithmException;
1311

14-
import org.json.JSONException;
15-
import org.json.JSONObject;
16-
1712
public class Utils {
18-
public static String url;
19-
public static String md5s;
20-
public static String secret;
2113
static final boolean assertionstatus;
2214
private static final byte[] byt;
15+
public static String url;
16+
public static String md5s;
17+
public static String secret;
2318

2419
static {
2520
assertionstatus = !Utils.class.desiredAssertionStatus();
@@ -28,39 +23,37 @@ public class Utils {
2823
secret = "aeffl";
2924
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};
3025
}
31-
26+
3227
public static String readJson(Reader rd) throws IOException {
3328
StringBuilder sb = new StringBuilder();
3429
int cp;
3530
while ((cp = rd.read()) != -1) {
36-
sb.append((char) cp);
31+
sb.append((char) cp);
3732
}
3833
return sb.toString();
39-
}
34+
}
35+
36+
public static JSONObject JSONRequest(String format, String data, String php) {
37+
JSONObject json = null;
38+
InputStream is;
39+
try {
40+
URL url = new URL(Utils.generateURL(format, data, php));
41+
is = url.openStream();
42+
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
43+
String jsonText = Utils.readJson(rd);
44+
if (jsonText.length() == 1) {
45+
return null;
46+
}
47+
json = new JSONObject(jsonText);
48+
49+
} catch (IOException | JSONException e) {
50+
51+
// TODO Auto-generated catch block
52+
e.printStackTrace();
53+
}
54+
return json;
55+
}
4056

41-
public static JSONObject JSONRequest(String format, String data, String php){
42-
JSONObject json = null;
43-
InputStream is;
44-
try {
45-
is = new URL(Utils.generateURL(format, data, php)).openStream();
46-
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
47-
String jsonText = Utils.readJson(rd);
48-
if (jsonText.length() == 1) {
49-
return null;
50-
}
51-
json = new JSONObject(jsonText);
52-
53-
} catch (MalformedURLException e) {
54-
// TODO Auto-generated catch block
55-
e.printStackTrace();
56-
} catch (IOException e) {
57-
58-
// TODO Auto-generated catch block
59-
e.printStackTrace();
60-
}
61-
return json;
62-
}
63-
6457
private static byte[] m9179a(byte[] bArr, int i, int i2, byte[] bArr2, int i3, byte[] bArr3) {
6558
int i4 = 0;
6659
int i5 = (i2 > 1 ? (bArr[i + 1] << 24) >>> 16 : 0) | (i2 > 0 ? (bArr[i] << 24) >>> 8 : 0);
@@ -158,7 +151,7 @@ public static byte[] assertion(byte[] bArr, int i, int i2, byte[] bArr2, int i3)
158151
}
159152

160153

161-
public static String generateURL(String str, String str2, String str3) {
154+
public static String generateURL(String str, String str2, String str3) {
162155
String[] strArr = new String[2];
163156
String[] split = str.split("::::");
164157
String[] split2 = str2.split("::::");
Lines changed: 65 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,79 @@
11
package me.checkium.vhackapi.console;
22

3+
import me.checkium.vhackapi.Utils;
4+
import org.json.JSONArray;
5+
import org.json.JSONObject;
6+
37
import java.io.BufferedReader;
48
import java.io.IOException;
59
import java.io.InputStreamReader;
6-
import java.net.MalformedURLException;
710
import java.net.URL;
811
import java.net.URLConnection;
912
import java.util.HashMap;
1013
import java.util.concurrent.TimeUnit;
1114

12-
import org.json.JSONArray;
13-
import org.json.JSONObject;
15+
public class AdwareManager {
1416

15-
import me.checkium.vhackapi.Utils;
17+
protected String password;
18+
protected String username;
1619

17-
public class AdwareManager {
20+
public AdwareManager(String pass, String user) {
21+
password = pass;
22+
username = user;
23+
}
24+
25+
public boolean uploadAdware(String target) {
26+
27+
URLConnection in;
28+
try {
29+
in = new URL(Utils.generateURL("user::::pass::::target", username + "::::" + password + "::::" + target, "vh_adwareUpload.php")).openConnection();
30+
31+
BufferedReader br = new BufferedReader(new InputStreamReader((in.getInputStream())));
32+
String line = br.readLine();
33+
return line.contains("0");
34+
} catch (IOException e) {
35+
// TODO Auto-generated catch block
36+
e.printStackTrace();
37+
}
38+
return false;
39+
}
40+
41+
public boolean removeAdware(String target) {
42+
@SuppressWarnings("unused")
43+
URLConnection in;
44+
try {
45+
in = new URL(Utils.generateURL("user::::pass::::target", username + "::::" + password + "::::" + target, "vh_removeAdwareRemote.php")).openConnection();
46+
BufferedReader br = new BufferedReader(new InputStreamReader((in.getInputStream())));
47+
String line = br.readLine();
48+
JSONObject json = new JSONObject(line);
49+
return json.getInt("result") == 0;
50+
} catch (IOException e) {
51+
e.printStackTrace();
52+
}
53+
return false;
54+
55+
}
56+
57+
58+
public HashMap<String, Integer> getAdwares() {
59+
try {
60+
TimeUnit.MILLISECONDS.sleep(100);
61+
} catch (InterruptedException e) {
62+
// TODO Auto-generated catch block
63+
e.printStackTrace();
64+
}
65+
HashMap<String, Integer> map = new HashMap<>();
66+
JSONObject json = Utils.JSONRequest("user::::pass", username + "::::" + password, "vh_adwareInfo.php");
67+
if (json.getInt("remote") <= 0) {
68+
return null;
69+
}
70+
JSONArray array = json.getJSONArray("data");
71+
for (int i = 0; i <= array.length() - 1; i++) {
72+
String IP = array.getJSONObject(i).getString("ip");
73+
Integer earn = array.getJSONObject(i).getInt("earn");
74+
map.put(IP, earn);
75+
}
1876

19-
protected String password;
20-
protected String username;
21-
public AdwareManager(String pass, String user) {
22-
password = pass;
23-
username = user;
24-
}
25-
public boolean uploadAdware(String target) {
26-
27-
URLConnection in;
28-
try {
29-
in = new URL(Utils.generateURL("user::::pass::::target", username + "::::" + password + "::::" + target, "vh_adwareUpload.php")).openConnection();
30-
31-
BufferedReader br = new BufferedReader(new InputStreamReader((in.getInputStream())));
32-
String line = br.readLine();
33-
if (line.contains("11")) {
34-
return true;
35-
} else {
36-
return false;
37-
}
38-
} catch (MalformedURLException e) {
39-
// TODO Auto-generated catch block
40-
e.printStackTrace();
41-
} catch (IOException e) {
42-
// TODO Auto-generated catch block
43-
e.printStackTrace();
44-
}
45-
return false;
46-
}
47-
48-
public boolean removeAdware(String target) {
49-
@SuppressWarnings("unused")
50-
URLConnection in;
51-
try {
52-
in = new URL(Utils.generateURL("user::::pass::::target", username + "::::" + password + "::::" + target, "vh_removeAdwareRemote.php")).openConnection();
53-
} catch (MalformedURLException e) {
54-
e.printStackTrace();
55-
} catch (IOException e) {
56-
e.printStackTrace();
57-
}
58-
59-
return true;
60-
61-
}
62-
63-
64-
public HashMap<String, Integer> getAdware() {
65-
try {
66-
TimeUnit.MILLISECONDS.sleep(100);
67-
} catch (InterruptedException e) {
68-
// TODO Auto-generated catch block
69-
e.printStackTrace();
70-
}
71-
HashMap<String, Integer> map = new HashMap<>();
72-
JSONObject json = Utils.JSONRequest("user::::pass", username + "::::" + password, "vh_adwareInfo.php");
73-
if (json.getInt("remote") <= 0) {
74-
return null;
75-
}
76-
JSONArray array = json.getJSONArray("data");
77-
for (int i = 0; i <= array.length() - 1; i++) {
78-
String IP = array.getJSONObject(i).getString("ip");
79-
Integer earn = array.getJSONObject(i).getInt("earn");
80-
map.put(IP, earn);
81-
}
82-
83-
return map;
84-
}
77+
return map;
78+
}
8579
}

0 commit comments

Comments
 (0)