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

Commit 6abb178

Browse files
authored
Merge pull request #38 from C0mm4nd/master
Added botnet
2 parents 3f8450e + cb0d151 commit 6abb178

File tree

6 files changed

+169
-12
lines changed

6 files changed

+169
-12
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package me.checkium.vhackapi.botnet;
2+
3+
import org.json.JSONArray;
4+
import org.json.JSONObject;
5+
6+
import me.checkium.vhackapi.Utils;
7+
8+
public class Bot {
9+
10+
protected int bID;
11+
protected String username, password, userHash;
12+
private JSONObject botInfo;
13+
14+
public Bot(String username, String password, String userHash, int bID){
15+
16+
this.bID = bID;
17+
this.username = username;
18+
this.password = password;
19+
this.userHash = userHash;
20+
BotnetManager.getInfo();
21+
getBotInfo();
22+
23+
}
24+
protected void getBotInfo(){
25+
26+
JSONArray botsInfo = BotnetManager.botnetInfo.getJSONArray("data");
27+
JSONObject botInfo = botsInfo.getJSONObject(--bID);
28+
this.botInfo = botInfo;
29+
30+
}
31+
32+
public int getBID(){
33+
34+
return botInfo.getInt("bID");
35+
36+
}
37+
38+
public int getLevel(){
39+
40+
return botInfo.getInt("bLVL");
41+
42+
}
43+
44+
public int getPrice(){
45+
46+
return botInfo.getInt("bPRICE");
47+
48+
}
49+
50+
public void update(){
51+
52+
Utils.JSONRequest("user::::pass::::uhash::::bID", username + "::::" + password + "::::" + userHash + "::::" + bID, "vh_upgradeBotnet.php");
53+
getBotInfo();
54+
55+
}
56+
57+
58+
59+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package me.checkium.vhackapi.botnet;
2+
3+
import org.json.JSONObject;
4+
5+
import me.checkium.vhackapi.Utils;
6+
7+
public class BotnetManager {
8+
9+
protected static String username, password, userHash;
10+
protected static JSONObject botnetInfo;
11+
public BotnetManager(String username, String password, String userHash){
12+
13+
BotnetManager.username = username;
14+
BotnetManager.password = password;
15+
BotnetManager.userHash = userHash;
16+
getInfo();
17+
18+
}
19+
20+
protected static void getInfo(){
21+
22+
botnetInfo = Utils.JSONRequest("user::::pass::::uhash", username + "::::" + password + "::::" + userHash, "vh_botnetInfo.php");
23+
24+
}
25+
public Bot getBot(int bID){
26+
27+
Bot bot = new Bot(username, password, userHash, bID);
28+
return bot;
29+
}
30+
31+
public int getBotCount(){
32+
33+
return botnetInfo.getInt("count");
34+
35+
}
36+
37+
public int getStrength(){
38+
39+
return botnetInfo.getInt("strength");
40+
41+
}
42+
43+
public boolean attack(BotnetTarget target){
44+
45+
boolean success;
46+
int cN = target.getCompanyN();
47+
if(botnetInfo.getInt("canAtt" + cN) == 1){
48+
49+
if(cN == 1){
50+
51+
try{
52+
Utils.JSONRequest("user::::pass::::uhash::::cID", username + "::::" + password + "::::" + userHash + "::::" + cN, "vh_attackCompany.php");
53+
success = true;
54+
} catch(Exception e) {
55+
success = false;
56+
}
57+
58+
} else {
59+
60+
try{
61+
Utils.JSONRequest("user::::pass::::uhash::::cID", username + "::::" + password + "::::" + userHash + "::::" + cN, "vh_attackCompany" + cN + ".php");
62+
success = true;
63+
} catch(Exception e) {
64+
success = false;
65+
}
66+
67+
}
68+
69+
} else {
70+
71+
success = false;
72+
73+
}
74+
75+
return success;
76+
77+
}
78+
79+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package me.checkium.vhackapi.botnet;
2+
3+
public enum BotnetTarget {
4+
5+
KFMSolutions (1),
6+
VHACKSERVER (2),
7+
NETCOINBANK (3);
8+
private final int companyN;
9+
10+
BotnetTarget(int companyN){
11+
12+
this.companyN = companyN;
13+
14+
}
15+
16+
int getCompanyN(){
17+
18+
return companyN;
19+
20+
}
21+
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package me.checkium.vhackapi.console;
22

3-
import java.io.*;
4-
import java.net.URL;
5-
import java.nio.charset.Charset;
3+
import java.io.BufferedReader;
4+
import java.io.StringReader;
65
import java.util.ArrayList;
76
import java.util.List;
87
import java.util.concurrent.TimeUnit;
@@ -75,6 +74,7 @@ public ArrayList<String> getIPs(int number, boolean attacked, boolean global) th
7574
return result;
7675
}
7776

77+
@SuppressWarnings("unused")
7878
public ScannedNode scanIP(String ip) {
7979
ScannedNode result = null;
8080

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

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

3-
import java.io.BufferedReader;
4-
import java.io.IOException;
5-
import java.io.InputStream;
6-
import java.io.InputStreamReader;
7-
import java.net.MalformedURLException;
8-
import java.net.URL;
9-
import java.net.URLConnection;
10-
import java.nio.charset.Charset;
113
import java.util.ArrayList;
124
import java.util.concurrent.TimeUnit;
135

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.json.JSONObject;
66

77
import me.checkium.vhackapi.Spyware.SpywareManager;
8+
import me.checkium.vhackapi.botnet.BotnetManager;
89
import me.checkium.vhackapi.chat.Chat;
910
import me.checkium.vhackapi.console.Console;
1011
import me.checkium.vhackapi.others.PackageOpener;
@@ -30,7 +31,12 @@ public UpgradeManager getUpgradeManager() {
3031
public SpywareManager getSpywareManager() {
3132
SpywareManager manager = new SpywareManager(username, password, userHash);
3233
return manager;
33-
}
34+
}
35+
36+
public BotnetManager getBotnetManager() {
37+
BotnetManager manager = new BotnetManager(username, password, userHash);
38+
return manager;
39+
}
3440

3541
public String getStats(Stats stat) {
3642
fetchStats();

0 commit comments

Comments
 (0)