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

Patch 1 #35

Closed
wants to merge 2 commits into from
Closed
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
6 changes: 1 addition & 5 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
2 changes: 1 addition & 1 deletion .project
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vhack</name>
<name>vhackapi</name>
<comment></comment>
<projects>
</projects>
Expand Down
16 changes: 6 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>vhack</groupId>
<artifactId>vhack</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>VHackAPI</name>
<groupId>olympiccode</groupId>
<artifactId>vhackapi</artifactId>
<version>1.0.0</version>
<name>vHackAPI</name>
<dependencies>
<dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>

</dependencies>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
21 changes: 0 additions & 21 deletions src/main/java/examples/ChatExample.java

This file was deleted.

27 changes: 0 additions & 27 deletions src/main/java/examples/ConsoleExample.java

This file was deleted.

10 changes: 0 additions & 10 deletions src/main/java/examples/ExampleCode.md

This file was deleted.

15 changes: 0 additions & 15 deletions src/main/java/examples/PackageExample.java

This file was deleted.

37 changes: 0 additions & 37 deletions src/main/java/examples/UpgradeExample.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package me.checkium.vhackapi;
package ga.olympiccode.vhack;

public enum Stats {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package me.checkium.vhackapi;
package ga.olympiccode.vhack;

import java.io.BufferedReader;
import java.io.IOException;
Expand All @@ -9,6 +9,7 @@
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.concurrent.TimeUnit;

import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -49,7 +50,7 @@ public class Utils {
* @return The String representation of data the buffered reader contains.
* @throws IOException If an I/O error occurs
*/
public static String readJson(Reader rd) throws IOException {
public static String readResponse(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
Expand All @@ -68,14 +69,14 @@ public static String readJson(Reader rd) throws IOException {
* Every request, except the very first one, should include "user::::pass::::uhash".<br>
* Example: "user::::pass::::uhash::::global" (taken from Console.getIP)
* @param data The data for the params that you passed in. They are also separated by "::::". You can just concatanate the parts of this.<br>
* Example: "vHackAPI::::123456::::aaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnoooopppp::::1"
* Example: "username::::password::::uhash::::1"
* @param php This is the api endpoint that the request will be sent to. In the case of the vHackAPI it are php documents.<br>
* Example "vh_network.php"
* @return The resulte Json as a JSONObject. Errors are thrown if user/password is wrong and (possibly) if the api url changed. null is returned if there are other errors.
*/
public static JSONObject JSONRequest(String format, String data, String php){
JSONObject json = null;
String jsonText = StringRequest(format, data, php);
String jsonText = RawRequest(format, data, php);
if("".equals(jsonText))
{
throw new RuntimeException("Old API URL");
Expand Down Expand Up @@ -103,22 +104,33 @@ else if (jsonText.length() == 1) {
* Example: "vHackAPI::::123456::::aaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnoooopppp::::1"
* @param php This is the api endpoint that the request will be sent to. In the case of the vHackAPI it are php documents.<br>
* Example "vh_network.php"
* @return The resulte Json as a String.
* @return Text from response
*/
public static String StringRequest(String format, String data, String php)
public static String RawRequest(String format, String data, String php)
{
System.setProperty("http.agent", "Chrome");

String jsonText = null;
String response = null;
InputStream is;
try {
is = new URL(Utils.generateURL(format, data, php)).openStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
jsonText = Utils.readJson(rd);
response = Utils.readResponse(rd);
} catch (IOException e) {
e.printStackTrace();
}
return jsonText;
if("".equals(response))
{
throw new RuntimeException("Old API URL");
}
else if("8".equals(response))
{
throw new RuntimeException("Wrong Password/User");
}
else if (response.length() == 1) {
return null;
}
return response;
}

private static byte[] m9179a(byte[] arrby, int n2, int n3, byte[] arrby2, int n4, byte[] arrby3) {
Expand Down Expand Up @@ -275,5 +287,17 @@ public static String generateURL(String format, String data, String php) {
String str8 = hashString(hashString(a3 + hashString(hashString(str9) + str7)));
return url + php + "?user=" + a + "&pass=" + str8;
}
/**
* Used internally to delay requests
* @param ms How long to delay
*/
public static void delay(long ms) {
try {
TimeUnit.MILLISECONDS.wait(ms);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}
59 changes: 59 additions & 0 deletions src/main/java/ga/olympiccode/vhack/console/Console.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package ga.olympiccode.vhack.console;

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

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

import ga.olympiccode.vhack.Utils;

public class Console {

protected String password;
protected String username;
protected String userHash;

public Console(String user, String pass, String uHash) {
username = user;
password = pass;
userHash = uHash;
//return this;
}

/**
*
* Get IP from console
*
* @param global Use global?
* @param attacked Get already attacked IPs?
*/
public IP getIP(boolean global) throws JSONException {
Utils.delay(200);
String result = null;
JSONObject json = new JSONObject(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 new IP(result, password, username);
}

/**
*
* Get IPs from console
*
* @param number How many IPs?
* @param global Use global?
* @param attacked Get already attacked IPs?
*/
public List<IP> getIPs(int number, boolean global) throws JSONException {
List<IP> result = new ArrayList<IP>();
JSONObject json = new JSONObject(Utils.JSONRequest("user::::pass::::uhash::::global", username + "::::" + password + "::::" + userHash + "::::" + (global?"1":"0"), "vh_network.php"));
JSONArray JSONArray = json.getJSONArray("data");
for(int i = 0; 0 <= number; i++) {
result.add(new IP(JSONArray.getJSONObject(i).getString("ip"), password, username));
}
return result;
}

}
49 changes: 49 additions & 0 deletions src/main/java/ga/olympiccode/vhack/console/IP.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package ga.olympiccode.vhack.console;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;

import org.json.JSONObject;

import ga.olympiccode.vhack.Utils;

public class IP {
String IP;
String password;
String username;
public IP(String ip, String password, String username) {
this.IP = ip;
}

public String getIP() {
return IP;
}

public ScanResult scan() {

ScanResult result = new ScanResult(parseScanResult(Utils.RawRequest("user::::pass::::target", username + "::::" + password + "::::" + IP, "vh_scan.php")));
result.setIP(IP);
return result;
}

public TransferResult transferTrojan() {
JSONObject json = new JSONObject(Utils.JSONRequest("user::::pass::::target", username + "::::" + password + "::::" + IP, "vh_trTransfer.php"));
return new TransferResult(json, IP);
}

public String[] ReadBigStringIn(BufferedReader buffIn) throws IOException {
String[] string = new String[14];
int i = 0;
String line;
while( (line = buffIn.readLine()) != null) {
string[i] = line;
i++;
}
return string;
}

private String[] parseScanResult(String input) {
return (new BufferedReader(new StringReader(input))).lines().toArray(String[]::new);
}
}
Loading