• Stars
    star
    131
  • Rank 275,867 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created over 4 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A go-to tool for scanning network. Scan all the open ports for a given host with just one click.

Port Scanner

A basic Port Scanner 🔎 using Python with an Express Server to test!

GitHub license GitHub code size in bytes GitHub last commit

Note: Please follow this link if you're a GSSoC participant. Keep watching this repo, we'll be opening more beginner-friendly issues.

With this port scanner, I just attempt to connectThis is a form of "reconnaissance" for hackers and penetration testers 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.

Pre-requisites 🚨

node-current GitHub top language

  • Python >= v2.7.0

    • Install Python from here.
  • Node.js >= v0.10.0

    • Install Node.js from here.
  • Pip >= v9.0.1

    • Install pip from here.

How to run? 🚀

To run Port Scanner: (Via Terminal)

  • Open terminal and type npm install: This will install the dependencies (Express).

  • In the same terminal and type npm start: This will start multiple servers within the given range.

  • 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.

Note: You can enter remote host if you want to scan the ports for any remote host. Check the DISCLAIMER.md before doing this.

To run Port Scanner: (Via UI)

Install flask

Make sure you have Python27\Scripts path added to your system's environment variables.

1. In PowerShell,

pip install flask

Install virtual environment

This step is required only if you are using Python2.7, skip this step when running Python3.X.

2. For Python 2, (via pip)

In PowerShell,

pip install virtualenv
virtualenv --help

Kindly check this if pip installation fails.

Create virtual environment

3. Create a venv folder inside src,

python -m virtualenv venv
\Python27\Scripts\virtualenv.exe venv

Activate the virtual environment

4. Activate venv,

venv\Scripts\activate

5. Run mainScanner.py,

pip install flask
python src/mainScanner.py

6. Go to the port url returned by your terminal.

To run IP Scanner:

  • 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.

Configuration ⚙️

The 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.

{
    "range": {
        "low": "1",
        "high": "8888"
    },
    "ipRange": {
        "low": "0",
        "high": "255"
    },
    "count": "10",
    "thread": { 
        "count": 8
    }
}
  • range.low: lowest port number (inclusive)
  • range.high: highest port number (exclusive)
  • ipRange.low: lowest IP address range (inclusive)
  • ipRange.high: highest IP address range (inclusive)
  • count: total number of ports
  • thread.count: total number of concurrent threads

Contributing 🤝

PRs Welcome CodeFactor Open Source Love

Please read our Code of Conduct.

We're accepting PRs for our open and unassigned issues. Please check CONTRIBUTING.md. We'd love your contributions! Kindly follow the steps below to get started:

1. Fork this repository.

2. Clone the forked repository.

git clone https://github.com/<your-github-username>/PortScanner

3. Navigate to the project directory.

cd PortScanner

4. Create a new branch.

git checkout -b <your_branch_name>

5. Make changes in source code.

6. Stage your changes and commit

git add .

git commit -m "<your_commit_message>"

7. Push your local commits to the remote repo.

git push -u origin <your_branch_name>

8. Create a PR to develop !

9. Congratulations! 🎉 Sit and relax, you've made your contribution to Port Scanner project. ✌️ ❤️

Branching 🚧

  • master branch is maintained and tested regulary for Python 2.

  • Please checkout feature/python3.8 if you're using Python 3.

git checkout feature/python3.8

Need for Multithreading

The ability of a process to execute multiple threads parallelly is called multithreading. Ideally, multithreading can significantly improve the performance of any program.

Imagine scanning substantial number of ports(range.high = 8888) consecutively. The process would require quite a long time.

This 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.

Performance using threads 🎯

  • src/single/scanner.py: Scanner without thread
  • src/scanner.py: Scanner with multi threads
Range(low-high) src/single/scanner.py (in milliseconds) src/scanner.py (in milliseconds)
1-80 143243 30862

CONST_NUM_THREADS : 8

Performance on the basis of number of threads 📉

Range of ports: 1-80

Number of threads Execution time (in milliseconds) Compared Performances
2 71627 50 % faster
4 40808 71.51 % faster
8 37003 74.17 % faster
16 36870 74.26 % faster
32 32674 77.19 % faster

Performance Analysis

Performance Analysis

Blog

Medium Story

Open Source Programs

We're now a part of Leapcode. 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 to get an early access.

Useful resources 📚

  • Express: Node.js web framework used for creating server. Check server/index.js
  • Socket: Low-level networking interface in Python. Check src/scanner.py
  • Threading: Thread-based parallelism in python. Check src/scanner_thread.py
  • Flask: A micro web framework written in Python. Check src/mainScanner.py

Contributors 🏆

GitHub issues GitHub pull requests

Name 🎖️ Social Media 👋 GitHub :octocat:
Vinit Shahdeo 🐦 Twitter
🎓 LinkedIn
@vinitshahdeo
Kashish 🐦 Twitter
🎓 LinkedIn
@Kashish121
Ishika Dubey 🐦 Twitter
🎓 LinkedIn
@ishika1727

