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

.NET 

Website To Ip VB.NET + Source!

Website To Ip VB.NET + Source!


DOWNLOAD


Code
dropbox.com/s/sqku1bfhgpm60xq/Website%20To%20Ip.exe?dl=0

virustotal .com/en/file/c38aac45c4e819beadd0e09bcf5108ceee208b1f16d8aa50436641e4d9082574/analysis/


Code
Imports System.Net
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      Dim Hostname As IPHostEntry = Dns.GetHostByName(TextBox1.Text)
      Dim ip As IPAddress() = Hostname.AddressList
      TextBox2.Text = ip(0).ToString
    End Sub

    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
      TextBox1.Clear()
      TextBox2.Clear()
    End Sub
End Class
Can you explain what you have done here? Do you understand the functionality of the dns class and net namespace?

edit: Lol OP viewed his thread, then viewd my reputation, then reported my post, i think.
https://hackforums.net/showthread.php?tid=4731782

Did you make a new account?
(Mar 16, 2015 11:51 AM)Odus Wrote:  hackforums .net/showthread.php?tid=4731782

Did you make a new account?
No thats my friend he stole my program and posted it i'm trying to get him to take it down!
(Mar 16, 2015 11:58 AM)TheFullyFledged Wrote:  No thats my friend he stole my program and posted it i'm trying to get him to take it down!

Your font is hard to read and your friend and you both posted the same snippet of code and it appears neither of you understand what it does.

Dim Hostname As IPHostEntry = Dns.GetHostByName(TextBox1.Text)
Dim ip As IPAddress() = Hostname.AddressList
TextBox2.Text = ip(0).ToString

Also you only returned a single address from the host.
(Mar 16, 2015 12:12 PM)evilivid Wrote:  Your font is hard to read and your friend and you both posted the same snippet of code and it appears neither of you understand what it does.

Dim Hostname As IPHostEntry = Dns.GetHostByName(TextBox1.Text)
Dim ip As IPAddress() = Hostname.AddressList
TextBox2.Text = ip(0).ToString

Also you only returned a single address from the host.

Im still learning but thanks for the feedback
(Mar 16, 2015 12:14 PM)TheFullyFledged Wrote:  Im still learning but thanks for the feedback

Then learn what you are doing.

You are using System.Net
You are using IPHostentry class, it's very simple.
You used the IPaddress class, you can get IP6 as well as IP4 however you only get one. "ip(0)"
Code
Private Function GetIPAddress()
      Try
      Dim req As HttpWebRequest = WebRequest.Create("http://wtfismyip.com/text")
      Dim res As HttpWebResponse = req.GetResponse()
      Dim Stream As Stream = res.GetResponseStream()
      Dim sr As StreamReader = New StreamReader(Stream)
      Return (sr.ReadToEnd())
      Catch error_t As Exception
      MessageBox.Show(error_t.ToString)
      End Try
      Return Nothing
    End Function

Code
Private Function GetIPv4Address() As String
      GetIPv4Address = String.Empty
      Dim strHostName As String = Dns.GetHostName()
      Dim iphe As IPHostEntry = Dns.GetHostEntry(strHostName)

      For i As Integer = LBound(iphe.AddressList) To UBound(iphe.AddressList) Step 1
      Dim ipheal As IPAddress = iphe.AddressList(i)
      If ipheal.AddressFamily = Sockets.AddressFamily.InterNetwork Then
            GetIPv4Address = ipheal.ToString()
      End If
      Next
    End Function
[Image: logo.gif]
(Mar 16, 2015 12:51 PM)n0$f3ratu$ Wrote:  
Code
Private Function GetIPAddress()
      Try
      Dim req As HttpWebRequest = WebRequest.Create("http://wtfismyip.com/text")
      Dim res As HttpWebResponse = req.GetResponse()
      Dim Stream As Stream = res.GetResponseStream()
      Dim sr As StreamReader = New StreamReader(Stream)
      Return (sr.ReadToEnd())
      Catch error_t As Exception
      MessageBox.Show(error_t.ToString)
      End Try
      Return Nothing
    End Function

Code
Private Function GetIPv4Address() As String
      GetIPv4Address = String.Empty
      Dim strHostName As String = Dns.GetHostName()
      Dim iphe As IPHostEntry = Dns.GetHostEntry(strHostName)

      For i As Integer = LBound(iphe.AddressList) To UBound(iphe.AddressList) Step 1
      Dim ipheal As IPAddress = iphe.AddressList(i)
      If ipheal.AddressFamily = Sockets.AddressFamily.InterNetwork Then
      GetIPv4Address = ipheal.ToString()
      End If
      Next
    End Function

Pretty clean and easy to understand nice code mate ✌
[Image: GUsQZTN.gif]
(Mar 16, 2015 01:04 PM)Stаlkеr Wrote:  Pretty clean and easy to understand nice code mate ✌

I spot a lot of room for improvement, even if his code is completely unrelated.

Code
Private ReadOnly _wc As New WebClient
Private Function FetchPublic() As String
    Return _wc.DownloadString("http://wtfismyip.com/text")
End Function
Private Function FetchIPv4() As String
    Return Dns.GetHostEntry(Dns.GetHostName).AddressList.First(Function(a) a.AddressFamily.Equals(AddressFamily.InterNetwork)).ToString()
End Function

Edit: Forgot the webclient.
Why all this work when we can all go to cmd and and type ping www.google.com?
This has already been posted hundreds of times and is one search on Google away.
Wow! Next gen level programs thank you so much!


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by rweed1Feb 5, 2015 04:27 PM 10 839 Feb 5, 2015 04:27 PM
Last Post: SIM-1456245
[.NET] by Marcusramse1Jun 7, 2013 09:01 AM 17 1,950 Jun 7, 2013 09:01 AM
Last Post: SMOKEFiSH
[.NET] by PsychotiicJan 30, 2013 03:32 PM 22 2,530 Jan 30, 2013 03:32 PM
Last Post: Xylon