vinitshahdeo / PortScanner

A go-to tool for scanning network. Scan all the open ports for a given host with just one click.
https://vinitshahdeo.github.io/PortScanner/
MIT License
133 stars 114 forks source link

[BUG] Indexes of the port list are getting used as ports rather than the actual PORT #55

Open priyo97 opened 4 years ago

priyo97 commented 4 years ago

Describe the bug Bug 1: the ports list which generated using the values read from the config.json file is not getting used. Rather the index is getting used as port in the scan function. [Refer to screenshot 2] Bug 2: Now because of the above bug, regardless of the low port value given in the config file, the port scanning starts from 0 onwards. Bug 3: setdefaulttimeout function is only used in ipscanner.py file. Should be used across all the files where socket is being created Bug 4: if the total number of ports to scan is less than number of threads, the logic implemented is not assigning the ports properly. between the threads. [Refer to screenshot 1]

Bug 5: This one is not a bug but an improvement on how the ports should get assigned to the threads. Currently, for example if there are 87 ports in total that needs to be scanned and the number of threads are 8, then the first 7 threads will get 10 ports each and the 8th thread will get 17 ports to scan. Now in practical scenarios, when the number of ports and the number of threads will be high, the last thread will have to scan additional number of ports compared to the other threads. (the number can become large)

Bug 6: Need to keep sanity checks for the config that is being read. For unexpected values, the program will crash.

To Reproduce Add logs to print the port range, split_size and the thread number to analyze the situation. Refer to screenshots

Expected behavior Mentioned is the description.

Screenshots [screenshot 1] https://drive.google.com/file/d/1Wd2SQr6me0CG5QiJBf2P9Lt_JKqBybGS/view?usp=sharing [screenshot 2] https://drive.google.com/file/d/199doKJWS2bw9L8oQnW0i1gfuqB3dP_dK/view?usp=sharing

Desktop (please complete the following information):

Additional context The above bugs are applicable for both python 2 and python 3 Will be raising a pull request with the above bug fixes.

abhis9427 commented 3 years ago

can you please assign this issue to me under JWOC