{"id":13769426,"url":"https://github.com/vinitshahdeo/PortScanner","last_synced_at":"2025-05-11T02:32:33.363Z","repository":{"id":46568203,"uuid":"269067166","full_name":"vinitshahdeo/PortScanner","owner":"vinitshahdeo","description":"A go-to tool for scanning network. Scan all the open ports for a given host with just one click.","archived":false,"fork":false,"pushed_at":"2024-06-07T19:59:25.000Z","size":7194,"stargazers_count":139,"open_issues_count":99,"forks_count":114,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-25T02:02:08.901Z","etag":null,"topics":["express","express-server","hacktoberfest","nodejs","port-scanner","port-scanner-socket","port-scanning","python","remote-host"],"latest_commit_sha":null,"homepage":"https://vinitshahdeo.github.io/PortScanner/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vinitshahdeo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-03T11:14:34.000Z","updated_at":"2025-04-15T23:50:02.000Z","dependencies_parsed_at":"2024-06-07T21:01:30.703Z","dependency_job_id":"f9439731-7988-4e26-bba4-cd365ac5490f","html_url":"https://github.com/vinitshahdeo/PortScanner","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinitshahdeo%2FPortScanner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinitshahdeo%2FPortScanner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinitshahdeo%2FPortScanner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinitshahdeo%2FPortScanner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vinitshahdeo","download_url":"https://codeload.github.com/vinitshahdeo/PortScanner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252940917,"owners_count":21828769,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express","express-server","hacktoberfest","nodejs","port-scanner","port-scanner-socket","port-scanning","python","remote-host"],"created_at":"2024-08-03T17:00:24.637Z","updated_at":"2025-05-11T02:32:32.768Z","avatar_url":"https://github.com/vinitshahdeo.png","language":"Python","funding_links":[],"categories":["Repositories for intermediate/Advanced Coders"],"sub_categories":[],"readme":"# Port Scanner \n## A basic [Port Scanner](https://vinitshahdeo.github.io/PortScanner/) :mag_right: using Python with an [Express](https://expressjs.com/) Server to test!\n\n[![GitHub license](https://img.shields.io/github/license/vinitshahdeo/PortScanner?logo=github)](https://github.com/vinitshahdeo/PortScanner/blob/master/LICENSE) [![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/vinitshahdeo/PortScanner?logo=github)](https://github.com/vinitshahdeo/PortScanner/) [![GitHub last commit](https://img.shields.io/github/last-commit/vinitshahdeo/PortScanner?logo=git\u0026logoColor=white)](https://github.com/vinitshahdeo/PortScanner/commits/master)\n\n\u003e ### **Note: Please follow [this link](https://github.com/vinitshahdeo/PortScanner/discussions/117) if you're a [GSSoC](https://gssoc.girlscript.tech/) participant.** Keep watching this repo, we'll be opening more `beginner-friendly` [issues](https://github.com/vinitshahdeo/PortScanner/issues).\n\n\nWith this port scanner, I just attempt to connect\u003csup\u003eThis is a form of \"reconnaissance\" for hackers and penetration testers\u003c/sup\u003e at various ports, and do nothing else. If I'm able to connect to open ports, then I know at least the port is open.\n\n## Pre-requisites :rotating_light:\n\n[![node-current](https://img.shields.io/node/v/express?logo=node.js)](https://nodejs.org/) [![GitHub top language](https://img.shields.io/github/languages/top/vinitshahdeo/PortScanner?logo=python\u0026logoColor=white)](https://www.python.org/)\n\n- **Python** `\u003e= v2.7.0`\n    - Install Python from [here](https://www.python.org/).\n\n- **Node.js** `\u003e= v0.10.0`\n    - Install Node.js from [here](https://nodejs.org/).\n    \n- **Pip** `\u003e= v9.0.1`\n    - Install pip from [here](https://pip.pypa.io/en/stable/installing/).\n\n## How to run? :rocket:\n\n### To run Port Scanner: (Via Terminal)\n\n- **Open terminal** and **type `npm install`**: This will install the dependencies ([Express](https://expressjs.com)).\n\n- In the same terminal and **type `npm start`**: This will start multiple servers within the given range.\n\n- **Open another terminal** and **type `python src/scanner.py`**: Enter `localhost` or `127.0.0.1`. It will scan all the ports and print the open ports.\n\n\u003e Note: You can enter remote host if you want to scan the ports for any remote host. Check the [DISCLAIMER.md](./DISCLAIMER.md) before doing this.\n\n### To run Port Scanner: (Via UI)\n\n#### Install [flask](https://flask.palletsprojects.com/en/1.1.x/installation/#install-flask)\n\n\u003e *Make sure you have `Python27\\Scripts` path added to your system's environment variables.*\n\n**1**. In PowerShell,\n\n```ps \npip install flask\n```\n\n#### Install virtual environment \n\n\u003e *This step is required only if you are using Python2.7, skip this step when running Python3.X.*\n\n**2**. For Python 2, (via pip)\n\n   In PowerShell,\n\n```ps\npip install virtualenv\nvirtualenv --help\n```\n\n\u003e *Kindly [check this](https://virtualenv.pypa.io/en/latest/installation.html) if pip installation fails.*\n\n#### Create virtual environment\n\n**3**. Create a `venv` folder inside `src`,\n\n```ps\npython -m virtualenv venv\n\\Python27\\Scripts\\virtualenv.exe venv\n```\n\n#### Activate the virtual environment\n\n**4**. Activate `venv`,\n\n```ps\nvenv\\Scripts\\activate\n```\n\n**5**. Run `mainScanner.py`,\n\n```ps\npip install flask\npython src/mainScanner.py\n```\n**6**. Go to the port url returned by your terminal.\n\n### To run IP Scanner:\n\n- **Open terminal** and **type `python src/ipscanner.py`**: Enter any IP address `XXX.XXX.XXX.YYY`. It will scan all the addresses in the range `XXX.XXX.XXX.0` to `XXX.XXX.XXX.255` and print the addresses which are live.\n\n## Configuration :gear:\n\nThe servers are opened at multiple ports, you can change the low range and high range for the ports to be listened by the Express server.\n\n```js\n{\n    \"range\": {\n        \"low\": \"1\",\n        \"high\": \"8888\"\n    },\n    \"ipRange\": {\n        \"low\": \"0\",\n        \"high\": \"255\"\n    },\n    \"count\": \"10\",\n    \"thread\": { \n        \"count\": 8\n    }\n}\n```\n\n- `range.low`: _lowest port number (**inclusive**)_\n- `range.high`: _highest port number (**exclusive**)_\n- `ipRange.low`: _lowest IP address range (**inclusive**)_\n- `ipRange.high`: _highest IP address range (**inclusive**)_\n- `count`: _total number of ports_\n- `thread.count`: _total number of concurrent threads_\n\n## Contributing :handshake:\n\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat\u0026logo=git\u0026logoColor=white)](https://github.com/vinitshahdeo/PortScanner/pulls) [![CodeFactor](https://www.codefactor.io/repository/github/vinitshahdeo/portscanner/badge)](https://www.codefactor.io/repository/github/vinitshahdeo/portscanner) [![Open Source Love](https://badges.frapsoft.com/os/v2/open-source.svg?v=103)](https://github.com/vinitshahdeo/PortScanner)\n\n\u003e Please read our [Code of Conduct](CODE_OF_CONDUCT.md).\n\n**We're accepting PRs for our open and unassigned [issues](https://github.com/vinitshahdeo/PortScanner/issues)**. Please check [CONTRIBUTING.md](CONTRIBUTING.md). We'd love your contributions! **Kindly follow the steps below to get started:** \n\n**1.** Fork [this](https://github.com/vinitshahdeo/PortScanner) repository.\n\n**2.** Clone the forked repository.\n\n```bash\ngit clone https://github.com/\u003cyour-github-username\u003e/PortScanner\n```\n\n**3.** Navigate to the project directory.\n\n```bash\ncd PortScanner\n```\n\n**4.** Create a new branch.\n\n```bash\ngit checkout -b \u003cyour_branch_name\u003e\n```\n\n**5.** Make changes in source code.\n\n**6.** Stage your changes and commit\n\n```bash\ngit add .\n\ngit commit -m \"\u003cyour_commit_message\u003e\"\n```\n\n**7.** Push your local commits to the remote repo.\n\n```bash\ngit push -u origin \u003cyour_branch_name\u003e\n```\n\n**8.** Create a [PR](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request) to `develop` !\n\n**9.** **Congratulations!** :tada: Sit and relax, you've made your contribution to [Port Scanner](https://vinitshahdeo.github.io/PortScanner/) project. :v: :heart:\n\n## Branching :construction:\n\n- `master` branch is maintained and tested regulary for **Python 2**.\n\n- Please checkout `feature/python3.8` if you're using **[Python 3](https://www.python.org/download/releases/3.0/)**.\n\n```sh\ngit checkout feature/python3.8\n```\n\n## Need for Multithreading :white_check_mark:\n\n\u003eThe ability of a process to execute multiple threads parallelly is called multithreading. Ideally, multithreading can significantly improve the performance of any program.\n\nImagine scanning substantial number of ports(`range.high` = 8888) consecutively. The process would require quite a long time. \n\nThis calls for the need of concurrency in different parts of this range(1-8888). That is, running different parts(1-1111, 1112-2222, 2223-3333...) of the same process at the same time. This would reduce the time required for completion by significant amount. The reduction in time can be related to the number of concurrent ranges(threads) being scanned simultaneously. Checkout the `Performance Analysis` for a follow up.\n\n## Performance using threads :dart:\n\n- `src/single/scanner.py`: Scanner without thread\n- `src/scanner.py`: Scanner with multi threads\n\n|Range(low-high)|`src/single/scanner.py` (in milliseconds)    |`src/scanner.py` (in milliseconds)   |\n|---------------|----------------------------------|----------------------------------------|\n|1-80           |143243                            |30862                                   |\n\n\u003e `CONST_NUM_THREADS` : 8\n\n### Performance on the basis of number of threads :chart_with_downwards_trend:\n\nRange of ports: `1-80`\n\n|Number of threads|Execution time (in milliseconds)   | Compared Performances|\n|-----------------|-----------------------------------|----------------------|\n|2                |71627                              |50 % faster           |\n|4                |40808                              |71.51 % faster        |\n|8                |37003                              |74.17 % faster        |\n|16               |36870                              |74.26 % faster        |\n|32               |32674                              |77.19 % faster        |\n\n#### Performance Analysis \n\n![Performance Analysis](./assets/Graph.png)\n\n## Blog\n\n\n[![Medium Story](https://img.shields.io/static/v1.svg?label=check\u0026message=story%20on%20medium\u0026color=success\u0026logo=medium\u0026style=for-the-badge\u0026logoColor=white\u0026colorA=grey)](https://medium.com/@kashish_121/go-green-featuring-github-f8750fbf0729)\n\n- Check out [Kashish](https://github.com/kashish121)'s story on Medium - [GO-GREEN featuring GITHUB](https://medium.com/@kashish_121/go-green-featuring-github-f8750fbf0729)! \nShe has shared her experience working on [this](https://vinitshahdeo.github.io/PortScanner/) project - **How it marks the commencement of her perennial journey to open source?**\n\n- Check out [Ishika](https://github.com/ishika1727)'s story on Medium: [**`git push`**: You just need a little PUSH](https://medium.com/@ishikadubey2000/look-mom-im-on-github-521bb6c1f51d)!\nShe has shared her experience in working on [this](https://vinitshahdeo.github.io/PortScanner/) project and making her identity in the open-source world.\n\n## Open Source Programs\n\n\u003ca href=\"https://www.leapcode.io/\"\u003e\u003cimg src=\"./assets/leapcode.png\" width=\"40%\" height=\"10%\"/\u003e\u003c/a\u003e\n\nWe're now a part of **[Leapcode](https://www.leapcode.io/)**. It helps you contribute to open-source projects right from your first PR to working on major projects. It's still under construction and hopeful to have their platform up pretty soon. [Click here](https://www.leapcode.io/) to get an early access.\n\n\n## Useful resources :books:\n\n- [Express](https://expressjs.com/): Node.js web framework used for creating server. Check `server/index.js`\n- [Socket](https://docs.python.org/3/library/socket.html):  Low-level networking interface in Python. Check `src/scanner.py`\n- [Threading](https://docs.python.org/3/library/threading.html): Thread-based parallelism in python. Check `src/scanner_thread.py`\n- [Flask](https://flask.palletsprojects.com/en/1.1.x/quickstart/): A micro web framework written in Python. Check `src/mainScanner.py`\n\n## [Contributors](https://github.com/vinitshahdeo/PortScanner/graphs/contributors) :trophy:\n\n[![GitHub issues](https://img.shields.io/github/issues/vinitshahdeo/PortScanner?logo=github)](https://github.com/vinitshahdeo/PortScanner/issues) [![GitHub pull requests](https://img.shields.io/github/issues-pr/vinitshahdeo/PortScanner?color=olive\u0026logo=github)](https://github.com/vinitshahdeo/PortScanner/pulls)\n\n\n|      Name :medal_military:    |     Social Media :wave:    | GitHub :octocat: |\n|:-------------:|:-------------------|------------------|\n| Vinit Shahdeo | :bird: [Twitter](https://twitter.com/Vinit_Shahdeo) \u003cbr\u003e:mortar_board: [LinkedIn](https://www.linkedin.com/in/vinitshahdeo/) | [@vinitshahdeo](https://github.com/vinitshahdeo/)  |\n| Kashish       | :bird: [Twitter](https://twitter.com/Kashish_121) \u003cbr\u003e:mortar_board: [LinkedIn](https://www.linkedin.com/in/kashish121/) | [@Kashish121](https://github.com/Kashish121/)      |\n| Ishika Dubey  | :bird: [Twitter](https://twitter.com/ishika1727) \u003cbr\u003e:mortar_board: [LinkedIn](https://www.linkedin.com/in/ishika1727/) | [@ishika1727](https://github.com/ishika1727/)      |\n\n\u003e **See the contribution graph [here](https://github.com/vinitshahdeo/PortScanner/graphs/contributors).**\n\n[![](https://sourcerer.io/fame/vinitshahdeo/vinitshahdeo/PortScanner/images/0)](https://github.com/vinitshahdeo/PortScanner/)[![](https://sourcerer.io/fame/vinitshahdeo/vinitshahdeo/PortScanner/images/1)](https://github.com/vinitshahdeo/PortScanner/)[![](https://sourcerer.io/fame/vinitshahdeo/vinitshahdeo/PortScanner/images/2)](https://github.com/vinitshahdeo/PortScanner/)[![](https://sourcerer.io/fame/vinitshahdeo/vinitshahdeo/PortScanner/images/3)](https://github.com/vinitshahdeo/PortScanner/)[![](https://sourcerer.io/fame/vinitshahdeo/vinitshahdeo/PortScanner/images/4)](https://github.com/vinitshahdeo/PortScanner/)[![](https://sourcerer.io/fame/vinitshahdeo/vinitshahdeo/PortScanner/images/5)](https://github.com/vinitshahdeo/PortScanner/)[![](https://sourcerer.io/fame/vinitshahdeo/vinitshahdeo/PortScanner/images/6)](https://github.com/vinitshahdeo/PortScanner/)[![](https://sourcerer.io/fame/vinitshahdeo/vinitshahdeo/PortScanner/images/7)](https://github.com/vinitshahdeo/PortScanner/)\n\n## Admin\n\n|                                                                                         \u003ca href=\"https://www.eatmy.news/2020/06/code-like-you-eat-i-mean-code-daily-as.html\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/vinitshahdeo/Water-Monitoring-System/master/assets/vinit-shahdeo.jpg\" width=\"150px \" height=\"150px\" /\u003e\u003c/a\u003e                                                                                         |\n| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |\n|                                                                                                                                        **[Vinit Shahdeo](https://fayz.in/stories/s/1522/0/?ckt_id=ZGL1ZGVk\u0026title=story_of_vinit_shahdeo)**                                                                                                                                        |\n| \u003ca href=\"https://twitter.com/Vinit_Shahdeo\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/vinitshahdeo/Water-Monitoring-System/master/assets/twitter.png\" width=\"32px\" height=\"32px\"\u003e\u003c/a\u003e \u003ca href=\"https://www.facebook.com/vinit.shahdeo\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/vinitshahdeo/Water-Monitoring-System/master/assets/facebook.png\" width=\"32px\" height=\"32px\"\u003e\u003c/a\u003e \u003ca href=\"https://www.linkedin.com/in/vinitshahdeo/\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/vinitshahdeo/Water-Monitoring-System/master/assets/linkedin.png\" width=\"32px\" height=\"32px\"\u003e\u003c/a\u003e |\n\n\n## License\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fvinitshahdeo%2FPortScanner.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fvinitshahdeo%2FPortScanner?ref=badge_large)\n\n## TL;DR\n\nCheck out [this](https://gist.github.com/vinitshahdeo/92bf103f74a98cc55a447aa522bcdea9) gist if you're only looking for a **Python** script for **scanning ports**.\n\n----\n```javascript\n\nif (_.isAwesome(thisRepo)) {\n  thisRepo.star(); // thanks in advance :p\n}\n\n```\n----\n\n[![GitHub followers](https://img.shields.io/github/followers/vinitshahdeo.svg?label=Follow%20@vinitshahdeo\u0026style=social)](https://github.com/vinitshahdeo/)  [![Twitter Follow](https://img.shields.io/twitter/follow/Vinit_Shahdeo?style=social)](https://twitter.com/Vinit_Shahdeo)\n\n\u003csup\u003eThis repository is intended for individuals to test their own equipment for weak\n security, and the author(**@vinitshahdeo**) will take no responsibility if it is put to any other use. Check [DISCLAIMER.md](./DISCLAIMER.md)\u003c/sup\u003e\n \n[![Made with Python](https://forthebadge.com/images/badges/made-with-python.svg)](https://github.com/vinitshahdeo/PortScanner/) [![Built with love](https://forthebadge.com/images/badges/built-with-love.svg)](https://github.com/vinitshahdeo/)\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinitshahdeo%2FPortScanner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvinitshahdeo%2FPortScanner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinitshahdeo%2FPortScanner/lists"}