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

Update to vHack 1.41 #19

Merged
merged 3 commits into from
Nov 29, 2016
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# vHackAPI-Java
[![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)]()

### Contributors: [@Checkium](https://github.com/checkium), [@dude24760](https://github.com/dude24760), [@angelbirth](https://github.com/angelbirth), [@Qup42](https://github.com/Qup42)
### 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)
###### Don't forget to add your name here when you pull request.
Current feature list:
- Ability to scan the network for IP addresses.
Expand Down
23 changes: 11 additions & 12 deletions src/examples/ConsoleExample.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package examples;

import java.util.ArrayList;
import java.util.List;
//import java.util.ArrayList;
//import java.util.List;

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

if(scanned.get(0).getSuccessRate() <= 90 && scanned.get(0).isAnonymous()) {
ArrayList<TransferResult> transfer = api.getConsole().trTransferIPs((ArrayList<String>) ip);
if(transfer.get(0).getSuccess()){
System.out.println("Got $" + transfer.get(0).getMoneyAmount());
System.out.println("Gained " + transfer.get(0).getRepGained() + " rep.");
}
}

if(scanned.getSuccessRate() >= 70) {
TransferResult transfer = api.getConsole().transferTrojanTo(scanned);
if(transfer.getSuccess()){
System.out.println("Got $" + transfer.getMoneyAmount());
System.out.println("Gained " + transfer.getRepGained() + " rep.");
}
}
}
}
11 changes: 11 additions & 0 deletions src/me/checkium/vhackapi/Spyware/SpywareManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ public SpywareUploadResult uploadSpywareTo(ScannedNode node)
return new SpywareUploadResult(returnString);
}

public boolean removeSpywareFrom(ScannedNode node)
{
String returnString = Utils.StringRequest("user::::pass::::uhash::::target", username + "::::" + password + "::::" + userHash + "::::" + node.getIP(), "vh_removeSpywareRemote.php");
JSONObject d = new JSONObject(returnString);
if (d.getInt("result") == 0) {
return true;
} else {
return false;
}
}

