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

Commit 16fb605

Browse files
author
Checkium
authored
Merge pull request #19 from vHack-API/development
Update to vHack 1.41
2 parents af71046 + 2b95c62 commit 16fb605

File tree

7 files changed

+103
-60
lines changed

7 files changed

+103
-60
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# vHackAPI-Java
22
[![Discord](https://img.shields.io/badge/Chat-%20on%20Discord-738bd7.svg)](https://discord.gg/PHgESQn) [![Build Status](https://travis-ci.org/vHack-API/vHackAPI-Java.svg?branch=master)](https://travis-ci.org/vHack-API/vHackAPI-Java) [![Downloads](https://img.shields.io/github/downloads/vHack-API/vHackAPI-Java/total.svg)]() [![GitHub release](https://img.shields.io/github/release/vHackAPI/vHackAPI-Java.svg)]()
33

4-
### Contributors: [@Checkium](https://github.com/checkium), [@dude24760](https://github.com/dude24760), [@angelbirth](https://github.com/angelbirth), [@Qup42](https://github.com/Qup42)
4+
### Contributors: [@Checkium](https://github.com/checkium), [@dude24760](https://github.com/dude24760), [@angelbirth](https://github.com/angelbirth), [@Qup42](https://github.com/Qup42), [@tr0teK](https://github.com/tr0teK)
55
###### Don't forget to add your name here when you pull request.
66
Current feature list:
77
- Ability to scan the network for IP addresses.

src/examples/ConsoleExample.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package examples;
22

3-
import java.util.ArrayList;
4-
import java.util.List;
3+
//import java.util.ArrayList;
4+
//import java.util.List;
55

66
import me.checkium.vhackapi.vHackAPI;
77
import me.checkium.vhackapi.vHackAPIBuilder;
@@ -11,16 +11,15 @@
1111
public class ConsoleExample {
1212
public static void main(String[] args) {
1313
vHackAPI api = new vHackAPIBuilder().password("pass").username("user").getAPI();
14-
List<String> ip = api.getConsole().getIPs(1, false, false);
15-
List<ScannedNode> scanned = api.getConsole().scanIPs(ip);
14+
String ip = api.getConsole().getIP(false, false);
15+
ScannedNode scanned = api.getConsole().scanIP(ip);
1616

17-
if(scanned.get(0).getSuccessRate() <= 90 && scanned.get(0).isAnonymous()) {
18-
ArrayList<TransferResult> transfer = api.getConsole().trTransferIPs((ArrayList<String>) ip);
19-
if(transfer.get(0).getSuccess()){
20-
System.out.println("Got $" + transfer.get(0).getMoneyAmount());
21-
System.out.println("Gained " + transfer.get(0).getRepGained() + " rep.");
22-
}
23-
}
24-
17+
if(scanned.getSuccessRate() >= 70) {
18+
TransferResult transfer = api.getConsole().transferTrojanTo(scanned);
19+
if(transfer.getSuccess()){
20+
System.out.println("Got $" + transfer.getMoneyAmount());
21+
System.out.println("Gained " + transfer.getRepGained() + " rep.");
22+
}
23+
}
2524
}
2625
}

src/me/checkium/vhackapi/Spyware/SpywareManager.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ public SpywareUploadResult uploadSpywareTo(ScannedNode node)
2626
return new SpywareUploadResult(returnString);
2727
}
2828

29+
public boolean removeSpywareFrom(ScannedNode node)
30+
{
31+
String returnString = Utils.StringRequest("user::::pass::::uhash::::target", username + "::::" + password + "::::" + userHash + "::::" + node.getIP(), "vh_removeSpywareRemote.php");
32+
JSONObject d = new JSONObject(returnString);
33+
if (d.getInt("result") == 0) {
34+
return true;
35+
} else {
36+
return false;
37+
}
38+
}
39+
2940
public ArrayList<Spyware> getActiveSpyware()
3041
{
3142
ArrayList<Spyware> list = new ArrayList<>();

src/me/checkium/vhackapi/Utils.java

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,8 @@
77
import java.io.Reader;
88
import java.net.URL;
99
import java.nio.charset.Charset;
10-
import java.security.GeneralSecurityException;
1110
import java.security.MessageDigest;
1211
import java.security.NoSuchAlgorithmException;
13-
import java.security.cert.X509Certificate;
14-
15-
import javax.net.ssl.HttpsURLConnection;
16-
import javax.net.ssl.SSLContext;
17-
import javax.net.ssl.TrustManager;
18-
import javax.net.ssl.X509TrustManager;
1912

2013
import org.json.JSONException;
2114
import org.json.JSONObject;
@@ -29,7 +22,7 @@ public class Utils {
2922

3023
static {
3124
assertionstatus = !Utils.class.desiredAssertionStatus();
32-
url = "https://api.vhack.cc/v/7/";
25+
url = "https://api.vhack.cc/v/8/";
3326
md5s = "MD5";
3427
secret = "aeffl";
3528
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};
@@ -57,13 +50,7 @@ public static JSONObject JSONRequest(String format, String data, String php){
5750
public static String StringRequest(String format, String data, String php)
5851
{
5952
System.setProperty("http.agent", "Chrome");
60-
try {
61-
SSLContext sc = SSLContext.getInstance("SSL");
62-
sc.init(null, Utils.trustAllCerts, new java.security.SecureRandom());
63-
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
64-
} catch (GeneralSecurityException e) {
65-
}
66-
53+
6754
String jsonText = null;
6855
InputStream is;
6956
try {
@@ -178,21 +165,7 @@ public static byte[] assertion(byte[] bArr, int i, int i2, byte[] bArr2, int i3)
178165
throw new AssertionError();
179166
}
180167

181-
public static TrustManager[] trustAllCerts = new TrustManager[] {
182-
new X509TrustManager() {
183-
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
184-
return new X509Certificate[0];
185-
}
186-
public void checkClientTrusted(
187-
java.security.cert.X509Certificate[] certs, String authType) {
188-
}
189-
public void checkServerTrusted(
190-
java.security.cert.X509Certificate[] certs, String authType) {
191-
}
192-
}
193-
};
194-
195-
168+
196169
public static String generateURL(String str, String str2, String str3) {
197170
String[] split = str.split("::::");
198171
String[] split2 = str2.split("::::");

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

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@ public Console(String user, String pass, String uHash) {
2929
//return this;
3030
}
3131

32+
/**
33+
*
34+
* Get IP from console
35+
*
36+
* @param global Use global?
37+
* @param attacked Get already attacked IPs?
38+
*/
39+
public String getIP(boolean attacked, boolean global) throws JSONException {
40+
String result = null;
41+
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::global", username + "::::" + password + "::::" + userHash + "::::" + (global?"1":"0"), "vh_network.php");
42+
JSONArray jSONArray = json.getJSONArray("data");
43+
result = jSONArray.getJSONObject(0).getString("ip");
44+
return result;
45+
}
46+
3247
/**
3348
*
3449
* Get IPs from console
@@ -37,16 +52,12 @@ public Console(String user, String pass, String uHash) {
3752
* @param global Use global?
3853
* @param attacked Get already attacked IPs?
3954
*/
40-
public ArrayList<String> getIPs(int number, boolean attacked, boolean global){
55+
public ArrayList<String> getIPs(int number, boolean attacked, boolean global) throws JSONException {
4156
ArrayList<String> result = new ArrayList<String>();
4257
ArrayList<String> temporary = new ArrayList<String>();
43-
int globali = 0;
44-
if (global) {
45-
globali = 1;
46-
}
4758
if (number > 10) {
4859
for (int i = 10; i <= number + 9; i = i + 10) {
49-
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::global", username + "::::" + password + "::::" + userHash + "::::" + Integer.toString(globali), "vh_network.php");
60+
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::global", username + "::::" + password + "::::" + userHash + "::::" + (global?"1":"0"), "vh_network.php");
5061
JSONArray jSONArray = json.getJSONArray("data");
5162
for (int j = 0; j <= jSONArray.length() - 1; j++) {
5263
JSONObject ip = jSONArray.getJSONObject(j);
@@ -58,7 +69,7 @@ public ArrayList<String> getIPs(int number, boolean attacked, boolean global){
5869
result.add(temporary.get(k));
5970
}
6071
} else {
61-
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::global", username + "::::" + password + "::::" + userHash + "::::" + Integer.toString(globali), "vh_network.php");
72+
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::global", username + "::::" + password + "::::" + userHash + "::::" + (global?"1":"0"), "vh_network.php");
6273
JSONArray jSONArray = json.getJSONArray("data");
6374
for (int k = 0; k < number; k++) {
6475
result.add(jSONArray.getJSONObject(k).getString("ip"));
@@ -67,14 +78,31 @@ public ArrayList<String> getIPs(int number, boolean attacked, boolean global){
6778
return result;
6879
}
6980

81+
public ScannedNode scanIP(String ip) {
82+
InputStream is;
83+
BufferedReader rd;
84+
ScannedNode result = null;
85+
try {
86+
is = new URL(Utils.generateURL("user::::pass::::target", username + "::::" + password + "::::" + ip, "vh_scan.php")).openStream();
87+
rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
88+
String[] temp = ReadBigStringIn(rd);
89+
result = new ScannedNode(temp);
90+
result.setIP(ip);
91+
TimeUnit.MILLISECONDS.sleep(100);
92+
} catch (InterruptedException|IOException e) {
93+
e.printStackTrace();
94+
}
95+
return result;
96+
}
97+
7098
public List<ScannedNode> scanIPs(List<String> ips) {
7199
InputStream is;
72100
BufferedReader rd;
73101
List<ScannedNode> array = new ArrayList<>();
74102
ScannedNode result;
75103

76104
for (String ip : ips) {
77-
try{
105+
try {
78106
is = new URL(Utils.generateURL("user::::pass::::target", username + "::::" + password + "::::" + ip, "vh_scan.php")).openStream();
79107
rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
80108
String[] temp = ReadBigStringIn(rd);
@@ -83,7 +111,6 @@ public List<ScannedNode> scanIPs(List<String> ips) {
83111
array.add(result);
84112
TimeUnit.MILLISECONDS.sleep(100);
85113
} catch (InterruptedException|IOException e) {
86-
// TODO Auto-generated catch block
87114
e.printStackTrace();
88115
}
89116
}
@@ -94,15 +121,13 @@ public TransferResult transferTrojanTo(ScannedNode node) throws JSONException {
94121
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::target", username + "::::" + password + "::::" + userHash + "::::" + node.getIP(), "vh_trTransfer.php");
95122
return new TransferResult(json, node.getIP());
96123
}
97-
98124

99-
public ArrayList<TransferResult> trTransferIPs(ArrayList<String> ips) {
125+
public ArrayList<TransferResult> transferTrojansTo(ArrayList<ScannedNode> nodes) throws JSONException {
100126
ArrayList<TransferResult> array = new ArrayList<TransferResult>();
101127
TransferResult result;
102-
for (int j = 0; j < ips.size(); j++) {
103-
104-
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::target", username + "::::" + password + "::::" + userHash + "::::" + ips.get(j), "vh_trTransfer.php");
105-
result = new TransferResult(json, ips.get(j));
128+
for (int j = 0; j < nodes.size(); j++) {
129+
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::target", username + "::::" + password + "::::" + userHash + "::::" + nodes.get(j).getIP(), "vh_trTransfer.php");
130+
result = new TransferResult(json, nodes.get(j).getIP());
106131
array.add(result);
107132
}
108133
return array;

src/me/checkium/vhackapi/vHackAPI.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import org.json.JSONObject;
1212

13+
import me.checkium.vhackapi.Spyware.SpywareManager;
1314
import me.checkium.vhackapi.chat.Chat;
1415
import me.checkium.vhackapi.console.Console;
1516
import me.checkium.vhackapi.others.Others;
@@ -30,7 +31,11 @@ public Console getConsole() {
3031
public UpgradeManager getUpgradeManager() {
3132
UpgradeManager manager = new UpgradeManager(username, password, userHash);
3233
return manager;
33-
}
34+
}
35+
public SpywareManager getSpywareManager() {
36+
SpywareManager manager = new SpywareManager(username, password, userHash);
37+
return manager;
38+
}
3439

3540
public String getStats(Stats stat) {
3641
try {

src/me/checkium/vhackapi/vHackAPIBuilder.java

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
package me.checkium.vhackapi;
22

3+
import java.security.GeneralSecurityException;
4+
import java.security.cert.X509Certificate;
5+
6+
import javax.net.ssl.HttpsURLConnection;
7+
import javax.net.ssl.SSLContext;
8+
import javax.net.ssl.TrustManager;
9+
import javax.net.ssl.X509TrustManager;
10+
311
import org.json.JSONObject;
412

513
public class vHackAPIBuilder {
@@ -37,8 +45,30 @@ public vHackAPIBuilder register() {
3745

3846

3947
public vHackAPI getAPI() {
40-
48+
try {
49+
SSLContext sc = SSLContext.getInstance("SSL");
50+
sc.init(null, trustAllCerts, new java.security.SecureRandom());
51+
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
52+
} catch (GeneralSecurityException e) {
53+
}
54+
4155
vHackAPI api = new vHackAPI(username, password);
4256
return api;
4357
}
58+
59+
public static TrustManager[] trustAllCerts = new TrustManager[] {
60+
new X509TrustManager() {
61+
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
62+
return new X509Certificate[0];
63+
}
64+
public void checkClientTrusted(
65+
java.security.cert.X509Certificate[] certs, String authType) {
66+
}
67+
public void checkServerTrusted(
68+
java.security.cert.X509Certificate[] certs, String authType) {
69+
}
70+
}
71+
};
72+
73+
4474
}

0 commit comments

Comments
 (0)