forked from R3dFruitRollUp/warberry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwarberry.py
executable file
·69 lines (58 loc) · 2.15 KB
/
warberry.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
"""
This file is part of the WarBerry tool.
Copyright (c) 2016 Yiannis Ioannides (@sec_groundzero).
https://github.com/secgroundzero/warberry
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
"""
import subprocess, signal
import sys, os
from src.utils.info_banners import *
def war(string):
string = "sudo python wrapper.py " + string
subprocess.call(string, shell=True)
def main():
war_arg_list=[]
responder_time = 1000
iface="eth0"
for i in range(1,len(sys.argv)):
if sys.argv[i]=="-t" or sys.argv[i]=="--time":
responder_time= sys.argv[i+1]
break
elif sys.argv[i]=="-h" or sys.argv[i]=="--help":
banner_full()
break
else:
war_arg_list.append(sys.argv[i])
if sys.argv[i]=="-I" or sys.argv[i]=="--interface":
iface = sys.argv[i+1]
war_string = ' '.join(war_arg_list)
pro= []
# Spawn process for responder
pid = subprocess.Popen(["sudo","python","run_responder.py",str(responder_time),str(iface)]) # call subprocess
#start warberry
war(war_string)
#wait until responder finishes
print bcolors.WARNING +"Waiting for Responder to finish!!!"+bcolors.ENDC
pid.wait()
print bcolors.TITLE+"Responder has Finished. Results in ../Results/responder_output"+bcolors.ENDC
p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE)
out, err = p.communicate()
for line in out.splitlines():
if 'python' in line:
pid = int(line.split(None, 1)[0])
os.kill(pid, signal.SIGKILL)
print "Killing threads done"
#atexit.register(cleanup(pid))
def cleanup(pid):
if pid.poll():
pid.terminate()
if __name__ == "__main__":
# execute main function
main()