Enhance CyberPanel functionality with FTP Quota and Bandwidth Management features: Added models, views, and templates for managing FTP quotas and bandwidth resets. Implemented IP blocking functionality with associated views and templates. Updated system scripts for improved repository synchronization and OS detection. Removed outdated workflow files.

This commit is contained in:
Master3395
2025-09-23 21:09:38 +02:00
parent 11991c0f80
commit 2c57ad595e
23 changed files with 2278 additions and 903 deletions

44
scripts/block_ip.py Normal file
View File

@@ -0,0 +1,44 @@
#!/usr/local/CyberCP/bin/python
"""
Quick IP blocking script for CyberPanel
Usage: python block_ip.py <ip_address> [reason]
"""
import sys
import os
import django
# Add CyberPanel to Python path
sys.path.append('/usr/local/CyberCP')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
try:
django.setup()
except:
pass
from plogical.firewallUtilities import FirewallUtilities
def main():
if len(sys.argv) < 2:
print("Usage: python block_ip.py <ip_address> [reason]")
print("Example: python block_ip.py 192.168.1.100 'Suspicious activity'")
sys.exit(1)
ip_address = sys.argv[1]
reason = sys.argv[2] if len(sys.argv) > 2 else "Manual block via CLI"
print(f"Blocking IP address: {ip_address}")
print(f"Reason: {reason}")
success, message = FirewallUtilities.blockIP(ip_address, reason)
if success:
print(f"{message}")
sys.exit(0)
else:
print(f"{message}")
sys.exit(1)
if __name__ == "__main__":
main()