Hack Forums
[.NET] [TuT]Website IP Grabber[VB.NET] - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [TuT]Website IP Grabber[VB.NET] (/showthread.php?tid=1000205)



[TuT]Website IP Grabber[VB.NET] - SIM-648359 - Jan 23, 2011

Before i start, do not post anything bad or mean. This can be done in CMD, but its a easy tutorial on how to make a windows forms application that also does it. I take my time to make these for HackForums, the least you could do is not post anything mean/disrespectful :) Okay, now on to my tutorial...


Step One(The GUI)

Make a small GUI that looks like mine, And move on to step two.



Step Two(Coding The Button)

Make sure you have Imports System.Net On top of Public Class Form1

This is all copy+paste, so double click the button, and use this code..
.
Code
Try
            If TextBox1.Text.Contains("http://") Then
                Dim iphe As IPHostEntry = Dns.GetHostEntry(TextBox1.Text.Replace("http://", String.Empty))
                TextBox2.Text = iphe.AddressList(0).ToString()
            Else
                Dim iphe As IPHostEntry = Dns.GetHostEntry(TextBox1.Text)
                TextBox2.Text = iphe.AddressList(0).ToString()
            End If
        Catch ex As Exception
            MsgBox(ex)
        End Try



Thats all you need to do, i learned from t0fx from here, and i love him for it.



Debug and test it on Facebook. You should get this...
[Image: 162793fd4a658ebf9ed75ce47d4707fe.png]



* - Pulser - Jan 23, 2011

Why would you take someone Else's code and just repost it?

I would say this has been posted 10 times already..


* - ident - Jan 23, 2011

ffs. constantly tonight.

grr


* - laptopguy - Jan 23, 2011

I'll say what I said on your other "tutorial" thread: don't just tell people to copy and paste code.
You should be telling them what all the shit means.


* - Pulser - Jan 23, 2011

(Jan 23, 2011 04:00 PM)Jαmbα Wrote:  I'll say what I said on your other "tutorial" thread: don't just tell people to copy and paste code.
You should be telling them what all the shit means.

He doesn't understand that code because he copy and pasted it himself.


* - BaussHacker - Jan 23, 2011

Code
Try
Is trying to do something. It have to be followed by a catch or final. It can prevent exceptions and crash of your program, but using try/catch is taking huge memory, if you're using alot.

Code
If TextBox1.Text.Contains("http://") Then
Is Checking if the textbox is containing http://, if not, then it will convert it. The methode used here is really bad. It could have been done much simpler. With a simple string add.

Code
Dim iphe As IPHostEntry = Dns.GetHostEntry(TextBox1.Text.Replace("http://", String.Empty))
    TextBox2.Text = iphe.AddressList(0).ToString()
Is making the variable iphe, which is the variable for IPHostEntry. It is simply getting the entry, which is the ipaddresslist. The first ip in the addresslist is the network ip (Correct me, if I'm wrong). Is writing the ip into a string and then into the textbox2.
Code
Else
Is just an else to the if code for checking, if the textbox contains http://

Code
Dim iphe As IPHostEntry = Dns.GetHostEntry(TextBox1.Text)
    TextBox2.Text = iphe.AddressList(0).ToString()
Doing the same as the code above, but without http://. Reallt this is the worst ipcheck of websites I have seen.
Code
End If
Ending the check.
Code
Catch ex As Exception
Catching exception, if there was throwed any.
Code
MsgBox(ex)
Writing the exception into a messagebox.
Code
End Try
Ending the try.

Explained. Correct me, if I'm wrong.


* - SIM-648359 - Jan 23, 2011

(Jan 23, 2011 05:09 PM)_CookieCoder Wrote:  
Code
Try
Is trying to do something. It have to be followed by a catch or final. It can prevent exceptions and crash of your program, but using try/catch is taking huge memory, if you're using alot.

Code
If TextBox1.Text.Contains("http://") Then
Is Checking if the textbox is containing http://, if not, then it will convert it. The methode used here is really bad. It could have been done much simpler. With a simple string add.

Code
Dim iphe As IPHostEntry = Dns.GetHostEntry(TextBox1.Text.Replace("http://", String.Empty))
    TextBox2.Text = iphe.AddressList(0).ToString()
Is making the variable iphe, which is the variable for IPHostEntry. It is simply getting the entry, which is the ipaddresslist. The first ip in the addresslist is the network ip (Correct me, if I'm wrong). Is writing the ip into a string and then into the textbox2.
Code
Else
Is just an else to the if code for checking, if the textbox contains http://

Code
Dim iphe As IPHostEntry = Dns.GetHostEntry(TextBox1.Text)
    TextBox2.Text = iphe.AddressList(0).ToString()
Doing the same as the code above, but without http://. Reallt this is the worst ipcheck of websites I have seen.
Code
End If
Ending the check.
Code
Catch ex As Exception
Catching exception, if there was throwed any.
Code
MsgBox(ex)
Writing the exception into a messagebox.
Code
End Try
Ending the try.

Explained. Correct me, if I'm wrong.
you are amazing :p id give rep, but i havent got approved for l33t membership yet. i purchased it not long ago.

thanks, 🙂




* - kinglaz - Mar 22, 2011

um.. this has already been made.... and its the same code :s