├── README.md └── rfc822_email_validator.py /README.md: -------------------------------------------------------------------------------- 1 | RFC822 Email Validator 2 | ===================== 3 | 4 | A simple, offline Python tool for validating email addresses against the RFC822 standard. 5 | Perfect for quick checks, integration into scripts, or security testing of email input fields. 6 | 7 | Features 8 | -------- 9 | - RFC822-compliant: Uses a regular expression closely matching the RFC822 specification. 10 | - Offline: No network connection required. 11 | - Easy to use: Just run the script and enter an email address. 12 | - Security Testing: Useful for testing input validation, including XSS payloads. 13 | 14 | Usage 15 | ----- 16 | 1. Clone the repository or download the script: 17 | git https://github.com/coffinxp/RFC822-Email-Validator.git) 18 | cd RFC822-Email-Validator 19 | 20 | 2. Run the script: 21 | python3 rfc822_email_validator.py 22 | 23 | 3. Enter the email address you want to validate when prompted. 24 | 25 | 4. Result: 26 | The script will print "RFC822 valid: YES" if the email is valid, or "RFC822 valid: NO" if not. 27 | 28 | Example 29 | ------- 30 | $ python3 rfc822_email_validator.py 31 | Enter email address: test@example.com 32 | RFC822 valid: YES 33 | 34 | $ python3 rfc822_email_validator.py 35 | Enter email address: ">@test.com 36 | RFC822 valid: NO 37 | 38 | ![Screenshot (1397)](https://github.com/user-attachments/assets/6a3ab9a6-efac-43f7-b315-061a97968821) 39 | 40 | Security Testing 41 | ---------------- 42 | You can use this tool to test how your application handles potentially malicious email input, such as XSS payloads. 43 | Example payloads to try: 44 | - ">@test.com 45 | - ">@test.com 46 | - ">"@x.y 47 | 48 | Requirements 49 | ------------ 50 | - Python 3.x 51 | 52 | --- 53 | Inspired by the classic RFC822 email validation tools and designed for modern security testing workflows. 54 | -------------------------------------------------------------------------------- /rfc822_email_validator.py: -------------------------------------------------------------------------------- 1 | import re 2 | from colorama import init, Fore, Style 3 | 4 | # Initialize colorama 5 | init(autoreset=True) 6 | 7 | # RFC822-compliant regex (simplified for practical use) 8 | RFC822_REGEX = re.compile( 9 | r"^(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*" 10 | r'|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")' 11 | r"@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$" 12 | ) 13 | 14 | def is_rfc822_valid(email): 15 | return bool(RFC822_REGEX.match(email)) 16 | 17 | if __name__ == "__main__": 18 | email = input("Enter email address: ").strip() 19 | if is_rfc822_valid(email): 20 | print(f"RFC822 valid: {Fore.GREEN}YES{Style.RESET_ALL}") 21 | else: 22 | print(f"RFC822 valid: {Fore.RED}NO{Style.RESET_ALL}") 23 | --------------------------------------------------------------------------------