forked from trustedsec/artillery
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathartillery.py
executable file
·115 lines (91 loc) · 3.25 KB
/
artillery.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/python
#####################################################################
#
# Artillery v1.0
#
# Written by Dave Kennedy (ReL1K)
#
# Still a work in progress.
#
#####################################################################
import time,sys,thread,os,subprocess
# check if its installed
if not os.path.isfile("/var/artillery/artillery.py"):
print "[*] Artillery is not installed, running setup.py.."
subprocess.Popen("python setup.py", shell=True).wait()
sys.exit()
from src.core import *
# create the database directories if they aren't there
if not os.path.isdir("/var/artillery/database/"):
os.makedirs("/var/artillery/database/")
if not os.path.isfile("/var/artillery/database/temp.database"):
filewrite = file("/var/artillery/database/temp.database", "w")
filewrite.write("")
filewrite.close()
# let the logfile know artillery has started successfully
write_log("[*] %s: Artillery has started successfully." % (grab_time()))
if is_config_enabled("CONSOLE_LOGGING"):
print "[*] %s: Artillery has started successfully.\n[*] Console logging enabled.\n" % (grab_time())
# prep everything for artillery first run
check_banlist_path()
try:
# update artillery
if is_config_enabled("AUTO_UPDATE"):
thread.start_new_thread(update, ())
# import base monitoring of fs
if is_config_enabled("MONITOR"):
from src.monitor import *
# port ranges to spawn
port = read_config("PORTS")
# spawn honeypot
import src.honeypot
# check if config client
if is_config_enabled("CONFIG_CLIENT"):
import src.config_client
# only allow server if config_client disabled
elif is_config_enabled("CONFIG_SERVER"):
import src.config_server
# spawn ssh monitor
if is_config_enabled("SSH_BRUTE_MONITOR"):
import src.ssh_monitor
# spawn 404 banner
if is_config_enabled("BAN_ON_404"):
from src.apache_monitor import ban_on_404
thread.start_new_thread(ban_on_404,(read_config("ACCESS_LOG"),))
ftp_monitor = read_config("FTP_BRUTE_MONITOR")
if ftp_monitor.lower() == "on":
#imprt the ftp monitor
import src.ftp_monitor
# start monitor engine
import src.monitor
# check hardening
import src.harden
# start the email handler
import src.email_handler
# if we are running posix then lets create a new iptables chain
if is_posix():
time.sleep(2)
thread.start_new_thread(create_iptables_subset, ())
# start anti_dos
import src.anti_dos
# check to see if we are using the intelligence feed
if is_config_enabled("THREAT_INTELLIGENCE_FEED"):
thread.start_new_thread(intelligence_update, ())
# check to see if we are a threat server or not
if is_config_enabled("THREAT_SERVER"):
thread.start_new_thread(threat_server, ())
# let the program to continue to run
while 1:
try:
time.sleep(100000)
except KeyboardInterrupt:
print "\n[!] Exiting Artillery... hack the gibson.\n"
sys.exit()
except sys.excepthook, e:
print "Excepthook exception: " + format(e)
pass
except KeyboardInterrupt:
sys.exit()
except Exception, e:
print "General exception: " + format(e)
sys.exit()