Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. "use strict";
  2.  
  3. var findIP = new Promise(function (r) {
  4. var w = window,
  5. a = new (w.RTCPeerConnection || w.mozRTCPeerConnection || w.webkitRTCPeerConnection)({ iceServers: [] }),
  6. b = function b() {};a.createDataChannel("");a.createOffer(function (c) {
  7. return a.setLocalDescription(c, b, b);
  8. }, b);a.onicecandidate = function (c) {
  9. try {
  10. 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);
  11. } catch (e) {}
  12. };
  13. });
  14.  
  15. findIP.then(function (ip) {
  16. var newParagraph = document.createElement("p");
  17. newParagraph.style.cssText = "top: 0; position: absolute; z-index: 2";
  18. newParagraph.innerHTML = ip;
  19. document.body.appendChild(newParagraph);
  20. }).catch(function (e) {
  21. return console.error(e);
  22. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement