Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
derv82
GitHub Repository: derv82/wifite2
Path: blob/master/wifite/tools/dependency.py
412 views
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
4
class Dependency(object):
5
required_attr_names = ['dependency_name', 'dependency_url', 'dependency_required']
6
7
# https://stackoverflow.com/a/49024227
8
def __init_subclass__(cls):
9
for attr_name in cls.required_attr_names:
10
if not attr_name in cls.__dict__:
11
raise NotImplementedError(
12
'Attribute "{}" has not been overridden in class "{}"' \
13
.format(attr_name, cls.__name__)
14
)
15
16
17
@classmethod
18
def exists(cls):
19
from ..util.process import Process
20
return Process.exists(cls.dependency_name)
21
22
23
@classmethod
24
def run_dependency_check(cls):
25
from ..util.color import Color
26
27
from .airmon import Airmon
28
from .airodump import Airodump
29
from .aircrack import Aircrack
30
from .aireplay import Aireplay
31
from .ifconfig import Ifconfig
32
from .iwconfig import Iwconfig
33
from .bully import Bully
34
from .reaver import Reaver
35
from .wash import Wash
36
from .pyrit import Pyrit
37
from .tshark import Tshark
38
from .macchanger import Macchanger
39
from .hashcat import Hashcat, HcxDumpTool, HcxPcapTool
40
41
apps = [
42
# Aircrack
43
Aircrack, #Airodump, Airmon, Aireplay,
44
# wireless/net tools
45
Iwconfig, Ifconfig,
46
# WPS
47
Reaver, Bully,
48
# Cracking/handshakes
49
Pyrit, Tshark,
50
# Hashcat
51
Hashcat, HcxDumpTool, HcxPcapTool,
52
# Misc
53
Macchanger
54
]
55
56
missing_required = any([app.fails_dependency_check() for app in apps])
57
58
if missing_required:
59
Color.pl('{!} {O}At least 1 Required app is missing. Wifite needs Required apps to run{W}')
60
import sys
61
sys.exit(-1)
62
63
64
@classmethod
65
def fails_dependency_check(cls):
66
from ..util.color import Color
67
from ..util.process import Process
68
69
if Process.exists(cls.dependency_name):
70
return False
71
72
if cls.dependency_required:
73
Color.p('{!} {O}Error: Required app {R}%s{O} was not found' % cls.dependency_name)
74
Color.pl('. {W}install @ {C}%s{W}' % cls.dependency_url)
75
return True
76
77
else:
78
Color.p('{!} {O}Warning: Recommended app {R}%s{O} was not found' % cls.dependency_name)
79
Color.pl('. {W}install @ {C}%s{W}' % cls.dependency_url)
80
return False
81
82