Skip to content

Advanced Cybersec Tool: Fifteen Security Commands in One Python CLI

AdvancedCybersecTool is a Python command-line toolkit: fifteen commands behind one entry point, with one third-party dependency.

It covers port scanning and host discovery, HTTP header and TLS checks, file encryption, hashing, and password auditing. It is about 1,200 lines across eight files, and everything except encryption uses the standard library.

The scanning commands are for systems you own or are authorised to test. Every result quoted here came from my own machine, and the network ones from 127.0.0.1 only.

What each module does

  • Recon (scan, banner, discover, dns, subenum). A threaded TCP connect scanner, 100 threads by default, that names services from a 39-entry port table. Discovery counts a host as alive if port 80, 443, 22 or 8080 accepts or actively refuses a connection, since a refusal still means something answered. Subdomain enumeration tries 123 built-in names or your own wordlist.
  • Encryption (encrypt, decrypt, keygen). Fernet, from the cryptography library.
  • Hashing (hash, hashid, verify). MD5, SHA-1, SHA-256 and SHA-512. verify guesses the algorithm from the hash length and exits 0 or 1, so it works in scripts.
  • Passwords (passcheck, passgen). A rule-based score with an optional Have I Been Pwned lookup, and a generator built on Python's secrets module.
  • Web (headers, tlscheck). A nine-header audit with a letter grade, and a TLS check for protocol, cipher, expiry and SANs.

A global --json flag covers eleven of the commands, with a caveat further down.

How it works

The repo started in November 2025 as a scaffold: Nmap and Scapy wrappers around a scanner class whose methods were still empty. In February 2026 I replaced it with flat files and a plain socket scanner. By July the dependency list had gone from six packages to one, and most of today's code was committed that month.

Fernet is AES-128 in CBC mode with an HMAC-SHA256 tag, so a wrong key or a tampered file fails with an error instead of decrypting to garbage. The key is 32 random bytes, not derived from a password. If you do not pass one, the tool writes a new one to <file>.key with 0600 permissions. That is convenient, but by default the key sits next to the encrypted file, and the tool also prints it to the terminal. Files are read whole into memory, capped at 500 MB.

The breach check uses the Pwned Passwords range API. It hashes the password with SHA-1, sends only the first five hex characters, and matches the rest locally, so the password never leaves the machine. Without an argument the tool prompts with getpass, which keeps the password out of shell history.

The score itself is a checklist: points for length and for each character class, deductions for runs like aaa or 123, and zero for 35 common passwords. Checklists have blind spots, and this one shows them. Offline, Tr0ub4dor&3 scores 5 of 8 with no issues, while the 25-character passphrase correcthorsebatterystaple scores 4 and is flagged for having no capitals, digits or symbols. The entropy estimate, length times log2 of the character set, rates that passphrase at 117.5 bits, far more than four dictionary words are worth.

The header audit sends a HEAD request, checks nine headers such as Content-Security-Policy, grades on how many are present, and flags headers that reveal software versions. Against Python's built-in web server on localhost it scores 0 of 9, grade F, and points out that the Server header gives away the exact Python version.

Running it

git clone https://git.mocipher.com/m01/AdvancedCybersecTool.git
cd AdvancedCybersecTool
python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt

python main.py scan 127.0.0.1 -s 1 -e 1024
python main.py headers http://127.0.0.1:8888
python main.py passcheck --no-online
python main.py keygen -o notes.key
python main.py encrypt notes.txt -k notes.key
python main.py verify ubuntu.iso "$EXPECTED_SHA256" && echo OK

What I'd do next

Testing it for this write-up turned up a list:

  • Tests. There are none. The scaffold had two, written against stub code, and they were deleted with it.
  • Clean JSON. Seven commands print status lines to stdout before the JSON, so piping into jq fails. Those lines belong on stderr.
  • Exit codes. Only verify sets one. A missing file or a wrong decryption key exits 0.
  • Key handling. Stop printing generated keys, and never overwrite an existing key file: encrypting the same file a second time, to a different output name, replaced its key and left the first copy undecryptable. Add a passphrase option with a proper key derivation function.
  • TLS on bad certificates. After a failed verification the tool retries unverified, but Python then returns an empty certificate. Self-signed and expired certificates show N/A, and the EXPIRED warning can never fire. Parsing the raw certificate fixes it.
  • Header grading. Header names are matched case-sensitively, so a lowercase x-frame-options counts as missing. The grade should also weight severity and check values, not just presence.
  • Smaller things. Key lookup strips every .enc from the filename, not just the last one. The subdomain timeout never reaches the resolver, there is no wildcard DNS detection, and scanning is IPv4 only.