See the contribution graph here.

Admin

Vinit Shahdeo

License

FOSSA Status

TL;DR

Check out this gist if you're only looking for a Python script for scanning ports.


if (_.isAwesome(thisRepo)) {
  thisRepo.star(); // thanks in advance :p
}

GitHub followers Twitter Follow

This repository is intended for individuals to test their own equipment for weak security, and the author(@vinitshahdeo) will take no responsibility if it is put to any other use. Check DISCLAIMER.md

Made with Python Built with love

More Repositories

1

Hacktoberfest2021

A community-led mentorship initiative to help beginners kickstarting their open-source journey by completing Hacktoberfest'21 challenge | Curated list of beginner-friendly issues for Hacktoberfest 2021 | Raise PR to add your issues
809
star
2

inspirational-quotes

💡 A simple NPM Package which returns random Inspirational Quotes. Get your daily quote and stay motivated! ✌️ 🌸
JavaScript
314
star
3

Hacktoberfest2020

List of beginner-friendly | first-timers-only | up-for-grabs issues (repositories) for Hacktoberfest 2020 | Submit 4 PRs to earn a T-shirt
248
star
4

Hashtagify

📸 Generates hashtags for Instagram posts. Upload your photo and it will suggest the relevant #hashtags for you. 🏷️ :trollface:
JavaScript
151
star
5

Water-Monitoring-System

Water Monitoring System is an IOT based Liquid Level Monitoring system that has mechanisms to keep the user alerted in case of liquid overflow or when tank depletes.
HTML
142
star
6

COVID19

A web app to display the live graphical state-wise reported corona cases in India so far. It also shows the latest news for COVID-19. Stay Home, Stay Safe!
CSS
124
star
7

Wedding-Invitation

Animated website for my Elder Sister's wedding Invitation (also contains timer & background music) | Save the Date: Nov 29, 2020
CSS
123
star
8

Library-Management-System

[DBMS Project] An interactive web portal for automating various manual processes done by librarian.
JavaScript
123
star
9

HBD

🎂 Coder's way of wishing Happy Birthday! 🍰 🎊 🎉 🎈
HTML
117
star
10

jobtweets

🔍 This project is about searching the twitter for job opportunities using popular hashtags and applying sentiment analysis on this. #️⃣ 🐦
Python
106
star
11

Email-Signature-Template

An email signature template made using HTML & CSS - let's make its easier for everyone!
HTML
103
star
12

Map-of-India

A Node.js script to generate the Map of India in terminal
JavaScript
84
star
13

JavaScript-Resources

Curated list of 10 resources to ace your next JavaScript interview
54
star
14

SimpleBio

A starter template for beginners.
CSS
54
star
15

peerlist-readme-badge

Markdown badge generator for any Peerlist profile 💚 | Style your GitHub Profile README with a Peerlist badge to showcase your work | Try out here: https://peerlist.io/tools/readme-badge
JavaScript
52
star
16

ParkingLot

Design a parking lot system which supports multiple features. It uses OOPS concepts and TDD approach.
JavaScript
51
star
17

online-debate-system

🗣️ Using google voice recognition API to predict the "For the motion" and "Against the motion" using sentiment analysis 💬 📢
Hack
51
star
18

ProgressiveNewsApp

A simple Progressive Web App that brought news from a variety of sources using News API.
JavaScript
41
star
19

vinitshahdeo

Hello, Glad to see you here! Check out this repository to view my work and learn more about me.
40
star
20

Quotter

🤖 A Twitter bot which tweets random quotes with image and #hashtags 🐦 🔔
HTML
37
star
21

Recruitment-Portal

An online recruitment portal developed for recruitments of VinnovateIT
PHP
36
star
22

HacktoberFest2K19

Hacktoberfest is here! Raise the PR and earn goodies.
35
star
23

TwitterSentimentAnalysis

💹 A web app to search twitter based on #Hashtags and calculate the sentiment of tweets.
PHP
35
star
24

MiniYouTube

A React App using YouTube API
JavaScript
33
star
25

covid19api

Playing with GraphQL and COVID-19 API! Checkout the related COVID-19 Tracker for India.
JavaScript
33
star
26

github-stars-feed

Get the latest feed of GitHub Stars out there! 🌟 ⭐ ✨
JavaScript
31
star
27

50DaysOfJavaScript

#50DaysOfJavaScript — Solve one question daily to ace your next interview! Calling out participants, mentors, and communities for an open-source initiative—join us to make a difference.
HTML
30
star
28

Cookie-Manager

A chrome extension to manage browser cookies.
JavaScript
29
star
29

wedding-website

शुभ विवाह | Animated wedding website in Hindi | Created with HTML, CSS and JS
CSS
26
star
30

topmate-readme-badge

Markdown badge generator for your Topmate profile | Style your profile README with Topmate badge to connect with your audience
JavaScript
23
star
31

FaceRecognition

