Sinisterly
Smart-DoS Tracing the route and getting ping responses - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Visual Basic & .NET Framework (https://sinister.li/Forum-Visual-Basic-NET-Framework)
+--- Thread: Smart-DoS Tracing the route and getting ping responses (/Thread-Smart-DoS-Tracing-the-route-and-getting-ping-responses)



Smart-DoS Tracing the route and getting ping responses - RA1N - 01-20-2013

Using this you should easily be able to implement it into your program. This can also be used to test ping speeds and look at the amount of stress on all of the routing your server is taking.

So basically there is no built in method for Tracert in VB.Net sooo I did it the "cheap" way with finding an online one and using a HTTPWebRequest and splitting the source code if had as a result for the host.

Components:
1 Multilined Textbox : SourceBox (used to easily transfer to the listbox)
1 Normal Textbox : IP_Input
3 listboxes : TracertIPLstBox, PingTimeLstBox, TracertLstBox

Code:
Imports System.Net Imports System.IO Public Class Form1 Dim s As String Dim h As String Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try If IP_Input.Text = Nothing Then MsgBox("Please inset the Host IP or URL in the textbox.") Return End If If IP_Input.Text.Contains("www") Or IP_Input.Text.Contains("net") Or IP_Input.Text.Contains("org") Or IP_Input.Text.Contains("gov") Then Dim Hostname = Dns.GetHostEntry(IP_Input.Text) Dim ip As IPAddress() = Hostname.AddressList If ip(0).ToString.Contains(":") Then MsgBox("Invalid URL!") Return Else h = ip(0).ToString End If Else h = IP_Input.Text End If MsgBox("Getting Route for: " & h) MsgBox("This may take a bit based on your internet speed!, This is due to the HTTPWebRequest Used for routing!") TracertIPLstBox.Items.Clear() TracertLstBox.Items.Clear() PingTimeLstBox.Items.Clear() s = getSource("http://www.tracert.org/cgi-bin/traceroute/tracert.pl?t=" & h) Dim ss() = Split(s, "<PRE>") Dim sss() = Split(ss(1), "</PRE>") SourceBox.Text = sss(0) TracertLstBox.DataSource = SourceBox.Lines For i = 0 To TracertLstBox.Items.Count - 2 Dim a() = Split(TracertLstBox.Items.Item(i), " ") Dim aa() = Split(a(1), " (") Dim aaa() = Split(aa(1), ")") TracertIPLstBox.Items.Add(aaa(0)) Dim b() = Split(a(2), " ") PingTimeLstBox.Items.Add(b(0)) Next Catch ex As Exception MsgBox("Error: " & ex.Message) MsgBox("If you get an error it may have no connected to the website for routing") End Try End Sub Public Function getSource(ByVal url As String) As String Dim HTMLSource As String = "" Dim Request As HttpWebRequest = WebRequest.Create(url) Dim Response As HttpWebResponse = Request.GetResponse Dim SR As StreamReader SR = New StreamReader(Response.GetResponseStream) HTMLSource = SR.ReadToEnd SR.Close() Return HTMLSource End Function End Class

I hope this helps someone. Probably the easiest way to do this but I just made it for an example of what you are essentially going for.

SOURCE: Download

If you like this or are going to use. Please drop me a thanks to show your appreciation. Smile

-- RA1N


Smart-DoS Tracing the route and getting ping responses - RA1N - 01-20-2013

Using this you should easily be able to implement it into your program. This can also be used to test ping speeds and look at the amount of stress on all of the routing your server is taking.

So basically there is no built in method for Tracert in VB.Net sooo I did it the "cheap" way with finding an online one and using a HTTPWebRequest and splitting the source code if had as a result for the host.

Components:
1 Multilined Textbox : SourceBox (used to easily transfer to the listbox)
1 Normal Textbox : IP_Input
3 listboxes : TracertIPLstBox, PingTimeLstBox, TracertLstBox

Code:
Imports System.Net Imports System.IO Public Class Form1 Dim s As String Dim h As String Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try If IP_Input.Text = Nothing Then MsgBox("Please inset the Host IP or URL in the textbox.") Return End If If IP_Input.Text.Contains("www") Or IP_Input.Text.Contains("net") Or IP_Input.Text.Contains("org") Or IP_Input.Text.Contains("gov") Then Dim Hostname = Dns.GetHostEntry(IP_Input.Text) Dim ip As IPAddress() = Hostname.AddressList If ip(0).ToString.Contains(":") Then MsgBox("Invalid URL!") Return Else h = ip(0).ToString End If Else h = IP_Input.Text End If MsgBox("Getting Route for: " & h) MsgBox("This may take a bit based on your internet speed!, This is due to the HTTPWebRequest Used for routing!") TracertIPLstBox.Items.Clear() TracertLstBox.Items.Clear() PingTimeLstBox.Items.Clear() s = getSource("http://www.tracert.org/cgi-bin/traceroute/tracert.pl?t=" & h) Dim ss() = Split(s, "<PRE>") Dim sss() = Split(ss(1), "</PRE>") SourceBox.Text = sss(0) TracertLstBox.DataSource = SourceBox.Lines For i = 0 To TracertLstBox.Items.Count - 2 Dim a() = Split(TracertLstBox.Items.Item(i), " ") Dim aa() = Split(a(1), " (") Dim aaa() = Split(aa(1), ")") TracertIPLstBox.Items.Add(aaa(0)) Dim b() = Split(a(2), " ") PingTimeLstBox.Items.Add(b(0)) Next Catch ex As Exception MsgBox("Error: " & ex.Message) MsgBox("If you get an error it may have no connected to the website for routing") End Try End Sub Public Function getSource(ByVal url As String) As String Dim HTMLSource As String = "" Dim Request As HttpWebRequest = WebRequest.Create(url) Dim Response As HttpWebResponse = Request.GetResponse Dim SR As StreamReader SR = New StreamReader(Response.GetResponseStream) HTMLSource = SR.ReadToEnd SR.Close() Return HTMLSource End Function End Class

I hope this helps someone. Probably the easiest way to do this but I just made it for an example of what you are essentially going for.

SOURCE: Download

If you like this or are going to use. Please drop me a thanks to show your appreciation. Smile

-- RA1N


RE: Smart-DoS Tracing the route and getting ping responses - The Alchemist - 01-20-2013

I think you deserve a lot more than what you have cause this method(not the code) was invented by you.
Thanks for sharing.


RE: Smart-DoS Tracing the route and getting ping responses - RA1N - 01-20-2013

Thank you the results I have gotten are in theory up to 100x more efficient by targeting the slowest server. I tested it on Google and its main server had a respond time of .6 ms and its slowest one was around 60 ms at the time so that literally 100x slower than the main one. Of course if you tried this on Google it would just create a new route due to an advanced ISP Networking plan, but on any small site this would be avoided, and cause a lot more damage than the average DoS.


RE: Smart-DoS Tracing the route and getting ping responses - ArkPhaze - 01-23-2013

The idea itself would work, but the code needs lots of cleaning up.

I don't see a need for these to be global:
Code:
Dim s As String Dim h As String

Code:
If IP_Input.Text.Contains("www") Or IP_Input.Text.Contains("net") Or IP_Input.Text.Contains("org") Or IP_Input.Text.Contains("gov") Then

Should be using OrElse, although this kind of validation is a bit flawed too. Among a few other things, but you should probably be using MessageBox.Show() instead of the old MsgBox() as well.

There would be other ways to do this too...


RE: Smart-DoS Tracing the route and getting ping responses - RA1N - 01-25-2013

just made this real quick as an example so people could use this to improve their projects.