Hack Forums
[.NET] [VB.Net] Port Scanner Source (Console) - 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] [VB.Net] Port Scanner Source (Console) (/showthread.php?tid=152952)



[VB.Net] Port Scanner Source (Console) - The-One - Sep 23, 2009

Heya People!

There you go :

Code
Module Module1

    Sub Main()
        Dim tcp As New TcpClient
        Console.WriteLine("Enter Host Name")
        Dim txtHost = Console.ReadLine()
        Console.WriteLine("Enter Start Port")
        Dim txtPortStart = Console.ReadLine()
        Console.WriteLine("Enter Stop Port")
        Dim txtPortStop = Console.ReadLine()

        Dim startPort As Integer = Convert.ToInt32(txtPortStart)
        Dim stopPort As Integer = Convert.ToInt32(txtPortStop)

        Dim port As Integer

        For port = startPort To stopPort
            Try
                tcp.Connect(txtHost, port)

                If (tcp.Connected) Then
                    Console.WriteLine(port & " : Port Open")
                End If

            Catch e As Exception
                Console.WriteLine(port & " : Port Closed")
            End Try
        Next
        tcp.Close()
        Console.WriteLine("Scan Finished")
        Console.ReadKey()
    End Sub

End Module



* - BlueMelon - Sep 23, 2009

Your missing some code there..
Code
Public Class TcpClient
    End Class

and tcp.connect,connected and close are not a member.


* - codepoet - Apr 30, 2010

very nice.....thanks for sharing....


* - Mark Webber's B1tch - Apr 30, 2010

Great post.

Thanks for sharing mate.