Skip to content

Commit

Permalink
allow overriding the default timeout for a session
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Cook committed May 1, 2015
1 parent 8174438 commit 97d671d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions msfrpcd
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,19 @@ arguments = Rex::Parser::Arguments.new(
"-U" => [ true, "Specify the username to access msfrpcd" ],
"-P" => [ true, "Specify the password to access msfrpcd" ],
"-u" => [ true, "URI for Web server" ],
"-S" => [ false, "Disable SSL on the RPC socket" ],
"-t" => [ true, "Token Timeout (default 300 seconds" ],
"-S" => [ false, "Disable SSL on the RPC socket" ],
"-f" => [ false, "Run the daemon in the foreground" ],
"-n" => [ false, "Disable database" ],
"-n" => [ false, "Disable database" ],
"-h" => [ false, "Help banner" ])

opts = {
'RunInForeground' => true,
'SSL' => true,
'ServerHost' => '0.0.0.0',
'ServerPort' => 55553,
'ServerType' => 'Msg'
'ServerType' => 'Msg',
'TokenTimeout' => 300,
}

foreground = false
Expand All @@ -60,6 +62,8 @@ arguments.parse(ARGV) { |opt, idx, val|
opts['User'] = val
when '-P'
opts['Pass'] = val
when "-t"
opts['TokenTimeout'] = val.to_i
when "-f"
foreground = true
when "-u"
Expand Down
4 changes: 3 additions & 1 deletion plugins/msgrpc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def initialize(framework, opts)
user = opts['User'] || "msf"
pass = opts['Pass'] || ::Rex::Text.rand_text_alphanumeric(8)
uri = opts['URI'] || "/api"
timeout = opts['TokenTimeout'] || 300

print_status("MSGRPC Service: #{host}:#{port} #{ssl ? " (SSL)" : ""}")
print_status("MSGRPC Username: #{user}")
Expand All @@ -56,7 +57,8 @@ def initialize(framework, opts)
:ssl => ssl,
:cert => cert,
:uri => uri,
:tokens => { }
:tokens => { },
:token_timeout => timeout
})

self.server.add_user(user, pass)
Expand Down

0 comments on commit 97d671d

Please sign in to comment.