Skip to content

Commit 9e5370e

Browse files
committed
Merge branch 'slight_speedup_to_db_hosts-R' of github.com:kernelsmith/metasploit-framework into kernelsmith-slight_speedup_to_db_hosts-R
2 parents 5cfabb0 + f05e358 commit 9e5370e

File tree

1 file changed

+12
-5
lines changed
  • lib/msf/ui/console/command_dispatcher

1 file changed

+12
-5
lines changed

lib/msf/ui/console/command_dispatcher/db.rb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,9 @@ def cmd_hosts(*args)
283283
if set_rhosts
284284
# only unique addresses
285285
addr = (host.scope ? host.address + '%' + host.scope : host.address )
286-
rhosts << addr unless rhosts.include?(addr)
286+
rhosts << addr
287287
end
288+
rhosts.uniq!
288289
end
289290
end
290291
return
@@ -323,8 +324,9 @@ def cmd_hosts(*args)
323324
tbl << columns
324325
if set_rhosts
325326
addr = (host.scope ? host.address + '%' + host.scope : host.address )
326-
rhosts << addr unless rhosts.include?(addr)
327+
rhosts << addr
327328
end
329+
rhosts.uniq!
328330
if mode == :delete
329331
host.destroy
330332
delete_count += 1
@@ -347,6 +349,8 @@ def cmd_hosts(*args)
347349
set_rhosts_from_addrs(rhosts) if set_rhosts
348350
print_status("Deleted #{delete_count} hosts") if delete_count > 0
349351
}
352+
##
353+
##
350354
end
351355

352356
def cmd_services_help
@@ -508,8 +512,9 @@ def cmd_services(*args)
508512
tbl << columns
509513
if set_rhosts
510514
addr = (host.scope ? host.address + '%' + host.scope : host.address )
511-
rhosts << addr unless rhosts.include?(addr)
515+
rhosts << addr
512516
end
517+
rhosts.uniq!
513518

514519
if (mode == :delete)
515520
service.destroy
@@ -828,8 +833,9 @@ def cmd_creds(*args)
828833
end
829834
if set_rhosts
830835
addr = (cred.service.host.scope ? cred.service.host.address + '%' + cred.service.host.scope : cred.service.host.address )
831-
rhosts << addr unless rhosts.include?(addr)
836+
rhosts << addr
832837
end
838+
rhosts.uniq!
833839
creds_returned += 1
834840
end
835841

@@ -954,8 +960,9 @@ def cmd_notes(*args)
954960
msg << " host=#{note.host.address}"
955961
if set_rhosts
956962
addr = (host.scope ? host.address + '%' + host.scope : host.address )
957-
rhosts << addr unless rhosts.include?(addr)
963+
rhosts << addr
958964
end
965+
rhosts.uniq!
959966
end
960967
if (note.service)
961968
name = (note.service.name ? note.service.name : "#{note.service.port}/#{note.service.proto}")

0 commit comments

Comments
 (0)