PORTSCANNING-IN-PYTHON - A python threaded portscanner to scan websites and ipaddresses

Overview

PORTSCANNING-IN-PYTHON

This is a python threaded portscanner to scan websites and ipaddresses.

To run the script:

git clone the file.

chmod +x portscanner.py

python portscanner.py

PORTSCANNING IN PYTHON 1 PORTSCANNING IN PYTHON Portscanning refers to locating “listening” TCP or UDP ports and obtaining sufficient information about the device from the ports. Port scanning involves the transmission of TCP segments or UDP datagrams to interesting port numbers at a given IP address. Our goal when port scanning is to answer three questions regarding the server;

  1. What ports are open?
  2. What services are running on these ports?
  3. What versions of those services are running? PYTHON SCRIPT 💡 You need basic python skills and an understanding of threading, the Queue module, and the socket module to understand the script better. First things first, Import the modules

from queue import Queue import socket import time import threading import pyfiglet import os from datetime import datetime

The main module is the socket module. This module provides access to the BSD socket interface.

clear=lambda : os.system('clear') clear()

PORTSCANNING IN PYTHON 2 Use os.system(’cls’) for windows. This will blank the screen once you run the script.

banner=pyfiglet.figlet_format("MINUTEBOSS") print (banner)

This creates a banner with the name MINUTEBOSS, feel free to change it and add fonts and styles of your liking.

print("1.Scan ipaddress.\n") print("2.Scan website.\n") choice=input("Enter option:") if choice=='1': target=input("Enter ipaddress to scan:") if choice=='2': website=input("Enter hostname to scan:") target=socket.gethostbyname(website)

Get the target ip or website name to scan. socket.gethostbyname() gets the ip of a website.

print ("Scanning target:" + target) print ("Scanning started at:"+str(datetime.now())) print ("-" * 50) q = Queue() open_ports = []

The first 3 print statements display information about the target and starting time. We use q to work with the Queue module. We define a list (open_ports) to store the list of open ports.

def portscan(port): try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((target, port)) return True except: return False

PORTSCANNING IN PYTHON 3 The function portscan tries to connect to the given ports which we will introduce later. A pair (target, port) is used for the AF_INET address family, where the target is a string representing an IPv4 address like '100.50.200.5' , and port is an integer.

def get_ports(): for port in range(1,65535): q.put(port)

We queue the ports using this function. We also define all ports in this function. You can change the range to scan specified ports of your liking.

def portguy(): while not q.empty(): port = q.get() if portscan(port): print("Port {} is open!".format(port)) open_ports.append(port) else: pass

This function checks whether the queue is empty, if not an if statement checks the return value of the portscan function for different given ports. This is easily managed using the Queue module. Open ports are appended on the open_ports list. For closed ports nothing is done.

def run_scanner(threads): get_ports() thread_list = [] for t in range(threads): thread = threading.Thread(target=portguy) thread_list.append(thread) for thread in thread_list: thread.start() for thread in thread_list: thread.join()

PORTSCANNING IN PYTHON 4

print("Open ports are:", open_ports)

In this function we call the get_ports() function, create a threading list and start threading. The portguy function is our target for threading. After threading we print the open ports list. For this function we have to pass number of ports to be scanned per second as an argument.

run_scanner(700) Different machines perform differently, for me 700 was a good choice.

contact me @[email protected]

A tool to flash .ofp files in bootloader mode without needing MSM Tool, an alternative to official realme tool

Oppo/Realme Flash .OFP File on Bootloader A tool to flash .ofp files in bootloader mode without needing MSM Tool, an alternative to official realme to

Italo Almeida 70 Jan 02, 2023
Prop-based map editor for the Apex Legends mod, R5Reloaded

R5R Map Editor A tool to build maps out of props in the Apex Legends mod, R5Reloaded Instuctions Install R5R Download this program Get the prop spawne

7 Dec 16, 2022
Notebooks for computing approximations to the prime counting function using Riemann's formula.

Notebooks for computing approximations to the prime counting function using Riemann's formula.

Tom White 2 Aug 02, 2022
Import Apex legends mprt files exported from Legion

