Skip to content

Commit b2666ad

Browse files
committed
Update host delete method to return full objects of deleted hosts
1 parent e964e8b commit b2666ad

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/metasploit/framework/data_service/proxy/host_data_proxy.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ def hosts(wspace = workspace, non_dead = false, addresses = nil)
1313
end
1414
end
1515

16+
# TODO: Shouldn't this proxy to RemoteHostDataService#find_or_create_host ?
17+
# It's currently skipping the "find" part
1618
def find_or_create_host(opts)
1719
puts 'Calling find host'
1820
report_host(opts)

lib/msf/core/db_manager/host.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,14 @@ def delete_host(opts)
3131
deleted = []
3232
hosts.each do |host|
3333
begin
34-
host.destroy
35-
deleted << host.address.to_s
34+
deleted << host.destroy
3635
rescue # refs suck
3736
elog("Forcibly deleting #{host.address}")
38-
host.delete
39-
deleted << host.address.to_s
37+
deleted << host.delete
4038
end
4139
end
4240

43-
return { deleted: deleted }
41+
return deleted
4442
}
4543
end
4644

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ def cmd_hosts(*args)
659659

660660
if mode == [:delete]
661661
result = framework.db.delete_host(workspace: framework.db.workspace, addresses: host_search)
662-
delete_count += result[:deleted].size
662+
delete_count += result.size
663663
end
664664
end
665665

0 commit comments

Comments
 (0)