commit
0b4260ab89
|
@ -12,7 +12,7 @@ private
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_workspace(wspace = nil)
|
def find_workspace(wspace = nil)
|
||||||
if(wspace and wspace != "")
|
if wspace and wspace != ""
|
||||||
return self.framework.db.find_workspace(wspace) || error(500, "Invalid workspace")
|
return self.framework.db.find_workspace(wspace) || error(500, "Invalid workspace")
|
||||||
end
|
end
|
||||||
self.framework.db.workspace
|
self.framework.db.workspace
|
||||||
|
@ -104,6 +104,39 @@ private
|
||||||
return opts, opts[:workspace]
|
return opts, opts[:workspace]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_notes(xopts)
|
||||||
|
::ActiveRecord::Base.connection_pool.with_connection {
|
||||||
|
opts, wspace = init_db_opts_workspace(xopts)
|
||||||
|
notes = []
|
||||||
|
|
||||||
|
host = self.framework.db.get_host(opts)
|
||||||
|
return notes if not host
|
||||||
|
|
||||||
|
if opts[:proto] && opts[:port]
|
||||||
|
services = []
|
||||||
|
nret = host.services.find_by_proto_and_port(opts[:proto], opts[:port])
|
||||||
|
return ret if nret == nil
|
||||||
|
services << nret if nret.class == ::Mdm::Service
|
||||||
|
services |= nret if nret.class == Array
|
||||||
|
|
||||||
|
services.each do |s|
|
||||||
|
nret = nil
|
||||||
|
if opts[:ntype]
|
||||||
|
nret = s.notes.find_by_ntype(opts[:ntype])
|
||||||
|
else
|
||||||
|
nret = s.notes
|
||||||
|
end
|
||||||
|
next if nret == nil
|
||||||
|
notes << nret if nret.class == ::Mdm::Note
|
||||||
|
notes |= nret if nret.class == Array
|
||||||
|
end
|
||||||
|
else
|
||||||
|
notes = host.notes
|
||||||
|
end
|
||||||
|
notes
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
public
|
public
|
||||||
|
|
||||||
|
|
||||||
|
@ -416,7 +449,7 @@ public
|
||||||
wspace.vulns.includes(:service).where(conditions).offset(offset).limit(limit).each do |v|
|
wspace.vulns.includes(:service).where(conditions).offset(offset).limit(limit).each do |v|
|
||||||
vuln = {}
|
vuln = {}
|
||||||
reflist = v.refs.map { |r| r.name }
|
reflist = v.refs.map { |r| r.name }
|
||||||
if(v.service)
|
if v.service
|
||||||
vuln[:port] = v.service.port
|
vuln[:port] = v.service.port
|
||||||
vuln[:proto] = v.service.proto
|
vuln[:proto] = v.service.proto
|
||||||
else
|
else
|
||||||
|
@ -495,7 +528,7 @@ public
|
||||||
wspace = find_workspace(wspace)
|
wspace = find_workspace(wspace)
|
||||||
ret = {}
|
ret = {}
|
||||||
ret[:workspace] = []
|
ret[:workspace] = []
|
||||||
if(wspace)
|
if wspace
|
||||||
w = {}
|
w = {}
|
||||||
w[:name] = wspace.name
|
w[:name] = wspace.name
|
||||||
w[:id] = wspace.id
|
w[:id] = wspace.id
|
||||||
|
@ -524,7 +557,7 @@ public
|
||||||
::ActiveRecord::Base.connection_pool.with_connection {
|
::ActiveRecord::Base.connection_pool.with_connection {
|
||||||
db_check
|
db_check
|
||||||
workspace = find_workspace(wspace)
|
workspace = find_workspace(wspace)
|
||||||
if(workspace)
|
if workspace
|
||||||
self.framework.db.workspace = workspace
|
self.framework.db.workspace = workspace
|
||||||
return { 'result' => "success" }
|
return { 'result' => "success" }
|
||||||
end
|
end
|
||||||
|
@ -580,7 +613,7 @@ public
|
||||||
::ActiveRecord::Base.connection_pool.with_connection {
|
::ActiveRecord::Base.connection_pool.with_connection {
|
||||||
db_check
|
db_check
|
||||||
wspace = self.framework.db.add_workspace(wspace)
|
wspace = self.framework.db.add_workspace(wspace)
|
||||||
return { 'result' => 'success' } if(wspace)
|
return { 'result' => 'success' } if wspace
|
||||||
{ 'result' => 'failed' }
|
{ 'result' => 'failed' }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -620,7 +653,7 @@ public
|
||||||
ret[:host] = []
|
ret[:host] = []
|
||||||
opts = fix_options(xopts)
|
opts = fix_options(xopts)
|
||||||
h = self.framework.db.get_host(opts)
|
h = self.framework.db.get_host(opts)
|
||||||
if(h)
|
if h
|
||||||
host = {}
|
host = {}
|
||||||
host[:created_at] = h.created_at.to_i
|
host[:created_at] = h.created_at.to_i
|
||||||
host[:address] = h.address.to_s
|
host[:address] = h.address.to_s
|
||||||
|
@ -669,7 +702,7 @@ public
|
||||||
opts, wspace = init_db_opts_workspace(xopts)
|
opts, wspace = init_db_opts_workspace(xopts)
|
||||||
|
|
||||||
res = self.framework.db.report_host(opts)
|
res = self.framework.db.report_host(opts)
|
||||||
return { :result => 'success' } if(res)
|
return { :result => 'success' } if res
|
||||||
{ :result => 'failed' }
|
{ :result => 'failed' }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -695,7 +728,7 @@ public
|
||||||
::ActiveRecord::Base.connection_pool.with_connection {
|
::ActiveRecord::Base.connection_pool.with_connection {
|
||||||
opts, wspace = init_db_opts_workspace(xopts)
|
opts, wspace = init_db_opts_workspace(xopts)
|
||||||
res = self.framework.db.report_service(opts)
|
res = self.framework.db.report_service(opts)
|
||||||
return { :result => 'success' } if(res)
|
return { :result => 'success' } if res
|
||||||
{ :result => 'failed' }
|
{ :result => 'failed' }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -735,9 +768,9 @@ public
|
||||||
services = []
|
services = []
|
||||||
sret = nil
|
sret = nil
|
||||||
|
|
||||||
if(host && opts[:proto] && opts[:port])
|
if host && opts[:proto] && opts[:port]
|
||||||
sret = host.services.find_by_proto_and_port(opts[:proto], opts[:port])
|
sret = host.services.find_by_proto_and_port(opts[:proto], opts[:port])
|
||||||
elsif(opts[:proto] && opts[:port])
|
elsif opts[:proto] && opts[:port]
|
||||||
conditions = {}
|
conditions = {}
|
||||||
conditions[:state] = [Msf::ServiceState::Open] if opts[:up]
|
conditions[:state] = [Msf::ServiceState::Open] if opts[:up]
|
||||||
conditions[:proto] = opts[:proto] if opts[:proto]
|
conditions[:proto] = opts[:proto] if opts[:proto]
|
||||||
|
@ -769,10 +802,12 @@ public
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# Returns a note.
|
# Returns a note.
|
||||||
#
|
#
|
||||||
# @param [Hash] xopts Options.
|
# @param [Hash] xopts Options.
|
||||||
|
# @option xopts [String] :addr Host address.
|
||||||
|
# @option xopts [String] :address Same as :addr.
|
||||||
|
# @option xopts [String] :host Same as :address.
|
||||||
# @option xopts [String] :proto Protocol.
|
# @option xopts [String] :proto Protocol.
|
||||||
# @option xopts [Fixnum] :port Port.
|
# @option xopts [Fixnum] :port Port.
|
||||||
# @option xopts [String] :ntype Note type.
|
# @option xopts [String] :ntype Note type.
|
||||||
|
@ -794,37 +829,11 @@ public
|
||||||
# @example Here's how you would use this from the client:
|
# @example Here's how you would use this from the client:
|
||||||
# rpc.call('db.get_note', {:proto => 'tcp', :port => 80})
|
# rpc.call('db.get_note', {:proto => 'tcp', :port => 80})
|
||||||
def rpc_get_note(xopts)
|
def rpc_get_note(xopts)
|
||||||
::ActiveRecord::Base.connection_pool.with_connection {
|
|
||||||
opts, wspace = init_db_opts_workspace(xopts)
|
|
||||||
|
|
||||||
ret = {}
|
ret = {}
|
||||||
ret[:note] = []
|
ret[:note] = []
|
||||||
|
|
||||||
host = self.framework.db.get_host(opts)
|
notes = get_notes(xopts)
|
||||||
|
|
||||||
return ret if( not host)
|
|
||||||
notes = []
|
|
||||||
if(opts[:proto] && opts[:port])
|
|
||||||
services = []
|
|
||||||
nret = host.services.find_by_proto_and_port(opts[:proto], opts[:port])
|
|
||||||
return ret if nret == nil
|
|
||||||
services << nret if nret.class == ::Mdm::Service
|
|
||||||
services |= nret if nret.class == Array
|
|
||||||
|
|
||||||
services.each do |s|
|
|
||||||
nret = nil
|
|
||||||
if opts[:ntype]
|
|
||||||
nret = s.notes.find_by_ntype(opts[:ntype])
|
|
||||||
else
|
|
||||||
nret = s.notes
|
|
||||||
end
|
|
||||||
next if nret == nil
|
|
||||||
notes << nret if nret.class == ::Mdm::Note
|
|
||||||
notes |= nret if nret.class == Array
|
|
||||||
end
|
|
||||||
else
|
|
||||||
notes = host.notes
|
|
||||||
end
|
|
||||||
notes.each do |n|
|
notes.each do |n|
|
||||||
note = {}
|
note = {}
|
||||||
host = n.host
|
host = n.host
|
||||||
|
@ -842,7 +851,6 @@ public
|
||||||
ret[:note] << note
|
ret[:note] << note
|
||||||
end
|
end
|
||||||
ret
|
ret
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -872,7 +880,7 @@ public
|
||||||
ret = {}
|
ret = {}
|
||||||
ret[:client] = []
|
ret[:client] = []
|
||||||
c = self.framework.db.get_client(opts)
|
c = self.framework.db.get_client(opts)
|
||||||
if(c)
|
if c
|
||||||
client = {}
|
client = {}
|
||||||
host = c.host
|
host = c.host
|
||||||
client[:host] = host.address
|
client[:host] = host.address
|
||||||
|
@ -909,7 +917,7 @@ public
|
||||||
::ActiveRecord::Base.connection_pool.with_connection {
|
::ActiveRecord::Base.connection_pool.with_connection {
|
||||||
opts, wspace = init_db_opts_workspace(xopts)
|
opts, wspace = init_db_opts_workspace(xopts)
|
||||||
res = self.framework.db.report_client(opts)
|
res = self.framework.db.report_client(opts)
|
||||||
return { :result => 'success' } if(res)
|
return { :result => 'success' } if res
|
||||||
{ :result => 'failed' }
|
{ :result => 'failed' }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -944,12 +952,16 @@ public
|
||||||
addr = opts[:host] || opts[:address]
|
addr = opts[:host] || opts[:address]
|
||||||
wspace = opts[:workspace] || self.framework.db.workspace
|
wspace = opts[:workspace] || self.framework.db.workspace
|
||||||
host = wspace.hosts.find_by_address(addr)
|
host = wspace.hosts.find_by_address(addr)
|
||||||
service = host.services.find_by_proto_and_port(opts[:proto],opts[:port]) if host.services.count > 0
|
if host && host.services.count > 0
|
||||||
opts[:service] = service if service
|
service = host.services.find_by_proto_and_port(opts[:proto],opts[:port])
|
||||||
|
if service
|
||||||
|
opts[:service] = service
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
res = self.framework.db.report_note(opts)
|
res = self.framework.db.report_note(opts)
|
||||||
return { :result => 'success' } if(res)
|
return { :result => 'success' } if res
|
||||||
{ :result => 'failed' }
|
{ :result => 'failed' }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -997,8 +1009,8 @@ public
|
||||||
note[:time] = n.created_at.to_i
|
note[:time] = n.created_at.to_i
|
||||||
note[:host] = ""
|
note[:host] = ""
|
||||||
note[:service] = ""
|
note[:service] = ""
|
||||||
note[:host] = n.host.address if(n.host)
|
note[:host] = n.host.address if n.host
|
||||||
note[:service] = n.service.name || n.service.port if(n.service)
|
note[:service] = n.service.name || n.service.port if n.service
|
||||||
note[:type ] = n.ntype.to_s
|
note[:type ] = n.ntype.to_s
|
||||||
note[:data] = n.data.inspect
|
note[:data] = n.data.inspect
|
||||||
ret[:notes] << note
|
ret[:notes] << note
|
||||||
|
@ -1058,14 +1070,14 @@ public
|
||||||
vulns = []
|
vulns = []
|
||||||
|
|
||||||
if opts[:host] or opts[:address] or opts[:addresses]
|
if opts[:host] or opts[:address] or opts[:addresses]
|
||||||
hosts = opts_to_hosts(opts)
|
hosts = opts_to_hosts(xopts)
|
||||||
end
|
end
|
||||||
|
|
||||||
if opts[:port] or opts[:proto]
|
if opts[:port] or opts[:proto]
|
||||||
if opts[:host] or opts[:address] or opts[:addresses]
|
if opts[:host] or opts[:address] or opts[:addresses]
|
||||||
services = opts_to_services(hosts,opts)
|
services = opts_to_services(hosts,xopts)
|
||||||
else
|
else
|
||||||
services = opts_to_services([],opts)
|
services = opts_to_services([],xopts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1144,58 +1156,8 @@ public
|
||||||
# @example Here's how you would use this from the client:
|
# @example Here's how you would use this from the client:
|
||||||
# rpc.call('db.del_note', {:workspace=>'default', :host=>ip, :port=>443, :proto=>'tcp'})
|
# rpc.call('db.del_note', {:workspace=>'default', :host=>ip, :port=>443, :proto=>'tcp'})
|
||||||
def rpc_del_note(xopts)
|
def rpc_del_note(xopts)
|
||||||
::ActiveRecord::Base.connection_pool.with_connection {
|
notes = get_notes(xopts)
|
||||||
opts, wspace = init_db_opts_workspace(xopts)
|
|
||||||
hosts = []
|
|
||||||
services = []
|
|
||||||
notes = []
|
|
||||||
|
|
||||||
if opts[:host] or opts[:address] or opts[:addresses]
|
|
||||||
hosts = opts_to_hosts(xopts)
|
|
||||||
end
|
|
||||||
|
|
||||||
if opts[:port] or opts[:proto]
|
|
||||||
if opts[:host] or opts[:address] or opts[:addresses]
|
|
||||||
services = opts_to_services(hosts,opts)
|
|
||||||
else
|
|
||||||
services = opts_to_services([],opts)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if opts[:port] or opts[:proto]
|
|
||||||
services.each do |s|
|
|
||||||
nret = nil
|
|
||||||
if opts[:ntype]
|
|
||||||
nret = s.notes.find_by_ntype(opts[:ntype])
|
|
||||||
else
|
|
||||||
nret = s.notes
|
|
||||||
end
|
|
||||||
next if nret == nil
|
|
||||||
notes << nret if nret.class == ::Mdm::Note
|
|
||||||
notes |= nret if nret.class == Array
|
|
||||||
end
|
|
||||||
elsif opts[:address] or opts[:host] or opts[:addresses]
|
|
||||||
hosts.each do |h|
|
|
||||||
nret = nil
|
|
||||||
if opts[:ntype]
|
|
||||||
nret = h.notes.find_by_ntype(opts[:ntype])
|
|
||||||
else
|
|
||||||
nret = h.notes
|
|
||||||
end
|
|
||||||
next if nret == nil
|
|
||||||
notes << nret if nret.class == ::Mdm::Note
|
|
||||||
notes |= nret if nret.class == Array
|
|
||||||
end
|
|
||||||
else
|
|
||||||
nret = nil
|
|
||||||
if opts[:ntype]
|
|
||||||
nret = wspace.notes.find_by_ntype(opts[:ntype])
|
|
||||||
else
|
|
||||||
nret = wspace.notes
|
|
||||||
end
|
|
||||||
notes << nret if nret.class == ::Mdm::Note
|
|
||||||
notes |= nret if nret.class == Array
|
|
||||||
end
|
|
||||||
deleted = []
|
deleted = []
|
||||||
notes.each do |n|
|
notes.each do |n|
|
||||||
dent = {}
|
dent = {}
|
||||||
|
@ -1208,7 +1170,6 @@ public
|
||||||
end
|
end
|
||||||
|
|
||||||
return { :result => 'success', :deleted => deleted }
|
return { :result => 'success', :deleted => deleted }
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -1360,7 +1321,7 @@ public
|
||||||
opts = fix_options(xopts)
|
opts = fix_options(xopts)
|
||||||
opts[:workspace] = find_workspace(opts[:workspace]) if opts[:workspace]
|
opts[:workspace] = find_workspace(opts[:workspace]) if opts[:workspace]
|
||||||
res = self.framework.db.report_vuln(opts)
|
res = self.framework.db.report_vuln(opts)
|
||||||
return { :result => 'success' } if(res)
|
return { :result => 'success' } if res
|
||||||
{ :result => 'failed' }
|
{ :result => 'failed' }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -1398,12 +1359,12 @@ public
|
||||||
|
|
||||||
wspace.events.offset(offset).limit(limit).each do |e|
|
wspace.events.offset(offset).limit(limit).each do |e|
|
||||||
event = {}
|
event = {}
|
||||||
event[:host] = e.host.address if(e.host)
|
event[:host] = e.host.address if e.host
|
||||||
event[:created_at] = e.created_at.to_i
|
event[:created_at] = e.created_at.to_i
|
||||||
event[:updated_at] = e.updated_at.to_i
|
event[:updated_at] = e.updated_at.to_i
|
||||||
event[:name] = e.name
|
event[:name] = e.name
|
||||||
event[:critical] = e.critical if(e.critical)
|
event[:critical] = e.critical if e.critical
|
||||||
event[:username] = e.username if(e.username)
|
event[:username] = e.username if e.username
|
||||||
event[:info] = e.info
|
event[:info] = e.info
|
||||||
ret[:events] << event
|
ret[:events] << event
|
||||||
end
|
end
|
||||||
|
@ -1430,7 +1391,7 @@ public
|
||||||
::ActiveRecord::Base.connection_pool.with_connection {
|
::ActiveRecord::Base.connection_pool.with_connection {
|
||||||
opts, wspace = init_db_opts_workspace(xopts)
|
opts, wspace = init_db_opts_workspace(xopts)
|
||||||
res = self.framework.db.report_event(opts)
|
res = self.framework.db.report_event(opts)
|
||||||
{ :result => 'success' } if(res)
|
{ :result => 'success' } if res
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1465,7 +1426,7 @@ public
|
||||||
end
|
end
|
||||||
|
|
||||||
res = self.framework.db.report_loot(opts)
|
res = self.framework.db.report_loot(opts)
|
||||||
{ :result => 'success' } if(res)
|
{ :result => 'success' } if res
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1503,8 +1464,8 @@ public
|
||||||
ret[:loots] = []
|
ret[:loots] = []
|
||||||
wspace.loots.offset(offset).limit(limit).each do |l|
|
wspace.loots.offset(offset).limit(limit).each do |l|
|
||||||
loot = {}
|
loot = {}
|
||||||
loot[:host] = l.host.address if(l.host)
|
loot[:host] = l.host.address if l.host
|
||||||
loot[:service] = l.service.name || l.service.port if(l.service)
|
loot[:service] = l.service.name || l.service.port if l.service
|
||||||
loot[:ltype] = l.ltype
|
loot[:ltype] = l.ltype
|
||||||
loot[:ctype] = l.content_type
|
loot[:ctype] = l.content_type
|
||||||
loot[:data] = l.data
|
loot[:data] = l.data
|
||||||
|
@ -1605,10 +1566,10 @@ public
|
||||||
|
|
||||||
host = self.framework.db.get_host(opts)
|
host = self.framework.db.get_host(opts)
|
||||||
|
|
||||||
return ret if( not host)
|
return ret if not host
|
||||||
vulns = []
|
vulns = []
|
||||||
|
|
||||||
if(opts[:proto] && opts[:port])
|
if opts[:proto] && opts[:port]
|
||||||
services = []
|
services = []
|
||||||
sret = host.services.find_by_proto_and_port(opts[:proto], opts[:port])
|
sret = host.services.find_by_proto_and_port(opts[:proto], opts[:port])
|
||||||
return ret if sret == nil
|
return ret if sret == nil
|
||||||
|
@ -1725,7 +1686,7 @@ public
|
||||||
clients = []
|
clients = []
|
||||||
|
|
||||||
if opts[:host] or opts[:address] or opts[:addresses]
|
if opts[:host] or opts[:address] or opts[:addresses]
|
||||||
hosts = opts_to_hosts(opts)
|
hosts = opts_to_hosts(xopts)
|
||||||
else
|
else
|
||||||
hosts = wspace.hosts
|
hosts = wspace.hosts
|
||||||
end
|
end
|
||||||
|
@ -1800,7 +1761,7 @@ public
|
||||||
# rpc.call('db.connect', {:driver=>'postgresql'})
|
# rpc.call('db.connect', {:driver=>'postgresql'})
|
||||||
def rpc_connect(xopts)
|
def rpc_connect(xopts)
|
||||||
opts = fix_options(xopts)
|
opts = fix_options(xopts)
|
||||||
if(not self.framework.db.driver and not opts[:driver])
|
if not self.framework.db.driver and not opts[:driver]
|
||||||
return { :result => 'failed' }
|
return { :result => 'failed' }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
10
msfrpcd
10
msfrpcd
|
@ -30,9 +30,10 @@ arguments = Rex::Parser::Arguments.new(
|
||||||
"-U" => [ true, "Specify the username to access msfrpcd" ],
|
"-U" => [ true, "Specify the username to access msfrpcd" ],
|
||||||
"-P" => [ true, "Specify the password to access msfrpcd" ],
|
"-P" => [ true, "Specify the password to access msfrpcd" ],
|
||||||
"-u" => [ true, "URI for Web server" ],
|
"-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" ],
|
"-f" => [ false, "Run the daemon in the foreground" ],
|
||||||
"-n" => [ false, "Disable database" ],
|
"-n" => [ false, "Disable database" ],
|
||||||
"-h" => [ false, "Help banner" ])
|
"-h" => [ false, "Help banner" ])
|
||||||
|
|
||||||
opts = {
|
opts = {
|
||||||
|
@ -40,7 +41,8 @@ opts = {
|
||||||
'SSL' => true,
|
'SSL' => true,
|
||||||
'ServerHost' => '0.0.0.0',
|
'ServerHost' => '0.0.0.0',
|
||||||
'ServerPort' => 55553,
|
'ServerPort' => 55553,
|
||||||
'ServerType' => 'Msg'
|
'ServerType' => 'Msg',
|
||||||
|
'TokenTimeout' => 300,
|
||||||
}
|
}
|
||||||
|
|
||||||
foreground = false
|
foreground = false
|
||||||
|
@ -60,6 +62,8 @@ arguments.parse(ARGV) { |opt, idx, val|
|
||||||
opts['User'] = val
|
opts['User'] = val
|
||||||
when '-P'
|
when '-P'
|
||||||
opts['Pass'] = val
|
opts['Pass'] = val
|
||||||
|
when "-t"
|
||||||
|
opts['TokenTimeout'] = val.to_i
|
||||||
when "-f"
|
when "-f"
|
||||||
foreground = true
|
foreground = true
|
||||||
when "-u"
|
when "-u"
|
||||||
|
|
|
@ -45,6 +45,7 @@ class Plugin::MSGRPC < Msf::Plugin
|
||||||
user = opts['User'] || "msf"
|
user = opts['User'] || "msf"
|
||||||
pass = opts['Pass'] || ::Rex::Text.rand_text_alphanumeric(8)
|
pass = opts['Pass'] || ::Rex::Text.rand_text_alphanumeric(8)
|
||||||
uri = opts['URI'] || "/api"
|
uri = opts['URI'] || "/api"
|
||||||
|
timeout = opts['TokenTimeout'] || 300
|
||||||
|
|
||||||
print_status("MSGRPC Service: #{host}:#{port} #{ssl ? " (SSL)" : ""}")
|
print_status("MSGRPC Service: #{host}:#{port} #{ssl ? " (SSL)" : ""}")
|
||||||
print_status("MSGRPC Username: #{user}")
|
print_status("MSGRPC Username: #{user}")
|
||||||
|
@ -56,7 +57,8 @@ class Plugin::MSGRPC < Msf::Plugin
|
||||||
:ssl => ssl,
|
:ssl => ssl,
|
||||||
:cert => cert,
|
:cert => cert,
|
||||||
:uri => uri,
|
:uri => uri,
|
||||||
:tokens => { }
|
:tokens => { },
|
||||||
|
:token_timeout => timeout
|
||||||
})
|
})
|
||||||
|
|
||||||
self.server.add_user(user, pass)
|
self.server.add_user(user, pass)
|
||||||
|
|
Loading…
Reference in New Issue