Skip to content

Conversation

@GYFX35
Copy link
Owner

@GYFX35 GYFX35 commented Sep 6, 2025

This commit introduces three new command-line cybersecurity tools to the repository, in response to the user's request to integrate tools for account access, data access, and hacking.

  1. Account Pwned Checker:

    • A tool to check if an email address has been part of a known data breach using the 'Have I Been Pwned?' API.
    • Includes the main script, a checker module, a requirements file, and a detailed README.
  2. Sensitive Data Scanner:

    • A tool to recursively scan a local directory for sensitive data patterns like API keys, private keys, and credit card numbers.
    • Includes the main script, a scanner module with regex patterns, and a README.
  3. Port Scanner:

    • A multi-threaded TCP port scanner to discover open ports on a target host.
    • Includes the main script, a scanner module, and a README with a legal disclaimer.

Additionally, the root index.html file has been overwritten with a new, clean landing page that serves as a central directory for all tools in the repository, including the newly added ones. This replaces the previous default React template.

Summary by Sourcery

Introduce three new command-line cybersecurity tools and overhaul the repository’s landing page to list and link to all available tools

New Features:

  • Add Account Pwned Checker CLI to query the 'Have I Been Pwned?' API for breached email accounts
  • Add Sensitive Data Scanner CLI to recursively detect sensitive information patterns in files
  • Add Port Scanner CLI to perform multi-threaded TCP port scans on target hosts

Enhancements:

  • Replace the default React template in index.html with a static landing page listing all tools in the repository

Documentation:

  • Provide README documentation for each newly added tool

This commit introduces three new command-line cybersecurity tools to the repository, in response to the user's request to integrate tools for account access, data access, and hacking.

1.  **Account Pwned Checker:**
    - A tool to check if an email address has been part of a known data breach using the 'Have I Been Pwned?' API.
    - Includes the main script, a checker module, a requirements file, and a detailed README.

2.  **Sensitive Data Scanner:**
    - A tool to recursively scan a local directory for sensitive data patterns like API keys, private keys, and credit card numbers.
    - Includes the main script, a scanner module with regex patterns, and a README.

3.  **Port Scanner:**
    - A multi-threaded TCP port scanner to discover open ports on a target host.
    - Includes the main script, a scanner module, and a README with a legal disclaimer.

Additionally, the root `index.html` file has been overwritten with a new, clean landing page that serves as a central directory for all tools in the repository, including the newly added ones. This replaces the previous default React template.
@sourcery-ai
Copy link

sourcery-ai bot commented Sep 6, 2025

Reviewer's Guide

This PR integrates three new Python-based CLI cybersecurity tools (Account Pwned Checker, Sensitive Data Scanner, and Port Scanner), each implemented with clear module separation, argument parsing, and accompanying documentation, and replaces the default React template in index.html with a custom landing page listing all repository tools.

File-Level Changes

Change Details Files
Add Account Pwned Checker CLI tool
  • Implemented pwned_main.py for command-line argument parsing and output formatting
  • Created pwned_checker/checker.py with HTTP interaction logic for the Have I Been Pwned API
  • Added pwned_checker/requirements.txt to declare the requests dependency
  • Authored README_pwned_checker.md to document setup, usage, and file structure
pwned_main.py
pwned_checker/checker.py
pwned_checker/requirements.txt
README_pwned_checker.md
Add Sensitive Data Scanner CLI tool
  • Implemented scanner_main.py for directory argument parsing and results display
  • Created sensitive_data_scanner/scanner.py with pre-compiled regex patterns for sensitive data detection
  • Authored README_sensitive_data_scanner.md detailing patterns, usage, and limitations
scanner_main.py
sensitive_data_scanner/scanner.py
README_sensitive_data_scanner.md
Add Port Scanner CLI tool
  • Implemented port_scanner_main.py to parse host/port range and thread count options
  • Created port_scanner/scanner.py using ThreadPoolExecutor for concurrent port scanning
  • Authored README_port_scanner.md with feature overview, examples, and legal disclaimer
port_scanner_main.py
port_scanner/scanner.py
README_port_scanner.md
Replace root index.html with a custom landing page
  • Removed default React/Vite template markup
  • Added custom HTML and inline CSS to list all security tools with links
  • Ensured new structure provides a central directory for existing and new tools
index.html

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@GYFX35 GYFX35 merged commit 5ec4c25 into main Sep 6, 2025
0 of 5 checks passed
@guardrails
Copy link

guardrails bot commented Sep 6, 2025

⚠️ We detected 1 security issue in this pull request:

Vulnerable Libraries (1)
Severity Details
Medium pkg:pypi/[email protected] upgrade to: 2.32.4

More info on how to fix Vulnerable Libraries in Python.


👉 Go to the dashboard for detailed results.

📥 Happy? Share your feedback with us.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

Blocking issues:

  • Identified a Private Key, which may compromise cryptographic security and sensitive data encryption. (link)

