Skip to content

Commit 8b786b7

Browse files
committed
Added setup.py. Run: python -m wifite
As asked by @blshkv in #102. Running: `sudo python -m wifite` Install: `sudo python setup.py install` These steps (and "uninstalling") are mentioned in the README.
1 parent a157132 commit 8b786b7

File tree

7 files changed

+180
-4
lines changed

7 files changed

+180
-4
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ hs/
55
*.bak
66
.idea/
77
cracked.txt
8+
MANIFEST
9+
dist/
10+
build/
11+
files.txt

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include README.md
2+
include wordlist-top4800-probable.txt

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,31 @@ A complete re-write of [`wifite`](https://github.com/derv82/wifite), a Python sc
55

66
Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments & switches!
77

8+
This version is compatible with both `python2` and `python3`.
9+
10+
Installation
11+
------------
12+
13+
From the root directory of this package:
14+
15+
Run *wifite* using: `python -m wifite`
16+
17+
To install onto your computer (so you can just run `wifite` from any terminal), run:
18+
19+
```bash
20+
sudo python setup.py install
21+
```
22+
23+
----
24+
25+
Note: Uninstalling is [not as easy](https://stackoverflow.com/questions/1550226/python-setup-py-uninstall#1550235). The only way to uninstall is to record the files installed by the above command and *remove* those files:
26+
27+
```bash
28+
sudo python setup.py install --record files.txt
29+
cat files.txt | xargs sudo rm -f
30+
sudo rm -f files.txt
31+
```
32+
833
What's new in Wifite2?
934
----------------------
1035

Wifite.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

bin/wifite

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env python
2+
3+
from wifite import __main__
4+
__main__.entry_point()

setup.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
from distutils.core import setup
2+
3+
from wifite.config import Configuration
4+
5+
setup(
6+
name='wifite',
7+
#version='2.1.9',
8+
version=Configuration.version,
9+
author='derv82',
10+
author_email='derv82@gmail.com',
11+
url='https://github.com/derv82/wifite2',
12+
packages=[
13+
'wifite',
14+
'wifite/attack',
15+
'wifite/model',
16+
'wifite/tools',
17+
'wifite/util',
18+
],
19+
data_files=[
20+
('', ['wordlist-top4800-probable.txt'])
21+
],
22+
entry_points={
23+
'console_scripts': [
24+
'wifite = wifite.wifite:entry_point'
25+
]
26+
},
27+
license='GNU GPLv2',
28+
scripts=['bin/wifite'],
29+
description='Wireless Network Auditor for Linux',
30+
#long_description=open('README.md').read(),
31+
long_description='''Wireless Network Auditor for Linux.
32+
33+
Cracks WEP, WPA, and WPS encrypted networks.
34+
35+
Depends on Aircrack-ng Suite, Tshark (from Wireshark), and various other external tools.''',
36+
classifiers = [
37+
"Programming Language :: Python :: 2.7",
38+
"Programming Language :: Python :: 3"
39+
]
40+
)

wifite/__main__.py

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
try:
5+
from .config import Configuration
6+
except (ValueError, ImportError) as e:
7+
raise Exception('You may need to run wifite from the root directory (which includes README.md)', e)
8+
9+
from .util.color import Color
10+
11+
import os
12+
import sys
13+
14+
15+
class Wifite(object):
16+
17+
def __init__(self):
18+
'''
19+
Initializes Wifite. Checks for root permissions and ensures dependencies are installed.
20+
'''
21+
22+
self.print_banner()
23+
24+
Configuration.initialize(load_interface=False)
25+
26+
if os.getuid() != 0:
27+
Color.pl('{!} {R}error: {O}wifite{R} must be run as {O}root{W}')
28+
Color.pl('{!} {R}re-run with {O}sudo{W}')
29+
Configuration.exit_gracefully(0)
30+
31+
from .tools.dependency import Dependency
32+
Dependency.run_dependency_check()
33+
34+
35+
def start(self):
36+
'''
37+
Starts target-scan + attack loop, or launches utilities dpeending on user input.
38+
'''
39+
from .model.result import CrackResult
40+
from .model.handshake import Handshake
41+
from .util.crack import CrackHelper
42+
43+
if Configuration.show_cracked:
44+
CrackResult.display()
45+
46+
elif Configuration.check_handshake:
47+
Handshake.check()
48+
49+
elif Configuration.crack_handshake:
50+
CrackHelper.run()
51+
52+
else:
53+
Configuration.get_monitor_mode_interface()
54+
self.scan_and_attack()
55+
56+
57+
def print_banner(self):
58+
'''Displays ASCII art of the highest caliber.'''
59+
Color.pl(r'{G} . {GR}{D} {W}{G} . {W}')
60+
Color.pl(r'{G}.´ · .{GR}{D} {W}{G}. · `. {G}wifite {D}%s{W}' % Configuration.version)
61+
Color.pl(r'{G}: : : {GR}{D} (¯) {W}{G} : : : {W}{D}automated wireless auditor{W}')
62+
Color.pl(r'{G}`. · `{GR}{D} /¯\ {W}{G}´ · .´ {C}{D}https://github.com/derv82/wifite2{W}')
63+
Color.pl(r'{G} ` {GR}{D}/¯¯¯\{W}{G} ´ {W}')
64+
Color.pl('')
65+
66+
67+
def scan_and_attack(self):
68+
'''
69+
1) Scans for targets, asks user to select targets
70+
2) Attacks each target
71+
'''
72+
from .util.scanner import Scanner
73+
from .attack.all import AttackAll
74+
75+
Color.pl('')
76+
77+
# Scan
78+
s = Scanner()
79+
targets = s.select_targets()
80+
81+
# Attack
82+
attacked_targets = AttackAll.attack_multiple(targets)
83+
84+
Color.pl('{+} Finished attacking {C}%d{W} target(s), exiting' % attacked_targets)
85+
86+
87+
##############################################################
88+
89+
90+
def entry_point():
91+
try:
92+
wifite = Wifite()
93+
wifite.start()
94+
except Exception as e:
95+
Color.pexception(e)
96+
Color.pl('\n{!} {R}Exiting{W}\n')
97+
98+
except KeyboardInterrupt:
99+
Color.pl('\n{!} {O}interrupted, shutting down...{W}')
100+
101+
Configuration.exit_gracefully(0)
102+
103+
104+
if __name__ == '__main__':
105+
entry_point()

0 commit comments

Comments
 (0)