From 8b786b70b0acf763c896677a23aab8e2310a4462 Mon Sep 17 00:00:00 2001 From: derv82 Date: Sun, 19 Aug 2018 15:13:22 -0700 Subject: [PATCH] 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. --- .gitignore | 4 ++ MANIFEST.in | 2 + README.md | 25 +++++++++++ Wifite.py | 4 -- bin/wifite | 4 ++ setup.py | 40 +++++++++++++++++ wifite/__main__.py | 105 +++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 180 insertions(+), 4 deletions(-) create mode 100644 MANIFEST.in delete mode 100755 Wifite.py create mode 100755 bin/wifite create mode 100644 setup.py create mode 100755 wifite/__main__.py diff --git a/.gitignore b/.gitignore index 33ee259..3b21bc5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,7 @@ hs/ *.bak .idea/ cracked.txt +MANIFEST +dist/ +build/ +files.txt diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..28e91d9 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include README.md +include wordlist-top4800-probable.txt diff --git a/README.md b/README.md index 5124850..153796f 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,31 @@ A complete re-write of [`wifite`](https://github.com/derv82/wifite), a Python sc Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments & switches! +This version is compatible with both `python2` and `python3`. + +Installation +------------ + +From the root directory of this package: + +Run *wifite* using: `python -m wifite` + +To install onto your computer (so you can just run `wifite` from any terminal), run: + +```bash +sudo python setup.py install +``` + +---- + +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: + +```bash +sudo python setup.py install --record files.txt +cat files.txt | xargs sudo rm -f +sudo rm -f files.txt +``` + What's new in Wifite2? ---------------------- diff --git a/Wifite.py b/Wifite.py deleted file mode 100755 index 3edc768..0000000 --- a/Wifite.py +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env python - -from wifite import wifite -wifite.entry_point() diff --git a/bin/wifite b/bin/wifite new file mode 100755 index 0000000..0205cdd --- /dev/null +++ b/bin/wifite @@ -0,0 +1,4 @@ +#!/usr/bin/env python + +from wifite import __main__ +__main__.entry_point() diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..83b8a85 --- /dev/null +++ b/setup.py @@ -0,0 +1,40 @@ +from distutils.core import setup + +from wifite.config import Configuration + +setup( + name='wifite', + #version='2.1.9', + version=Configuration.version, + author='derv82', + author_email='derv82@gmail.com', + url='https://github.com/derv82/wifite2', + packages=[ + 'wifite', + 'wifite/attack', + 'wifite/model', + 'wifite/tools', + 'wifite/util', + ], + data_files=[ + ('', ['wordlist-top4800-probable.txt']) + ], + entry_points={ + 'console_scripts': [ + 'wifite = wifite.wifite:entry_point' + ] + }, + license='GNU GPLv2', + scripts=['bin/wifite'], + description='Wireless Network Auditor for Linux', + #long_description=open('README.md').read(), + long_description='''Wireless Network Auditor for Linux. + + Cracks WEP, WPA, and WPS encrypted networks. + + Depends on Aircrack-ng Suite, Tshark (from Wireshark), and various other external tools.''', + classifiers = [ + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3" + ] +) diff --git a/wifite/__main__.py b/wifite/__main__.py new file mode 100755 index 0000000..3b2bdf2 --- /dev/null +++ b/wifite/__main__.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +try: + from .config import Configuration +except (ValueError, ImportError) as e: + raise Exception('You may need to run wifite from the root directory (which includes README.md)', e) + +from .util.color import Color + +import os +import sys + + +class Wifite(object): + + def __init__(self): + ''' + Initializes Wifite. Checks for root permissions and ensures dependencies are installed. + ''' + + self.print_banner() + + Configuration.initialize(load_interface=False) + + if os.getuid() != 0: + Color.pl('{!} {R}error: {O}wifite{R} must be run as {O}root{W}') + Color.pl('{!} {R}re-run with {O}sudo{W}') + Configuration.exit_gracefully(0) + + from .tools.dependency import Dependency + Dependency.run_dependency_check() + + + def start(self): + ''' + Starts target-scan + attack loop, or launches utilities dpeending on user input. + ''' + from .model.result import CrackResult + from .model.handshake import Handshake + from .util.crack import CrackHelper + + if Configuration.show_cracked: + CrackResult.display() + + elif Configuration.check_handshake: + Handshake.check() + + elif Configuration.crack_handshake: + CrackHelper.run() + + else: + Configuration.get_monitor_mode_interface() + self.scan_and_attack() + + + def print_banner(self): + '''Displays ASCII art of the highest caliber.''' + Color.pl(r'{G} . {GR}{D} {W}{G} . {W}') + Color.pl(r'{G}.´ · .{GR}{D} {W}{G}. · `. {G}wifite {D}%s{W}' % Configuration.version) + Color.pl(r'{G}: : : {GR}{D} (¯) {W}{G} : : : {W}{D}automated wireless auditor{W}') + Color.pl(r'{G}`. · `{GR}{D} /¯\ {W}{G}´ · .´ {C}{D}https://github.com/derv82/wifite2{W}') + Color.pl(r'{G} ` {GR}{D}/¯¯¯\{W}{G} ´ {W}') + Color.pl('') + + + def scan_and_attack(self): + ''' + 1) Scans for targets, asks user to select targets + 2) Attacks each target + ''' + from .util.scanner import Scanner + from .attack.all import AttackAll + + Color.pl('') + + # Scan + s = Scanner() + targets = s.select_targets() + + # Attack + attacked_targets = AttackAll.attack_multiple(targets) + + Color.pl('{+} Finished attacking {C}%d{W} target(s), exiting' % attacked_targets) + + +############################################################## + + +def entry_point(): + try: + wifite = Wifite() + wifite.start() + except Exception as e: + Color.pexception(e) + Color.pl('\n{!} {R}Exiting{W}\n') + + except KeyboardInterrupt: + Color.pl('\n{!} {O}interrupted, shutting down...{W}') + + Configuration.exit_gracefully(0) + + +if __name__ == '__main__': + entry_point()