From 26fe8ca059254679a67123eff92ba4c033fcd1c0 Mon Sep 17 00:00:00 2001 From: Simone Margaritelli <evilsocket@gmail.com> Date: Thu, 3 Oct 2019 20:18:50 +0200 Subject: [PATCH] new on_internet_available event --- docs/about.md | 19 +++++++++ docs/configure.md | 0 docs/connect.md | 0 docs/index.md | 5 +++ docs/install.md | 0 docs/plugins.md | 0 sdcard/rootfs/root/pwnagotchi/scripts/main.py | 39 ++++++++++--------- .../pwnagotchi/plugins/default/example.py | 5 +++ 8 files changed, 50 insertions(+), 18 deletions(-) create mode 100644 docs/about.md create mode 100644 docs/configure.md create mode 100644 docs/connect.md create mode 100644 docs/index.md create mode 100644 docs/install.md create mode 100644 docs/plugins.md diff --git a/docs/about.md b/docs/about.md new file mode 100644 index 0000000..f1cb536 --- /dev/null +++ b/docs/about.md @@ -0,0 +1,19 @@ +## About the Project + +[Pwnagotchi](https://twitter.com/pwnagotchi) is an "AI" that learns from the WiFi environment and instruments +[bettercap](https://www.bettercap.org/) in order to maximize the WPA key material that's being captured either passively + or by performing deauthentication and association attakcs. This material is collected as pcap files containing any form + of handshake supported by [hashcat](https://hashcat.net/hashcat/), including [PMKIDs](https://www.evilsocket.net/2019/02/13/Pwning-WiFi-networks-with-bettercap-and-the-PMKID-client-less-attack/), +full and half WPA handshakes. + + + +Instead of playing [Super Mario or Atari games](https://becominghuman.ai/getting-mario-back-into-the-gym-setting-up-super-mario-bros-in-openais-gym-8e39a96c1e41?gi=c4b66c3d5ced), pwnagotchi will tune over time [its own parameters](https://github.com/evilsocket/pwnagotchi/blob/master/sdcard/rootfs/root/pwnagotchi/config.yml#L54), effectively learning to get better at pwning WiFi things. **Keep in mind:** unlike the usual RL simulations, pwnagotchi learns over time (where a single epoch can last from a few seconds to minutes, depending on how many access points and client stations are visible), do not expect it to perform amazingly well at the beginning, as it'll be exploring several combinations of parameters ... but listen to it when it's bored, bring it with you and have it observe new networks and capture new handshakes and you'll see :) + +Multiple units can talk to each other, advertising their own presence using a parasite protocol I've built on top of the existing dot11 standard, by broadcasting custom information elements. Over time, two or more units learn to cooperate if they detect each other's presence, by dividing the available channels among them. + + + +Depending on the status of the unit, several states and states transitions are configurable and represented on the display as different moods, expressions and sentences. + +If instead you just want to use your own parameters and save battery and CPU cycles, you can disable the AI in `config.yml` and enjoy an automated deauther, WPA handshake sniffer and portable bettercap + webui dedicated hardware. diff --git a/docs/configure.md b/docs/configure.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/connect.md b/docs/connect.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..4af5b89 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,5 @@ +# Documentation + +- [About the Project](https://github.com/evilsocket/pwnagotchi/blob/master/docs/about.md) +- [How to Install](https://github.com/evilsocket/pwnagotchi/blob/master/docs/install.md) +- [Configuration](https://github.com/evilsocket/pwnagotchi/blob/master/docs/configure.md) diff --git a/docs/install.md b/docs/install.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/plugins.md b/docs/plugins.md new file mode 100644 index 0000000..e69de29 diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/main.py b/sdcard/rootfs/root/pwnagotchi/scripts/main.py index 7caa81e..b4730d0 100755 --- a/sdcard/rootfs/root/pwnagotchi/scripts/main.py +++ b/sdcard/rootfs/root/pwnagotchi/scripts/main.py @@ -101,30 +101,33 @@ if args.do_manual: display.on_manual_mode(log) time.sleep(1) - if config['twitter']['enabled'] and log.is_new() and Agent.is_connected() and log.handshakes > 0: - import tweepy + if Agent.is_connected(): + plugins.on('internet_available', config, log) - logging.info("detected a new session and internet connectivity!") + if config['twitter']['enabled'] and log.is_new() and log.handshakes > 0: + import tweepy - picture = '/dev/shm/pwnagotchi.png' + logging.info("detected a new session and internet connectivity!") - display.update(force=True) - display.image().save(picture, 'png') - display.set('status', 'Tweeting...') - display.update(force=True) + picture = '/dev/shm/pwnagotchi.png' - try: - auth = tweepy.OAuthHandler(config['twitter']['consumer_key'], config['twitter']['consumer_secret']) - auth.set_access_token(config['twitter']['access_token_key'], config['twitter']['access_token_secret']) - api = tweepy.API(auth) + display.update(force=True) + display.image().save(picture, 'png') + display.set('status', 'Tweeting...') + display.update(force=True) - tweet = Voice(lang=config['main']['lang']).on_log_tweet(log) - api.update_with_media(filename=picture, status=tweet) - log.save_session_id() + try: + auth = tweepy.OAuthHandler(config['twitter']['consumer_key'], config['twitter']['consumer_secret']) + auth.set_access_token(config['twitter']['access_token_key'], config['twitter']['access_token_secret']) + api = tweepy.API(auth) - logging.info("tweeted: %s" % tweet) - except Exception as e: - logging.exception("error while tweeting") + tweet = Voice(lang=config['main']['lang']).on_log_tweet(log) + api.update_with_media(filename=picture, status=tweet) + log.save_session_id() + + logging.info("tweeted: %s" % tweet) + except Exception as e: + logging.exception("error while tweeting") quit() diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/plugins/default/example.py b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/plugins/default/example.py index e527f0f..9c1c8c4 100644 --- a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/plugins/default/example.py +++ b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/plugins/default/example.py @@ -17,6 +17,11 @@ def on_loaded(): logging.warning("WARNING: plugin %s should be disabled!" % __name__) +# called in manual mode when there's internet connectivity +def on_internet_available(config, log): + pass + + # called to setup the ui elements def on_ui_setup(ui): # add custom UI elements