General comments:

  • In port_scanner_main.py the port parsing logic only uses the min and max values for scanning, so comma-separated or discrete port lists end up scanning the entire range instead of the exact ports specified—consider scanning exactly the user-provided ports.
  • The HIBP checker returns None for both a 'not found' result and for API errors, so the CLI can’t differentiate between no breaches and request failures—consider returning distinct error indicators or exceptions for error cases.
  • scan_file in the sensitive data scanner silently ignores all exceptions which may hide file read issues or permission errors—consider logging or otherwise surfacing errors to aid debugging.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In port_scanner_main.py the port parsing logic only uses the min and max values for scanning, so comma-separated or discrete port lists end up scanning the entire range instead of the exact ports specified—consider scanning exactly the user-provided ports.
- The HIBP checker returns None for both a 'not found' result and for API errors, so the CLI can’t differentiate between no breaches and request failures—consider returning distinct error indicators or exceptions for error cases.
- scan_file in the sensitive data scanner silently ignores all exceptions which may hide file read issues or permission errors—consider logging or otherwise surfacing errors to aid debugging.

## Individual Comments

### Comment 1
<location> `port_scanner/scanner.py:21` </location>
<code_context>
+    try:
+        s.connect((host, port))
+        return True
+    except (socket.timeout, ConnectionRefusedError, socket.gaierror, OSError):
+        return False
+    finally:
</code_context>

<issue_to_address>
Catching OSError may mask unexpected socket errors.

Handle only the specific exceptions relevant to connection failures to prevent masking unrelated errors.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
    try:
        s.connect((host, port))
        return True
    except (socket.timeout, ConnectionRefusedError, socket.gaierror, OSError):
        return False
    finally:
        s.close()
=======
    try:
        s.connect((host, port))
        return True
    except (socket.timeout, ConnectionRefusedError, socket.gaierror):
        return False
    finally:
        s.close()
>>>>>>> REPLACE

</suggested_fix>

### Comment 2
<location> `port_scanner_main.py:34` </location>
<code_context>
+
+    print(f"Scanning host {target_host} for open ports...")
+
+    # In this implementation, we will pass the start and end of the main range.
+    # A more complex implementation would handle disjointed lists of ports.
+    start_port = min(ports_to_scan)
+    end_port = max(ports_to_scan)
</code_context>

<issue_to_address>
Disjointed port lists are not handled accurately.

Currently, specifying ports like '80,443' results in scanning all ports between 80 and 443. Please update the logic to scan only the explicitly listed ports.
</issue_to_address>

## Security Issues

### Issue 1
<location> `sensitive_data_scanner/scanner.py:10` </location>

<issue_to_address>
**security (private-key):** Identified a Private Key, which may compromise cryptographic security and sensitive data encryption.

*Source: gitleaks*
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +18 to +24
try:
s.connect((host, port))
return True
except (socket.timeout, ConnectionRefusedError, socket.gaierror, OSError):
return False
finally:
s.close()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Catching OSError may mask unexpected socket errors.

Handle only the specific exceptions relevant to connection failures to prevent masking unrelated errors.

Suggested change
try:
s.connect((host, port))
return True
except (socket.timeout, ConnectionRefusedError, socket.gaierror, OSError):
return False
finally:
s.close()
try:
s.connect((host, port))
return True
except (socket.timeout, ConnectionRefusedError, socket.gaierror):
return False
finally:
s.close()

Comment on lines +34 to +35
# In this implementation, we will pass the start and end of the main range.
# A more complex implementation would handle disjointed lists of ports.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Disjointed port lists are not handled accurately.

Currently, specifying ports like '80,443' results in scanning all ports between 80 and 443. Please update the logic to scan only the explicitly listed ports.

Comment on lines +10 to +11
"RSA Private Key": re.compile(r"-----BEGIN RSA PRIVATE KEY-----"),
"SSH Private Key": re.compile(r"-----BEGIN OPENSSH PRIVATE KEY-----"),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (private-key): Identified a Private Key, which may compromise cryptographic security and sensitive data encryption.

Source: gitleaks

try:
s.connect((host, port))
return True
except (socket.timeout, ConnectionRefusedError, socket.gaierror, OSError):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Remove redundant exceptions from an except clause (remove-redundant-exception)

Suggested change
except (socket.timeout, ConnectionRefusedError, socket.gaierror, OSError):
except (socket.timeout, socket.gaierror, OSError):

Comment on lines +39 to +47
open_ports = scanner.scan_ports(target_host, start_port, end_port, max_workers=num_threads)

if not open_ports:
print("\n--- No Open Ports Found ---")
print(f"No open ports were found in the specified range on {target_host}.")
else:
print("\n--- Open Ports Found! ---")
for port in open_ports:
print(f" [+] Port {port} is open")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (code-quality): We've found these issues:

Comment on lines +10 to +12
breaches = checker.check_pwned(args.email)

if breaches:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use named expression to simplify assignment and conditional (use-named-expression)

Suggested change
breaches = checker.check_pwned(args.email)
if breaches:
if breaches := checker.check_pwned(args.email):

Comment on lines +35 to +36
matches = regex.findall(content)
if matches:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use named expression to simplify assignment and conditional (use-named-expression)

Suggested change
matches = regex.findall(content)
if matches:
if matches := regex.findall(content):

Comment on lines +60 to +61
file_findings = scan_file(filepath)
if file_findings:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use named expression to simplify assignment and conditional (use-named-expression)

Suggested change
file_findings = scan_file(filepath)
if file_findings:
if file_findings := scan_file(filepath):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants