Mar 16, 2015 11:46 AM
(This post was last modified: Mar 16, 2015 11:50 AM by TheFullyFledged.)
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.
DO NOT DEAL WITH THIS MEMBER
(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)"
Mar 16, 2015 12:51 PM
(This post was last modified: Mar 16, 2015 12:54 PM by n0$f3ratu$.)
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
(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 ✌
DO NOT DEAL WITH THIS MEMBER
Mar 16, 2015 01:51 PM
(This post was last modified: Mar 16, 2015 02:15 PM by Odus.)
(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.
DO NOT DEAL WITH THIS MEMBER
Mar 16, 2015 10:10 PM
(This post was last modified: Mar 16, 2015 10:10 PM by ๖ۣۜSyria.)
Why all this work when we can all go to cmd and and type ping www.google.com?
DO NOT DEAL WITH THIS MEMBER
This has already been posted hundreds of times and is one search on Google away.
Wow! Next gen level programs thank you so much!
|