How To Get Someone’s IP Address And Trace Their Location

This is a clever little hack to discover someone’s IP address and location. It requires some free tools that I list below in this post.

Why Would You Want To Know Someone’s IP?

OK…I agree, it sounds a bit nefarious wanting to know someone’s IP, but actually, there are several reasons why you would; and with marketing (not just growth marketing) there are tons of reasons why you’d be really interested to know – and work with – your target customers IP Address.

In the post we look at one white hat reason, and two black hat reasons you’d want to know someone’s IP Address.

Let’s look at the good first then take a look at the more Blackhat stuff further down the page.

Reason #1 For Marketing (White Hat Reasons)

Knowing and displaying the city (or country) that you are browsing from.

VPN companies use this tactic a lot.

Hong Kong-based ExpressVPN and NordVPN and several of those other players have landing pages that clearly state your IP and your ISP Provider with a view to “scare you” into showing you just how easy it is to track your IP.

Any visit to thepiratebay.org and you’ll see dozens of ads from ExpressVPN stating exactly that.

However, many organizations are doing it as well, CNN and the Guardian are just two examples, but there are millions of other examples.

I live in Hong Kong – so a neat example of targeted marketing

Knowing your audience’s IP address also allows the publisher to show different content.

Of course, personalization hugely helps with multiple marketing strategies.

Reason #2 For Illicit Gain (Black Hat Reasons)

This one is more sneaky, but here’s a Black Hat growth marketing technique for discovering someone’s IP.

Say, for example, that you are involved in some reciprocal back-linking, i.e you link to me and I link to you.

Simple enough, but it’s likely that search engines place lesser value on reciprocity over one-way dofollow links.

Knowing your link exchange partners IP address could mean that when they hit your page to check that the link is still there then they are shown it.

A Sample PHP Script To Achieve This

The below PHP script would show different data (or text with a URL) to visitors with a specific IP range or address.

I took this snippet from here.

<?
mysql_connect("localhost","username""pass");
mysql_select_db("ips");

$ip = $_SERVER['REMOTE_ADDR'];

$resultx = mysql_query("SELECT * FROM tablename WHERE ip = $ip LIMIT 1");
$nrowsx  = mysql_num_rows($resultx);

if (nrowsx == 0) {
mysql_query("INSERT INTO IpLogs (Ip) VALUES ('$ip')") or die(mysql_error());
echo 'not in db, logging ip.';
} else {
echo 'in db already';
}

?>

Reason #3 To Hack Someone Or Some Organization

Once you know someone’s IP then you can launch a port scan against your target using a tool like nmap or indeed any other port-scanning tools listed here.

When you launch a tool like Nmap (that by the way would be illegal without permission) you can map their network and see what ports are open and anything else of interest.

Once you know what’s on the target’s network then a quick look at the hacking opportunities available using a tool like Metasploit would be the next logical step.

OK, How Do We Find Someone’s IP Address?

For this tutorial we will send our target an email and entice them to click a link, i.e. old-school phishing.

Step 1: Upload any old image or file and get the URL. You could upload a file to Dropbox, Google drive, or even your FTP server. Next, just copy and paste that URL. Nice and simple.

Step 2: We head over to a service called IPLogger via this site. Click on the “URL and Image Shortner” option, and go ahead and paste your link in there.

Once you’ve done that then every time that link is clicked (by whomever) then their IP details are recorded on the service.

Step 3: You can be a little more sneaky and send them the IPLogger link via a shortener like bit.ly, and hey presto – your link now looks totally legit!

Wrap Up

There you have it.

Very simple and effective.

Use this knowledge wisely and be nice.

Henry "HMFIC"

I'm Henry, the guy behind this site. I've been Growth Hacking since 2002, yep, that long...

2 thoughts on “How To Get Someone’s IP Address And Trace Their Location

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts