├── requirements.txt ├── LICENSE ├── CONTRIBUTING.md ├── SECURITY.md ├── README.md ├── .gitignore └── lightcc.py /requirements.txt: -------------------------------------------------------------------------------- 1 | braintree==4.9.0 2 | dotenv==0.19.1 3 | python-dotenv==0.19.0 4 | requests==2.26.0 5 | re==2.2.1 6 | datetime==4.3 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Amin Mousavi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to LightCC 2 | 3 | We welcome contributions to LightCC! Here are some guidelines to follow when contributing: 4 | 5 | ## Reporting Issues 6 | If you encounter a bug or an issue with LightCC, please open an issue on our GitHub repository with a clear description of the problem, along with any relevant error messages or code snippets. 7 | 8 | ## Feature Requests 9 | If you have an idea for a new feature or enhancement, please open an issue on our GitHub repository with a clear description of the proposed feature or enhancement. 10 | 11 | ## Pull Requests 12 | We welcome pull requests for bug fixes, new features, and enhancements. Before submitting a pull request, please make sure to: 13 | 14 | - Fork the repository and create a new branch for your changes 15 | - Write clear and concise commit messages 16 | - Follow the PEP 8 style guide for Python code 17 | - Include documentation and tests for your changes 18 | 19 | We will review your pull request as soon as possible and provide feedback. Once your pull request is accepted, we will merge it into the main branch and include it in the next release of LightCC. 20 | 21 | Thank you for your contributions to LightCC! 22 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | If you believe you've found a security vulnerability in our project, we encourage you to let us know right away. We will investigate all legitimate reports and do our best to quickly fix the problem. 6 | 7 | To report a security issue, please email us directly at chrisdante042@proton.me with a description of the issue and any related information that could help us reproduce it. Please do not disclose any details of the vulnerability publicly until we have had a chance to investigate and address it. 8 | 9 | We take security very seriously and appreciate your help in maintaining the security of our project. 10 | 11 | 12 | ## Supported Versions 13 | 14 | We are committed to providing security updates for our project on the following versions: 15 | 16 | - The latest stable release 17 | - The most recent major release for up to 12 months after the release of the subsequent major release 18 | 19 | If you are running an older version, we strongly recommend upgrading to a supported version to ensure you receive security updates. 20 | 21 | ## Acknowledgments 22 | 23 | We would like to thank the following individuals and organizations for reporting security vulnerabilities in our project: 24 | 25 | - [Emen M.](https://github.com/emenmousavi) 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LightCC 2 | LightCC is a Python-based tool that validates credit card numbers, tests payment processing, and obtains details about a given credit card. Please note that this tool is for educational purposes only. 3 | 4 | ## Requirements 5 | LightCC requires Python 3.x and the following Python packages: 6 | - requests 7 | - braintree 8 | - python-dotenv 9 | 10 | 11 | You can install these dependencies using the following command: 12 | ``` 13 | pip install -r requirements.txt 14 | ``` 15 | 16 | ## Usage 17 | To use LightCC, you can run the script from the command line using the following command: 18 | ``` 19 | python lightcc.py 20 | ``` 21 | 22 | The script will prompt you to choose from a menu of options, including validating a credit card number, testing payment processing, and obtaining credit card details. 23 | 24 | ## Options 25 | 26 | - Validate a credit card number 27 | - This option prompts you to enter a credit card number, which will be validated using the BINList API. 28 | 29 | - Test payment processing 30 | - This option prompts you to enter a credit card number and an amount, and then submits a payment request to a test payment processing endpoint. 31 | 32 | - Get credit card details 33 | - This option will prompt you to enter a credit card number and will return details about the credit card, including the card scheme, type, brand, and issuing country. 34 | 35 | ## Credits 36 | LightCC was developed by Emen M. and is licensed under the [MIT license](https://github.com/emenmousavi/LightCC/blob/main/README.md). 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.pyc 4 | *.pyo 5 | *$py.class 6 | 7 | # C extensions 8 | *.so 9 | 10 | # Distribution / packaging 11 | .Python 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | pip-wheel-metadata/ 25 | share/python-wheels/ 26 | *.egg-info/ 27 | .installed.cfg 28 | *.egg 29 | MANIFEST 30 | 31 | # PyInstaller 32 | # Usually these files are written by a python script from a template 33 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 34 | *.manifest 35 | *.spec 36 | 37 | # Installer logs 38 | pip-log.txt 39 | pip-delete-this-directory.txt 40 | 41 | # Unit test / coverage reports 42 | htmlcov/ 43 | .tox/ 44 | .nox/ 45 | .coverage 46 | .coverage.* 47 | .cache 48 | nosetests.xml 49 | coverage.xml 50 | *.cover 51 | *.py,cover 52 | .hypothesis/ 53 | .pytest_cache/ 54 | 55 | # Translations 56 | *.mo 57 | *.pot 58 | 59 | # Django stuff: 60 | *.log 61 | local_settings.py 62 | db.sqlite3 63 | db.sqlite3-journal 64 | 65 | # Flask stuff: 66 | instance/ 67 | .webassets-cache 68 | 69 | # Scrapy stuff: 70 | .scrapy 71 | 72 | # Sphinx documentation 73 | docs/_build/ 74 | 75 | # PyBuilder 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | .python-version 87 | 88 | # pipenv 89 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 90 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 91 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 92 | # install all needed dependencies. 93 | #Pipfile.lock 94 | 95 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 96 | __pypackages__/ 97 | 98 | # Celery stuff 99 | celerybeat-schedule 100 | celerybeat.pid 101 | 102 | # SageMath parsed files 103 | *.sage.py 104 | 105 | # Environments 106 | .env 107 | .venv 108 | env/ 109 | venv/ 110 | ENV/ 111 | env.bak/ 112 | venv.bak/ 113 | 114 | # Spyder project settings 115 | .spyderproject 116 | .spyproject 117 | 118 | # Rope project settings 119 | .ropeproject 120 | 121 | # mkdocs documentation 122 | /site 123 | 124 | # mypy 125 | .mypy_cache/ 126 | .dmypy.json 127 | dmypy.json 128 | 129 | # Pyre type checker 130 | .pyre/ 131 | 132 | # API keys 133 | .env 134 | -------------------------------------------------------------------------------- /lightcc.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | import re 3 | import requests 4 | import braintree 5 | import os 6 | from dotenv import load_dotenv 7 | 8 | def main(): 9 | choice = main_menu() 10 | if choice == '1': 11 | validate_credit_card_number() 12 | elif choice == '2': 13 | get_credit_card_details() 14 | elif choice == '3': 15 | process_payment() 16 | elif choice == '4': 17 | return 18 | else: 19 | print("[-] Invalid choice, please try again") 20 | 21 | def main_menu(): 22 | print("​🇹​​🇭​​🇮​​🇸​ ​🇵​​🇷​​🇴​​🇬​​🇷​​🇦​​🇲​ ​🇲​​🇦​​🇩​​🇪​ ​🇧​​🇾​ ❝​🇪​​🇲​​🇪​​🇳​ ​🇲​​🇴​​🇺​​🇸​​🇦​​🇻​​🇮​❝") 23 | print("Please choose an option:") 24 | print("1. Validate a credit card number") 25 | print("2. Get credit card details") 26 | print("3. Process a payment using Stripe") 27 | print("4. Exit") 28 | choice = input("Enter your choice: ") 29 | return choice 30 | 31 | def validate_credit_card_number(): 32 | credit_card_number = input("Enter the credit card number to validate: ") 33 | if validate(credit_card_number): 34 | print("[+] Valid credit card number") 35 | else: 36 | print("[-] Invalid credit card number") 37 | 38 | def get_credit_card_details(card_number): 39 | url = f"https://lookup.binlist.net/{card_number}" 40 | response = requests.get(url) 41 | 42 | if response.status_code == 404: 43 | return "Invalid card number" 44 | 45 | data = response.json() 46 | scheme = data["scheme"] 47 | card_type = data["type"] 48 | brand = data["brand"] 49 | country = data["country"]["name"] 50 | 51 | print(f"Scheme: {scheme}") 52 | print(f"Type: {card_type}") 53 | print(f"Brand: {brand}") 54 | print(f"Issuing country: {country}") 55 | 56 | expiration_date = input("Enter the expiration date (MM/YY): ") 57 | if not re.match(r"^\d{2}/\d{2}$", expiration_date): 58 | raise ValueError("Invalid expiration date format. Please enter in MM/YY format.") 59 | 60 | month, year = expiration_date.split("/") 61 | month = int(month) 62 | year = int(year) 63 | 64 | if month > 12 or month < 1: 65 | raise ValueError("Invalid month. Please enter a value between 01 and 12.") 66 | 67 | current_year = datetime.datetime.now().year % 100 68 | if year < current_year or year > current_year + 10: 69 | raise ValueError("Invalid year. Please enter a value between {current_year} and {current_year + 10}.") 70 | 71 | print(f"Expiration date: {month}/{year:02}") 72 | 73 | def process_payment(): 74 | card_number = input("Enter your credit card number: ") 75 | expiration_date = input("Enter your expiration date (MM/YY): ") 76 | exp_month, exp_year = expiration_date.split("/") 77 | cvv = input("Enter your CVV code: ") 78 | amount = input("Enter the payment amount (Write it in cents): ") 79 | 80 | # Load environment variables from .env file 81 | load_dotenv() 82 | 83 | # Prompt the user to enter their Braintree API credentials 84 | while True: 85 | merchant_id = input("Enter your Braintree Merchant ID: ") 86 | public_key = input("Enter your Braintree Public Key: ") 87 | private_key = input("Enter your Braintree Private Key: ") 88 | if not(merchant_id and public_key and private_key): 89 | print("Error: API keys are missing or incorrect. Please enter the correct values:") 90 | merchant_id = input("Enter your Merchant ID: ") 91 | public_key = input("Enter your Public Key: ") 92 | private_key = input("Enter your Private Key: ") 93 | os.environ['MERCHANT_ID'] = merchant_id 94 | os.environ['PUBLIC_KEY'] = public_key 95 | os.environ['PRIVATE_KEY'] = private_key 96 | try: 97 | gateway = braintree.BraintreeGateway( 98 | braintree.Configuration( 99 | environment=braintree.Environment.Sandbox, 100 | merchant_id=merchant_id, 101 | public_key=public_key, 102 | private_key=private_key 103 | ) 104 | ) 105 | break 106 | except Exception as e: 107 | print(f"[-] Error: Failed to initialize gateway with the provided API keys. {e}") 108 | os.environ['MERCHANT_ID'] = '' 109 | os.environ['PUBLIC_KEY'] = '' 110 | os.environ['PRIVATE_KEY'] = '' 111 | 112 | gateway = braintree.BraintreeGateway( 113 | braintree.Configuration( 114 | environment=braintree.Environment.Sandbox, 115 | merchant_id=merchant_id, 116 | public_key=public_key, 117 | private_key=private_key 118 | ) 119 | ) 120 | 121 | result = gateway.transaction.sale({ 122 | "amount": amount, 123 | "credit_card": { 124 | "number": card_number, 125 | "expiration_date": expiration_date, 126 | "cvv": cvv 127 | } 128 | }) 129 | 130 | if result.is_success: 131 | print("Payment processed successfully") 132 | else: 133 | print(result.message) 134 | 135 | def validate(card_number): 136 | # Luhn Algorithm 137 | r = [int(ch) for ch in str(card_number)][::-1] 138 | x = sum(r[0::2]) + sum(sum(divmod(d * 2, 10)) for d in r[1::2]) 139 | return x % 10 == 0 140 | 141 | if __name__ == '__main__': 142 | main() 143 | --------------------------------------------------------------------------------