Skip to main content

Hii everyone My name is MJM AKA Mohammad Juned Malik , it's going to be my second project which i am going to avail this publically and don't mind my english or it's grammar if anything goes wrong while writing and I have written this code as most simplest form as possible so anyone who knows some basic python, OOPs(Class) and it's methods and python libraries can easily understand this project also mostly i have imported files from one other so don't get confused and i have written some comments also in some files , so let's start our project description :-

PatchLens - Web Security Assessment & Fix Verification Engine

██████╗ █████╗ ████████╗ ██████╗██╗ ██╗██╗ ███████╗███╗ ██╗███████╗ ██╔══██╗██╔══██╗╚══██╔══╝██╔════╝██║ ██║██║ ██╔════╝████╗ ██║██╔════╝ ██████╔╝███████║ ██║ ██║ ███████║██║ █████╗ ██╔██╗ ██║███████╗ ██╔═══╝ ██╔══██║ ██║ ██║ ██╔══██║██║ ██╔══╝ ██║╚██╗██║╚════██║ ██║ ██║ ██║ ██║ ╚██████╗██║ ██║███████╗███████╗██║ ╚████║███████║ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═══╝╚══════╝ [+] Find. Explain. Fix. Verify. [+]

It's an Web security scanner that's can that find easily but the different is that normail scanner only scans and list warning one time and forgets but the Patchlens web security scanner that not only audit websites butttt... it also save previous scans by sqlite database to check whether the any problem or vulnerability is fixed or it's reappearing/ reopening over time. and now below here is how it get it done :-

  1. BodyGuard and Crawler (AKA scope.py & crawler.py) : it validates/checks the given or targeted url and runs a bounded breadth first search (BFS) , crawler strictly stays on the main domain not looking into external links
  2. Security Auditer/Checker (AKA patchlens/checks) : it checks every header, weak cookie, insecure mix content and tls/ssh certifications
  3. Fix verification Engine (AKA historydb.py) : it stores findings in sqlite database using SHA-256 fingerprint, it even rescans the target and compares them with previous scan automatically and generates or tell us whether a issue is new, open , resolved or reopened
  4. Reporter and CLI (AKA reporter.py & main.py) : it presents the summary in the terminall cleanly with an banner (if you are curious about banner you can look up and see the very big Patchlens written that's the banner ) , it counts severity level and generates an report in json .

What i have build till now:-

-Strict scope boundaries : it rejects rejects external domain, sub-domain and protocols like:- mailto:, tel: and javascript: -Web crawler : it configures page count and crawling depth of it with url normalization -Http security audit/check : it checks misconfigured or missing x-frame options , hsts(strict transfer policy), csp (content security policy) x-content type options , referrer policy and the leaked server banner tokens -Cookie security analyzer : it checks/audit cookie header for missing secure, httponly and samesite -Mixed content detector : it raises insecure http scripts, stylesheets and iframe options from inside https pages -TLS/SSH Verification : it checks https availability, validation, expiration and also redirecting http to https -Stable Fingerprinting : it involves 16 characters SHA-256 hashes so findings can be tracked -Fix verfication lifecycle : it classifies findgings automatically in scans -Autometed tests : created tests for scope, checkers, and history

Files :-

-main.py : CLI and report export -patchlens/scope.py : it validated approved origins and ensures crawler focus on target domain -patchlens/http_client : safe rate-limited of http and wrapped with timeout & redirect protection http to https -patchlens/crawler.py : it bounded by bfs with depth and page limits -patchlens/findings.py : it normalized finding dataclasses with severity, confidence, stable SHA-256 fingerprinting and status tracking -patchlens/historydb.py : it's sqlite database and fix verification engine -patchlens/reporter.py : it summarize the findings by severity then prints output in the terminal and save it in json file -patchlens/checks/headers.py : it checks module of 6 for http header -patchlens/checks/cookies.py : check header of cookie for secure , httponly and samesite -patchlens/checks/mixed.py : it checks module detecting http resources loaded on web pages -patchlens/checks/tls.py : it checks for tls/ssl certificate and redirection -tests/test_scope.py : automated unit tests for url normalization and domain rules -tests/test_checks.py : automated unit tests for headers, cookies and mixed -tests/test_his.py : automated unit tests for sqlite and fix verification -requirement.txt : list of python dependencies Beautifulsoup, requests, pytest

What you need

-Linux/ macOS / Windows -Python 3.10 or higher

How to run it ! (write the commands in the terminal or just copy and paste)

1. set up ur virtual environment :

it creates virtual environment

python3 -m venv venv

activate virtual environment

source venv/bin/activate

install dependencies

pip install -r requirement.txt

2. Run a basic scan against a target url :

python main.py --target https://example.com

3. Run a proper scan and save in json :

python main.py --target https:example.com --max_pages 5 --max-depth 2 --json report.json

4. Run fix verification engine :

run the same scan on the same target and see the results

5. to run the automated unit tests:

python -m pytest tests/ -v

it's safe to use in the terminal , it's not going to hack your system anything it's safe and if any bug or error arises and if there is any updation can be done , let me know !

Metadata

Release files for patchlens 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for patchlens 0.1.0
File Size Uploaded Provenance Actions
patchlens-0.1.0.tar.gz 17.9 kB Without provenance Details for patchlens-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for patchlens 0.1.0
File Interpreter ABI Platform Actions
patchlens-0.1.0-py3-none-any.whl Python 3 none any Details for patchlens-0.1.0-py3-none-any.whl

Total release size: 37.3 kB

Release files / patchlens-0.1.0.tar.gz

Download URL patchlens-0.1.0.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
86a878f81c912376049c680e11a801acdc12f5ca4ac243cdc3e9e386cb84bedb
BLAKE2b-256 checksum
How to use checksums
afefdccc46da848a5b0c0ccb3b02c5852a9e72ab0dcf1db15d3bcee26e643d9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / patchlens-0.1.0-py3-none-any.whl

Download URL patchlens-0.1.0-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
406d478c13a975e5da9a32a2cce77fdae1f1b7fbd7645328125b545f18ddddbe
BLAKE2b-256 checksum
How to use checksums
98b265bfb0a6bcce6fd43ae82d2e8ff82a572ed0e6bf547ef84143b56f363325
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for patchlens 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page