From 6c44d7f0f68433d1dfd41b7378c4f235e2af253a Mon Sep 17 00:00:00 2001 From: root Date: Thu, 10 Oct 2019 19:42:40 +0100 Subject: [PATCH 1/3] quickdic plugin --- pwnagotchi/defaults.yml | 4 +- pwnagotchi/plugins/default/quickdic.py | 53 ++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 pwnagotchi/plugins/default/quickdic.py diff --git a/pwnagotchi/defaults.yml b/pwnagotchi/defaults.yml index f87f7caf..e6787c7e 100644 --- a/pwnagotchi/defaults.yml +++ b/pwnagotchi/defaults.yml @@ -55,7 +55,9 @@ main: screen_refresh: enabled: false refresh_interval: 50 - + quickdic: + enabled: false + wordlist_folder: /opt/wordlists/ # monitor interface to use iface: mon0 # command to run to bring the mon interface up in case it's not up already diff --git a/pwnagotchi/plugins/default/quickdic.py b/pwnagotchi/plugins/default/quickdic.py new file mode 100644 index 00000000..7ef77620 --- /dev/null +++ b/pwnagotchi/plugins/default/quickdic.py @@ -0,0 +1,53 @@ +__author__ = 'pwnagotchi [at] rossmarks [dot] uk' +__version__ = '1.0.0' +__name__ = 'quickdic' +__license__ = 'GPL3' +__description__ = 'Run a quick dictionary scan against captured handshakes' + +''' +Aircrack-ng needed, to install: +>apt-get install aircrak-ng +Upload worrdlists files in .txt forrmat to folder in config file (default: /opt/wordlists/) +''' + +import logging +import subprocess +import string +import re + +OPTIONS = dict() + +def on_loaded(): + logging.info("Quick dictionary check plugin loaded") + +def on_handshake(agent, filename, access_point, client_station): + display = agent._view + + result = subprocess.run(('/usr/bin/aircrack-ng '+ filename +' | grep "1 handshake" | awk \'{print $2}\''),shell=True, stdout=subprocess.PIPE) + result = result.stdout.decode('utf-8').translate({ord(c) :None for c in string.whitespace}) + if not result: + logging.info("[quickdic] No handshake") + else: + logging.info("[quickdic] Handshake confirmed") + result2 = subprocess.run(('aircrack-ng -w '+OPTIONS['wordlist_folder']+'*.txt -q -b '+result+' '+filename+' | grep KEY'),shell=True,stdout=subprocess.PIPE) + result2 = result2.stdout.decode('utf-8').strip() + logging.info("[quickdic] "+result2) + if result2 != "KEY NOT FOUND": + key = re.search('\[(.*)\]', result2) + pwd = str(key.group(1)) + set_text("Cracked password: "+pwd) + agent.set_excited() + display.update(force=True) + +text_to_set = ""; +def set_text(text): + global text_to_set + text_to_set = text + logging.info('[quickdic] setText: '+text) + +def on_ui_update(ui): + global text_to_set + if text_to_set: + logging.info('[quickdic] ui_update: '+text_to_set) + ui.set('status', text_to_set) + text_to_set = "" \ No newline at end of file From e48f9bfcc766a7e573e6aa1a565466ea29152232 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 10 Oct 2019 23:34:15 +0100 Subject: [PATCH 2/3] code tidy --- pwnagotchi/plugins/default/quickdic.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pwnagotchi/plugins/default/quickdic.py b/pwnagotchi/plugins/default/quickdic.py index 7ef77620..6896272c 100644 --- a/pwnagotchi/plugins/default/quickdic.py +++ b/pwnagotchi/plugins/default/quickdic.py @@ -6,8 +6,9 @@ __description__ = 'Run a quick dictionary scan against captured handshakes' ''' Aircrack-ng needed, to install: ->apt-get install aircrak-ng -Upload worrdlists files in .txt forrmat to folder in config file (default: /opt/wordlists/) +> apt-get install aircrack-ng +Upload wordlist files in .txt format to folder in config file (Default: /opt/wordlists/) +Cracked handshakes stored in handshake folder as [essid].pcap.cracked ''' import logging @@ -29,7 +30,7 @@ def on_handshake(agent, filename, access_point, client_station): logging.info("[quickdic] No handshake") else: logging.info("[quickdic] Handshake confirmed") - result2 = subprocess.run(('aircrack-ng -w '+OPTIONS['wordlist_folder']+'*.txt -q -b '+result+' '+filename+' | grep KEY'),shell=True,stdout=subprocess.PIPE) + result2 = subprocess.run(('aircrack-ng -w '+OPTIONS['wordlist_folder']+'*.txt -l '+filename+'.cracked -q -b '+result+' '+filename+' | grep KEY'),shell=True,stdout=subprocess.PIPE) result2 = result2.stdout.decode('utf-8').strip() logging.info("[quickdic] "+result2) if result2 != "KEY NOT FOUND": @@ -43,11 +44,9 @@ text_to_set = ""; def set_text(text): global text_to_set text_to_set = text - logging.info('[quickdic] setText: '+text) def on_ui_update(ui): global text_to_set if text_to_set: - logging.info('[quickdic] ui_update: '+text_to_set) ui.set('status', text_to_set) - text_to_set = "" \ No newline at end of file + text_to_set = "" From 9f3f71ce3d548b4ce37661822791f5bfd3577f83 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 11 Oct 2019 00:11:27 +0100 Subject: [PATCH 3/3] custom face --- pwnagotchi/plugins/default/quickdic.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pwnagotchi/plugins/default/quickdic.py b/pwnagotchi/plugins/default/quickdic.py index 6896272c..916a3b16 100644 --- a/pwnagotchi/plugins/default/quickdic.py +++ b/pwnagotchi/plugins/default/quickdic.py @@ -8,7 +8,6 @@ __description__ = 'Run a quick dictionary scan against captured handshakes' Aircrack-ng needed, to install: > apt-get install aircrack-ng Upload wordlist files in .txt format to folder in config file (Default: /opt/wordlists/) -Cracked handshakes stored in handshake folder as [essid].pcap.cracked ''' import logging @@ -37,7 +36,6 @@ def on_handshake(agent, filename, access_point, client_station): key = re.search('\[(.*)\]', result2) pwd = str(key.group(1)) set_text("Cracked password: "+pwd) - agent.set_excited() display.update(force=True) text_to_set = ""; @@ -48,5 +46,6 @@ def set_text(text): def on_ui_update(ui): global text_to_set if text_to_set: + ui.set('face', "(·ω·)") ui.set('status', text_to_set) text_to_set = ""