Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

The Brotherhood 

How to Scan IP Address For Open Ports (FREE C++ and Python Source Code)

[Image: header4.gif]

Port Scanner
in C++ and Python

Want to download the compiled exe program?
Available here (generated by Pyinstaller):


https://hackforums.net/showthread.php?pid=62309697



When you are looking into whether your server is secure or not, you may need to figure out which ports are open for connection attempts. A port scanner is a tool that allows you to look for common ports used by services such as smtp, ftp, ssh, webdav, http, and more.

Please note that it may take some time to return a response for big ranges due to connection timeout settings and your personal connection as well. The C++ version is far faster than the Python script, but both work reliably - Enjoy!



Pscan.py (Python) Source Code & Instructions :
Spoiler (Click to View)

Pscan.cpp (C++ for Windows) Source Code & Instructions :
Spoiler (Click to View)

You can feel free to use my code above in your own programs or compile & use as-is, for educational purposes or authorized, legal use.
Thats excellent nodes ty i usually used zenmap for it
i use nmap why i should use yours whats the secret sauce of your tool?
(Jan 6, 2024 02:35 PM)wtf Wrote:  Thats excellent nodes ty i usually used zenmap for it
Thanks, glad you like it!

(Jan 6, 2024 02:49 PM)13K_HOPE Wrote:  i use nmap why i should use yours whats the secret sauce of your tool?
No secret sauce, I just like coding and figure some people would prefer to have a small example / source code to use in their own automatic programs.
(Jan 6, 2024 03:01 PM)Hackers Wrote:  Thanks, glad you like it!

No secret sauce, I just like coding and figure some people would prefer to have a small example / source code to use in their own automatic programs.

now im curisous to see the code
(Jan 6, 2024 03:03 PM)13K_HOPE Wrote:  now im curisous to see the code

It's in my post.
(Jan 6, 2024 03:05 PM)Hackers Wrote:  It's in my post.

Stop hiding the code from us nodes
Got a question here.... Just like the guy above... I use nmap... The CLI version of zenmap but I'm just now getting into this port scanning thing. Recently I've been scanning devices on my local network and when I scan for TCP protocol I only get port:22 ssh.... So I figured this was good and that my device was perfectly secure as long as no one new my ssh password or had my key. But my question is dealing with another protocol....when I scanned for UDP I find that there are various ports open running Netbios-ns , Netbios-dgm,llmnr,ect but the scan returns open/filtered? I understand what open means but what does open / filtered mean and how does this have a negative impact on exploitation?
(Jan 6, 2024 03:03 PM)13K_HOPE Wrote:  now im curisous to see the code

It's uncompiled python and C++ code.
where can I use this?
(Jan 6, 2024 05:25 PM)hamdaanisystems Wrote:  Got a question here.... Just like the guy above... I use nmap... The CLI version of zenmap but I'm just now getting into this port scanning thing. Recently I've been scanning devices on my local network and when I scan for TCP protocol I only get port:22 ssh.... So I figured this was good and that my device was perfectly secure as long as no one new my ssh password or had my key. But my question is dealing with another protocol....when I scanned for UDP I find that there are various ports open running Netbios-ns , Netbios-dgm,llmnr,ect but the scan returns open/filtered? I understand what open means but what does open / filtered mean and how does this have a negative impact on exploitation?

It returns open/filtered because open UDP ports don't respond to packets. Networking is important. Good networking knowledge would help you understand what NetBIOS and LLMNR do.

(Jan 6, 2024 06:24 PM)vycka69 Wrote:  where can I use this?

Computer networks
Thanks for the advice. Is there a particular course that you advise for me to take in understanding networks? I'm in prison and I have nothing but time. Please point me in the right direction....or else I would just hit YouTube up and watch Network Chuck videos.

(Jan 6, 2024 08:16 PM)DramaKing Wrote:  It returns open/filtered because open UDP ports don't respond to packets. Networking is important. Good networking knowledge would help you understand what NetBIOS and LLMNR do.


Computer networks

(Jan 6, 2024 09:14 PM)hamdaanisystems Wrote:  Thanks for the advice. Is there a particular course that you advise for me to take in understanding networks? I'm in prison and I have nothing but time. Please point me in the right direction....or else I would just hit YouTube up and watch Network Chuck videos.

(Jan 6, 2024 08:16 PM)DramaKing Wrote:  It returns open/filtered because open UDP ports don't respond to packets. Networking is important. Good networking knowledge would help you understand what NetBIOS and LLMNR do.


Computer networks

Thanks for the advice. Is there a particular course that you suggest I take to gain a solid foundation in regard to networking? If so point me in the right direction. I'm in prison and have nothing but time.
(Jan 6, 2024 06:24 PM)vycka69 Wrote:  where can I use this?
You can use this to scan any IP address, such as an IP of a website, your own internet connection, etc.

(Jan 6, 2024 09:14 PM)hamdaanisystems Wrote:  Thanks for the advice. Is there a particular course that you suggest I take to gain a solid foundation in regard to networking? If so point me in the right direction. I'm in prison and have nothing but time.

I am not a networking expert, but I recommend looking into how routers and modems work in general. If you can learn about websites, learn DNS or general website routing, ports, and proxies.
sounds veryyyyyyyy gooooooooooodddd [warn]
(Jan 8, 2024 07:54 AM)Hackers Wrote:  You can use this to scan any IP address, such as an IP of a website, your own internet connection, etc.


I am not a networking expert, but I recommend looking into how routers and modems work in general. If you can learn about websites, learn DNS or general website routing, ports, and proxies.

Network+, freecodecamp, NetworkChuck, and David Bombal are all good.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[The Brotherhood] by HackersMar 16, 2026 08:35 PM 12 396 Mar 16, 2026 08:35 PM
Last Post: Stanley
[The Brotherhood] by HackersMar 16, 2026 08:19 PM 6 272 Mar 16, 2026 08:19 PM
Last Post: Hackers
by DevenderApr 12, 2024 08:55 AM 0 132 Apr 12, 2024 08:55 AM
Last Post: Devender