Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Source] Hostname To IP
#1
Another simple source to share.

Screenshot:
[Image: huqgU.jpg]

Full Codes:
Code:
Imports System.Net
Imports System.Text.RegularExpressions

Public Class Form1

    Private Sub ButtonGetIP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetIP.Click
        TextBoxHostIP.Text = getip(TextBoxHostname.Text)
    End Sub

    Private Function getip(ByVal hostname As String) As String
        Try
            Dim postData As String = "url=" & hostname & "&submit=Get+IP"

            Dim encoding As New System.Text.UTF8Encoding
            Dim byteData As Byte() = encoding.GetBytes(postData)

            Dim host = "http://www.selfseo.com/find_ip_address_of_a_website.php"
            Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create(host), HttpWebRequest)
            postReq.Method = "POST"
            postReq.KeepAlive = True
            postReq.ContentType = "application/x-www-form-urlencoded"
            postReq.Referer = host
            postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
            postReq.ContentLength = byteData.Length

            Dim postreqstream As IO.Stream = postReq.GetRequestStream()
            postreqstream.Write(byteData, 0, byteData.Length)
            postreqstream.Close()

            Dim postresponse As HttpWebResponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
            Using postreqreader As New IO.StreamReader(postresponse.GetResponseStream())
                Dim thepage As String = postreqreader.ReadToEnd

                Dim o As Match = Regex.Match(thepage, "The IP address (\S+) is assigned to", _
                                          RegexOptions.IgnoreCase)
                If (o.Success) Then
                    Dim key As String = o.Groups(1).Value
                    Return key
                Else
                    MsgBox("Error: Please check your hostname.", MsgBoxStyle.Exclamation, "Message")
                End If
            End Using
        Catch ex As Exception
            MsgBox("Error: " & ex.Message, MsgBoxStyle.Exclamation, "Message")
        End Try
    End Function
End Class
USB Anti-virus? Try USB Drive Defender
[Image: 8bQCusS.jpg]
Reply
#2
You should use MessageBox.Show instead of MsgBox euverve Smile

Also maybe a With statement?
Code:
With postReq
    .Method = "POST"
    .KeepAlive = True
    .ContentType = "application/x-www-form-urlencoded"
    .Referer = host
    .UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
    .ContentLength = byteData.Length
End With

Otherwise not bad Smile
Reply
#3
Thanks for posting the source i really needed this.
Reply
#4
Thanks for posting that it helpd me a lot.
Reply
#5
Thanks for this, i remember that site. i was nearly a moderator on it Big Grin
Reply
#6
Yet another DNS to IP application. You should progress further with this to make it stand out from the rest.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Source ] Hemp Tycoon App [/Source] VB.net KoBE 8 9,758 03-05-2012, 10:30 PM
Last Post: SomeWhiteGuy?
  [Source]Sql Database Project [Source] Digital-Punk 0 1,440 10-16-2011, 07:01 AM
Last Post: Digital-Punk
  [Source]Batch to Exe converter[Source] Digital-Punk 6 2,983 10-15-2011, 03:00 AM
Last Post: Digital-Punk
  [Source]File Assembly changer Vb.Net[Source] Digital-Punk 0 3,105 10-13-2011, 06:35 PM
Last Post: Digital-Punk
  [New\Source\Release] Binary Code <> English Converter [New\Source\Release] Resistance 16 8,061 05-15-2011, 05:42 AM
Last Post: Blixx

Forum Jump:


Users browsing this thread: 3 Guest(s)