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

Added botnet #38

Merged
merged 1 commit into from
Feb 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions src/main/java/me/checkium/vhackapi/botnet/Bot.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package me.checkium.vhackapi.botnet;

import org.json.JSONArray;
import org.json.JSONObject;

import me.checkium.vhackapi.Utils;

public class Bot {

protected int bID;
protected String username, password, userHash;
private JSONObject botInfo;

public Bot(String username, String password, String userHash, int bID){

this.bID = bID;
this.username = username;
this.password = password;
this.userHash = userHash;
BotnetManager.getInfo();
getBotInfo();

}
protected void getBotInfo(){

JSONArray botsInfo = BotnetManager.botnetInfo.getJSONArray("data");
JSONObject botInfo = botsInfo.getJSONObject(--bID);
this.botInfo = botInfo;

}

public int getBID(){

return botInfo.getInt("bID");

}

public int getLevel(){

return botInfo.getInt("bLVL");

}

public int getPrice(){

return botInfo.getInt("bPRICE");

}

public void update(){

Utils.JSONRequest("user::::pass::::uhash::::bID", username + "::::" + password + "::::" + userHash + "::::" + bID, "vh_upgradeBotnet.php");
getBotInfo();

}



}
79 changes: 79 additions & 0 deletions src/main/java/me/checkium/vhackapi/botnet/BotnetManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package me.checkium.vhackapi.botnet;

import org.json.JSONObject;

import me.checkium.vhackapi.Utils;

public class BotnetManager {

protected static String username, password, userHash;
protected static JSONObject botnetInfo;
public BotnetManager(String username, String password, String userHash){

BotnetManager.username = username;
BotnetManager.password = password;
BotnetManager.userHash = userHash;
getInfo();

}

protected static void getInfo(){

botnetInfo = Utils.JSONRequest("user::::pass::::uhash", username + "::::" + password + "::::" + userHash, "vh_botnetInfo.php");

}
public Bot getBot(int bID){

Bot bot = new Bot(username, password, userHash, bID);
return bot;
}

public int getBotCount(){

return botnetInfo.getInt("count");

}

public int getStrength(){

return botnetInfo.getInt("strength");

}

public boolean attack(BotnetTarget target){

boolean success;
int cN = target.getCompanyN();
if(botnetInfo.getInt("canAtt" + cN) == 1){

if(cN == 1){

try{
Utils.JSONRequest("user::::pass::::uhash::::cID", username + "::::" + password + "::::" + userHash + "::::" + cN, "vh_attackCompany.php");
success = true;
} catch(Exception e) {
success = false;
}

} else {

try{
Utils.JSONRequest("user::::pass::::uhash::::cID", username + "::::" + password + "::::" + userHash + "::::" + cN, "vh_attackCompany" + cN + ".php");
success = true;
} catch(Exception e) {
success = false;
}

}

} else {

success = false;

}

return success;

}

}
21 changes: 21 additions & 0 deletions src/main/java/me/checkium/vhackapi/botnet/BotnetTarget.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package me.checkium.vhackapi.botnet;

public enum BotnetTarget {

KFMSolutions (1),
VHACKSERVER (2),
NETCOINBANK (3);
private final int companyN;

BotnetTarget(int companyN){

this.companyN = companyN;

}

int getCompanyN(){

return companyN;

}
}
6 changes: 3 additions & 3 deletions src/main/java/me/checkium/vhackapi/console/Console.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package me.checkium.vhackapi.console;

import java.io.*;
import java.net.URL;
import java.nio.charset.Charset;
import java.io.BufferedReader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -75,6 +74,7 @@ public ArrayList<String> getIPs(int number, boolean attacked, boolean global) th
return result;
}

@SuppressWarnings("unused")
public ScannedNode scanIP(String ip) {
ScannedNode result = null;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
package me.checkium.vhackapi.upgrades;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;

Expand Down
8 changes: 7 additions & 1 deletion src/main/java/me/checkium/vhackapi/vHackAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.json.JSONObject;

import me.checkium.vhackapi.Spyware.SpywareManager;
import me.checkium.vhackapi.botnet.BotnetManager;
import me.checkium.vhackapi.chat.Chat;
import me.checkium.vhackapi.console.Console;
import me.checkium.vhackapi.others.PackageOpener;
Expand All @@ -30,7 +31,12 @@ public UpgradeManager getUpgradeManager() {
public SpywareManager getSpywareManager() {
SpywareManager manager = new SpywareManager(username, password, userHash);
return manager;
}
}

public BotnetManager getBotnetManager() {
BotnetManager manager = new BotnetManager(username, password, userHash);
return manager;
}

public String getStats(Stats stat) {
fetchStats();
Expand Down