Releases: fled-dev/CryptoDrain
Version 1.4
Key Enhancements
Modularization & Code Refactoring
- Configuration Management: Introduced a dedicated
Configclass to load and manage configuration fromconfig.jsonwith support for environment variable overrides. - Wallet Operations: Created a
WalletManagerclass that encapsulates wallet creation and sweeping operations, improving testability and separation of concerns. - Code Organization: Refactored functions into clearly defined sections and modules, adhering to PEP 8 and PEP 20 best practices.
Security Improvements
- Sensitive Data Handling: Sensitive information such as wallet seed phrases is now masked in logs and notifications.
- Environment Overrides: Sensitive configuration values (e.g., Telegram API key, channel ID, host IP/port) can now be provided via environment variables.
- Input Validation: Enhanced input validation and sanitization to prevent XSS and ensure proper formatting of API keys, seed phrases, and addresses.
Performance & Scalability
- IP Lookup Caching: Implemented caching of IP lookup details per request to reduce redundant external API calls.
- Asynchronous Operations: Applied Gevent monkey patching to enable non-blocking I/O operations and improved concurrency.
- Health-Check Endpoint: Added a
/healthendpoint to facilitate monitoring and load balancing.
Error Handling & Logging
- Improved Exception Handling: Specific exceptions are now caught instead of using bare
except:clauses, ensuring errors are logged with context and stack traces. - Structured Logging: Refined logging practices to clearly indicate when sensitive data is involved, without exposing it.
Documentation & Maintainability
- Docstrings & Comments: Added comprehensive docstrings and inline comments across the codebase for better clarity.
- PEP 8 Compliance: Reformatted code to adhere to Pythonic best practices and maintain consistency across the project.
Breaking Changes
- Configuration File Updates: The JSON configuration file now includes additional fields: HOST_IP and HOST_PORT. Users must update their api/config.json or supply these values via environment variables.
- Sensitive Logging: Sensitive information (e.g., wallet seed phrases) is now redacted in logs and notifications. Ensure that any downstream systems or alerts are adjusted accordingly.
Version 1.3.0
What's Changed
- Logging setup: Added logging configuration using RotatingFileHandler.
- Flask integration: Integrated Flask framework for handling API requests.
- API Input validation: Implemented input validation for api_key, seed phrase, receiver address, and balance.
- API Improvements: Enhanced error handling and added detailed logging.
- Notifications: Added notifications for wallet operations.
- Error Handling: Updated messages for clarity and improved response handling.
Full Changelog: v1.2.2...v1.3.0
Version 1.2.2
What's Changed
- Detected Security Issue: The system audit has identified that there is binding to all network interfaces using hardcoded values. This practice can lead to potential security vulnerabilities as it exposes the system to unnecessary risks. Immediate attention and remediation are advised to enhance security.
Full Changelog: v1.2.1...v1.2.2
Version 1.2.1
What's Changed
- refactor: remove unnecessary whitespace by @deepsource-autofix in #19
- refactor: add newline at end of file by @deepsource-autofix in #20
- refactor: refactor unnecessary
else/elifwhenifblock has areturnstatement by @deepsource-autofix in #21 - refactor: use identity check for comparison to a singleton by @deepsource-autofix in #22
- refactor: remove unnecessary parentheses after keyword by @deepsource-autofix in #25
Full Changelog: v1.2.0...v1.2.1
Version 1.2.0
What's Changed
-
Additional Imports: The script now includes imports for
json,os,pyfiglet,time, andgevent.pywsgi. -
Boot Screen Functionality: There is a new function
boot_screenthat seems to be designed for displaying a startup screen or banner when the application is launched. It usespyfigletfor ASCII art and includes code for clearing the screen and printing in a specific color (orange). -
WSGIServer from gevent: The import of
WSGIServerfromgevent.pywsgisuggests that there might be a change in how the Flask app is served, potentially for improved performance or concurrency handling. -
Version Information and Banner Customization: The
boot_screenfunction includes code for displaying version information ("Version 1.2.0") and a custom banner with the developer's handle (@fled-dev). This addition enhances the user interface and provides immediate visibility of the application version. -
Enhanced Logging Functionality: A new function
loghas been introduced. It appears to handle logging messages with timestamps. This function is likely used to create or append to alogfile.txt, providing a detailed and time-stamped record of events and operations. -
Use of
datetimefor Timestamps: The script now involves the use ofdatetime(presumably imported) for generating current date and time, which is then formatted and included in log entries. -
Config File Handling: The new version includes a
get_configfunction to manage the application's configuration settings. This function reads aconfig.jsonfile, presumably containing key settings like API keys, server configuration, etc. -
Improved Log Management: Before reading the
config.jsonfile, the script checks for an existinglogfile.txtand deletes it if present. This step ensures that each session starts with a fresh log file, making it easier to track current session activities without confusion from previous logs. -
Enhanced Error Handling and Logging in Config Management: The script includes error handling for cases where the
logfile.txtdoes not exist and logs relevant messages, ensuring smoother operation and better traceability of events. -
Global Variable Definition from Configuration: The
get_configfunction now sets global variables based on the contents of theconfig.jsonfile. Variables such asFLASK_API_KEYS,TG_API_KEY,TG_CHANNEL_ID, andTG_NOTIFICATIONSare being initialized, suggesting a more dynamic and configurable approach to managing API keys and Telegram integration settings. -
Enhanced Configuration Management: The script logs the process of assigning configuration values to global variables, enhancing traceability and debugging capabilities. This approach indicates a move towards a more modular and configurable application design.
-
Refined Telegram Notification Function (
tg_notify):- The updated
tg_notifyfunction includes checks to ensure Telegram notifications are enabled (TG_NOTIFICATIONS). - The function now verifies the presence of the Telegram API key (
TG_API_KEY) and channel ID (TG_CHANNEL_ID) before proceeding with sending notifications. - If either the API key or the channel ID is missing, the function logs an error and returns without attempting to send a notification.
- The updated
-
Enhanced Telegram Notification Sending Logic:
- The
tg_notifyfunction now logs a message before sending a notification, improving transparency in the notification process. - The Telegram API URL is constructed using the
TG_API_KEY, and the notification is sent using a POST request. - After sending the notification, the script logs a confirmation message, ensuring that notification delivery attempts are tracked.
- Exception handling is included to capture and log any failures in sending Telegram notifications, enhancing the robustness and reliability of this feature.
- The
-
IP Location and Current IP Functions:
- The script includes enhanced IP location and current IP retrieval functions with improved logging. This will help in tracking and logging the IP addresses of API users.
-
Updated API Endpoint Implementation:
- The
/apiroute now includes additional logging for actions like reading the API key, checking its validity, and obtaining the seed phrase and receiver. - Enhanced Telegram notification integration within the API route, providing detailed status updates for various stages of API interaction.
- The
-
Execution Flow in Main Function:
- The script now starts with a boot screen and reads the configuration using
get_config. - It defines the host IP and port for the Flask server (set to '0.0.0.0' and 8080 respectively).
- Implements a WSGI server using
geventfor running the Flask app, which can offer better performance and handle concurrent requests more efficiently.
- The script now starts with a boot screen and reads the configuration using
-
WSGIServer for Flask App:
- The use of
WSGIServerfromgevent.pywsgifor running the Flask app suggests a move towards a more production-ready setup. This server can handle multiple simultaneous requests, making it more suitable for real-world deployment than the default Flask server.
- The use of
-
Comprehensive Error Handling and Logging:
- The main function includes comprehensive error handling and logging, ensuring robustness in the application's execution and startup process.
Full Changelog: v1.1.0...v1.2.0
Version 1.1.0
What's Changed
-
Enhanced Import Statements: Added imports for
requestsandurllib.request, expanding the functionality for network operations and external requests. -
Configuration Updates:
- Introduced new variables
valid_api_keys,api_key, andchannel_idfor API key validation and Telegram integration. - Automated host IP detection using
urllib.request.urlopen.
- Introduced new variables
-
Telegram Notifications:
- Implemented a
tg_notifyfunction for sending notifications to a specified Telegram channel using the Telegram Bot API. - Integrated Telegram notifications at various stages of the API process, including connection attempts, wallet creation, and sweeping outcomes.
- Implemented a
-
IP Location Tracking:
- Added the
ip_locationfunction to determine the geographical location of the IP address making the API request. - Used
requests.getto fetch location data from an external IP location service.
- Added the
-
Enhanced API Endpoint (
/api) Functionality:- Improved error handling with redirection to
http://www.blockchain.comfor specific failure scenarios. - Introduced detailed logging of errors and critical events in
logfile.txt. - Enhanced security checks for valid API keys and handling unauthorized access attempts.
- Improved error handling with redirection to
-
Sweep Function Improvements:
- The
sweepfunction now includes enhanced error handling and logging. - Added notifications for different stages of the wallet sweeping process, including wallet creation, success, and failure scenarios.
- The
-
Dynamic Host and Port Configuration for Flask App:
- Flask app now automatically determines the host IP and sets the port to '5000'.
- Error handling for Flask server startup issues with logging and Telegram notification.
-
Overall Error Handling and Logging Enhancements:
- Improved overall robustness with comprehensive error capturing and handling mechanisms.
- Systematic logging of critical errors and operational information in
logfile.txtand via Telegram notifications.
Full Changelog: v1.0.0...v1.1.0
Version 1.0.0
Version 1.0.0
This is the initial version. For more, please read the documentation.