Apex-mprt-importer-for-Blender Import Apex legends mprt files exported from Legion. REQUIRES CAST IMPORTER Usage: Use a VPK extracter to extract the m

15 Dec 18, 2022
peace-performance (Rust) binding for python. To calculate star ratings and performance points for all osu! gamemodes

peace-performance-python Fast, To calculate star ratings and performance points for all osu! gamemodes peace-performance (Rust) binding for python bas

9 Sep 19, 2022
Скрипт позволяет заводить задачи в Панель мониторинга YouTrack на основе парсинга сайта safe-surf.ru

Скрипт позволяет заводить задачи в Панель мониторинга YouTrack на основе парсинга сайта safe-surf.ru

Bad_karma 3 Feb 12, 2022
Retrying is an Apache 2.0 licensed general-purpose retrying library, written in Python, to simplify the task of adding retry behavior to just about anything.

Retrying Retrying is an Apache 2.0 licensed general-purpose retrying library, written in Python, to simplify the task of adding retry behavior to just

Ray Holder 1.9k Dec 29, 2022
A python based app to improve your presentation workflow

Presentation Remote A remote made for making presentations easier by enabling all the members to have access to change the slide and control the flow

Parnav 1 Oct 28, 2021
In this project , I play with the YouTube data API and extract trending videos in Nigeria on a particular day

YouTubeTrendingVideosAnalysis In this project , I played with the YouTube data API and extracted trending videos in Nigeria on a particular day. This

1 Jan 11, 2022
Notes on the Deep Learning book from Ian Goodfellow, Yoshua Bengio and Aaron Courville (2016)

The Deep Learning Book - Goodfellow, I., Bengio, Y., and Courville, A. (2016) This content is part of a series following the chapter 2 on linear algeb

hadrienj 1.7k Jan 07, 2023
FantasyBballHelper - Espn Fantasy Basketball Helper

ESPN FANTASY BASKETBALL HELPER The simple goal of this project is to allow fanta

1 Jan 18, 2022
My collection of mini-projects in various languages

Mini-Projects My collection of mini-projects in various languages About: This repository consists of a number of small projects. Most of these "mini-p

Siddhant Attavar 1 Jul 11, 2022
dbt (data build tool) adapter for Oracle Autonomous Database

dbt-oracle version 1.0.0 dbt (data build tool) adapter for the Oracle database. dbt "adapters" are responsible for adapting dbt's functionality to a g

Oracle 22 Nov 15, 2022
Simple dotfile pre-processor with a per-file configuration

ix (eeks) Simple dotfile pre-processor with a per-file configuration Summary (TL;DR) ix.py is all you need config is an ini file. files to be processe

Poly 12 Dec 16, 2021
The bidirectional mapping library for Python.

bidict The bidirectional mapping library for Python. Status bidict: has been used for many years by several teams at Google, Venmo, CERN, Bank of Amer

Joshua Bronson 1.2k Dec 31, 2022
ioztat is a storage load analysis tool for OpenZFS

ioztat is a storage load analysis tool for OpenZFS. It provides iostat-like statistics at an individual dataset/zvol level.

Jim Salter 116 Nov 25, 2022
Identify and annotate mutations from genome editing assays.

CRISPR-detector Here we propose our CRISPR-detector to facilitate the CRISPR-edited amplicon and whole genome sequencing data analysis, with functions

hlcas 2 Feb 20, 2022
A python program to detect rickrolls with just the youtube link.

rickroll_detector A python program to detect rickrolls with just the youtube link. Usage: clone this repo or download zip run the main.py file with py

Tricky 4 Nov 06, 2022
Fused multiply-add (with a single rounding) for Python.

pyfma Fused multiply-add for Python. Fused multiply-add computes (x*y) + z with a single rounding. Useful for dot products, matrix multiplications, po

Nico Schlömer 18 Nov 08, 2022
GUI for the Gammu library.

Wammu GUI for the Gammu library. Homepage https://wammu.eu/ License GNU GPL version 3 or later. First start On first start you will be asked for set

Gammu 60 Dec 14, 2022