Skip to content
This repository was archived by the owner on Nov 24, 2018. It is now read-only.
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.idea
/.gradle
example.txt
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
language: java
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@

# vHackOSAPI-Java

## IN-DEV
### The vHackOSAPI is currently being developed, progress below.
## BETA
### The vHackOSAPI is now in a beta stage, meaning it might have some bugs and not all features are implemented, please report any issues.
### Join [Our Discord](https://discord.gg/52MtBDp) to keep updated.
[![Discord](https://img.shields.io/badge/Chat-%20on%20Discord-738bd7.svg?style=flat-square)](https://discord.gg/52MtBDp) [![Downloads](https://img.shields.io/github/downloads/OlympicCode/vHackAPI-Java/total.svg?style=flat-square)]()
[![Discord](https://img.shields.io/badge/Chat-%20on%20Discord-738bd7.svg?style=flat-square)](https://discord.gg/52MtBDp) [![Downloads](https://img.shields.io/github/downloads/OlympicCode/vHackOSAPI-Java/total.svg?style=flat-square)]() [![](https://jitpack.io/v/net.olympiccode/vHackOSAPI-Java.svg?style=flat-square)](https://jitpack.io/#net.olympiccode/vHackOSAPI-Java)
#
#### Gradle configuration
```
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
compile 'net.olympiccode:vHackOSAPI-Java:dev-SNAPSHOT'
}
```
##### Current API progress:
- [x] Base request system
- [x] Basic status retrieving
- [X] App upgrading & installing
- [ ] Update boosting and finishing
- [ ] Exploiting, remote notepad editing and bruteforcing
- [ ] Logging in and grabbing money
- [X] Update boosting and finishing
- [X] Exploiting, remote notepad editing and bruteforcing
- [X] Logging in and grabbing money
- [ ] Mission completing

23 changes: 23 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '1.2.4'
}
group 'vHackAPI'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
compile 'com.squareup.okhttp3:okhttp:3.9.1'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.6.1'
compile group: 'org.json', name: 'json', version: '20090211'
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
compileOnly 'org.projectlombok:lombok:1.16.20'
}

shadowJar.destinationDir = file("/build/libs")
shadowJar.archiveName = 'vHackOSAPI.jar'
157 changes: 157 additions & 0 deletions src/main/java/examples/BrainStormExample.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
package examples;

import net.olympiccode.vhackos.api.appstore.App;
import net.olympiccode.vhackos.api.entities.AppType;
import net.olympiccode.vhackos.api.entities.BruteForceState;
import net.olympiccode.vhackos.api.entities.impl.TaskManagerImpl;
import net.olympiccode.vhackos.api.events.Event;
import net.olympiccode.vhackos.api.events.EventListener;
import net.olympiccode.vhackos.api.events.StatsUpdateEvent;
import net.olympiccode.vhackos.api.events.UpdateTaskFinishEvent;
import net.olympiccode.vhackos.api.exceptions.ExploitFailedException;
import net.olympiccode.vhackos.api.network.ExploitedTarget;
import net.olympiccode.vhackos.api.vHackOSAPI;
import net.olympiccode.vhackos.api.vHackOSAPIBuilder;

import javax.security.auth.login.LoginException;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

public class BrainStormExample implements EventListener {
/*
ATTENTION

THIS IS THE CLASS I USE TO TEST THE API, I DECIDED TO KEEP IT HERE AS IT HAS MOST API FUNCTIONS AND CAN BE GOOD FOR EXAMPLES
*/
public static void main(String[] args) {
try {
String l = null;
try {
l = Files.readAllLines(Paths.get("example.txt"), Charset.forName("UTF-8")).stream().collect(Collectors.joining());
} catch (IOException e) {
e.printStackTrace();
}
if (l == null || !l.contains("#")) {
return;
}
String username = l.split("#")[0];
String pass = l.split("#")[1];
System.out.println(username + pass);
// Proxy proxyTest = new Proxy(Proxy.Type.HTTP,new InetSocketAddress("127.0.0.1", 8888));
//OkHttpClient.Builder builder = new OkHttpClient.Builder().proxy(proxyTest);
vHackOSAPI api = new vHackOSAPIBuilder()/*.setHttpClientBuilder(builder)*/.setUsername(username).setPassword(pass).buildBlocking();
api.addEventListener(new BrainStormExample());
// Executors.newScheduledThreadPool(1).scheduleAtFixedRate(() -> System.out.println(api.getTaskManager().getActiveTasks().stream().map(task -> task.getType() + ": " + task.getLevel() + " (" + task.getId() + ") - " + ((task.getEndTimestamp() - System.currentTimeMillis()) / 1000) ).collect(Collectors.joining("\n"))), 0, 5000, TimeUnit.MILLISECONDS);
// api.getAppManager().getApp(AppType.Spam).getAsUpdateable().fillTasks();
int lvl = 10000000;
App capp = null;
System.out.println(api.getAppManager().getApps());
for (App app : api.getAppManager().getApps()) {
if (!app.isInstalled() && app.getRequiredLevel() <= api.getStats().getLevel()) app.getAsInstallable().install();
if (app.getLevel() != 0 && !app.isOneTime() && app.isInstalled() && app.getLevel() < lvl) {
lvl = app.getLevel();
capp = app;
}
}
if (capp.getPrice() < api.getStats().getMoney()) {
System.out.println("Starting " + capp.getType().getName());
if (!capp.getAsUpdateable().fillTasks()) ((TaskManagerImpl) api.getTaskManager()).reloadTasks();
if (api.getTaskManager().getBoosters() > 0) {
System.out.println("Boosted tasks");
api.getTaskManager().boostAll();
}
if (api.getStats().getNetcoins() > 1000) {
System.out.println("Finished tasks with netcoins");
api.getTaskManager().finishAll();
}
}
Executors.newScheduledThreadPool(1).scheduleAtFixedRate(() -> {
System.out.println("Active tasks: " + api.getTaskManager().getActiveTasks().stream().map(task -> task.getId() + " " + task.getType().getName()).collect(Collectors.joining(", ")));
}, 0, 10000, TimeUnit.MILLISECONDS);
Executors.newScheduledThreadPool(1).scheduleAtFixedRate(() -> {
api.getMiner().start();
}, 0, 60000 * 60, TimeUnit.MILLISECONDS);
Executors.newScheduledThreadPool(1).scheduleAtFixedRate(() -> {
final long[] money = {0};
api.getTaskManager().getActiveBrutes().forEach(bruteForce -> {
if (bruteForce.getState() == BruteForceState.SUCCESS) {
ExploitedTarget etarget = bruteForce.exploit();
ExploitedTarget.Banking banking = etarget.getBanking();

if (banking.isBruteForced()) {
long av = banking.getAvaliableMoney();
if (av > 0 && banking.withdraw()) System.out.println("Got " + av + " of " + banking.getTotal() + " (" + banking.getSavings() + "/" + banking.getMaxSavings() + ") " + (banking.getSavings() / 2 < banking.getMaxSavings())); else System.out.println("fail" + (banking.getSavings() / 2 < banking.getMaxSavings()));
money[0] = money[0] + av;
if (!(banking.getSavings() / 2 < banking.getMaxSavings()) && banking.getSavings() < 1000000 && !bruteForce.getUsername().toLowerCase().contains("atjon")) bruteForce.remove();
} else {
banking.startBruteForce();
}
etarget.setSystemLog("Checkium was here #OlympicCode");
}
});
api.getStats().getExploits();
if (api.getStats().getExploits() > 0) {
int level = api.getAppManager().getApp(AppType.SDK).getLevel();
api.getNetworkManager().getTargets().forEach(target -> {
if (target.getFirewall() < level && api.getStats().getExploits() > 0) {
try {
ExploitedTarget etarget = target.exploit();
etarget.getBanking().startBruteForce();
etarget.setSystemLog("Checkium was here #OlympicCode");
System.out.println("Started brute @ " + etarget.getIp());
} catch (ExploitFailedException e) {
System.out.println(target.getIp() + ": " + e.getMessage());
}
}
});
}
}, 100, 60000, TimeUnit.MILLISECONDS);
System.out.println(api.getTaskManager().getActiveBrutes().stream().map(bruteForce -> bruteForce.getUsername() + " " + bruteForce.getState()).collect(Collectors.joining(", ")));
} catch (LoginException | InterruptedException e) {
e.printStackTrace();
}
}

@Override
public void onEvent(Event event) {
if (event instanceof StatsUpdateEvent) {
StatsUpdateEvent e = (StatsUpdateEvent) event;
System.out.println(e.getStats().getExploits() + " " + e.getStats().getMoney() + " " + e.getStats().getNetcoins() + " (" + e.getAPI().getMiner().isRunning() + ")");
System.out.println(e.getStats().getLevel() + " - " + e.getStats().getLevelPorcentage());
} else if (event instanceof UpdateTaskFinishEvent) {
UpdateTaskFinishEvent e = (UpdateTaskFinishEvent) event;
System.out.println(e.getAPI().getTaskManager().getActiveTasks().size() + "Finished " + e.getTask().getType() + " to level " + e.getTask().getLevel());
if (e.getAPI().getTaskManager().getActiveTasks().size() == 0) {
int lvl = 100;
App capp = null;
for (App app : e.getAPI().getAppManager().getApps()) {
if (app.getLevel() != 0 && !app.isOneTime() && app.isInstalled() && app.getLevel() < lvl) {
lvl = app.getLevel();
capp = app;
}
}
System.out.println("Starting " + capp.getType().getName() + " (" + capp.getType().getId() + ")");
boolean a = capp.getAsUpdateable().fillTasks();
if (!a) {
a = capp.getAsUpdateable().fillTasks();
}
if (a) {
if (e.getAPI().getTaskManager().getBoosters() > 0) {
System.out.println("Boosted tasks");
e.getAPI().getTaskManager().boostAll();
}
if (e.getAPI().getStats().getNetcoins() > 1000) {
System.out.println("Finished tasks with netcoins");
e.getAPI().getTaskManager().finishAll();
}
}
}
}
}
}
21 changes: 21 additions & 0 deletions src/main/java/net/olympiccode/vhackos/api/appstore/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package net.olympiccode.vhackos.api.appstore;

import net.olympiccode.vhackos.api.entities.AppType;

public interface App {
InstallableApp getAsInstallable();

UpdateableApp getAsUpdateable();

AppType getType();

long getPrice();

int getLevel();

int getRequiredLevel();

boolean isOneTime();

boolean isInstalled();
}
10 changes: 10 additions & 0 deletions src/main/java/net/olympiccode/vhackos/api/appstore/AppManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package net.olympiccode.vhackos.api.appstore;

import net.olympiccode.vhackos.api.entities.AppType;

import java.util.List;

public interface AppManager {
App getApp(AppType type);
List<App> getApps();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package net.olympiccode.vhackos.api.appstore;

public interface InstallableApp {
boolean hasRequiredLevel();
boolean install();
}
12 changes: 12 additions & 0 deletions src/main/java/net/olympiccode/vhackos/api/appstore/Task.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package net.olympiccode.vhackos.api.appstore;

import net.olympiccode.vhackos.api.entities.AppType;

public interface Task {
boolean isFinished();
long getLevel();
AppType getType();
long getId();
long getEndTimestamp();
long getStartTimestamp();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package net.olympiccode.vhackos.api.appstore;

import net.olympiccode.vhackos.api.entities.impl.BruteForceImpl;

import java.util.List;

public interface TaskManager {
List<Task> getActiveTasks();
List<BruteForceImpl> getActiveBrutes();
boolean finishAll();
boolean boostAll();
int getFinishAllCost();
int getBoosters();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package net.olympiccode.vhackos.api.appstore;

public interface UpdateableApp {
boolean update();
boolean fillTasks();
}
39 changes: 39 additions & 0 deletions src/main/java/net/olympiccode/vhackos/api/entities/AppType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package net.olympiccode.vhackos.api.entities;

import lombok.Getter;

import java.util.Arrays;
import java.util.stream.Collectors;


public enum AppType {
Notepad("Notepad", 0),
Antivirus ("Antivirus", 1),
Firewall ("Firewall", 2),
Spam ("Spam", 3),
BruteForce ("Bruteforce", 4),
BankingProtection ("Banking Protection", 5),
SDK ("Software Development Kit", 6),
Community ("Community", 7),
Missions ("Missions", 8),
Leaderboards ("Leaderboards", 9),
IPSP ("IP-Spoofing", 10),
NCMiner ("NCMiner", 11),
MalwareKit ("Malware Kit", 12),
Jobs ("Jobs", 13);

@Getter
private String name;
@Getter
private int id;

AppType(String name, int id) {
this.name = name;
this.id = id;
}

public static AppType byId(int id) {
return Arrays.stream(AppType.values()).filter(appType -> appType.getId() == id).collect(Collectors.toList()).get(0);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package net.olympiccode.vhackos.api.entities;

public enum BruteForceState {
RUNNING, SUCCESS, FAILED
}
21 changes: 21 additions & 0 deletions src/main/java/net/olympiccode/vhackos/api/entities/Stats.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package net.olympiccode.vhackos.api.entities;

public interface Stats {
long getMoney();

long getExploits();

long getNetcoins();

long getLevel();

long getExperience();

long getRequiredExperience();

long getLevelPorcentage();

String getIpAddress();

String getUsername();
}
Loading