Skip to content

Instantly share code, notes, and snippets.

@ukcoderj
Last active April 30, 2024 16:15
Show Gist options
  • Save ukcoderj/f8b6fc86c15a4727f737a75bc1bf43b2 to your computer and use it in GitHub Desktop.
Save ukcoderj/f8b6fc86c15a4727f737a75bc1bf43b2 to your computer and use it in GitHub Desktop.
Get client ip address from html page without going to an external website.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>IP Address</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
<link rel="stylesheet" href="css/styles.css?v=1.0">
<script>
var findIP = new Promise(r=>{var w=window,a=new (w.RTCPeerConnection||w.mozRTCPeerConnection||w.webkitRTCPeerConnection)({iceServers:[]}),b=()=>{};a.createDataChannel("");a.createOffer(c=>a.setLocalDescription(c,b,b),b);a.onicecandidate=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){}}})
/*Usage example*/
findIP.then(ip => document.write('your ip: ', ip)).catch(e => console.error(e))
</script>
</head>
<body>
</body>
</html>
@RyKP3Erf70QXg8Mv
Copy link

i can now blackmail my friend

@aydimine
Copy link

i want to send this file to my friend. how can i get his ip system in my pc? pls help me

@RyKP3Erf70QXg8Mv
Copy link

i want to send this file to my friend. how can i get his ip system in my pc? pls help me

You can grab his IP and then just use a discord webhook or something so that the discord webhook will send his IP as a message

@aydimine
Copy link

i want to send this file to my friend. how can i get his ip system in my pc? pls help me

You can grab his IP and then just use a discord webhook or something so that the discord webhook will send his IP as a message

sir, i want to find my friend's IP :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment