Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

[Tutorial] How to make an IP-logger | To get other's IP [Detailed]


Hello

There were pretty lot of people who wanted to track the IP of other persons.
I thought it won’t be a bad idea to make a small tutorial about IP-logging.
However, if you haven't read this one before: https://hackforums.net/showthread.php?tid=4178212
I recommend that one first. :)
It's a pretty complex tutorial if you don't know programming, however, I'll try to explain everything well! :)

[img]http://i.minus.com/iWXBEjOGqbhcS.png[/img]

An IP-address (Internet Protocol) is a specific, unique number given to each computer, this is used to communicate with other computer devices.
There are right now, two different kind of IP-addresses, the ipv4 (32-bit system) and ipv6 (128-bit system).
The first one was the ipv4 system, but because we were running out of IP-addresses, we needed a new system and then, the ipv6 was born.

Examples:
Ipv4 - 173.194.112.0
Ipv6 - 2a00:1450:4001:c02::8a:

But some people abuse this system to do harm to other people.

[img]http://i.minus.com/i9CFyJIxFHpUa.png[/img]

Well, to do this, we need multiple things:
  • Basic knowledge about HTML, CSS, JavaScript, and PHP (No worry if you don’t know them).
  • A webhost (SPAM.com)
  • A domain name (dot.tk)
  • A .txt file

Okay, it maybe seems like a LOT for you, and extremely hard – Well, it isn’t!
We only are making a simple button in HTML & CSS, an alert-box in JS, and the log-system in PHP. :)

I’ll explain every line, so don’t worry!

We’ll be making a simple web-page that gets the IP of the victim, and then saves it in a .txt file.

[img]http://i.minus.com/iv34s6Tj8BwY5.png[/img]

Okay, first we have to make the webpage, for this we need two languages, HTML and CSS.
I assume you already know these, if not, I highly recommend learning them. :)
http://codecademy.com can help you a lot further.
We only need the basics though.

First we need an editor (program to code in, Mostly used for Mark-up (HTML), Stylesheet (CSS), and scriping languages (JavaScript).
Notepad++ is a good free one, but if you don't have that one your normal Notepad is okay to.
Go here: http://notepad-plus-plus.org/download/ - Recommended; Download & Install
Or, if you want to do it fast and now, use Winkey + R > "Notepad".
[img]http://i.minus.com/iwzGh4XiyelGR.png[/img]

Now, we're ready to go!
The basic HTML tags:
Code
<!DOCTYPE html>
<html>
<head>
<title></title>

</head>
<body>

</body>
</html>
So, let me explain all these things.
Every tag you open in the HTML language, must also be closed (most of the time).
<html> (open) </html> (close it "\").
  • <!DOCTYPE html> - Our browsers must know we're using the latest HTML version (HTML5)
  • <head> - Here we place all our metadata and styling,...
  • <title> - The text you see in your browser bar (Hack Forums)
  • <body> - All the content (not necessary layout) is placed here

Peanuts isn't it? :)

Well, now let's go deeper in our HTML code, I'll use comments (<!-- TEXT -->) to show what I've added this time. Comments won't be displayed on the webpage
because it's ignored by browsers.

Code
<!DOCTYPE html>
<html>
<head>
[b]<!--[/b] NEW! I've set a title here, this will be displayed in the browser tab-->
<title>Give a damn • Now!</title>

</head>
<body>
<!--NEW! I've added a division-->
<div>Give a damn</div>
</body>
</html>

Okay, So, I've added a browser tab title, and a division.
Let me explain that division.
A division means in HTML... Nothing!
You don't say anything with it.

But for what is it used then?
Just to wrap text together, or wrap other elements in your text together, or to only 'select' a specific area on/in your page/code.

If you save it now as index.php (nothing else! It MUST be index.php (mention the .php extension),
and open it with your browser you will see the title in your browser tab + The text "Give a damn!".
Not much, isn't it?

It looks, so boring... Let's style it!
For styling we use the language CSS (Cascading StyleSheet), cascading because the structure of such a code, and StyleSheet because it's to... Style. :D
Code
<!DOCTYPE html>
<html>
<head>
<title>Give a damn • Now!</title>
[b]<!--[/b] NEW! I've added <style>-->
<style>

</style>
</head>
<body>
<!--NEW! I've added an ID in this division-->
<div id="button">Give a damn</div>
</body>
</html>

I again added two things.
Style, and an id.
In the <style> tags we are going to place our CSS codes.
Let me now explain what an ID is;

If you give an element in HTML an ID by adding id="anything" to it, you say that only that one element, no other, only that one must listen to what the CSS says.
That means that if CSS says: "EVERYTHING RED, NOW!" But id-anything says: "Please, become blue" The element including id-anything will turn blue.

In short: You can edit only one element with it. :P

If you want to give an element an id in HTML, you add id="text" to it, where text can be anything.
Example:
Code
<p id="turnBlue"></p> - Paragraph has an ID called "turnBlue"
<div id="main"></div> - This division has an ID called "main", probably it's the biggest div of all
<font id="specialFontFamily"></font> - This font has an ID called "specialFontFamily", probably the coder added a special font-family (Arial, Courier,...) to it.

But we may set as many unique IDs as we want, if there is no CSS, those IDs have no clue what to do! And we don't want to confuse our IDs, do we?

So we add it in our CSS, I pick out a piece of our long code, so it's easier to explain etc.

We've got a division with ID "button", in CSS we declare we're picking out an ID from our HTML using the #-symbol.
That'd give:
Code
[b]<!--[/b] Remember our Style where we place all our CSS?-->
<style>
#button {

}
</style>

Let's say, we want to give it a yellow colour, with black coloured text which is in font-family Courier.
That'd give:
Code
[b]<!--[/b] Remember our Style where we place all our CSS?-->
<style>
#button {
background-color: #FFFF00;
width: 25%;
height: 15%;
font-family: Courier;
font-size: 250%;
text-align: Center;
position:absolute; top:40%; left:40%;
}
</style>

Let me explain everything about it!

- First we of course say we're using an ID called "button" > #button, everything we style for that ID do we place in {} brackets.
- Background-color ~ Declare we want to set a specific background-color for our ID (division).
- With # ~ we don't only declare IDs, but also that we're using HTML-colour-codes to say what colour to use, #FFFF00 gives yellow (you don't have to learn those
from outside >>http://html-color-codes.info<< well, you may learn those from outside, but eh...)

- Width and height ~ to set a specific width and height of our division.
- Font-family ~ to say we want to use a specific font family
- Font-size ~ To set a specific font size (250% = 2.5 times bigger as default [mostly 16px])
- text-align: Center ~ We want all our text in our div(ision) with id "button" is in the center (you can also place left and right)
- Position ~ We set our division box 40% away from the top, and 40% away from the left, so it's perfectly in the middle of our browser screen.

So, now we've got a button, but on a white background? That doesn't look professional!
Let's make it blue!

We do that with the body element, the body (<body>) element goes over our whole webpage.
We do it like this:
Code
<style>
/*NEW! We added the body to change (CSS has special comments [/*Comment Text*/])*/
body {
background-color:#0000FF;
}
#button {
background-color: #FFFF00;
width: 25%;
height: 15%;
font-family: Courier;
font-size: 250%;
text-align: Center;
position:absolute; top:40%; left:40%;
}
</style>

Because body isn't an ID, nor a class (.myClassName - Able to give to multiple elements) we use body directly in our CSS without a special icon.
And we make it blue (#FFFF00).
Let's place our style back in our HTML code.

No we've got a nice button! :)
It doesn't look much, but it isn't needed. The IP gets logged directly after a person visits it, we just style our webpage so it doesn't look suspicious. ;)

So, our full HTML & CSS code would be:
Spoiler (Click to View)

[img]http://i.minus.com/i9D8mWTpeXpa8.png[/img]

Now, let's move on to our next language called JavaScript, JavaScript is an extremely powerful scripting (just say programming) language on the web, and also exists
as long as the web does. We won't be using it that much now, but okay.

We're going to make a pop-up box, we do that with the alert() function, it looks like this:
alert("This Text will be displayed");
And
Quote:This Text will be displayed
will pop-up.

Well, Let's go!
To code in JavaScript, we have to include <script> tags.
<script>
//JS here
</script>

So, our code will look like this:
Code
<!DOCTYPE html>
<html>
<head>
<title>Give a damn • Now!</title>
<style>
body {
background-color:#0000FF;
}
#button {
background-color: #FFFF00;
width: 25%;
height: 15%;
font-family: Courier;
font-size: 250%;
text-align: Center;
position:absolute; top:40%; left:40%;
}
</style>
<script>
alert("Thanks for giving a Damn!!!!!");
</script>
</head>
<body>
<div id="button">Give a damn</div>
</body>
</html>

No click on that give-a-damn button!
...
Yeah, it doesn't work.
We have to make it work by Clicking On the button, let's use onClick for that in our HTML!
To use onClick we need two things:
  • A JS-function
  • A HTML element
We've already got a HTML element (our DIV), but no JS-function.
I won't go to deep on this because you can write a whole book about functions.

Anyway, we use functions to say a piece of code to return something, that piece of code do we place between {} brackets while we defined our function.

Example:
Code
<script>
function myFunctionName() {
//Piece of code to do something...
}
</script>

Now, we can trigger that function using onClick in our div. Like this:
Code
<div id="button" onClick="myFunctionName()"></div>

So, your full code would be:
Spoiler (Click to View)

Let's move on! :)

[img]http://i.minus.com/inOEO26SZMGrL.png[/img]

Now, we've got our HTML, CSS, and JS done!
Now we have to program our PHP.
PHP stands for Hypertext PreProcessor and is a server-side language, that means we can't test it while coding offline (except if you got an APACHE server downloaded). :)
But as soon as we upload it, you can.

Okay, the code we will be using is this one:
Code
<?php
$ip = $_SERVER['REMOTE_ADDR']."\r\n";
$logFile = 'logs.txt';
$fO = fopen('logs.txt' , 'a');
fwrite($fO, $ip);
fclose($fO);
?>
You can place it anywhere, I recommend beneath the <HTML> tags. :)
The <script> for JS and the <style> for CSS is <?php ?> for PHP.

In PHP we declare variables using the $-symbol, we keep using that symbol if we want to use our variable for something.

So, I've got a variable called IP with this as value:
Code
//Just to get IP
$_SERVER['REMOTE_ADDR']
That is to get the IP, "\r\n" so the IPs get listened beneath each other and not side-by-side. :)

- $logFile is our variable which says what .txt file we're going to use.
Make a .txt file called: logs.txt and just type: "--IP-addresses:--" [Press Enter]X2 in it.


- $fo variable together with the fopen function to open the file (fopen), we open the file logs.txt the 'a' means that we only allow to write something in the file, but nothing else!
Not reading, not editing, only writing. :)


- And then the most important, the fwrite function, we write the value of $ip and $ date in logs.txt with the permission 'a'.

- And as last we close it (fclose).

Not that hard, is it? :)

So, our full, full, code will be:
Spoiler (Click to View)

Now, our site is ready.
But, we need to put it online!

And we don't want to spend a penny of course.
What we need is a free webhost, and a free domain name.
The webhost will make sure our site is online, they're the server.
The domain name will translate that complex ip-address in to a domain name (www.example.com).

We will be using www.SPAM.com as webhost, and www.dot.tk as domain name system (DNS).
I'll be also making a video explaining this.

First, register at dot.tk, leave that tab open and browse to SPAM.com.
Now, you register at SPAM.

When that's ready (and you waited a long time) you can got your 'CPanel', there on the top-left you should see 'Account details'.
[img]http://i.minus.com/iMXTFYqoYBCeU.png[/img]
The first 4 tables include the info you need, it are our Nameserves, that is what we will be linking to our Domain Name Service (Dot.tk).
[img]http://i.minus.com/iWTQ1pFxwuKn0.png[/img]
When you're on the dot.tk page of registering your Domain (you can also edit it afterwards) you should see these boxes:
[img]http://i.minus.com/i9etq9CB6iNhh.png[/img]
Just type the nameserver details over (Keep the order like you see at SPAM).
You can choose how long you want that domain, and save it! :)
After that, our site# should be online in 48 hours or less! ;)

So, the site is online, but our files yet aren't!
You should have two files now:
  • index.php (including the code for our webpage)
  • logs.txt (inlcuding the text: '--IP-addresses--'

We will both upload them.
Go to 'File Manager' on your CPanel of SPAM. Log-in there, after that you need to browse to public_html. It's a folder.
Now, you just click 'upload' and select the files you want to upload (logs.txt and index.php). Accept > Accept (Green check-icon).
If you visit your site now you should get refered to your index.php site! :)
Now, you can check the content of logs.txt through your FTP-server (click view, open)!
And the IP-address of everyone who visits it.

You can use url-shorteners (bitf.ly) to 'spoof' the URL so it looks more legit. ;)
(I'll post videos about this part soon if you want).


[img]http://i.minus.com/iPaZm1OAre9PG.png[/img]

Now, let's analyse what we've done.
First we created a webpage in HTML, CSS, JavaScript and PHP.
Full code (Bit customized by me):
Spoiler (Click to View)
Like you see, not a beast website.
Of course we could make a nice style 100% responsive scroll-style website, if we hadn't a 18.000 character limit. :)
Also, it isn't needed, the IP gets logged as soon the user visits the webpage.

After that, we uploaded the website to SPAM, and linked it to our Dot.tk DNS (100% free of course).

Done! :)

[img]http://i.minus.com/ibqYZGh5mIeMxd.png[/img]

Well, you can also short the URL with bit.ly [WARNING: potentially infected]/dot.tk/goog.gl... so it looks again less suspicious.
You just send the URL to any person you want the IP of, if he doesn't use Tor/VPN/Proxy/... You get the IP! :)

What can I do with an IP?
An IP is an unique number, that means that you can 'track' the unique device who uses that IP and their users.
http://www.infosniper.net/ is an awesome site where you can get some info about the IP-address. (Location, ISP,..).
When you got all these info, you can start DOX'ing, DOX'ing (documenting) is getting a lot of info about a specific person, an IP is an important part of that.

Another thing is to take down that IP, you can DDoS (An attack where you overflood a server (/router)) that IP, if your attack is strong enough that IP can't connect
to the internet for a while, that means that the persons who uses that IP also can't connect to the internet anymore! But this is not legal (of course). ;)
For DDoS'ing you need a booter/Botnet. :)

And best of all... Getting IP-addresses this way is 100% legal! It's done by millions of sites a day, maybe while you don't even know it! :D

Of course we could also just link a third-party tool to our webpage, but doesn't it feel better to 100% code it yourself?
Anyway.


Hope you enjoyed reading and found it a bit interesting.
I'm open for any questions and will (try to) answer them, my PM box is always open too. ;)

(Sorry for my bad spelling/grammar).

Thanks for reading,
Niely
Very HQ post, as always! HQ Member keep it up. Really good job.
Amazing tutorial, OP. This is very well detailed. Good job!
[Image: Tg14nDl.gif]
Very helpful :) I might use this someday! :D
Thanks for sharing this man!

Will try this.
Or instead of doing all that extra HTML

Message friend "Hey check out this webpage I made" and on your page

PHP Code

<?php
$ip 
= $_SERVER['REMOTE_ADDR']."\r\n";
$logFile = 'logs.txt';
$fO = fopen('logs.txt' , 'a');
fwrite($fO, $ip);
fclose($fO);
header('differentsite.com');
die();
?>

No need for anything else
(Jul 4, 2014 01:16 PM)koshka1 Wrote:  Or instead of doing all that extra HTML

Message friend "Hey check out this webpage I made" and on your page

PHP Code

<?php
$ip 
= $_SERVER['REMOTE_ADDR']."\r\n";
$logFile = 'logs.txt';
$fO = fopen('logs.txt' , 'a');
fwrite($fO, $ip);
fclose($fO);
header('differentsite.com');
die();
?>

No need for anything else

That's true.
But I also added those other languages to make it more 'entertaining'.
Also, a website with a 'purpose' looks more suspicious than one with a purpose. :)

I thought it'd also be interesting to make a webpage instead of just a few lines of PHP.
Holy shit that post <3 Good job man! Gotta love it. Hopefully it'll help some people out.
Thanks for the nice reactions all! :3
Really appreciate it.

I'm open to answer any questions! :)
(Jul 4, 2014 12:33 PM)spoonface Wrote:  Thanks for sharing this man!

Will try this.

Good to hear that! :)
Feel free to say if it worked. ;)
Your ways of teaching the copy paste techniques are worth mentioning for.
^I didn't copy pasted it? :)
I've wrote everything myself.
(Jul 7, 2014 07:29 AM)Niely Wrote:  ^I didn't copy pasted it? :)
I've wrote everything myself.
Re-read my sentence. You're not copy pasting. You're teaching copy pasting.
^Ohw sorry for misreading. :)

Yeah, and no...
Sure, there will be people who will copy/paste it, but that's their problem if they don't want to learn.

Normally, I explained every little line in that code, so people who really read that, and knew some HTML & CSS basics should really understand the code. :)

How would you suggest making a tutorial then including codes but avoid copy/pasting? :)
(Jul 7, 2014 07:35 AM)Niely Wrote:  ^Ohw sorry for misreading. :)

Yeah, and no...
Sure, there will be people who will copy/paste it, but that's their problem if they don't want to learn.

Normally, I explained every little line in that code, so people who really read that, and knew some HTML & CSS basics should really understand the code. :)

How would you suggest making a tutorial then including codes but avoid copy/pasting? :)
Not making a tutorial about this in this approach. Or, you can call this a Proof-Of-Concept instead of a tutorial as ultimately you explained an already-made tool, in English. Walkthrough of a bunch of scripts and the process of uploading them to a file hosting shouldn't be a tutorial.
In my mindset, a tutorial should: Innovate, Leave no doubt, and be Original. You've nailed the last two. Still a solid try though.


Possibly Related Threads...
Thread / Author Replies Views Last Post
by c x y kJul 31, 2014 04:19 PM 10 512 Jul 31, 2014 04:19 PM
Last Post: c x y k
by ForzaSQLFeb 6, 2013 11:34 PM 8 230 Feb 6, 2013 11:34 PM
Last Post: Jemjem787
by PopsSep 24, 2012 12:40 PM 36 1,634 Sep 24, 2012 12:40 PM
Last Post: Pops