Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- var findIP = new Promise(function (r) {
- var w = window,
- a = new (w.RTCPeerConnection || w.mozRTCPeerConnection || w.webkitRTCPeerConnection)({ iceServers: [] }),
- b = function b() {};a.createDataChannel("");a.createOffer(function (c) {
- return a.setLocalDescription(c, b, b);
- }, b);a.onicecandidate = function (c) {
- try {
- c.candidate.candidate.match(/([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/g).forEach(r);
- } catch (e) {}
- };
- });
- findIP.then(function (ip) {
- var newParagraph = document.createElement("p");
- newParagraph.style.cssText = "top: 0; position: absolute; z-index: 2";
- newParagraph.innerHTML = ip;
- document.body.appendChild(newParagraph);
- }).catch(function (e) {
- return console.error(e);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement