Skip to content

Commit 97d671d

Browse files
author
Brent Cook
committed
allow overriding the default timeout for a session
1 parent 8174438 commit 97d671d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

msfrpcd

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,19 @@ arguments = Rex::Parser::Arguments.new(
3030
"-U" => [ true, "Specify the username to access msfrpcd" ],
3131
"-P" => [ true, "Specify the password to access msfrpcd" ],
3232
"-u" => [ true, "URI for Web server" ],
33-
"-S" => [ false, "Disable SSL on the RPC socket" ],
33+
"-t" => [ true, "Token Timeout (default 300 seconds" ],
34+
"-S" => [ false, "Disable SSL on the RPC socket" ],
3435
"-f" => [ false, "Run the daemon in the foreground" ],
35-
"-n" => [ false, "Disable database" ],
36+
"-n" => [ false, "Disable database" ],
3637
"-h" => [ false, "Help banner" ])
3738

3839
opts = {
3940
'RunInForeground' => true,
4041
'SSL' => true,
4142
'ServerHost' => '0.0.0.0',
4243
'ServerPort' => 55553,
43-
'ServerType' => 'Msg'
44+
'ServerType' => 'Msg',
45+
'TokenTimeout' => 300,
4446
}
4547

4648
foreground = false
@@ -60,6 +62,8 @@ arguments.parse(ARGV) { |opt, idx, val|
6062
opts['User'] = val
6163
when '-P'
6264
opts['Pass'] = val
65+
when "-t"
66+
opts['TokenTimeout'] = val.to_i
6367
when "-f"
6468
foreground = true
6569
when "-u"

plugins/msgrpc.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def initialize(framework, opts)
4545
user = opts['User'] || "msf"
4646
pass = opts['Pass'] || ::Rex::Text.rand_text_alphanumeric(8)
4747
uri = opts['URI'] || "/api"
48+
timeout = opts['TokenTimeout'] || 300
4849

4950
print_status("MSGRPC Service: #{host}:#{port} #{ssl ? " (SSL)" : ""}")
5051
print_status("MSGRPC Username: #{user}")
@@ -56,7 +57,8 @@ def initialize(framework, opts)
5657
:ssl => ssl,
5758
:cert => cert,
5859
:uri => uri,
59-
:tokens => { }
60+
:tokens => { },
61+
:token_timeout => timeout
6062
})
6163

6264
self.server.add_user(user, pass)

0 commit comments

Comments
 (0)