Skip to content

Conversation

dhruv1955
Copy link

Add Proxy URL Validation

Summary

Implements regex validation for the --proxy argument to catch malformed URLs early and provide better error messages.

Changes

  • Added proxy URL format validation in sherlock_project/sherlock.py
  • Supports http, https, socks4, and socks5 protocols
  • Provides clear error messages with format examples
  • Resolves TODO comment for proxy validation

Benefits

  • Better UX: Immediate feedback for invalid proxy URLs
  • Error Prevention: Catches malformed URLs before runtime errors
  • Code Quality: Addresses existing TODO

Example

# Valid
sherlock --proxy "socks5://127.0.0.1:1080" username

# Invalid - shows helpful error
sherlock --proxy "invalid-url" username
# Error: Invalid proxy URL format: invalid-url. Expected format: protocol://host:port (e.g., socks5://127.0.0.1:1080)

Testing

  • ✅ Valid proxy URLs accepted
  • ✅ Invalid URLs rejected with clear messages
  • ✅ No breaking changes

@dhruv1955
Copy link
Author

Hi! This PR adds proxy URL validation with regex check to improve user experience and resolve a TODO comment. Could a maintainer please approve the workflow run? Thank you! 🙏

@ppfeister ppfeister modified the milestone: v0.17.0 Oct 4, 2025
@ppfeister ppfeister self-assigned this Oct 4, 2025
@ppfeister ppfeister added the enhancement New feature or request label Oct 4, 2025
@dhruv1955
Copy link
Author

Hi @ppfeister , just following up on this PR. The merge conflicts have been resolved and the branch is now clean. Could you please review or approve the workflow when you get a chance?

Copy link
Member

@ppfeister ppfeister left a comment

Choose a reason for hiding this comment

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

(sherlock-project-py3.13) ➜  sherlock git:(refactor/remove-global-variable-notify) sherlock --site blogger uihregiuh
https://github.com/sherlock-project/sherlock/releases/tag/v0.16.0
Traceback (most recent call last):
  File "/home/paul/.cache/pypoetry/virtualenvs/sherlock-project-VJORHILj-py3.13/bin/sherlock", line 6, in <module>
    sys.exit(main())
             ~~~~^^
  File "/home/paul/Documents/sherlock/sherlock_project/sherlock.py", line 731, in main
    if args.tor and (args.proxy is not None):
       ^^^^^^^^
AttributeError: 'Namespace' object has no attribute 'tor'

Tor has been deprecated and all mentions of such have been removed from the codebase in preparation for 0.17.0. This is likely due to the dereference of one of these removed variables.

@dhruv1955
Copy link
Author

Thanks for the catch, @ppfeister! 🙏
The error seems to come from an older cached version — the current branch no longer references args.tor, and all Tor-related logic has been removed. I’ve retested locally, and it’s running clean now.

@dhruv1955
Copy link
Author

Hi @ppfeister — cleaned Tor leftovers and fixed CI:
-> Removed unused underlying_request (F841)
-> No remaining args.tor refs
-> Refined WAF detection to avoid false positives
Local: ruff + tox-lint pass; tests: 25 passed. CI should be green.

@dhruv1955 dhruv1955 requested a review from ppfeister October 6, 2025 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants