skerkour / kerkour.com

(Ab)using technology for fun & profit. Programming, Hacking & Entrepreneurship @ https://kerkour.com
https://kerkour.com
Apache License 2.0
463 stars 63 forks source link

rust_fast_port_scanner returns all ports #3

Closed sylvain101010 closed 2 years ago

sylvain101010 commented 2 years ago

Hello @claudiociardelli , I tested rust_fast_port_scanner today. Not sure if this is an issue or a lack of understanding from me: I run the program with the IP address of my linux server to check what ports might be listening to requests. so I ran the command like this:

./target/release/rust_fast_port_scanner 192.168.1.70

I will not print the result here, But I get 1002 rows in the result so, all the ports tested. From @claudiociardelli (https://github.com/skerkour/bloom/issues/72)

However when I check what ports are listening as per https://www.techrepublic.com/article/how-to-locate-and-close-an-open-port-in-linux/ I only see 6 open ports

coco@dev01:~/projects/kerkour.com/2021/rust_fast_port_scanner$ sudo ss -tulwn | grep LISTEN
tcp   LISTEN 0      511                            127.0.0.1:41683      0.0.0.0:*

tcp   LISTEN 0      4096                       127.0.0.53%lo:53         0.0.0.0:*

tcp   LISTEN 0      128                              0.0.0.0:22         0.0.0.0:*

tcp   LISTEN 0      100                              0.0.0.0:25         0.0.0.0:*

tcp   LISTEN 0      100                                 [::]:25            [::]:*
sylvain101010 commented 2 years ago

Thank you for reaching out @claudiociardelli,

i think it should come from your firewall. What does return

$ nmap -T4 -sT 192.168.1.70

?

Also what is the operating system of your server?

sylvain101010 commented 2 years ago

Or it may come from an actual bug, that https://github.com/skerkour/kerkour.com/commit/f1ea1ea6f6996b3ccc99fbeee4106523b10db7e4 should have fixed.

Could you tell me if the result is similar with the new version

claudiociardelli commented 2 years ago

NAME="Ubuntu" VERSION="20.04.3 LTS (Focal Fossa)"

I applied the fix, but still not returning all ports. Nmap tells me this

~/projects/kerkour.com/2021/rust_fast_port_scanner$ nmap -T4 -sT 192.168.1.70
Starting Nmap 7.80 ( https://nmap.org ) at 2021-10-16 20:31 UTC
Nmap scan report for dev01 (192.168.1.70)
Host is up (0.00013s latency).
Not shown: 998 closed ports
PORT   STATE SERVICE
22/tcp open  ssh
25/tcp open  smtp

Nmap done: 1 IP address (1 host up) scanned in 0.25 seconds
sylvain101010 commented 2 years ago

Thanks for the feedback.

What does return https://github.com/skerkour/black-hat-rust/tree/main/ch_02/tricoder

cargo run -- 192.168.1.70

?

-------- Original Message -------- On Oct 16, 2021, 22:35, claudiociardelli wrote:

NAME="Ubuntu" VERSION="20.04.3 LTS (Focal Fossa)"

I applied the fix, but still not returning all ports. Nmap tells me this

~/projects/kerkour.com/2021/rust_fast_port_scanner$ nmap -T4 -sT 192.168.1.70 Starting Nmap 7.80 ( https://nmap.org ) at 2021-10-16 20:31 UTC Nmap scan report for dev01 (192.168.1.70) Host is up (0.00013s latency). Not shown: 998 closed ports PORT STATE SERVICE 22/tcp open ssh 25/tcp open smtp

Nmap done: 1 IP address (1 host up) scanned in 0.25 seconds

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

claudiociardelli commented 2 years ago

Sylvain, tricorder and rust_fast_port_scan now work correcty. I wonder if I had not retested correctly yesterday after refreshing my local repository. Thx for your help

sylvain101010 commented 2 years ago

I'm glad to hear that :)

Have a nice day