public ArrayList<Spyware> getActiveSpyware()
{
ArrayList<Spyware> list = new ArrayList<>();
Expand Down
33 changes: 3 additions & 30 deletions src/me/checkium/vhackapi/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,8 @@
import java.io.Reader;
import java.net.URL;
import java.nio.charset.Charset;
import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;

import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;

import org.json.JSONException;
import org.json.JSONObject;
Expand All @@ -29,7 +22,7 @@ public class Utils {

static {
assertionstatus = !Utils.class.desiredAssertionStatus();
url = "https://api.vhack.cc/v/7/";
url = "https://api.vhack.cc/v/8/";
md5s = "MD5";
secret = "aeffl";
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};
Expand Down Expand Up @@ -57,13 +50,7 @@ public static JSONObject JSONRequest(String format, String data, String php){
public static String StringRequest(String format, String data, String php)
{
System.setProperty("http.agent", "Chrome");
try {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, Utils.trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
} catch (GeneralSecurityException e) {
}


String jsonText = null;
InputStream is;
try {
Expand Down Expand Up @@ -178,21 +165,7 @@ public static byte[] assertion(byte[] bArr, int i, int i2, byte[] bArr2, int i3)
throw new AssertionError();
}

public static TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
public void checkClientTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
}
}
};



public static String generateURL(String str, String str2, String str3) {
String[] split = str.split("::::");
String[] split2 = str2.split("::::");
Expand Down
55 changes: 40 additions & 15 deletions src/me/checkium/vhackapi/console/Console.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ public Console(String user, String pass, String uHash) {
//return this;
}

/**
*
* Get IP from console
*
* @param global Use global?
* @param attacked Get already attacked IPs?
*/
public String getIP(boolean attacked, boolean global) throws JSONException {
String result = null;
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::global", username + "::::" + password + "::::" + userHash + "::::" + (global?"1":"0"), "vh_network.php");
JSONArray jSONArray = json.getJSONArray("data");
result = jSONArray.getJSONObject(0).getString("ip");
return result;
}

/**
*
* Get IPs from console
Expand All @@ -37,16 +52,12 @@ public Console(String user, String pass, String uHash) {
* @param global Use global?
* @param attacked Get already attacked IPs?
*/
public ArrayList<String> getIPs(int number, boolean attacked, boolean global){
public ArrayList<String> getIPs(int number, boolean attacked, boolean global) throws JSONException {
ArrayList<String> result = new ArrayList<String>();
ArrayList<String> temporary = new ArrayList<String>();
int globali = 0;
if (global) {
globali = 1;
}
if (number > 10) {
for (int i = 10; i <= number + 9; i = i + 10) {
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::global", username + "::::" + password + "::::" + userHash + "::::" + Integer.toString(globali), "vh_network.php");
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::global", username + "::::" + password + "::::" + userHash + "::::" + (global?"1":"0"), "vh_network.php");
JSONArray jSONArray = json.getJSONArray("data");
for (int j = 0; j <= jSONArray.length() - 1; j++) {
JSONObject ip = jSONArray.getJSONObject(j);
Expand All @@ -58,7 +69,7 @@ public ArrayList<String> getIPs(int number, boolean attacked, boolean global){
result.add(temporary.get(k));
}
} else {
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::global", username + "::::" + password + "::::" + userHash + "::::" + Integer.toString(globali), "vh_network.php");
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::global", username + "::::" + password + "::::" + userHash + "::::" + (global?"1":"0"), "vh_network.php");
JSONArray jSONArray = json.getJSONArray("data");
for (int k = 0; k < number; k++) {
result.add(jSONArray.getJSONObject(k).getString("ip"));
Expand All @@ -67,14 +78,31 @@ public ArrayList<String> getIPs(int number, boolean attacked, boolean global){
return result;
}

public ScannedNode scanIP(String ip) {
InputStream is;
BufferedReader rd;
ScannedNode result = null;
try {
is = new URL(Utils.generateURL("user::::pass::::target", username + "::::" + password + "::::" + ip, "vh_scan.php")).openStream();
rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
String[] temp = ReadBigStringIn(rd);
result = new ScannedNode(temp);
result.setIP(ip);
TimeUnit.MILLISECONDS.sleep(100);
} catch (InterruptedException|IOException e) {
e.printStackTrace();
}
return result;
}

public List<ScannedNode> scanIPs(List<String> ips) {
InputStream is;
BufferedReader rd;
List<ScannedNode> array = new ArrayList<>();
ScannedNode result;

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


public ArrayList<TransferResult> trTransferIPs(ArrayList<String> ips) {
public ArrayList<TransferResult> transferTrojansTo(ArrayList<ScannedNode> nodes) throws JSONException {
ArrayList<TransferResult> array = new ArrayList<TransferResult>();
TransferResult result;
for (int j = 0; j < ips.size(); j++) {

JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::target", username + "::::" + password + "::::" + userHash + "::::" + ips.get(j), "vh_trTransfer.php");
result = new TransferResult(json, ips.get(j));
for (int j = 0; j < nodes.size(); j++) {
JSONObject json = Utils.JSONRequest("user::::pass::::uhash::::target", username + "::::" + password + "::::" + userHash + "::::" + nodes.get(j).getIP(), "vh_trTransfer.php");
result = new TransferResult(json, nodes.get(j).getIP());
array.add(result);
}
return array;
Expand Down
7 changes: 6 additions & 1 deletion src/me/checkium/vhackapi/vHackAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import org.json.JSONObject;

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

public String getStats(Stats stat) {
try {
Expand Down
32 changes: 31 additions & 1 deletion src/me/checkium/vhackapi/vHackAPIBuilder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package me.checkium.vhackapi;

import java.security.GeneralSecurityException;
import java.security.cert.X509Certificate;

import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;

import org.json.JSONObject;

public class vHackAPIBuilder {
Expand Down Expand Up @@ -37,8 +45,30 @@ public vHackAPIBuilder register() {


public vHackAPI getAPI() {

try {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
} catch (GeneralSecurityException e) {
}

vHackAPI api = new vHackAPI(username, password);
return api;
}

public static TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
public void checkClientTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
}
}
};


}