add fail2ban scripts
This commit is contained in:
20
fail2ban/action.d/entryPoint.py
Executable file
20
fail2ban/action.d/entryPoint.py
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
"""
|
||||
Creates a virtual environment, installs dependencies, and then calls modifyBanList.py
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
if len(sys.argv) < 3:
|
||||
print("Usage: ./entryPoint.py <ip> <add|del>")
|
||||
sys.exit(1)
|
||||
|
||||
venv_dir = 'env'
|
||||
|
||||
if not os.path.exists(venv_dir):
|
||||
os.system(f"{sys.executable} -m venv {venv_dir}")
|
||||
|
||||
os.system(f"{os.path.join(venv_dir, 'bin', 'pip')} install --upgrade requests ipaddress")
|
||||
os.system(f"{os.path.join(venv_dir, 'bin', 'python')} /data/action.d/modifyBanList.py {sys.argv[1]} {sys.argv[2]}")
|
Reference in New Issue
Block a user