Hack Forums
[.NET] Looking for a port scanner source[VB] - 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] Looking for a port scanner source[VB] (/showthread.php?tid=4709832)



Looking for a port scanner source[VB] - IMAGINARY666 - Mar 1, 2015

Hello guys

I'm looking for a port scanner source... I know, there are some sources on the internet but they are very basic, or lead to memory exhaustion (really). I'd like something advanced, maybe a Syn scanner, or something that won't lead to memory exhaustion after i scan from port 1 to 20000... Please note that I'm not the kind that writes a code from scratch, I like to understand the code, and improve it, and maybe include it in something bigger.

Thank you very much.


* - nuk - Mar 1, 2015

Here's one: http://www.codeproject.com/Articles/17257/VB-Port-Scanner
Here's two: https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=904&lngWId=10

BTW....that was after only 1 Google search and it was like magic or something LoL


* - IMAGINARY666 - Mar 1, 2015

(Mar 1, 2015 07:12 AM)nuk Wrote:  Here's one:
Here's two:

BTW....that was after only 1 Google search and it was like magic or something LoL

One - Timers, it might not work well, but I'll give it a try, maybe I'll replace the timers with a background worker.

Two - 2003... cool


* - Marwix - Mar 1, 2015

(Mar 1, 2015 10:17 AM)IMAGINARY666 Wrote:  One - Timers, it might not work well, but I'll give it a try, maybe I'll replace the timers with a background worker.

Two - 2003... cool

You could download one of my old ones that I made a long time ago.

http://www.mediafire.com/download/aqtpakj6d0z516c/Port+Scanner+-+Keiko.rar

Educational purposes only.


* - IMAGINARY666 - Mar 1, 2015

(Mar 1, 2015 11:03 AM)Keiko Wrote:  You could download one of my old ones that I made a long time ago.

Educational purposes only.

Sorry but it doesn't work remotely... I can only scan 127.0.0.1

Btw i have this, and it does work remotely, but only for a certain port

Code
Dim logonServer As New TcpClient()

      Try
      logonServer.Connect(iptxt.Text, porttxt.Text)

      Catch generatedExceptionName As Exception
      label1.ForeColor = Color.Red
      label1.Text = "Offline!"

      End Try
      If logonServer.Connected Then

      label1.ForeColor = Color.LimeGreen
      label1.Text = "Online!"
      logonServer.Close()
                End If
I tried to make it work for a port range but i failed... :(
Can someone help me to make this work for a port range?


* - Punkbastard - Mar 1, 2015

For a port range use a for-loop.
My quick code:

Code
For portIndex As Integer = 1 To 5 'You could use two numericupdown's here for start-port and end-port (For port As Integer = numericUpDownStartPort.Value To numericUpDownEndPort.Value
    Try
      logonServer.Connect(iptxt.Text, porttxt.Text)
      Messagebox.Show("Connection Successful on port: " & Convert.ToString(portIndex))
    Catch ex As Exception
      Messagebox.Show("Connection Failed on port: " & Convert.ToString(portIndex))
Next

However, change your validation, as a label would not work right, try to add the logs to richtextbox or something like that.


* - IMAGINARY666 - Mar 2, 2015

(Mar 1, 2015 04:17 PM)Punkbastard Wrote:  For a port range use a for-loop.
My quick code:

Code
For portIndex As Integer = 1 To 5 'You could use two numericupdown's here for start-port and end-port (For port As Integer = numericUpDownStartPort.Value To numericUpDownEndPort.Value
    Try
      logonServer.Connect(iptxt.Text, porttxt.Text)
      Messagebox.Show("Connection Successful on port: " & Convert.ToString(portIndex))
    Catch ex As Exception
      Messagebox.Show("Connection Failed on port: " & Convert.ToString(portIndex))
Next

However, change your validation, as a label would not work right, try to add the logs to richtextbox or something like that.

It does work but it's the slowest thing ever made. :\


* - Punkbastard - Mar 2, 2015

(Mar 2, 2015 12:12 PM)IMAGINARY666 Wrote:  It does work but it's the slowest thing ever made. :\

That's because it takes time to connect. You could use multithreading to make it look more 'flawless' but I guess you won't get it much faster.


* - IMAGINARY666 - Mar 2, 2015

(Mar 2, 2015 12:17 PM)Punkbastard Wrote:  That's because it takes time to connect. You could use multithreading to make it look more 'flawless' but I guess you won't get it much faster.

I did use threading, lol, it's important, i dont want to kill my UI. But it is slow, not the slowest thing but meh, slow.


* - Odus - Mar 2, 2015

(Mar 2, 2015 12:45 PM)IMAGINARY666 Wrote:  I did use threading, lol, it's important, i dont want to kill my UI. But it is slow, not the slowest thing but meh, slow.

If you want something better, write it yourself. Beggars can't be choosers.


* - IMAGINARY666 - Mar 2, 2015

(Mar 2, 2015 12:51 PM)Odus Wrote:  If you want something better, write it yourself. Beggars can't be choosers.

I'm ok with it, i'll do some research to find out how this thing works.


* - Ninja - Mar 2, 2015

(Mar 1, 2015 07:12 AM)nuk Wrote:  Here's one: http://www.codeproject.com/Articles/17257/VB-Port-Scanner
Here's two: https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=904&lngWId=10

BTW....that was after only 1 Google search and it was like magic or something LoL

omg are you a wizard or something? what is this magical place called Google?
OT: Seriously, resort to Google first. It prevents these silly posts on the forums and saves you a lot of time waiting for an answer.