def main(self): ''' Either performs action based on arguments, or starts attack scanning ''' if os.getuid() != 0: Color.pl('{!} {R}error: {O}wifite{R} must be run as {O}root{W}') Color.pl('{!} {O}re-run as: sudo ./Wifite.py{W}') Configuration.exit_gracefully(0) self.dependency_check() Configuration.initialize(load_interface=False) if Configuration.show_cracked: self.display_cracked() elif Configuration.check_handshake: self.check_handshake(Configuration.check_handshake) elif Configuration.crack_handshake: CrackHandshake() else: Configuration.get_interface() self.run()
def run(): w = Wifite() w.print_banner() try: w.main() except Exception, e: Color.pl('\n{!} {R}Error:{O} %s{W}' % str(e)) if Configuration.verbose > 0 or True: Color.pl('\n{!} {O}Full stack trace below') from traceback import format_exc Color.p('\n{!} ') err = format_exc().strip() err = err.replace('\n', '\n{!} {C} ') err = err.replace(' File', '{W}File') err = err.replace(' Exception: ', '{R}Exception: {O}') Color.pl(err) Color.pl('\n{!} {R}Exiting{W}\n') except KeyboardInterrupt: Color.pl('\n{!} {O}interrupted, shutting down...{W}') Configuration.exit_gracefully(0) if __name__ == '__main__': run()