📷 Face Recognition using Haar-Cascade Classifier, OpenCV and Python
Jupyter Notebook
19
star
32

GitHub-LookBook

:octocat: Look up the GitHub profiles with better UI experience. Build your GitHub Report Card!
HTML
18
star
33

myFaculty

A React app to search faculties of VIT Vellore with autocomplete input
JavaScript
18
star
34

GitHubLookBook

Look up the GitHub profiles with better UI experience.
CSS
14
star
35

vinitshahdeo.github.io

Hello World! Welcome to my portfolio. Glad to see you here!
CSS
12
star
36

hacktoberfest-issue-hunt

Find all the open issues for Hacktoberfest | Filter on the basis of language and labels like first-timers-only
JavaScript
11
star
37

Mini-YouTube

A web app where one can search YouTube videos and sort the videos according to number of likes, comments, views, name and date.
JavaScript
10
star
38

Event-Loop-In-JavaScript

A Webinar on Event loop in JavaScript and rise of Async Programming, organized by HackOn and powered by Coding Blocks
8
star
39

Truth-OR-Dare-Game

Enjoy the wonderful game of Truth or Dare. Have fun with your buddies! It’s a great way to learn more about your friends.
HTML
8
star
40

holopin-readme-badge

Get yourself a Holopin markdown badge to show your collection of badges ツ
JavaScript
8
star
41

Hackathon-Timer

A timer for Hackathon with GitHub Live Updates. Made this for VinHack - a hackathon by VinnovateIT
HTML
8
star
42

CookOff-4.0

A competitive coding event hosted by CodeChef VIT Chapter during graVITas'18
C++
8
star
43

DSA-Lab-Codes

Lab Assignments for Data Structures and Algoithms
C++
6
star
44

Cook-Off-3.0

Competitive coding event organised by CodeChef VIT Chapter annually during Gravitas.
C++
6
star
45

openapi-url-resolver

Resolve server URLs and extract hosts from OpenAPI 3.x and Swagger specifications.
JavaScript
5
star
46

E-Commerce-Website

E-Commerce website developed while completion of Udemy course
PHP
4
star
47

TechFest

Website for the college fest.
HTML
4
star
48

coaching-website

Freelance Work - Website for a CBSE Coaching named SINGH TUTORIAL
HTML
3
star
49

HashnodeBlog

Back up for my articles published on Hashnode | Blog
3
star
50

Happy-New-Year-Wish

A web app to send personalized [Happy New Year] e-card to your loved ones.
PHP
3
star
51

IPL-Swiggy6

SWIGGY6 - A chrome extension to notify the sixers in live IPL matches. Get 60% after every sixer within 6 minutes.
JavaScript
3
star
52

ServerHub

A website for a web hosting startup
HTML
2
star
53

LRUCache

Implementation of LRUCache using Map and Doubly Linked List in JavaScript
JavaScript
2
star
54

Old-Portfolio

My personal website
CSS
2
star
55

Corona-India

A web app to display the live graphical state-wise reported corona cases in India so far. It also shows the latest news for COVID-19. Stay Home, Stay Safe!
JavaScript
2
star
56

postman-schema-editor

Edit your Postman Schema directly into VS Code
JavaScript
1
star
57

Wikipedia-Instant-Search

An instant search application made using Wikipedia API
HTML
1
star
58

CodeCombat

The website for the upcoming event of CodeChef VIT Chapter.
JavaScript
1
star
59

WebDev-InCore-Sessions

Source code for all the tasks assigned to the VinnovateIT members while the internal sessions of Web Development.
HTML
1
star
60

community-codechef

A project by us for CodeChef VIT Community
Java
1
star
61

InspireMe

[Native Desktop App] Get daily quotes as your desktop notifications.
Objective-C
1
star
62

CodeChef-VIT-Website

The website of CodeChef Chapter of VIT University Vellore
HTML
1
star
63

Music-Composer-Website

[Freelance Work] Website for Popular Indian Music Composer - Mohamaad Ghibran
HTML
1
star
64

Square-Calculator

An application that calculates the squares and cubes of the numbers from 1 to n(where n is input given by user) and prints the resulting values in table format.
CSS
1
star
65

TableEntry

Working with Database in PHP
PHP
1
star
66

TeamScoreApp

It's a web app for displaying scores of two teams in any competitions like debate. It also contains audio media for the score.
CSS
1
star
67

Learning-React

Excited to learn React.JS
JavaScript
1
star
68

celeb-diwali

A simple node module which generates Diwali Wishes randomly.
JavaScript
1
star
69

newrelic-nerdgraph-client

An API client for NerdGraph—the GraphQL API of New Relic. Supports both synchronous and asynchronous NRQL queries.
JavaScript
1
star
70

Mobile-Portfolio

Bootstrap theme for portfolio
JavaScript
1
star
71

miTweet

miTweet generates link to your message. Whoever clicks on the link will have the message automatically added to their Twitter status box and they can simply tweet it.
PHP
1
star