โโโโโโ โโโโ โ โโโโโโ โโโโโโ โโโ โโโ โโโโโโ โโโโโโโโโ โโ โ โโ โโ โ โโโโ โโ โโโ โ โโโโโโ โโโโโโโ โโโโ โโโ โโ โโโโ โโโ โโ โโโโโโ โ โโโ โโโ โ โโโ โโโโโโโ โโโโโ โโโโ โโ โโโ โ โโโโ โโโโโโโโโ โโโโโโโโโโโ โ โโโโโโโโโโโโ โโ โโโโ โ โโโโโโโโโโโ โโโโโ โโโโโ โโโโโ โโโโ โ โโโโโโโโโ โ โ โโโโ โ โโ โโ โโ โโ โ โ โ โโ โ โโ โโ โโโโ โโโโโ โโโโ โ โ โ โโ โ โ โโ โโ โ โโ โ โ โโ โ โโโโโ โโโ โโ โ โ โ โ โ โ โ โโ โ โ โ โโ โโ โ โ โ โ โ โ โ โ โ โ โ โ ============================================================== ๐ก Detailed Features & Functions Guide Welcome to the comprehensive breakdown of e-N-c-R-y-P-t! ============================================================== ๐ง Core Functions ------------------ 1. **sha256** ๐ - ๐งฉ Hashes a given string using the SHA-256 algorithm. - ๐งช Utilizes OpenSSL's EVP API. - ๐งพ Returns the hash as a hexadecimal string. 2. **loadAllowedHashes** ๐ฅ - ๐ Loads allowed peer IPs from allowed_hashes.txt. - ๐งพ Returns a set of allowed IPs. 3. **loadTrustedHashes** ๐ - ๐ Loads trusted peer hashes from trusted_hashes.txt. - ๐งพ Returns a set of trusted hashes. 4. **appendTrustedHash** โ - ๐ Appends a new trusted hash to trusted_hashes.txt. - ๐ก๏ธ Ensures trusted peers are recorded. 5. **isAllowedPeerIP** โ - ๐ Checks if a peer's IP is in the allowed list. - ๐งพ Returns true if allowed, false otherwise. 6. **isTrustedPeerIP** ๐ก๏ธ - ๐ Checks if a peer's IP is trusted. - ๐งพ If not trusted, hashes the IP and appends it to the trusted list. - ๐งพ Returns true if trusted, false otherwise. 7. **human_readable_bytes** ๐ - ๐ข Converts byte count to a human-readable format (e.g., KB, MB). - ๐งพ Returns a formatted string. 8. **is_singleton** ๐ซ - ๐ Ensures only one instance of the application runs at a time. - ๐งพ Returns true if single instance, false otherwise. 9. **log_stats** ๐ - ๐ Logs statistics to stats.log. - ๐ Includes data on banned IPs, TLS connections, traffic, and packets. - ๐ Resets stats after each log. 10. **to_upper** ๐ - ๐ค Converts a string to uppercase. - ๐งพ Returns the uppercase string. ๐ Stats Structure ------------------------- - ๐งฎ Tracks: - ๐ซ banned_ips: Number of banned IPs. - ๐ nonTlsAttemptsCount: Number of non-TLS attempts. - ๐ tlsConnections: Number of TLS connections. - ๐ฅ bytes_rx: Bytes received. - ๐ค bytes_tx: Bytes transmitted. - ๐ฆ packets_rx: Packets received. - ๐ฆ packets_tx: Packets transmitted. - ๐ Resets every 1 minute after logging. ๐ Configuration Files ----------------------- - **allowed_hashes.txt** โ - ๐ Lists allowed peer IPs. - **trusted_hashes.txt** ๐ - ๐ Stores trusted peer hashes. - **stats.lock** ๐ - ๐ Ensures a single instance of the application. - **stats.log** ๐ - ๐ Logs 1 minute statistics. ๐ Logging & Monitoring ------------------------ - ๐ Logs statistics every 1 minute. - ๐ Includes data on: - ๐ซ Banned IPs - ๐ Non-TLS attempts - ๐ TLS connections - ๐ฅ Received traffic - ๐ค Transmitted traffic - ๐ฆ Received packets - ๐ฆ Transmitted packets - ๐ Logs to stats.log for monitoring. โ ๏ธ Notes --------- - ๐ Utilizes OpenSSL's SHA-256 for hashing. - ๐ Ensures only one instance runs at a time using stats.lock. - ๐ Logs detailed statistics to stats.log. - ๐งพ Requires allowed_hashes.txt and trusted_hashes.txt for operation.
Made with โค๏ธ in ๐ธ๐ฐ