Security Libraries Python

Recon & Scanning

python-nmap
For Nmap scans

shodan
Accessing information from the search engine

socket
For custom port scans

scapy
Working with packets and scanning networks

masscan
High speed port scanner


Networking & Packet Manipulation

scapy
Sniffing, spoofing and scrutinizing packets

pcapy / pypcap
Capturing and scrutinizing network traffic

dpkt
Quick packet generation and analysis

netifaces
Interface for obtaining network information


Cryptography & Hashing

hashlib
Hash functions (MD5, SHA1, SHA256)

Cryptography
High-level cryptography

pycryptodome
Full-featured crypto library

bcrypt
Password hashing

passlib
Password hashing framework


Web Security & Automation

requests
Send HTTP requests for APIs and endpoint testing

beautifulsoup4
Handles HTML for web scraping and XSS testing

mechanize
Automate interactions with web forms

selenium
Automate web browsers to perform advanced testing tasks


OSINT & Intelligence

whois
Domain WHOIS lookups

dnspython
DNS queries

ipwhois
WHOIS for IP addresses

shodan
Searches for devices that are connected to the internet

virustotal-python
VirusTotal API for file and URL scanning

abuseipdb
Checks if IPs are a target

haveibeenpwned
Checks email or domain breaches via API


Forensics & Analysis

python-magic
Identifies file types

pytsk3
File system analysis

dfvfs
Analyzes the disk and file system structures

pyexif
Extracts image information

yara-python
Matches malware patterns


Automation & Remote Access

paramiko
SSH connections and running commands

pexpect
Automating command-line tools

apscheduler
Running tasks that have a schedule

keyboard / pynput
Working with keyboard input