Skip to content

Commit 52b9fc8

Browse files
author
Brent Cook
committed
handle unknown host when generating a new note
1 parent 8d78135 commit 52b9fc8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/msf/core/rpc/v10/rpc_db.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def get_notes(xopts)
115115

116116
return ret if not host
117117
notes = []
118+
118119
if opts[:proto] && opts[:port]
119120
services = []
120121
nret = host.services.find_by_proto_and_port(opts[:proto], opts[:port])
@@ -952,8 +953,12 @@ def rpc_report_note(xopts)
952953
addr = opts[:host] || opts[:address]
953954
wspace = opts[:workspace] || self.framework.db.workspace
954955
host = wspace.hosts.find_by_address(addr)
955-
service = host.services.find_by_proto_and_port(opts[:proto],opts[:port]) if host.services.count > 0
956-
opts[:service] = service if service
956+
if host && host.services.count > 0
957+
service = host.services.find_by_proto_and_port(opts[:proto],opts[:port])
958+
if service
959+
opts[:service] = service
960+
end
961+
end
957962
end
958963

959964
res = self.framework.db.report_note(opts)

0 commit comments

Comments
 (0)