497 Commits

Author SHA1 Message Date
Simone Margaritelli
9e92201d82 releasing v1.2.1 2019-11-05 19:11:37 +01:00
Simone Margaritelli
4e592df6d8 fix: fixed a bug which prevented rebooting 2019-11-05 19:07:16 +01:00
Simone Margaritelli
403ee242a6 releasing v1.2.0 2019-11-05 18:54:42 +01:00
Simone Margaritelli
106d72c4a2 reverted 5ddc2d7080 2019-11-05 18:51:01 +01:00
Simone Margaritelli
5ddc2d7080 fix: fixed issue with webui in landcape (fixes #523) 2019-11-05 18:30:09 +01:00
evilsocket
52f1111a5b Merge pull request #525 from dadav/fix/backup-loop
Add max_tries param
2019-11-05 18:25:44 +01:00
dadav
346773f790 Add max_tries param 2019-11-05 18:02:36 +01:00
Simone Margaritelli
9264b837c8 misc: small fix or general refactoring i did not bother commenting 2019-11-05 15:56:30 +01:00
Simone Margaritelli
81032fe5e3 misc: refactored webui into separate files instead of strings 2019-11-05 15:51:26 +01:00
Simone Margaritelli
2aa73d1a7e misc: small fix or general refactoring i did not bother commenting 2019-11-05 15:11:38 +01:00
Simone Margaritelli
b796384345 new: webui status pages reload /ui after a given interval 2019-11-05 15:04:58 +01:00
Simone Margaritelli
a6ca99c693 misc: small fix or general refactoring i did not bother commenting 2019-11-05 15:01:58 +01:00
Simone Margaritelli
60d9fd46ae misc: small fix or general refactoring i did not bother commenting 2019-11-05 14:57:22 +01:00
Simone Margaritelli
de71d18a72 misc: small fix or general refactoring i did not bother commenting 2019-11-05 14:52:54 +01:00
Simone Margaritelli
aba5b938bc misc: small fix or general refactoring i did not bother commenting 2019-11-05 14:48:26 +01:00
Simone Margaritelli
0830e0c74b misc: small fix or general refactoring i did not bother commenting 2019-11-05 14:37:42 +01:00
Simone Margaritelli
cf8a4da9e7 misc: small fix or general refactoring i did not bother commenting 2019-11-05 14:33:16 +01:00
Simone Margaritelli
80e2cdcd8d refact: using flask templating 2019-11-05 14:26:35 +01:00
Simone Margaritelli
a5cfb9aa8b misc: small fix or general refactoring i did not bother commenting 2019-11-05 14:03:56 +01:00
Simone Margaritelli
62a0cc6276 fix: suppress flask logging 2019-11-05 14:03:15 +01:00
Simone Margaritelli
f8523eb382 fix: added flask requirements 2019-11-05 13:55:35 +01:00
Simone Margaritelli
58b0b0fea0 fix: using try/finally to return the html and then call the action 2019-11-05 11:03:41 +01:00
evilsocket
bdf585afe5 Merge pull request #518 from dadav/fix/bt-tet-loaded-msg
More bt-tether fixes
2019-11-05 10:48:19 +01:00
evilsocket
b7d1c82788 Merge pull request #519 from dadav/feature/flask_migration
Migrate to flask
2019-11-05 10:47:51 +01:00
evilsocket
74838d6b96 Merge pull request #520 from gkrs/master
Updated polish language pack. New messages translated.
2019-11-05 10:47:08 +01:00
dadav
7fc46ddcf6 Add restart route 2019-11-04 18:43:33 +01:00
dadav
4503e71bfb Rebased 2019-11-04 18:38:12 +01:00
dadav
11fb95d299 Add CSRF support 2019-11-04 18:31:58 +01:00
dadav
0aaeeb8011 First step 2019-11-04 18:29:26 +01:00
dadav
3e1f3d5eec Add deps 2019-11-04 18:28:42 +01:00
dadav
86a3443b8d Handle exception if no Interface found 2019-11-04 17:55:16 +01:00
dadav
806efa1fc2 More consistency 2019-11-04 17:45:53 +01:00
dadav
537519dea6 Fix typo 2019-11-04 17:44:53 +01:00
Simone Margaritelli
0c1d98f2ab misc: small fix or general refactoring i did not bother commenting 2019-11-04 17:44:35 +01:00
dadav
4852b3f59e Make bt-tet lil bit more verbose 2019-11-04 17:41:27 +01:00
Simone Margaritelli
364af70ad5 new: button to restart in auto or manu mode 2019-11-04 17:35:06 +01:00
Simone Margaritelli
e336fca0de fix: fixed race condition (again) on override files 2019-11-04 17:33:35 +01:00
Simone Margaritelli
00e7c04980 misc: small fix or general refactoring i did not bother commenting 2019-11-04 14:30:22 +01:00
evilsocket
2549433e34 Merge pull request #517 from neutralinsomniac/fix_pixelated_css
fix: use a css class for the pixelated property, since apparently this still isn't standardized among different browsers
2019-11-04 14:24:55 +01:00
Jeremy O'Brien
9f9fca02e5 fix: use a css class for the pixelated property, since apparently this still isn't standardized among different browsers
Signed-off-by: Jeremy O'Brien <neutral@fastmail.com>
2019-11-04 08:19:13 -05:00
gkrs
6945e260bd Updated polish language pack. New messages translated.
Signed-off-by: gkrs <457603+gkrs@users.noreply.github.com>
2019-11-04 13:07:43 +01:00
evilsocket
c21986488d Merge pull request #514 from xenDE/master
add timestamp to net-pos plugin, https://github.com/evilsocket/pwnago…
2019-11-04 12:49:41 +01:00
Simone Margaritelli
b52ceae2ee misc: small fix or general refactoring i did not bother commenting 2019-11-04 11:44:24 +01:00
Simone Margaritelli
19fc25d508 new: reporting version on startup (closes #504) 2019-11-04 11:32:09 +01:00
Simone Margaritelli
ba22b7d5d7 misc: basic refactoring of #502 2019-11-04 11:13:51 +01:00
evilsocket
59019efad0 Merge pull request #512 from edmael/web_reboot
Added "Reboot into AUTO mode" button in web ui
2019-11-04 11:07:22 +01:00
evilsocket
20aa0d1909 Merge pull request #510 from dwi/patch-1
Unblurred image rendering in browsers
2019-11-04 11:07:10 +01:00
evilsocket
c56c6bb8f5 Merge pull request #513 from dadav/fix/bt-tet-silence
Make bt-tet less verbose
2019-11-04 11:05:18 +01:00
xenDE
1e426f7411 add timestamp to net-pos plugin, https://github.com/evilsocket/pwnagotchi/issues/308
added timestam as "ts" var in both .json files.
tested with old plugin format.
2019-11-04 00:16:50 +01:00
dadav
aeb6002e10 Make bt-tet less verbose 2019-11-03 23:25:55 +01:00
Edoardo Maria Elidoro
dc2362c371 Added "Reboot into AUTO mode" button in web ui
As requested in issue #502
2019-11-03 22:57:32 +01:00
dwi
d6c0ec0dfd Unblurred image rendering in browsers
Unblurred image rendering in browsers. Affects both desktop and mobile image rendering.

![Before and after](https://i.imgur.com/pffQREV.png)
2019-11-03 22:14:43 +01:00
evilsocket
04e551600d Merge pull request #471 from neutralinsomniac/ohc_whitelist
Add whitelist support to onlinehashcrack plugin
2019-11-03 16:54:44 +01:00
evilsocket
62983dfea5 Merge pull request #478 from opteeks/master
Adding 2.9inch Display support
2019-11-03 16:48:55 +01:00
evilsocket
b2c812d05d Merge pull request #501 from damoklov/master
Added Ukrainian language
2019-11-03 15:57:54 +01:00
evilsocket
7ba9b35d06 Merge pull request #507 from FrixosTh/patch-2
Bug Fix on AircrackOnly.py plugin
2019-11-03 15:57:38 +01:00
FrixosTh
b4b14ba9fd Bug Fix on AircrackOnly.py plugin
The code will always delete the pcap file unless there is a PMKID due to the structure of the if statements. Added a new variable handshakeFound that will allow the file not to be deleted if there is a handshake and also it will scan for PMKID only if no handshake is found... If no handshake is found and no PMKID, only then the file is marked as to be deleted
2019-11-03 02:31:13 +02:00
opteeks
1ba3a69651 Merge branch 'master' into master 2019-11-02 13:48:11 -07:00
damoklov
0aef199131 Added Ukrainian language
Signed-off-by: damoklov <mishanya@protonmail.com>
2019-11-02 16:47:13 +02:00
evilsocket
ace61836e5 Merge pull request #496 from dadav/fix/bt-tet-defaults
Fix bt-tether config
2019-11-02 12:13:08 +01:00
evilsocket
d04f124add Merge pull request #498 from LuckyFishGeek/ch
Add Chinese translation version 0.0.1
2019-11-02 12:12:50 +01:00
LuckyFish
bc1db7ceea Add files via upload 2019-11-02 09:42:54 +08:00
dadav
fd506b1533 Fix bt-tether config 2019-11-01 21:42:02 +01:00
evilsocket
6c44a687b1 Merge pull request #492 from dadav/feature/multi-device-tether
Add multi bt-tether support
2019-11-01 20:19:22 +01:00
dadav
a2bb66ad57 Fix case 2019-11-01 20:12:04 +01:00
Jeremy O'Brien
61af8b4762 Add whitelist support to onlinehashcrack plugin
Signed-off-by: Jeremy O'Brien <neutral@fastmail.com>
2019-11-01 15:08:05 -04:00
dadav
9b58fed862 Typo 2019-11-01 18:23:55 +01:00
dadav
53ae8ea1cf Add check if connected but no interface created 2019-11-01 18:13:38 +01:00
dadav
5b66d687c4 Add multi bt-tether support 2019-11-01 18:00:07 +01:00
Simone Margaritelli
4b74de48bf misc: small fix or general refactoring i did not bother commenting 2019-11-01 17:49:50 +01:00
Simone Margaritelli
22e76f956c fix: fixed memtemp for waveshare v2 2019-11-01 17:45:53 +01:00
Simone Margaritelli
4418492637 Merge branch 'master' of github.com:evilsocket/pwnagotchi 2019-11-01 15:53:39 +01:00
Simone Margaritelli
31a89cbe4b new: added new angry state (closes #486) 2019-11-01 15:53:31 +01:00
evilsocket
d91f49d596 Merge pull request #490 from dadav/fix/grid
Fix debug msg to fit new plugin class
2019-11-01 14:57:31 +01:00
dadav
66dc03ec05 Fix debug msg to fit new plugin class 2019-11-01 14:25:20 +01:00
Simone Margaritelli
2f948306eb misc: refactored plugin system to use classes 2019-11-01 13:51:45 +01:00
Simone Margaritelli
ae330dc0b5 fix: don't reset network interfaces configuration if not needed (closes #483) 2019-11-01 12:12:37 +01:00
evilsocket
e06f2a32e8 Merge pull request #487 from dadav/fix/fix-bt-disconnect-bug
Add reference to network object (bt-tether fix)
2019-11-01 10:45:33 +01:00
evilsocket
e184176ae4 Merge pull request #488 from dadav/feature/version-option
Add version option
2019-11-01 10:45:15 +01:00
dadav
1827ee564c Add version option 2019-11-01 10:04:36 +01:00
dadav
bfdaffa14b Add reference to network object 2019-11-01 09:20:06 +01:00
evilsocket
53f99f4c28 Merge pull request #485 from neutralinsomniac/backup_script_enhancements
enhancement: Improve the backup script
2019-10-31 19:06:32 +01:00
Jeremy O'Brien
3efa96b292 enhancement: Improve the backup script
- Significantly decrease time it takes to save a backup
- Remove host dependency on 'zip' binary
- Preserve file attributes on backed-up files
- Avoid copying files on the pi itself to /tmp

Signed-off-by: Jeremy O'Brien <neutral@fastmail.com>
2019-10-31 14:02:07 -04:00
Simone Margaritelli
8118a10a6a new: auto-update is now enabled by default 2019-10-31 18:24:43 +01:00
Simone Margaritelli
bd63f71a1d fix: +x to /usr/bin/* while creating the .img 2019-10-31 17:25:21 +01:00
Simone Margaritelli
31d401e03b fix: increased delay before shutting down to allow slower displays to update (closes #446) 2019-10-31 15:39:59 +01:00
Simone Margaritelli
3c32bbb582 releasing v1.1.1 2019-10-31 14:50:03 +01:00
Simone Margaritelli
03067da005 misc: small fix or general refactoring i did not bother commenting 2019-10-31 14:49:44 +01:00
Simone Margaritelli
64aad56fba releasing v[3~1.1.1 2019-10-31 14:47:51 +01:00
Simone Margaritelli
4240d05872 misc: small fix or general refactoring i did not bother commenting 2019-10-31 14:20:35 +01:00
evilsocket
f03e07f0cf Merge pull request #472 from neutralinsomniac/grid_handle_malformed_filenames
fix: don't attempt to parse/upload pcaps with malformed filenames
2019-10-31 14:17:00 +01:00
Simone Margaritelli
13064879e0 fix: fixed, refactored and centralized launchers logic (closes #473) 2019-10-31 14:14:13 +01:00
Simone Margaritelli
96c617e152 misc: small fix or general refactoring i did not bother commenting 2019-10-31 12:56:27 +01:00
Simone Margaritelli
783ac61594 fix: the auto-update plugin now also installs launchers and service files via setup.py (closes #470) 2019-10-31 12:48:15 +01:00
evilsocket
279d885ec6 Merge pull request #479 from deveth0/patch-2
Change memory splitting to have more memory available
2019-10-31 10:52:59 +01:00
evilsocket
a8705c1d3c Merge pull request #476 from dadav/fix/provisioning
Change the ordering of the provisioners of packer
2019-10-31 10:50:30 +01:00
Alex Muthmann
90386c7a64 Change memory splitting to have more memory available
As most users won't use a big GUI, it should be sufficient to have 16MB assigned to the GPU and have some more for the system.
2019-10-31 08:49:58 +01:00
opteeks
205480bc38 Merge pull request #4 from opteeks/waveshare29inch
Added 2.9inch display libraries
2019-10-30 22:57:10 -07:00
opteeks
d2726c1a14 Added 2.9inch display libraries 2019-10-30 22:56:02 -07:00
opteeks
1c9a25d22a Merge pull request #3 from opteeks/opteeks-waveshare29inch
Add support for Waveshare 2.9inch display
2019-10-30 22:50:12 -07:00
opteeks
e9494992fc Add support for Waveshare 2.9inch display 2019-10-30 22:49:06 -07:00
dadav
c7931450c3 change ordering 2019-10-30 22:28:12 +01:00
opteeks
cc7299153c Merge pull request #2 from opteeks/opteeks-waveshare29inch
Added waveshare29inch.py
2019-10-30 13:22:23 -07:00
opteeks
a27f09871f Added waveshare29inch.py
Added the Waveshare e-ink 2.9 inch display definition and layout.
2019-10-30 13:09:32 -07:00
Jeremy O'Brien
3714899e95 fix: don't attempt to parse/upload pcaps with malformed filenames
Signed-off-by: Jeremy O'Brien <neutral@fastmail.com>
2019-10-30 15:33:09 -04:00
Simone Margaritelli
be414e57b3 fix: builder now uses files provisioners and auto-update installs project data (ref #470) 2019-10-30 19:24:12 +01:00
Simone Margaritelli
1600d8cbd1 fix: skipping open access points (fixes #463) 2019-10-30 17:50:56 +01:00
Simone Margaritelli
965416483d fix: more robust version parsing in auto-update (fixes #469) 2019-10-30 17:37:17 +01:00
Simone Margaritelli
78a036ed1a fix: fixed Slack invite link (fixes #466) 2019-10-30 16:49:20 +01:00
Simone Margaritelli
667c64832f releasing v1.1.0 2019-10-30 15:47:36 +01:00
Simone Margaritelli
9d19fb8e7a misc: small fix or general refactoring i did not bother commenting 2019-10-30 14:25:21 +01:00
Simone Margaritelli
cb09648ba1 misc: small fix or general refactoring i did not bother commenting 2019-10-30 14:11:14 +01:00
evilsocket
03b85ac66b Merge pull request #465 from dipsylala/master
Added exception handling to config.yml parsing
2019-10-30 11:59:23 +01:00
Dispsylala
5255e5fd13 Fix default setting to be an array, otherwise the iterator works over
characters, not strings.
2019-10-30 01:05:58 +00:00
Dispsylala
d5a8cda278 Merge remote-tracking branch 'upstream/master' 2019-10-29 23:21:29 +00:00
Dispsylala
bcdbf41bb8 Added exception handling to config.yml parsing/merging 2019-10-29 22:38:41 +00:00
evilsocket
3c86b58696 Merge pull request #461 from maxxer/fix-eth0-check
Fix eth0 connection check for MANU mode
2019-10-29 11:07:51 +01:00
Lorenzo Milesi
18a41f3e29 Fix eth0 connection check for MANU mode
Issue #460 - Originally noted by @ZeroCool-Dade
a78a4b0b3e (commitcomment-35683998)

Signed-off-by: Lorenzo Milesi <io@maxxer.it>
2019-10-29 08:47:44 +01:00
evilsocket
09f33112b4 Merge pull request #453 from deveth0/patch-2
Fix lcdhat _display.clear()
2019-10-28 17:10:48 +01:00
evilsocket
432d654cc5 Merge pull request #454 from ciara1234/master
check zip is installed first before running backup
2019-10-28 17:10:17 +01:00
Alex Muthmann
3b1d90baef Fix _display.clear()
There is a typo (uppercase / lowercase) which prevents the display from initializing.
2019-10-28 12:52:14 +01:00
Ciara Brennan
0ad6e887ac check zip is installed first
Signed-off-by: Ciara Brennan <ciara.brennan@gmail.com>
2019-10-28 11:49:24 +00:00
evilsocket
d42ab1574b Merge pull request #445 from chillinPanda/issue/444_waveshare_1.54_comment
Waveshare 1.54 inch screen - config possibility in defaults.yml
2019-10-28 10:30:55 +01:00
evilsocket
7189f3c461 Merge pull request #450 from ratmandu/gpio_plugin
Adding GPIO Plugin
2019-10-28 10:30:25 +01:00
evilsocket
32e3343596 Merge pull request #439 from dipsylala/master
InkyPHAT opt-in for fast refresh
2019-10-28 10:29:02 +01:00
evilsocket
b76144909a Merge pull request #438 from nikhiljha/ws213d
add waveshare 213d display
2019-10-28 10:28:32 +01:00
Justin Richards
7676b55b87 Revert "Adding original screen clearing LUT to help prevent burn-in"
This reverts commit dfcc2f6bf2.
2019-10-27 19:36:29 -05:00
Justin Richards
92773a2b37 adding to defaults.yml and shortening debounce a little bit
Signed-off-by: Justin Richards <ratmandu@gmail.com>
2019-10-27 19:20:43 -05:00
Justin Richards
d3c6194e0f adding gpio plugin
Signed-off-by: Justin Richards <ratmandu@gmail.com>
2019-10-27 19:11:36 -05:00
Nikhil Jha
7fd31e14f9 fix resolution
Signed-off-by: Nikhil Jha <hi@nikhiljha.com>
2019-10-27 14:32:30 -07:00
Dinh Bao Dang
c0434b7dde add waveshare154inch config possibility to defaults.yml, since ...
support was introduced in #434
2019-10-27 22:29:16 +01:00
Nikhil Jha
4d5bfc2adf maybe actually fix now
Signed-off-by: Nikhil Jha <hi@nikhiljha.com>
2019-10-27 14:20:56 -07:00
Nikhil Jha
4814e10940 attempt to fix init for 213d
Signed-off-by: Nikhil Jha <hi@nikhiljha.com>
2019-10-27 14:14:48 -07:00
Justin Richards
dfcc2f6bf2 Adding original screen clearing LUT to help prevent burn-in
Signed-off-by: Justin Richards <ratmandu@gmail.com>
2019-10-27 15:48:14 -05:00
Dispsylala
a897e00c98 Merge remote-tracking branch 'origin/master' 2019-10-27 19:54:21 +00:00
Dispsylala
caec837050 Makes Inky Fast mode opt-in by selecting 'fastAndFurious'
Displays warning if selected.
Otherwise uses original InkyPHAT library
2019-10-27 19:53:29 +00:00
Nikhil Jha
786564ebb8 add waveshare 213d display
Signed-off-by: Nikhil Jha <hi@nikhiljha.com>
2019-10-27 12:52:01 -07:00
Dispsylala
bfe0ea7623 Makes Inky Fast mode opt-in by selecting 'fastAndFurious'
Displays warning if selected.
Otherwise uses original InkyPHAT library
2019-10-27 19:51:48 +00:00
evilsocket
15b815d8ad Merge pull request #422 from benleb/patch-1
polish backup.sh: add username, .bashrc to backup files, fix shellcheck lint issues
2019-10-27 18:00:13 +01:00
evilsocket
f74979b10c Merge pull request #434 from ronangaillard/feature/waveshare-154-inch
Add support for Waveshare 1.54 inch screen
2019-10-27 17:59:14 +01:00
Ben Lebherz
5119bf4326 quote shifting 2019-10-27 17:59:06 +01:00
evilsocket
74778a0acf Merge pull request #436 from dipsylala/master
Updated Preview
2019-10-27 17:58:34 +01:00
Dispsylala
65a3553521 Remove reference to VideoHandler, added reference to
Peer::first_encounter()
2019-10-27 15:43:42 +00:00
Ronan Gaillard
f4fa259781 Add support for Waveshare 1.54 inch screen 2019-10-27 16:02:00 +01:00
evilsocket
f86d5afb5c Merge pull request #417 from georgikoemdzhiev/AddBulgarian
Add Bulgarian language support
2019-10-27 13:02:22 +01:00
evilsocket
321595f93c Merge pull request #423 from PhyberApex/patch-2
Fix for #421 / Webhook missing positional argiment
2019-10-27 12:56:59 +01:00
evilsocket
d1d7107923 Merge pull request #425 from jsoref/spelling
Spelling
2019-10-27 12:56:20 +01:00
evilsocket
787a498c49 Merge pull request #426 from emedvedev/patch-1
Fix the AircrackOnly plugin
2019-10-27 12:55:17 +01:00
evilsocket
9c5006fefd Merge pull request #428 from ratmandu/waveshare-tricolor-fast
Adding Waveshare 2.13 tri-color display FAST MODE
2019-10-27 12:54:51 +01:00
evilsocket
18957c6ad3 Merge pull request #430 from strasharo/patch-2
Don't disable display output for DVI as well. fixes #429
2019-10-27 12:54:03 +01:00
georgikoemdzhiev
5e1486be93 Fixed compile
Signed-off-by: georgikoemdzhiev <koemdjiev@gmail.com>
2019-10-27 10:44:21 +00:00
strasharo
8cb3e1c8d5 Don't disable display output for DVI as well
Some people are attaching DVI displays through an adapter.
2019-10-27 10:38:28 +02:00
Justin Richards
723e1892e4 Fixed bug. Not sure how that got changed back
Signed-off-by: Justin Richards <ratmandu@gmail.com>
2019-10-27 02:53:26 -05:00
Justin Richards
f1bc2d945b Adding fastAndFurious and warning info
Signed-off-by: Justin Richards <ratmandu@gmail.com>
2019-10-27 02:29:09 -05:00
Justin Richards
16e310e377 Adding fast display update for waveshare 3-color
Signed-off-by: Justin Richards <ratmandu@gmail.com>
2019-10-27 02:18:42 -05:00
Ed Medvedev
b66c86b31a Fix the AircrackOnly plugin
AircrackOnly plugin wasn't working because of a typo: marking files for deletion referenced a wrong variable.
2019-10-27 07:47:22 +02:00
Josh Soref
b93bcd07d4 spelling: uploads 2019-10-26 22:14:15 -04:00
Josh Soref
5ae7695229 spelling: unknown 2019-10-26 22:13:59 -04:00
Josh Soref
8a687b723b spelling: transfer 2019-10-26 22:13:42 -04:00
Josh Soref
0b495ebd13 spelling: successfully 2019-10-26 22:12:45 -04:00
Josh Soref
9888e1fb39 spelling: stopping 2019-10-26 22:12:28 -04:00
Josh Soref
5a16819feb spelling: pwnagotchi 2019-10-26 22:09:57 -04:00
Josh Soref
102a061814 spelling: please 2019-10-26 22:09:37 -04:00
Josh Soref
ecfc5f9063 spelling: occurred 2019-10-26 22:09:19 -04:00
Josh Soref
1c2ff20ab4 spelling: lifting 2019-10-26 22:08:50 -04:00
Josh Soref
a2c3df5c99 spelling: going 2019-10-26 22:08:06 -04:00
Josh Soref
28c28b8b0c spelling: furnished 2019-10-26 22:07:47 -04:00
Josh Soref
3bc887631b spelling: functions 2019-10-26 22:07:34 -04:00
Josh Soref
13b73a64c8 spelling: documentation 2019-10-26 22:05:42 -04:00
Josh Soref
479f9cf79d spelling: display 2019-10-26 22:05:29 -04:00
Josh Soref
8a87bbeb90 spelling: delete 2019-10-26 22:13:18 -04:00
Josh Soref
d3d4df2500 spelling: available 2019-10-26 22:03:31 -04:00
PhyberApex
69b3fabba1 Fix for #421
Missed giving the argument to actually be able to write the response.
2019-10-27 02:02:34 +02:00
Ben Lebherz
d5007385f3 add username option, .bashrc to backup files, implement shellcheck hints 2019-10-27 01:35:13 +02:00
georgikoemdzhiev
d2af951b34 Generated mo file 2019-10-26 20:09:39 +01:00
georgikoemdzhiev
a44c325877 Added meta data 2019-10-26 20:07:59 +01:00
georgikoemdzhiev
1522470fa5 Fixed compile 2019-10-26 19:55:14 +01:00
georgikoemdzhiev
3463740fd9 Small fixes 2019-10-26 19:51:37 +01:00
georgikoemdzhiev
d6228b133b Completed bulgarian translation 2019-10-26 19:47:47 +01:00
evilsocket
441bd905a5 Merge pull request #415 from ratmandu/add-dfrobot-display
Add support for DFRobot epaper display
2019-10-26 20:37:01 +02:00
georgikoemdzhiev
db7fc74b4a Added bulgarian language WiP 2019-10-26 19:01:02 +01:00
Justin Richards
88f7384f52 adding to list of available options
Signed-off-by: Justin Richards <ratmandu@gmail.com>
2019-10-26 12:55:23 -05:00
Justin Richards
d984ea8a76 adding support for dfrobot 2.13in epaper display
Signed-off-by: Justin Richards <ratmandu@gmail.com>
2019-10-26 12:52:07 -05:00
evilsocket
4b606d9a6b Merge pull request #413 from emedvedev/imports-optimization
Optimize plugin imports
2019-10-26 17:54:47 +02:00
Edward Medvedev
ea51ab7014 Optimize plugin imports
Signed-off-by: Edward Medvedev <edward.medvedev@gmail.com>
2019-10-26 18:36:42 +03:00
Simone Margaritelli
68c11ada8d Merge branch 'master' of github.com:evilsocket/pwnagotchi 2019-10-26 17:15:58 +02:00
Simone Margaritelli
546c7fe397 fix: chown backup file (fixes #409) 2019-10-26 17:15:42 +02:00
evilsocket
5790f494df Merge pull request #408 from python273/set-cors-headers-only-if-added-to-config
Set CORS headers only if set in config
2019-10-26 17:07:48 +02:00
Simone Margaritelli
063cc73689 misc: small fix or general refactoring i did not bother commenting 2019-10-26 16:39:49 +02:00
python273
5643f9ae70 Set CORS headers only if set in config 2019-10-26 17:07:47 +03:00
Simone Margaritelli
99f6758aae releasing v1.1.0RC0 2019-10-26 14:14:43 +02:00
Simone Margaritelli
0a33f9c0af new: bump bettercap version to 2.26.1 2019-10-26 10:31:02 +02:00
evilsocket
d231541403 Merge pull request #399 from leon-th/patch-2
Added plugin PAW GPS
2019-10-26 10:29:56 +02:00
evilsocket
f1eb3316c6 Merge pull request #401 from SpiderDead/master
Updated libraries to V4.0 for the 2.7" display
2019-10-26 10:29:08 +02:00
evilsocket
f3a96b7981 Merge pull request #402 from PhyberApex/patch-1
Minor text fixes
2019-10-26 10:27:19 +02:00
PhyberApex
beb2b83f36 Minor text fixes
There is no plural of information.
2019-10-26 02:12:37 +02:00
SpiderDead
24ae443ee9 Updated libraries to V4.0 for the 2.7" display
Signed-off-by: Mike van der Vrugt <mimij68@live.nl>
2019-10-25 23:20:01 +02:00
Simone Margaritelli
3f785ee06a misc: small fix or general refactoring i did not bother commenting 2019-10-25 19:38:23 +02:00
Simone Margaritelli
cf146a54ee misc: small fix or general refactoring i did not bother commenting 2019-10-25 19:36:23 +02:00
Simone Margaritelli
31c1d742e0 fix: webui /shutdown is now on POST 2019-10-25 19:34:31 +02:00
Simone Margaritelli
c0252c9830 fix: safer call to webhook 2019-10-25 19:32:11 +02:00
Simone Margaritelli
4aa29f1b79 misc: small fix or general refactoring i did not bother commenting 2019-10-25 19:15:55 +02:00
Leon T
5dc780a88f Edited defaut.yml to add the pawgps plugin 2019-10-25 17:02:15 +02:00
Leon T
39a6ae1be5 Created the paw-gps plugin v1.0.0
This plugin connects to PAW Server with the GPS hack and saves the GPS location when a handshake is detected
2019-10-25 16:57:05 +02:00
Simone Margaritelli
047f0d5d63 misc: bump bettercap to 2.26 2019-10-25 16:43:14 +02:00
Simone Margaritelli
715e696537 fix: rebooting after setting hostname 2019-10-25 16:37:45 +02:00
Simone Margaritelli
22afb563e3 misc: small fix or general refactoring i did not bother commenting 2019-10-25 16:01:53 +02:00
Simone Margaritelli
5f4ee26f99 new: pwnagotchi folder can now be in /boot/ in which case will be moved to /etc/pwnagotchi 2019-10-25 15:29:10 +02:00
Simone Margaritelli
1959bc08ae Merge branch 'master' of github.com:evilsocket/pwnagotchi 2019-10-25 13:21:17 +02:00
Simone Margaritelli
2c9f54567f misc: small fix or general refactoring i did not bother commenting 2019-10-25 13:21:08 +02:00
evilsocket
63694d57e5 Merge pull request #395 from deveth0/patch-1
Add missing lcdhat
2019-10-25 12:36:08 +02:00
Alex Muthmann
c6c2e0e7ce Update utils.py 2019-10-25 12:25:42 +02:00
Alex Muthmann
cb6365b9f2 Add missing lcdhat 2019-10-25 12:18:13 +02:00
Simone Margaritelli
8b00e0ae10 misc: small fix or general refactoring i did not bother commenting 2019-10-25 12:17:44 +02:00
Simone Margaritelli
7954bb5fcf misc: small fix or general refactoring i did not bother commenting 2019-10-25 12:15:56 +02:00
Simone Margaritelli
06d8cc63fb misc: added debug logs for AI loading times 2019-10-25 11:40:58 +02:00
evilsocket
c4ae3c15bd Merge pull request #392 from deveth0/Display-failed-Backup
Show information on failed backup on display
2019-10-25 11:21:21 +02:00
evilsocket
3604f483aa Merge pull request #393 from deveth0/391_verify_backupfiles
#391: Verify if the configured files exist
2019-10-25 11:21:01 +02:00
Alex Muthmann
d51d3f61ac #391: Verify if the configured files exist 2019-10-25 10:55:45 +02:00
Alex Muthmann
6bb8fede0c Show information on failed backup on display 2019-10-25 10:33:12 +02:00
evilsocket
c35d202ffd Merge pull request #385 from caquino/master
parse /proc/meminfo to gather memory usage
2019-10-25 10:21:46 +02:00
evilsocket
ffa432587a Merge pull request #389 from dadav/fix/bt-tet
Fix lot of bt-tether problems
2019-10-25 10:21:23 +02:00
dadav
6f013bb1ef Fix lot of bt-tether problems 2019-10-25 01:06:29 +02:00
Cassiano Aquino
f8f6608968 one decimal place 2019-10-24 20:35:30 +01:00
Cassiano Aquino
0c176ca308 parse /proc/meminfo to gather memory usage 2019-10-24 20:29:09 +01:00
Simone Margaritelli
ec430a5cba misc: small fix or general refactoring i did not bother commenting 2019-10-24 19:54:55 +02:00
Simone Margaritelli
97733cbf43 fix: hostname validation when provided by config 2019-10-24 18:12:10 +02:00
Simone Margaritelli
4445ef6432 misc: small fix or general refactoring i did not bother commenting 2019-10-24 17:53:02 +02:00
Simone Margaritelli
a25395a945 misc: small fix or general refactoring i did not bother commenting 2019-10-24 17:52:43 +02:00
Simone Margaritelli
0f171c35ce new: unit's name can be now set via main.name configuration parameter 2019-10-24 17:48:37 +02:00
Simone Margaritelli
61b957ac77 fix: prevent user contributed plugins to crash the main process while loading 2019-10-24 17:23:33 +02:00
Simone Margaritelli
30e3898f3c misc: small fix or general refactoring i did not bother commenting 2019-10-24 15:55:00 +02:00
Simone Margaritelli
094dde0e8c fix: 'effective configuration' is a debug log now 2019-10-24 15:47:21 +02:00
Simone Margaritelli
dc5a626bd5 misc: small fix or general refactoring i did not bother commenting 2019-10-24 15:34:52 +02:00
Simone Margaritelli
608aad4820 new: observing and reporting total number of peers met per each epoch 2019-10-24 15:18:04 +02:00
Simone Margaritelli
30f9c16778 new: bumped pwngrid required version to 1.10.1 2019-10-24 14:00:22 +02:00
Simone Margaritelli
97cccf5a1d new: face expression while looking around will change dependig if the unit is with friends or alone 2019-10-24 13:42:43 +02:00
Simone Margaritelli
ce0c248cf4 misc: small fix or general refactoring i did not bother commenting 2019-10-24 13:22:05 +02:00
Simone Margaritelli
d5ac988498 misc: small fix or general refactoring i did not bother commenting 2019-10-24 13:20:55 +02:00
Simone Margaritelli
6d70a24aae misc: small fix or general refactoring i did not bother commenting 2019-10-24 13:09:54 +02:00
Simone Margaritelli
032e183ff7 new: face expression when a new unit is detected depends on the units bond level 2019-10-24 13:02:50 +02:00
Simone Margaritelli
f00c861844 misc: small fix or general refactoring i did not bother commenting 2019-10-24 12:53:52 +02:00
Simone Margaritelli
4addefd57d misc: small fix or general refactoring i did not bother commenting 2019-10-24 12:48:04 +02:00
Simone Margaritelli
2239406272 misc: small fix or general refactoring i did not bother commenting 2019-10-24 12:33:03 +02:00
Simone Margaritelli
0df5e54f91 misc: small fix or general refactoring i did not bother commenting 2019-10-24 12:29:39 +02:00
Simone Margaritelli
3e0833698a fix: forcing view update when calling manual mode 2019-10-24 12:26:18 +02:00
Simone Margaritelli
ab9ddb4513 fix: throttled manual mode grid connections to avoid rate limits 2019-10-24 12:24:38 +02:00
Simone Margaritelli
2beef33251 fix: checking inbox correctly from the grid plugin 2019-10-24 12:21:48 +02:00
evilsocket
2b583d7458 Merge pull request #373 from dadav/fix/lang
Fix/lang
2019-10-24 10:53:29 +02:00
evilsocket
da7e21bbdd Merge pull request #375 from dadav/fix/wigle-bug
[Fix] Wigle plugin - add escape char
2019-10-24 10:53:19 +02:00
evilsocket
d9ddae9a41 Merge pull request #378 from spees/patch-1
Small fix
2019-10-24 10:53:06 +02:00
spees
d306877c7a Small fix
Last change broke the launchers.
2019-10-24 10:26:58 +02:00
dadav
7d34e631f5 add escape char 2019-10-23 23:27:25 +02:00
dadav
f39c154b23 fix en and de 2019-10-23 20:59:22 +02:00
dadav
04b2ee5b44 fix en and de 2019-10-23 20:57:26 +02:00
Simone Margaritelli
9a72a8868b misc: small fix or general refactoring i did not bother commenting 2019-10-23 20:02:42 +02:00
Simone Margaritelli
d636c2b1f2 misc: small fix or general refactoring i did not bother commenting 2019-10-23 19:53:23 +02:00
Simone Margaritelli
84616827ad misc: small fix or general refactoring i did not bother commenting 2019-10-23 19:46:26 +02:00
Simone Margaritelli
d16180189e misc: small fix or general refactoring i did not bother commenting 2019-10-23 19:41:14 +02:00
Simone Margaritelli
885fddfce8 misc: small fix or general refactoring i did not bother commenting 2019-10-23 19:35:51 +02:00
Simone Margaritelli
68d7686a03 misc: small fix or general refactoring i did not bother commenting 2019-10-23 19:32:24 +02:00
Simone Margaritelli
d20f6c8a52 misc: small fix or general refactoring i did not bother commenting 2019-10-23 19:28:05 +02:00
Simone Margaritelli
5bf9f25a46 Merge branch 'master' of github.com:evilsocket/pwnagotchi 2019-10-23 19:24:16 +02:00
Simone Margaritelli
b85e4174dc misc: small fix or general refactoring i did not bother commenting 2019-10-23 19:21:42 +02:00
evilsocket
0de2e3d150 Merge pull request #369 from zenzen666/aircrackonly-minor-correction
Aircrackonly minor correction
2019-10-23 19:13:45 +02:00
evilsocket
412fca5290 Merge pull request #370 from XavierForks/fix/language-fr
Correct some typos and update
2019-10-23 19:13:33 +02:00
Simone Margaritelli
3ab2088c79 misc: small fix or general refactoring i did not bother commenting 2019-10-23 19:09:36 +02:00
Simone Margaritelli
eda8a18788 misc: small fix or general refactoring i did not bother commenting 2019-10-23 19:08:43 +02:00
Xavier Stouder
ea14cb370e fix: forgot some exclamation mark fix
Signed-off-by: Xavier Stouder <xavier@stouder.io>
2019-10-23 19:04:28 +02:00
Xavier Stouder
6f2228f439 fix: add translation
Signed-off-by: Xavier Stouder <xavier@stouder.io>
2019-10-23 18:58:58 +02:00
Xavier Stouder
1d53dc7c4e fix: fix space before !
Signed-off-by: Xavier Stouder <xavier@stouder.io>
2019-10-23 18:58:23 +02:00
Xavier Stouder
202cd1f32e fix: translate a word
Signed-off-by: Xavier Stouder <xavier@stouder.io>
2019-10-23 18:54:12 +02:00
Xavier Stouder
ab871f9d2d fix: fix type of ellpsis in french
Signed-off-by: Xavier Stouder <xavier@stouder.io>
2019-10-23 18:52:40 +02:00
Xavier Stouder
f2ceec0f8f fix: update french translation
Signed-off-by: Xavier Stouder <xavier@stouder.io>
2019-10-23 18:47:47 +02:00
Simone Margaritelli
f734c9cd68 new: bumped pwngrid required version to 1.10.0 2019-10-23 18:21:23 +02:00
Simone Margaritelli
36c3ea5bbc new: new grateful status that can override sad/bored/lonely if units with a strong bond are nearby 2019-10-23 18:19:43 +02:00
Zenzen San
062de3b618 minor logging correction
`on loaded` the plugin was showing a different name: `cleancap plugin loaded`
I've changed it with the name of the plugin to be consistent and easy to find what going on from pwnagotchi.log
2019-10-23 15:59:11 +00:00
Zenzen San
77ada644ed Merge pull request #2 from evilsocket/master
just rebase from origin
2019-10-23 15:56:38 +00:00
Simone Margaritelli
277906a673 fix: fixed bogus support for waveshare lcd displays (fixes #364) 2019-10-23 15:37:12 +02:00
Simone Margaritelli
a78a4b0b3e fix: fixes a race condition in the launcher scripts and enables MANU if eth0 is up (closes #365) 2019-10-23 15:26:53 +02:00
Simone Margaritelli
3ad426916f small refactoring to facilitate integration of the bond equation 2019-10-23 15:20:16 +02:00
Simone Margaritelli
23ef17d4c7 fix: using normal status to signal unread messages in order to avoid BT overlap bug 2019-10-23 15:14:55 +02:00
evilsocket
7779ebc983 Merge pull request #362 from python273/add-non-blocking-screen-updating
Add non blocking display updating
2019-10-23 12:52:02 +02:00
opteeks
ddc264bbb9 Deleted epd2in9.py
Wrong format
2019-10-23 00:25:08 -07:00
opteeks
f0092ff154 Waveshare 2.9 inch e-ink display 2019-10-23 00:17:28 -07:00
opteeks
ed0df18f68 Added 2.9 inch Waveshare E-Ink display 2019-10-23 00:11:25 -07:00
python273
4fa7e9f077 Add slight delay for waveshare v1 ReadBusy
Signed-off-by: python273 <iam@python273.pw>
2019-10-22 20:59:15 +03:00
python273
9ca2424df1 Add non-blocking screen updating
Signed-off-by: python273 <iam@python273.pw>
2019-10-22 20:53:15 +03:00
Simone Margaritelli
8c22b1d6f1 fix: if bettercap starts and no active interfaces are found, if mon0 is not explicitly passed it will fail with a 'No active interfces' error 2019-10-22 12:14:56 +02:00
Simone Margaritelli
538b547560 fix: on rpi4 sometimes systemd fails to monstart 2019-10-22 12:09:41 +02:00
Simone Margaritelli
414a6b4c7a misc: small fix or general refactoring i did not bother commenting 2019-10-22 11:35:35 +02:00
evilsocket
cdf11df270 Merge pull request #354 from caquino/caquino/papirus
papirus, fbi and idempotency changes
2019-10-22 11:11:01 +02:00
evilsocket
ef52cbcc25 Merge pull request #356 from SpiderDead/master
Changed the overall look of the layout on the 2.7"
2019-10-21 23:54:13 +02:00
SpiderDead
b0dab7b589 Changed the overall look of the layout on the 2.7"
Signed-off-by: Mike van der Vrugt <mimij68@live.nl>
2019-10-21 23:45:35 +02:00
Cassiano Aquino
ace1244d10 disable sap plugin for bluetooth service 2019-10-21 18:41:36 +01:00
Cassiano Aquino
84fa293a11 change quotes to allow tab expansion 2019-10-21 17:58:00 +01:00
Simone Margaritelli
139c9df88c fix: fixed auto-backup plugin to only create local backups 2019-10-21 18:51:22 +02:00
Cassiano Aquino
7a721be7dc papirus, fbi and idempotency changes 2019-10-21 16:38:53 +01:00
Simone Margaritelli
56079dfd9d fix: waiting for bettercap's API to start 2019-10-21 16:26:07 +02:00
Simone Margaritelli
90998be24c fix: handling exceptions when bettercap is not running yet 2019-10-21 16:22:38 +02:00
Simone Margaritelli
5cb721f490 fix: correct services dependencies 2019-10-21 16:10:09 +02:00
Simone Margaritelli
c954bf8ffa fix: refactored backup.sh script to not require root login 2019-10-21 15:41:45 +02:00
Simone Margaritelli
41ea0e0747 new: new ui.display.video.on_frame configuration to use fbi on framebuffer based screens 2019-10-21 14:01:21 +02:00
Simone Margaritelli
e943cfad70 misc: small fix or general refactoring i did not bother commenting 2019-10-21 12:27:16 +02:00
Simone Margaritelli
f576fb609b Merge branch 'master' of github.com:evilsocket/pwnagotchi 2019-10-21 11:34:00 +02:00
Simone Margaritelli
1e015fe6f6 misc: replaced ssh-keygen with pwngrid -generate 2019-10-21 11:33:48 +02:00
evilsocket
d526915cce Merge pull request #352 from gkrs/master
Updated polish language pack. New phrase, corrections and cleanup.
2019-10-21 11:29:02 +02:00
gkrs
0ac940f636 Updated polish language pack. New phrase, corrections and cleanup. 2019-10-21 10:57:16 +02:00
evilsocket
da6f3608f3 Merge pull request #350 from friedphish/patch-1
Make wpa-sec URL configurable, part 1.
2019-10-21 10:20:25 +02:00
evilsocket
bdfd021820 Merge pull request #351 from friedphish/patch-2
Update wpa-sec.py
2019-10-21 10:20:15 +02:00
friedphish
4a2091e688 Update wpa-sec.py
Part 2 of closing https://github.com/evilsocket/pwnagotchi/issues/347.
2019-10-21 09:53:32 +02:00
friedphish
16832cd414 Update defaults.yml 2019-10-21 09:48:55 +02:00
evilsocket
020be7185c Merge pull request #299 from dadav/feature/web-hook-for-plugins
Implement webhook for plugins
2019-10-20 22:11:04 +02:00
evilsocket
c8ff69c068 Merge pull request #348 from SpiderDead/master
Added support for Waveshare 2.7inch e-Paper Display
2019-10-20 22:10:39 +02:00
evilsocket
79d252254f Merge pull request #345 from python273/patch-3
Fix Origin header check bypass
2019-10-20 21:42:08 +02:00
Simone Margaritelli
64e677f5df new: implemented auto-update plugin (closes #343) 2019-10-20 21:39:14 +02:00
Simone Margaritelli
bceb3c4c4f misc: small fix or general refactoring i did not bother commenting 2019-10-20 21:36:37 +02:00
Simone Margaritelli
df246b255a misc: small fix or general refactoring i did not bother commenting 2019-10-20 21:35:36 +02:00
SpiderDead
d6d810497e Added libraries for the 2.7" display
Signed-off-by: Mike van der Vrugt <mimij68@live.nl>
2019-10-20 21:28:29 +02:00
SpiderDead
9df1dbe077 Added configuration file for waveshare27inch
Signed-off-by: Mike van der Vrugt <mimij68@live.nl>
2019-10-20 21:27:44 +02:00
SpiderDead
3c97dbf8dc Added waveshare27inch as a known display
Signed-off-by: Mike van der Vrugt <mimij68@live.nl>
2019-10-20 21:27:10 +02:00
SpiderDead
376a74d7ac Added documentation for waveshare27inch
Signed-off-by: Mike van der Vrugt <mimij68@live.nl>
2019-10-20 21:26:32 +02:00
Simone Margaritelli
855b493040 misc: small fix or general refactoring i did not bother commenting 2019-10-20 21:25:27 +02:00
Simone Margaritelli
375486f9d0 misc: small fix or general refactoring i did not bother commenting 2019-10-20 21:20:55 +02:00
Simone Margaritelli
0263777e4b misc: small fix or general refactoring i did not bother commenting 2019-10-20 21:18:43 +02:00
Simone Margaritelli
132666935a misc: small fix or general refactoring i did not bother commenting 2019-10-20 20:59:59 +02:00
Simone Margaritelli
74a75f03b8 misc: small fix or general refactoring i did not bother commenting 2019-10-20 20:57:15 +02:00
Simone Margaritelli
399e78e675 misc: small fix or general refactoring i did not bother commenting 2019-10-20 20:52:22 +02:00
Simone Margaritelli
649091766f misc: small fix or general refactoring i did not bother commenting 2019-10-20 20:47:52 +02:00
Simone Margaritelli
999b130224 misc: small fix or general refactoring i did not bother commenting 2019-10-20 20:46:18 +02:00
Simone Margaritelli
2a450e64ef misc: small fix or general refactoring i did not bother commenting 2019-10-20 20:32:18 +02:00
Simone Margaritelli
6152374024 misc: small fix or general refactoring i did not bother commenting 2019-10-20 19:56:31 +02:00
Simone Margaritelli
f9cbef9697 misc: small fix or general refactoring i did not bother commenting 2019-10-20 19:53:02 +02:00
Simone Margaritelli
682b373c66 misc: small fix or general refactoring i did not bother commenting 2019-10-20 19:51:30 +02:00
Simone Margaritelli
8d0d3df2b0 misc: small fix or general refactoring i did not bother commenting 2019-10-20 19:50:05 +02:00
Simone Margaritelli
6d5054387b misc: small fix or general refactoring i did not bother commenting 2019-10-20 19:48:52 +02:00
Simone Margaritelli
4018071bba misc: small fix or general refactoring i did not bother commenting 2019-10-20 19:47:08 +02:00
Simone Margaritelli
63568f1725 misc: small fix or general refactoring i did not bother commenting 2019-10-20 19:45:45 +02:00
Simone Margaritelli
c72cb5b962 misc: small fix or general refactoring i did not bother commenting 2019-10-20 19:42:15 +02:00
Simone Margaritelli
0cdb8c3221 misc: small fix or general refactoring i did not bother commenting 2019-10-20 19:29:11 +02:00
Simone Margaritelli
ddeefa037d misc: small fix or general refactoring i did not bother commenting 2019-10-20 19:27:31 +02:00
Simone Margaritelli
a4e072cf33 misc: small fix or general refactoring i did not bother commenting 2019-10-20 19:22:04 +02:00
Simone Margaritelli
677b335403 misc: small fix or general refactoring i did not bother commenting 2019-10-20 19:18:50 +02:00
Kirill
f762c3ac0d Fix headers.get('origin') == None check 2019-10-20 20:03:17 +03:00
Simone Margaritelli
152676f651 fix: don't show sad face in manual mode for very short sessions 2019-10-20 18:51:33 +02:00
Simone Margaritelli
0ce1fa9d12 misc: small fix or general refactoring i did not bother commenting 2019-10-20 18:49:45 +02:00
Simone Margaritelli
2e8f2aa1b8 misc: small fix or general refactoring i did not bother commenting 2019-10-20 18:48:05 +02:00
Simone Margaritelli
f7a23b32c1 misc: small fix or general refactoring i did not bother commenting 2019-10-20 18:45:56 +02:00
Kirill
4653c5d95d Fix Origin header check bypass 2019-10-20 19:45:43 +03:00
Simone Margaritelli
c947d5c43b misc: small fix or general refactoring i did not bother commenting 2019-10-20 18:41:57 +02:00
Simone Margaritelli
26bb5d6183 misc: small fix or general refactoring i did not bother commenting 2019-10-20 18:39:01 +02:00
Simone Margaritelli
916be1f63e misc: small fix or general refactoring i did not bother commenting 2019-10-20 18:36:06 +02:00
Simone Margaritelli
4a4b973f60 misc: small fix or general refactoring i did not bother commenting 2019-10-20 18:33:43 +02:00
Simone Margaritelli
d49cefe1e4 misc: small fix or general refactoring i did not bother commenting 2019-10-20 18:32:24 +02:00
Simone Margaritelli
c6b3e11e04 new: new --skip-session for manual mode to skip session parsing 2019-10-20 18:29:36 +02:00
Simone Margaritelli
e8fa682302 misc: small fix or general refactoring i did not bother commenting 2019-10-20 18:20:07 +02:00
Simone Margaritelli
fbd12bf87b misc: small fix or general refactoring i did not bother commenting 2019-10-20 18:11:18 +02:00
Simone Margaritelli
40c01db1d1 misc: small fix or general refactoring i did not bother commenting 2019-10-20 18:08:14 +02:00
Simone Margaritelli
ca2becd9ce working on auto-update plugin 2019-10-20 18:05:53 +02:00
Simone Margaritelli
ff6bf5c198 started working on #343 2019-10-20 17:36:34 +02:00
Simone Margaritelli
cd5d783c52 new: users can now customize the faces via config.yml (ui.faces) 2019-10-20 17:13:05 +02:00
Simone Margaritelli
99e0a31ea8 misc: changed readme image 2019-10-20 16:31:34 +02:00
dadav
5f6cc378f1 Implement webhook 2019-10-20 16:17:46 +02:00
Simone Margaritelli
d45e8c7ba0 new: secured the web ui with CORS 2019-10-20 16:09:27 +02:00
Simone Margaritelli
539df810ed misc: small fix or general refactoring i did not bother commenting 2019-10-20 15:42:08 +02:00
Simone Margaritelli
bd7c64b2af misc: refactored web ui code 2019-10-20 15:41:06 +02:00
Simone Margaritelli
892fda775d fix: throttling report requests a bit to avoid rate limits on the API 2019-10-20 14:55:34 +02:00
Simone Margaritelli
f9c0efc24a new: bump pwngrid to 1.9.0 2019-10-20 14:55:15 +02:00
Simone Margaritelli
400d0e7290 fix: removed unused variable in the grid plugin 2019-10-20 14:32:15 +02:00
Simone Margaritelli
fb2c65ef0a fix: made grid api errors due to rate limiting and stuff way less dramatic 2019-10-20 14:31:45 +02:00
Simone Margaritelli
6d88cb17f3 minor refactoring 2019-10-20 14:28:34 +02:00
Simone Margaritelli
c10f25140c Merge branch 'master' of github.com:evilsocket/pwnagotchi 2019-10-20 14:26:54 +02:00
Simone Margaritelli
d2966098b0 lol dadav 2019-10-20 14:24:40 +02:00
evilsocket
a3a4854427 Merge pull request #338 from spees/master
refactored memtemp so it actually works
2019-10-20 14:17:55 +02:00
evilsocket
e5d623c114 Merge pull request #336 from dadav/fix/tweepy_version
increase version
2019-10-20 13:52:18 +02:00
dadav
68801adcaf increase version 2019-10-20 12:10:01 +02:00
spees
58a085188f refactored to use the already existing functions
Signed-off-by: spees <speeskonijn@gmail.com>
2019-10-19 22:25:12 +02:00
spees
f52687642e refactored so it actually works
Signed-off-by: spees <speeskonijn@gmail.com>
2019-10-19 21:32:55 +02:00
Simone Margaritelli
2d7b6b54fe releasing v1.0.1 2019-10-19 18:56:03 +02:00
Simone Margaritelli
b3aa5bc2c1 fix: bumped pwngrid to 1.8.1 2019-10-19 18:43:16 +02:00
Simone Margaritelli
10cba6872a fix: fixed travis-ci regexp 2019-10-19 17:26:03 +02:00
Simone Margaritelli
b213f9f214 releasing v1.0.0 2019-10-19 17:22:34 +02:00
evilsocket
fa72a53129 Merge pull request #330 from python273/patch-2
Fix waveshare v1 layout: status pos
2019-10-19 12:07:03 +02:00
Kirill
49f7c652c7 Fix waveshare v1 layout: status pos 2019-10-19 12:53:46 +03:00
evilsocket
9c78e16c1b Merge pull request #328 from szymex73/polish-lang
Add polish translation
2019-10-19 10:10:43 +02:00
evilsocket
22ebc09c9d Merge pull request #329 from ggiraudon/master
Adding support for Waveshare LCD Hat (ST7789 chip)
2019-10-19 10:08:41 +02:00
root
0ea67cb97f Adding support for Waveshare LCD Hat (ST7789 chip) 2019-10-19 04:49:38 +01:00
Szymon Borecki
2324423cab Add polish translation files
Signed-off-by: Szymon Borecki <szymex73@gmail.com>
2019-10-19 00:55:48 +02:00
evilsocket
be2cd8293f Merge pull request #326 from dadav/fix/gast-version
need old gast version
2019-10-18 21:23:41 +02:00
dadav
86cbe01081 need old gast version 2019-10-18 20:31:10 +02:00
Simone Margaritelli
eea4feee71 new: bump pwngrid binary to 1.8.0 2019-10-18 19:51:07 +02:00
evilsocket
cff487008c Merge pull request #325 from dadav/fix/bt-dbus-bug
Fix str comparison and add sleep
2019-10-18 19:35:27 +02:00
dadav
6cecca67a4 Fix str comparison and add sleep 2019-10-18 19:20:25 +02:00
Simone Margaritelli
fb4d46d71a fix: fixed Invalid cross-device link error 2019-10-18 17:43:45 +02:00
Simone Margaritelli
e220a869e0 new: user config is now copied from /boot/config.yml 2019-10-18 16:34:58 +02:00
Simone Margaritelli
f4a59549fa fix: update process will be reflash based for a while 2019-10-18 15:58:53 +02:00
Simone Margaritelli
a058d2e00d fix: removed deprecated script 2019-10-18 15:57:40 +02:00
Simone Margaritelli
8c73e32853 fix: handling corrupted log lines (fixes #321) 2019-10-18 10:30:27 +02:00
evilsocket
eeee4bdd3c Merge pull request #314 from ChipWolf/patch-1
Only show ui complication if you have unread pwnmail
2019-10-18 09:45:10 +02:00
evilsocket
1ddf020ba8 Merge pull request #318 from colossus700/colossus700-patch-1
Fix LM75B import error for Papirus Screens
2019-10-18 09:44:32 +02:00
evilsocket
e992834b37 Merge pull request #316 from spees/master
Minor fixes to the UI to prevent overlap
2019-10-18 09:43:59 +02:00
colossus700
55bac8a8b9 Update epd.py
Fixed LM75B import error
2019-10-17 19:03:04 -04:00
Chip Wolf ‮
61a6b77a52 Only show ui complication if you have unread pwnmail 2019-10-17 23:09:49 +01:00
spees
0aa4f95235 Made the memtemp plugin usable and added to default.yml
Signed-off-by: spees <speeskonijn@gmail.com>
2019-10-17 23:55:11 +02:00
Simone Margaritelli
95b871aade releasing v1.0.0RC5 2019-10-17 22:02:53 +02:00
Simone Margaritelli
7b05f10c6f pwngrid 1.7.6 2019-10-17 21:56:12 +02:00
spees
299bd9a5ca Moved APs status to prevent overlap with channel status on inky screens
Signed-off-by: spees <speeskonijn@gmail.com>
2019-10-17 20:10:43 +02:00
spees
10688ca7b0 Moved BT status to prevent overlap with last recon total APS
Signed-off-by: spees <speeskonijn@gmail.com>
2019-10-17 20:07:56 +02:00
evilsocket
6b1bca7cb2 Merge pull request #312 from wytshadow/master
added jp translation
2019-10-17 14:01:18 +02:00
Simone Margaritelli
79688305fd fix: fixed reboot procedure (fixes #313) 2019-10-17 13:42:05 +02:00
evilsocket
13b1fb6d14 Merge pull request #298 from dadav/fix/cool-smilie
Fix the weird looking COOL-face
2019-10-17 13:38:43 +02:00
dadav
8a1aad1a99 changed left and right faces 2019-10-17 13:05:47 +02:00
wytshadow
aeb6536959 added jp translation 2019-10-16 15:09:46 -06:00
Simone Margaritelli
970b6922b7 fix: if -> elif typo (fixes #310) 2019-10-16 17:20:48 +02:00
Simone Margaritelli
18dd71b989 💔 2019-10-16 16:37:42 +02:00
evilsocket
256ccab05c Merge pull request #306 from ciara1234/irish-lang
Adding Irish translations
2019-10-16 14:34:49 +02:00
evilsocket
0aa80d2307 Merge pull request #307 from dadav/fix/improve_bt
Fix/improve bt
2019-10-16 14:34:30 +02:00
dadav
5987f93009 Refracture code 2019-10-16 09:41:47 +02:00
dadav
ebeb22081b Improve logging and add already_connected check 2019-10-16 09:28:29 +02:00
Ciara Brennan
f97b106858 Irish translations
Signed-off-by: Ciara Brennan <ciara.brennan@gmail.com>
2019-10-15 23:52:08 +01:00
evilsocket
c449c77ef9 Merge pull request #304 from deveth0/master
Print effective merged config
2019-10-15 18:17:38 +02:00
amuthmann
a05ea2f48a Merge branch 'master' of github.com:deveth0/pwnagotchi 2019-10-15 17:47:38 +02:00
amuthmann
beb2fedf02 Print effective merged config
Signed-off-by: deveth0 <github@dev-eth0.de>
2019-10-15 17:47:08 +02:00
amuthmann
1936c309f0 Print effective merge config 2019-10-15 17:43:32 +02:00
Simone Margaritelli
ee3fb285be misc: small fix or general refactoring i did not bother commenting 2019-10-15 13:19:30 +02:00
Simone Margaritelli
aa60a369a9 fix: fix for bug mentioned in 13d68c7c24\#commitcomment-35504643 2019-10-15 13:17:26 +02:00
Simone Margaritelli
0e9f9c0f2e fix: fixed typos due to old configuration paths (fixes #300) 2019-10-15 12:05:06 +02:00
Simone Margaritelli
6645c80db3 misc: small fix or general refactoring i did not bother commenting 2019-10-15 11:56:49 +02:00
Simone Margaritelli
13d68c7c24 misc: attempted refactoring of the display support in something less shitty 2019-10-15 11:50:09 +02:00
Simone Margaritelli
df33d20cb2 fix: refactored oledhat layout 2019-10-15 10:45:03 +02:00
Simone Margaritelli
f3eb208c6a fix: refactored papirus layout 2019-10-15 10:42:08 +02:00
Simone Margaritelli
ae5ca2a05e fix: refactored inkyphat layout 2019-10-15 10:37:40 +02:00
evilsocket
a9b9c6677e Merge pull request #296 from systemik/master
Fix for layout.py to handle oledhat
2019-10-15 10:25:43 +02:00
dadav
f85d80d3fd Use the coolest face for the cool emotion 2019-10-14 22:43:12 +02:00
Administrator
4be54cf3ee Fix layout issues 2019-10-14 21:08:07 +02:00
Administrator
c8953d4654 Fix few errors with OledHat 2019-10-14 20:41:41 +02:00
Simone Margaritelli
26ff5c95f2 Merge branch 'master' of github.com:evilsocket/pwnagotchi 2019-10-14 20:20:07 +02:00
Simone Margaritelli
2f0f0edab0 pwngrid 1.7.5 2019-10-14 20:20:00 +02:00
evilsocket
b81c80cf99 Merge pull request #294 from dadav/fix/wpa-sec-cookie
Fix/wpa sec cookie
2019-10-14 20:05:44 +02:00
dadav
baf20a9ac8 Fix url 2019-10-14 19:58:47 +02:00
dadav
280ca22261 Change header to cookie 2019-10-14 19:57:04 +02:00
Simone Margaritelli
277dbd5a16 misc: small fix or general refactoring i did not bother commenting 2019-10-14 19:48:33 +02:00
Simone Margaritelli
5b29f65042 misc: small fix or general refactoring i did not bother commenting 2019-10-14 19:35:49 +02:00
Simone Margaritelli
9f66d7ab96 misc: small fix or general refactoring i did not bother commenting 2019-10-14 19:32:40 +02:00
Simone Margaritelli
9625cf1122 misc: small fix or general refactoring i did not bother commenting 2019-10-14 19:26:23 +02:00
Simone Margaritelli
6b42e48dff misc: refactored ui layout code 2019-10-14 19:21:46 +02:00
evilsocket
d814de75ab Merge pull request #292 from systemik/master
Add support for waveshare oledhat display.
2019-10-14 18:46:28 +02:00
evilsocket
35b442f941 Merge pull request #293 from pcotret/patch-1
Added missing words for the french PO file
2019-10-14 18:42:35 +02:00
Pascal Cotret
0f2ad47c17 Added missing words for the french PO file 2019-10-14 18:25:22 +02:00
Administrator
748dbea13e Fix bug. Line misplaced in the code to init the display. 2019-10-14 18:19:53 +02:00
Administrator
b66f1b66e5 Add oledhat in the default.yml options for ui 2019-10-14 16:41:09 +02:00
Simone Margaritelli
1642663c84 fix: added explicit path for pwngrid client token 2019-10-14 16:40:29 +02:00
Administrator
54a8fd81a5 Initial commit Waveshare OledHat
Add support for Waveshare Oled Hat
Change view.py to have more variable to support more types of screen in the future
2019-10-14 16:38:57 +02:00
Simone Margaritelli
2fe7ac0a71 misc: small fix or general refactoring i did not bother commenting 2019-10-14 16:18:33 +02:00
Simone Margaritelli
4b563398f4 misc: small fix or general refactoring i did not bother commenting 2019-10-14 16:18:07 +02:00
Simone Margaritelli
84be7c0d34 misc: small fix or general refactoring i did not bother commenting 2019-10-14 16:16:59 +02:00
Simone Margaritelli
82bf9b9853 misc: small fix or general refactoring i did not bother commenting 2019-10-14 14:38:24 +02:00
evilsocket
d9d38e7a1e Merge pull request #290 from beliver17/patch-1
Update README.md
2019-10-14 13:17:26 +02:00
beliver17
5b78a13e95 Update README.md 2019-10-14 16:00:05 +05:30
Simone Margaritelli
a8a0f842a3 new: saving unit's fingerprint to /etc/pwnagotchi/fingerprint for easy access 2019-10-14 11:36:42 +02:00
evilsocket
f8a28d375b Merge pull request #276 from dipsylala/master
Inkyphat subclass to incorporate timing changes.
2019-10-14 10:43:39 +02:00
evilsocket
cfa8a02abc Merge pull request #279 from dadav/feature/auto-pairing-bt
Add auto-pair and internet-sharing
2019-10-14 10:42:34 +02:00
evilsocket
e32be6ff27 Merge pull request #285 from cdiemel/plugin.on-callback
on_unfiltered_ap_list() for plugins
2019-10-14 10:42:11 +02:00
evilsocket
ab74395602 Merge pull request #288 from charlesrocket/RU
Fix RU
2019-10-14 10:39:51 +02:00
evilsocket
b7a806c8ad Merge pull request #282 from dadav/feature/migrate-to-statusfile
Migrate to statusfile
2019-10-14 10:38:46 +02:00
-k
e146a87b44 RU locale edits 2019-10-13 22:20:53 -07:00
Casey Diemel
dfb4bcaf21 added on_loaded function
Signed-off-by: Casey Diemel <diemelcw@gmail.com>
2019-10-13 18:13:25 -04:00
Casey Diemel
9aca3a3a5b added example for testing
Signed-off-by: Casey Diemel <diemelcw@gmail.com>
2019-10-13 17:53:18 -04:00
Casey Diemel
d15f8c18b5 updated function call
Signed-off-by: Casey Diemel <diemelcw@gmail.com>
2019-10-13 17:52:41 -04:00
dadav
87a3fb5f0c Migrate to statusfile 2019-10-13 22:39:03 +02:00
dadav
8b366ca736 Add auto-pair and internet-sharing 2019-10-13 21:26:53 +02:00
Casey Diemel
2bbcc36f2a added unfiltered ap list call back
Signed-off-by: Casey Diemel <diemelcw@gmail.com>
2019-10-13 13:57:45 -04:00
Casey Diemel
308746a7de removed plugin.on() return value as is not needed
Signed-off-by: Casey Diemel <diemelcw@gmail.com>
2019-10-13 13:54:22 -04:00
Casey Diemel
d648f7cdf5 Merge branch 'master' into plugin.on-callback
bring the current branch up to evilsocket/pwnagotchi
Signed Off: Casey Diemel <diemelcw@gmail.com>
2019-10-13 13:45:11 -04:00
Dispsylala
5a53670133 Merge remote-tracking branch 'upstream/master' 2019-10-13 18:16:10 +01:00
Simone Margaritelli
e15d0f3323 releasing v1.0.0RC4 2019-10-13 19:07:29 +02:00
Simone Margaritelli
1ce361a839 misc: small fix or general refactoring i did not bother commenting 2019-10-13 18:49:50 +02:00
Dispsylala
e9899dda94 Overrides default inky library to change timings on black rendering 2019-10-13 17:40:58 +01:00
Simone Margaritelli
2430b4a134 misc: small fix or general refactoring i did not bother commenting 2019-10-13 18:35:09 +02:00
Simone Margaritelli
b539a76124 misc: small fix or general refactoring i did not bother commenting 2019-10-13 18:32:14 +02:00
Simone Margaritelli
ba7c0ee4e6 misc: small fix or general refactoring i did not bother commenting 2019-10-13 18:29:56 +02:00
Dispsylala
f0c5ad4b74 Overrides default inky library to change timings on black rendering 2019-10-13 17:18:27 +01:00
Simone Margaritelli
8d2cbee8df fix: fixed log flooding with whitelisten networks for grid report 2019-10-13 18:09:33 +02:00
Simone Margaritelli
6793312691 misc: small fix or general refactoring i did not bother commenting 2019-10-13 18:02:11 +02:00
Simone Margaritelli
5989d2571c misc: small fix or general refactoring i did not bother commenting 2019-10-13 17:55:10 +02:00
Simone Margaritelli
ad2fbdb9dd misc: small fix or general refactoring i did not bother commenting 2019-10-13 17:54:33 +02:00
Simone Margaritelli
1215fda459 misc: small fix or general refactoring i did not bother commenting 2019-10-13 17:45:34 +02:00
Simone Margaritelli
1808392a1d misc: small fix or general refactoring i did not bother commenting 2019-10-13 17:40:30 +02:00
Simone Margaritelli
77efeafd65 misc: small fix or general refactoring i did not bother commenting 2019-10-13 17:39:25 +02:00
Simone Margaritelli
ac5ee1ba7b misc: small fix or general refactoring i did not bother commenting 2019-10-13 17:38:00 +02:00
Simone Margaritelli
ef31366078 mergbe 2019-10-13 17:25:31 +02:00
Simone Margaritelli
5d28557608 new: using pwngrid for mesh advertising (we got rid of scapy loading times) 2019-10-13 17:24:47 +02:00
evilsocket
3a14d1d87f Merge pull request #275 from dadav/feature/bluetooth-plugin
Add bluetooth plugin
2019-10-13 13:25:24 +02:00
dadav
1691896531 add config param 2019-10-13 13:23:38 +02:00
dadav
e08b633c88 add bluetooth plugin 2019-10-13 13:14:22 +02:00
Simone Margaritelli
77c16c38f4 fix: using /proc/uptime to correctly calculate uptime in seconds (fixes #264) 2019-10-13 12:18:35 +02:00
Casey Diemel
3773f96901 Updated on() to allow return values
modified line 21

added line 22-23

Signed-off-by: Casey Diemel <diemelcw@gmail.com>
2019-10-12 16:49:52 -04:00
146 changed files with 9373 additions and 2699 deletions

View File

@@ -3,7 +3,6 @@ maintainers:
- caquino
- dadav
- justin-p
- hexwaxwing
features:
- comments

View File

@@ -20,7 +20,7 @@ deploy:
repo: evilsocket/pwnagotchi
branches:
only:
- "/^v[0-9]+\\.[0-9]+\\.[0-9]+[A-Za-z0-9]+?$/"
- "/^v[0-9]+\\.[0-9]+\\.[0-9]+[A-Za-z0-9]*$/"
cache:
apt: true
before_script:

View File

@@ -6,3 +6,4 @@ include LICENSE
recursive-include bin *
recursive-include pwnagotchi *.py
recursive-include pwnagotchi *.yml
recursive-include pwnagotchi *.*

View File

@@ -1,7 +1,7 @@
PWN_HOSTNAME=pwnagotchi
PWN_VERSION=master
all: install image clean
all: clean install image
install:
curl https://releases.hashicorp.com/packer/1.3.5/packer_1.3.5_linux_amd64.zip -o /tmp/packer.zip

View File

@@ -1,40 +1,29 @@
# Pwnagotchi
<p align="center">
<p align="center">
<a href="https://github.com/evilsocket/pwnagotchi/releases/latest"><img alt="Release" src="https://img.shields.io/github/release/evilsocket/pwnagotchi.svg?style=flat-square"></a>
<a href="https://github.com/evilsocket/pwnagotchi/blob/master/LICENSE.md"><img alt="Software License" src="https://img.shields.io/badge/license-GPL3-brightgreen.svg?style=flat-square"></a>
<a href="https://github.com/evilsocket/pwnagotchi/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/evilsocket/pwnagotchi"/></a>
<a href="https://travis-ci.org/evilsocket/pwnagotchi"><img alt="Travis" src="https://img.shields.io/travis/evilsocket/pwnagotchi/master.svg?style=flat-square"></a>
<a href="https://pwnagotchi.herokuapp.com/"><img alt="Slack" src="https://pwnagotchi.herokuapp.com/badge.svg"></a>
<a href="https://invite.pwnagotchi.ai/"><img alt="Slack" src="https://invite.pwnagotchi.ai/badge.svg"></a>
<a href="https://community.pwnagotchi.ai/"><img alt="Forum" src="https://img.shields.io/discourse/posts?server=https%3A%2F%2Fcommunity.pwnagotchi.ai%2F&style=flat-square"></a>
<a href="https://twitter.com/intent/follow?screen_name=pwnagotchi"><img src="https://img.shields.io/twitter/follow/pwnagotchi?style=social&logo=twitter" alt="follow on Twitter"></a>
</p>
</p>
[Pwnagotchi](https://twitter.com/pwnagotchi) is an [A2C](https://hackernoon.com/intuitive-rl-intro-to-advantage-actor-critic-a2c-4ff545978752)-based "AI" leveraging [bettercap](https://www.bettercap.org/) that learns from its surrounding WiFi environment in order to maximize the crackable WPA key material it captures (either passively, or by performing deauthentication and association attacks). 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/),
[Pwnagotchi](https://pwnagotchi.ai/) is an [A2C](https://hackernoon.com/intuitive-rl-intro-to-advantage-actor-critic-a2c-4ff545978752)-based "AI" leveraging [bettercap](https://www.bettercap.org/) that learns from its surrounding WiFi environment to maximize the crackable WPA key material it captures (either passively, or by performing authentication and association attacks). 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.
![ui](https://i.imgur.com/c7xh4hN.png)
![ui](https://i.imgur.com/X68GXrn.png)
Instead of merely 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) like most reinforcement learning based "AI" *(yawn)*, Pwnagotchi tunes [its own parameters](https://github.com/evilsocket/pwnagotchi/blob/master/pwnagotchi/defaults.yml#L73) over time to **get better at pwning WiFi things** in the environments you expose it to.
Instead of merely 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) like most reinforcement learning-based "AI" *(yawn)*, Pwnagotchi tunes [its parameters](https://github.com/evilsocket/pwnagotchi/blob/master/pwnagotchi/defaults.yml#L73) over time to **get better at pwning WiFi things to** in the environments you expose it to.
More specifically, Pwnagotchi is using an [LSTM with MLP feature extractor](https://stable-baselines.readthedocs.io/en/master/modules/policies.html#stable_baselines.common.policies.MlpLstmPolicy) as its policy network for the [A2C agent](https://stable-baselines.readthedocs.io/en/master/modules/a2c.html). If you're unfamiliar with A2C, here is [a very good introductory explanation](https://hackernoon.com/intuitive-rl-intro-to-advantage-actor-critic-a2c-4ff545978752) (in comic form!) of the basic principles behind how Pwnagotchi learns. (You can read more about how Pwnagotchi learns in the [Usage](https://www.pwnagotchi.ai/usage/#training-the-ai) doc.)
**Keep in mind:** Unlike the usual RL simulations, Pwnagotchi actually learns over time. Time for a Pwnagotchi is measured in epochs; 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 your Pwnagotchi to perform amazingly well at the very beginning, as it will be [exploring](https://hackernoon.com/intuitive-rl-intro-to-advantage-actor-critic-a2c-4ff545978752) several combinations of [key parameters](https://www.pwnagotchi.ai/usage/#training-the-ai) to determine ideal adjustments for pwning the particular environment you are exposing it to during its beginning epochs ... but **definitely listen to your Pwnagotchi when it tells you it's bored!** Bring it into novel WiFi environments with you and have it observe new networks and capture new handshakes—and you'll see. :)
**Keep in mind:** Unlike the usual RL simulations, Pwnagotchi learns over time. Time for a Pwnagotchi is measured in epochs; 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 your Pwnagotchi to perform amazingly well at the very beginning, as it will be [exploring](https://hackernoon.com/intuitive-rl-intro-to-advantage-actor-critic-a2c-4ff545978752) several combinations of [key parameters](https://www.pwnagotchi.ai/usage/#training-the-ai) to determine ideal adjustments for pwning the particular environment you are exposing it to during its beginning epochs ... but ** listen to your Pwnagotchi when it tells you it's boring!** Bring it into novel WiFi environments with you and have it observe new networks and capture new handshakes—and you'll see. :)
Multiple units within close physical proximity can "talk" to each other, advertising their own presence to each other by broadcasting custom information elements using a parasite protocol I've built on top of the existing dot11 standard. Over time, two or more units trained together will learn to cooperate upon detecting each other's presence by dividing the available channels among them for optimal pwnage.
## Why does Pwnagotchi exist?
For hackers to learn reinforcement learning, WiFi networking, and have an excuse to get out for more walks. Also? **It's cute as f---**.
**In case you're curious about the name:** *Pwnagotchi* is a portmanteau of *pwn* (which we shouldn't have to explain if you are interested in this project :kissing_heart:) and *-gotchi*. It is a nostalgic reference made in homage to a very popular children's toy from the 1990s called the [Tamagotchi](https://en.wikipedia.org/wiki/Tamagotchi). The Tamagotchi (たまごっち, derived from *tamago* (たまご) "egg" + *uotchi* (ウオッチ) "watch") is a cultural touchstone for many Millennial hackers as a formative electronic toy from our collective childhoods. Were you lucky enough to possess a Tamagotchi as a kid? Well, with your Pwnagotchi, you too can enjoy the nostalgic delight of being strangely emotionally attached to a handheld automata *yet again!* Except, this time around...you get to #HackThePlanet. >:D
Multiple units within close physical proximity can "talk" to each other, advertising their presence to each other by broadcasting custom information elements using a parasite protocol I've built on top of the existing dot11 standard. Over time, two or more units trained together will learn to cooperate upon detecting each other's presence by dividing the available channels among them for optimal pwnage.
## Documentation
---
:warning: **THE FOLLOWING DOCUMENTATION IS BEING PREPARED FOR THE v1.0 RELEASE OF PWNAGOTCHI. Since this effort is an active (and unstable) work-in-progress, the docs displayed here are in various stages of [in]completion. There will be dead links and placeholders throughout as we are still building things out in preparation for the v1.0 release.** :warning:
**IMPORTANT NOTE:** If you'd like to alphatest Pwnagotchi and are trying to get yours up and running while the project is still very unstable, please understand that the documentation here may not reflect what is currently implemented. If you have questions, ask the community of alphatesters in the [official Pwnagotchi Slack](https://pwnagotchi.herokuapp.com). The Pwnagotchi dev team is entirely focused on the v1.0 release and will NOT be providing support for alphatesters trying to get their Pwnagotchis working in the meantime. All technical support during this period of development is being provided by your fellow alphatesters in the Slack (thanks, everybody! :heart:).
https://www.pwnagotchi.ai
@@ -42,10 +31,11 @@ https://www.pwnagotchi.ai
&nbsp; | Official Links
---------|-------
Slack | [pwnagotchi.slack.com](https://pwnagotchi.herokuapp.com)
Twitter | [@pwnagotchi](https://twitter.com/pwnagotchi)
Subreddit | [r/pwnagotchi](https://www.reddit.com/r/pwnagotchi/)
Website | [pwnagotchi.ai](https://pwnagotchi.ai/)
Forum | [community.pwnagotchi.ai](https://community.pwnagotchi.ai/)
Slack | [pwnagotchi.slack.com](https://invite.pwnagotchi.ai/)
Subreddit | [r/pwnagotchi](https://www.reddit.com/r/pwnagotchi/)
Twitter | [@pwnagotchi](https://twitter.com/pwnagotchi)
## License

View File

@@ -2,10 +2,11 @@
if __name__ == '__main__':
import argparse
import time
import os
import logging
import yaml
import pwnagotchi
import pwnagotchi.grid as grid
import pwnagotchi.utils as utils
import pwnagotchi.plugins as plugins
@@ -21,26 +22,41 @@ if __name__ == '__main__':
help='If this file exists, configuration will be merged and this will override default values.')
parser.add_argument('--manual', dest="do_manual", action="store_true", default=False, help="Manual mode.")
parser.add_argument('--skip-session', dest="skip_session", action="store_true", default=False,
help="Skip last session parsing in manual mode.")
parser.add_argument('--clear', dest="do_clear", action="store_true", default=False,
help="Clear the ePaper display and exit.")
parser.add_argument('--debug', dest="debug", action="store_true", default=False,
help="Enable debug logs.")
parser.add_argument('--version', dest="version", action="store_true", default=False,
help="Prints the version.")
args = parser.parse_args()
if args.version:
print(pwnagotchi.version)
SystemExit(0)
config = utils.load_config(args)
utils.setup_logging(args, config)
pwnagotchi.set_name(config['main']['name'])
plugins.load(config)
display = Display(config=config, state={'name': '%s>' % pwnagotchi.name()})
keypair = KeyPair(view=display)
agent = Agent(view=display, config=config, keypair=keypair)
logging.info("%s@%s (v%s)" % (pwnagotchi.name(), agent._keypair.fingerprint, pwnagotchi.version))
logging.info("%s@%s (v%s)" % (pwnagotchi.name(), agent.fingerprint(), pwnagotchi.version))
logging.debug("effective configuration:\n\n%s\n\n" % yaml.dump(config, default_flow_style=False))
for _, plugin in plugins.loaded.items():
logging.debug("plugin '%s' v%s loaded from %s" % (plugin.__name__, plugin.__version__, plugin.__file__))
logging.debug("plugin '%s' v%s" % (plugin.__class__.__name__, plugin.__version__))
if args.do_clear:
logging.info("clearing the display ...")
@@ -49,27 +65,28 @@ if __name__ == '__main__':
elif args.do_manual:
logging.info("entering manual mode ...")
agent.last_session.parse()
logging.info(
"the last session lasted %s (%d completed epochs, trained for %d), average reward:%s (min:%s max:%s)" % (
agent.last_session.duration_human,
agent.last_session.epochs,
agent.last_session.train_epochs,
agent.last_session.avg_reward,
agent.last_session.min_reward,
agent.last_session.max_reward))
agent.mode = 'manual'
agent.last_session.parse(agent.view(), args.skip_session)
if not args.skip_session:
logging.info(
"the last session lasted %s (%d completed epochs, trained for %d), average reward:%s (min:%s max:%s)" % (
agent.last_session.duration_human,
agent.last_session.epochs,
agent.last_session.train_epochs,
agent.last_session.avg_reward,
agent.last_session.min_reward,
agent.last_session.max_reward))
while True:
display.on_manual_mode(agent.last_session)
time.sleep(1)
if Agent.is_connected():
time.sleep(5)
if grid.is_connected():
plugins.on('internet_available', agent)
else:
logging.info("entering auto mode ...")
agent.mode = 'auto'
agent.start()
while True:
@@ -102,7 +119,7 @@ if __name__ == '__main__':
# affect ours ... neat ^_^
agent.next_epoch()
if Agent.is_connected():
if grid.is_connected():
plugins.on('internet_available', agent)
except Exception as e:

View File

@@ -0,0 +1,2 @@
allow-hotplug eth0
iface eth0 inet dhcp

View File

@@ -0,0 +1,2 @@
auto lo
iface lo inet loopback

View File

@@ -0,0 +1,7 @@
allow-hotplug usb0
iface usb0 inet static
address 10.0.0.2
netmask 255.255.255.0
network 10.0.0.0
broadcast 10.0.0.255
gateway 10.0.0.1

View File

@@ -0,0 +1,2 @@
allow-hotplug wlan0
iface wlan0 inet static

View File

@@ -0,0 +1,14 @@
[Unit]
Description=bettercap api.rest service.
Documentation=https://bettercap.org
Wants=network.target
[Service]
Type=simple
PermissionsStartOnly=true
ExecStart=/usr/bin/bettercap-launcher
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,15 @@
[Unit]
Description=pwnagotchi Deep Reinforcement Learning instrumenting bettercap for WiFI pwning.
Documentation=https://pwnagotchi.ai
Wants=network.target
After=pwngrid-peer.service
[Service]
Type=simple
PermissionsStartOnly=true
ExecStart=/usr/bin/pwnagotchi-launcher
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,15 @@
[Unit]
Description=pwngrid peer service.
Documentation=https://pwnagotchi.ai
Wants=network.target
After=bettercap.service
[Service]
Type=simple
PermissionsStartOnly=true
ExecStart=/usr/bin/pwngrid -keys /etc/pwnagotchi -address 127.0.0.1:8666 -client-token /root/.api-enrollment.json -wait -log /var/log/pwngrid-peer.log -iface mon0
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
source /usr/bin/pwnlib
# start mon0
start_monitor_interface
if is_auto_mode_no_delete; then
/usr/bin/bettercap -no-colors -caplet pwnagotchi-auto -iface mon0
else
/usr/bin/bettercap -no-colors -caplet pwnagotchi-manual -iface mon0
fi

2
builder/data/usr/bin/hdmioff Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
sudo /opt/vc/bin/tvservice -o

2
builder/data/usr/bin/hdmion Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
sudo /opt/vc/bin/tvservice -p

3
builder/data/usr/bin/monstart Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
source /usr/bin/pwnlib
start_monitor_interface

3
builder/data/usr/bin/monstop Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
source /usr/bin/pwnlib
stop_monitor_interface

View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
source /usr/bin/pwnlib
# blink 10 times to signal ready state
blink_led 10 &
if is_auto_mode; then
/usr/local/bin/pwnagotchi
else
/usr/local/bin/pwnagotchi --manual
fi

87
builder/data/usr/bin/pwnlib Executable file
View File

@@ -0,0 +1,87 @@
#!/usr/bin/env bash
# well ... it blinks the led
blink_led() {
for i in $(seq 1 "$1"); do
echo 0 >/sys/class/leds/led0/brightness
sleep 0.3
echo 1 >/sys/class/leds/led0/brightness
sleep 0.3
done
echo 0 >/sys/class/leds/led0/brightness
sleep 0.3
}
# starts mon0
start_monitor_interface() {
iw phy phy0 interface add mon0 type monitor && ifconfig mon0 up
}
# stops mon0
stop_monitor_interface() {
ifconfig mon0 down && iw dev mon0 del
}
# returns 0 if the specificed network interface is up
is_interface_up() {
if grep -qi 'up' /sys/class/net/$1/operstate; then
return 0
fi
return 1
}
# returns 0 if conditions for AUTO mode are met
is_auto_mode() {
# check override file first
if [ -f /root/.pwnagotchi-manual ]; then
# remove the override file if found
rm -rf /root/.pwnagotchi-manual
return 1
fi
# check override file first
if [ -f /root/.pwnagotchi-auto ]; then
# remove the override file if found
rm -rf /root/.pwnagotchi-auto
return 0
fi
# if usb0 is up, we're in MANU
if is_interface_up usb0; then
return 1
fi
# if eth0 is up (for other boards), we're in MANU
if is_interface_up eth0; then
return 1
fi
# no override, but none of the interfaces is up -> AUTO
return 0
}
# returns 0 if conditions for AUTO mode are met
is_auto_mode_no_delete() {
# check override file first
if [ -f /root/.pwnagotchi-manual ]; then
return 1
fi
# check override file first
if [ -f /root/.pwnagotchi-auto ]; then
return 0
fi
# if usb0 is up, we're in MANU
if is_interface_up usb0; then
return 1
fi
# if eth0 is up (for other boards), we're in MANU
if is_interface_up eth0; then
return 1
fi
# no override, but none of the interfaces is up -> AUTO
return 0
}

View File

@@ -1,12 +1,14 @@
{
"builders": [{
"name": "pwnagotchi",
"type": "arm-image",
"iso_url" : "https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-07-12/2019-07-10-raspbian-buster-lite.zip",
"iso_checksum_type":"sha256",
"iso_checksum":"9e5cf24ce483bb96e7736ea75ca422e3560e7b455eee63dd28f66fa1825db70e",
"last_partition_extra_size" : 3221225472
}],
"builders": [
{
"name": "pwnagotchi",
"type": "arm-image",
"iso_url": "https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-07-12/2019-07-10-raspbian-buster-lite.zip",
"iso_checksum_type": "sha256",
"iso_checksum": "9e5cf24ce483bb96e7736ea75ca422e3560e7b455eee63dd28f66fa1825db70e",
"last_partition_extra_size": 3221225472
}
],
"provisioners": [
{
"type": "shell",
@@ -18,7 +20,83 @@
]
},
{
"type":"ansible-local",
"type": "file",
"source": "data/usr/bin/pwnlib",
"destination": "/usr/bin/pwnlib"
},
{
"type": "file",
"source": "data/usr/bin/bettercap-launcher",
"destination": "/usr/bin/bettercap-launcher"
},
{
"type": "file",
"source": "data/usr/bin/pwnagotchi-launcher",
"destination": "/usr/bin/pwnagotchi-launcher"
},
{
"type": "file",
"source": "data/usr/bin/monstop",
"destination": "/usr/bin/monstop"
},
{
"type": "file",
"source": "data/usr/bin/monstart",
"destination": "/usr/bin/monstart"
},
{
"type": "file",
"source": "data/usr/bin/hdmion",
"destination": "/usr/bin/hdmion"
},
{
"type": "file",
"source": "data/usr/bin/hdmioff",
"destination": "/usr/bin/hdmioff"
},
{
"type": "file",
"source": "data/etc/network/interfaces.d/lo-cfg",
"destination": "/etc/network/interfaces.d/lo-cfg"
},
{
"type": "file",
"source": "data/etc/network/interfaces.d/wlan0-cfg",
"destination": "/etc/network/interfaces.d/wlan0-cfg"
},
{
"type": "file",
"source": "data/etc/network/interfaces.d/usb0-cfg",
"destination": "/etc/network/interfaces.d/usb0-cfg"
},
{
"type": "file",
"source": "data/etc/network/interfaces.d/eth0-cfg",
"destination": "/etc/network/interfaces.d/eth0-cfg"
},
{
"type": "file",
"source": "data/etc/systemd/system/pwngrid-peer.service",
"destination": "/etc/systemd/system/pwngrid-peer.service"
},
{
"type": "file",
"source": "data/etc/systemd/system/pwnagotchi.service",
"destination": "/etc/systemd/system/pwnagotchi.service"
},
{
"type": "file",
"source": "data/etc/systemd/system/bettercap.service",
"destination": "/etc/systemd/system/bettercap.service"
},
{
"type": "shell",
"inline": [
"chmod +x /usr/bin/*"
]
},
{
"type": "ansible-local",
"playbook_file": "pwnagotchi.yml",
"command": "ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 PWN_VERSION={{user `pwn_version`}} PWN_HOSTNAME={{user `pwn_hostname`}} ansible-playbook"
},

View File

@@ -9,10 +9,13 @@
system:
boot_options:
- "dtoverlay=dwc2"
- "dtparam=spi=on"
- "dtoverlay=spi1-3cs"
- "dtoverlay=i2c_arm=on"
- "dtoverlay=i2c1=on"
- "dtparam=spi=on"
- "dtparam=i2c_arm=on"
- "dtparam=i2c1=on"
- "gpu_mem=16"
modules:
- "i2c-dev"
services:
enable:
- dphys-swapfile.service
@@ -31,10 +34,10 @@
- ifup@wlan0.service
packages:
bettercap:
url: "https://github.com/bettercap/bettercap/releases/download/v2.25/bettercap_linux_armv6l_2.25.zip"
url: "https://github.com/bettercap/bettercap/releases/download/v2.26.1/bettercap_linux_armhf_v2.26.1.zip"
ui: "https://github.com/bettercap/ui/releases/download/v1.3.0/ui.zip"
pwngrid:
url: "https://github.com/evilsocket/pwngrid/releases/download/v1.6.3/pwngrid_linux_armv6l_v1.6.3.zip"
url: "https://github.com/evilsocket/pwngrid/releases/download/v1.10.1/pwngrid_linux_armhf_v1.10.1.zip"
apt:
hold:
- firmware-atheros
@@ -95,26 +98,31 @@
- libfuse-dev
- bc
- fonts-freefont-ttf
- fbi
- python3-flask
- python3-flask-cors
- python3-flaskext.wtf
tasks:
- name: selected hostname
debug:
msg: "{{ pwnagotchi.hostname }}"
- name: build version
debug:
msg: "{{ pwnagotchi.version }}"
- name: change hostname
hostname:
name: "{{pwnagotchi.hostname}}"
when: lookup('file', '/etc/hostname') == "raspberrypi"
register: hostname
- name: add hostname to /etc/hosts
lineinfile:
dest: /etc/hosts
regexp: '^127\.0\.0\.1[ \t]+localhost'
line: '127.0.0.1 localhost {{pwnagotchi.hostname}} {{pwnagotchi.hostname}}.local'
regexp: '^127\.0\.1\.1[ \t]+raspberrypi'
line: "127.0.1.1\t{{pwnagotchi.hostname}}"
state: present
when: hostname.changed
- name: disable sap plugin for bluetooth.service
lineinfile:
dest: /lib/systemd/system/bluetooth.service
regexp: '^ExecStart=/usr/lib/bluetooth/bluetoothd$'
line: 'ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=sap'
state: present
- name: Add re4son-kernel repo key
@@ -161,6 +169,7 @@
git:
repo: https://github.com/repaper/gratis.git
dest: /usr/local/src/gratis
register: gratisgit
- name: build papirus service
make:
@@ -169,6 +178,7 @@
params:
EPD_IO: epd_io.h
PANEL_VERSION: 'V231_G2'
when: gratisgit.changed
- name: install papirus service
make:
@@ -177,6 +187,7 @@
params:
EPD_IO: epd_io.h
PANEL_VERSION: 'V231_G2'
when: gratisgit.changed
- name: configure papirus display size
lineinfile:
@@ -184,6 +195,16 @@
regexp: "#EPD_SIZE=2.0"
line: "EPD_SIZE=2.0"
- name: collect python pip package list
command: "pip3 list"
register: pip_output
- name: set python pip package facts
set_fact:
pip_packages: >
{{ pip_packages | default({}) | combine( { item.split()[0]: item.split()[1] } ) }}
with_items: "{{ pip_output.stdout_lines }}"
- name: acquire python3 pip target
command: "python3 -c 'import sys;print(sys.path.pop())'"
register: pip_target
@@ -192,26 +213,39 @@
git:
repo: https://github.com/evilsocket/pwnagotchi.git
dest: /usr/local/src/pwnagotchi
register: pwnagotchigit
- name: fetch pwnagotchi version
set_fact:
pwnagotchi_version: "{{ lookup('file', '/usr/local/src/pwnagotchi/pwnagotchi/__init__.py') | replace('\n', ' ') | regex_replace('.*version.*=.*''([0-9]+\\.[0-9]+\\.[0-9]+[A-Za-z0-9]*)''.*', '\\1') }}"
- name: pwnagotchi version found
debug:
msg: "{{ pwnagotchi_version }}"
- name: build pwnagotchi wheel
command: "python3 setup.py sdist bdist_wheel"
args:
chdir: /usr/local/src/pwnagotchi
when: (pwnagotchigit.changed) or (pip_packages['pwnagotchi'] is undefined) or (pip_packages['pwnagotchi'] != pwnagotchi.version)
- name: install opencv-python
pip:
name: "https://www.piwheels.hostedpi.com/simple/opencv-python/opencv_python-3.4.3.18-cp37-cp37m-linux_armv6l.whl"
extra_args: "--no-deps --no-cache-dir --platform=linux_armv6l --only-binary=:all: --target={{ pip_target.stdout }}"
when: (pip_packages['opencv-python'] is undefined) or (pip_packages['opencv-python'] != '3.4.3.18')
- name: install tensorflow
pip:
name: "https://www.piwheels.hostedpi.com/simple/tensorflow/tensorflow-1.13.1-cp37-none-linux_armv6l.whl"
extra_args: "--no-deps --no-cache-dir --platform=linux_armv6l --only-binary=:all: --target={{ pip_target.stdout }}"
when: (pip_packages['tensorflow'] is undefined) or (pip_packages['tensorflow'] != '1.13.1')
- name: install pwnagotchi wheel and dependencies
pip:
name: "{{ lookup('fileglob', '/usr/local/src/pwnagotchi/dist/pwnagotchi*.whl') }}"
extra_args: "--no-cache-dir"
when: (pwnagotchigit.changed) or (pip_packages['pwnagotchi'] is undefined) or (pip_packages['pwnagotchi'] != pwnagotchi.version)
- name: download and install pwngrid
unarchive:
@@ -234,11 +268,13 @@
git:
repo: https://github.com/bettercap/caplets.git
dest: /tmp/caplets
register: capletsgit
- name: install bettercap caplets
make:
chdir: /tmp/caplets
target: install
when: capletsgit.changed
- name: download and install bettercap ui
unarchive:
@@ -247,121 +283,12 @@
remote_src: yes
mode: 0755
- name: create cpuusage script
copy:
dest: /usr/bin/cpuusage
mode: 0755
content: |
#!/usr/bin/env bash
while true
do
top -b -n1 | awk '/Cpu\(s\)/ { printf("%d %", $2 + $4 + 0.5) }'
sleep 3
done
- name: create memusage script
copy:
dest: /usr/bin/memusage
mode: 0755
content: |
#!/usr/bin/env bash
free -m | awk '/Mem/ { printf( "%d %", $3 / $2 * 100 + 0.5 ) }'
- name: create bootblink script
copy:
dest: /usr/bin/bootblink
mode: 0755
content: |
#!/usr/bin/env bash
for i in $(seq 1 "$1");
do
echo 0 >/sys/class/leds/led0/brightness
sleep 0.3
echo 1 >/sys/class/leds/led0/brightness
sleep 0.3
done
echo 0 >/sys/class/leds/led0/brightness
sleep 0.3
- name: create pwnagotchi-launcher script
copy:
dest: /usr/bin/pwnagotchi-launcher
mode: 0755
content: |
#!/usr/bin/env bash
# blink 10 times to signal ready state
/usr/bin/bootblink 10 &
# start a detached screen session with bettercap
if ifconfig | grep usb0 | grep RUNNING; then
# if override file exists, go into auto mode
if [ -f /root/.pwnagotchi-auto ]; then
rm /root/.pwnagotchi-auto
/usr/local/bin/pwnagotchi
else
/usr/local/bin/pwnagotchi --manual
fi
else
/usr/local/bin/pwnagotchi
fi
- name: create bettercap-launcher script
copy:
dest: /usr/bin/bettercap-launcher
mode: 0755
content: |
#!/usr/bin/env bash
# blink 10 times to signal ready state
/usr/bin/bootblink 10 &
if ifconfig | grep usb0 | grep RUNNING; then
# if override file exists, go into auto mode
if [ -f /root/.pwnagotchi-auto ]; then
rm /root/.pwnagotchi-auto
/usr/bin/bettercap -no-colors -caplet pwnagotchi-auto
else
/usr/bin/bettercap -no-colors -caplet pwnagotchi-manual
fi
else
/usr/bin/bettercap -no-colors -caplet pwnagotchi-auto
fi
- name: create monstart script
copy:
dest: /usr/bin/monstart
mode: 0755
content: |
#!/usr/bin/env bash
iw phy phy0 interface add mon0 type monitor && ifconfig mon0 up
- name: create monstop script
copy:
dest: /usr/bin/monstop
mode: 0755
content: |
#!/usr/bin/env bash
ifconfig mon0 down && iw dev mon0 del
- name: create hdmion script
copy:
dest: /usr/bin/hdmion
mode: 0755
content: |
#!/usr/bin/env bash
sudo /opt/vc/bin/tvservice -p
- name: create hdmioff script
copy:
dest: /usr/bin/hdmioff
mode: 0755
content: |
#!/usr/bin/env bash
sudo /opt/vc/bin/tvservice -o
- name: add HDMI powersave to rc.local
blockinfile:
path: /etc/rc.local
insertbefore: "exit 0"
block: |
if ! /opt/vc/bin/tvservice -s | grep HDMI; then
if ! /opt/vc/bin/tvservice -s | egrep 'HDMI|DVI'; then
/opt/vc/bin/tvservice -o
fi
@@ -379,7 +306,7 @@
copy:
dest: /etc/pwnagotchi/config.yml
content: |
# Add your configuration overrides on this file any configuration changes done to defaults.yml will be lost!
# Add your configuration overrides on this file any configuration changes done to default.yml will be lost!
# Example:
#
# ui:
@@ -389,39 +316,6 @@
#
when: not user_config.stat.exists
- name: configure lo interface
copy:
dest: /etc/network/interfaces.d/lo-cfg
content: |
auto lo
iface lo inet loopback
- name: configure wlan interface
copy:
dest: /etc/network/interfaces.d/wlan0-cfg
content: |
allow-hotplug wlan0
iface wlan0 inet static
- name: configure usb interface
copy:
dest: /etc/network/interfaces.d/usb0-cfg
content: |
allow-hotplug usb0
iface usb0 inet static
address 10.0.0.2
netmask 255.255.255.0
network 10.0.0.0
broadcast 10.0.0.255
gateway 10.0.0.1
- name: configure eth0 interface (pi2/3/4)
copy:
dest: /etc/network/interfaces.d/eth0-cfg
content: |
allow-hotplug eth0
iface eth0 inet dhcp
- name: enable ssh on boot
file:
path: /boot/ssh
@@ -434,6 +328,13 @@
line: '{{ item }}'
with_items: "{{system.boot_options}}"
- name: adjust /etc/modules
lineinfile:
dest: /etc/modules
insertafter: EOF
line: '{{ item }}'
with_items: "{{system.modules}}"
- name: change root partition
replace:
dest: /boot/cmdline.txt
@@ -454,14 +355,14 @@
copy:
dest: /etc/motd
content: |
(◕‿‿◕) {{pwnagotchi.hostname}} (pwnagotchi-{{pwnagotchi.version}})
(◕‿‿◕) {{pwnagotchi.hostname}}
Hi! I'm a pwnagotchi, please take good care of me!
Here are some basic things you need to know to raise me properly!
If you want to change my configuration, use /etc/pwnagotchi/config.yml
All the configuration options can be found on /etc/pwnagotchi/defaults.yml,
All the configuration options can be found on /etc/pwnagotchi/default.yml,
but don't change this file because I will recreate it every time I'm restarted!
I'm managed by systemd. Here are some basic commands.
@@ -480,6 +381,7 @@
touch /root/.pwnagotchi-auto && systemctl restart pwnagotchi
You learn more about me at https://pwnagotchi.ai/
when: hostname.changed
- name: clean apt cache
apt:
@@ -489,74 +391,6 @@
apt:
autoremove: yes
- name: add pwngrid-peer service to systemd
copy:
dest: /etc/systemd/system/pwngrid-peer.service
content: |
[Unit]
Description=pwngrid peer service.
Documentation=https://pwnagotchi.ai
Wants=network.target
After=network.target
[Service]
Type=simple
PermissionsStartOnly=true
ExecStart=/usr/bin/pwngrid -keys /etc/pwnagotchi -address 127.0.0.1:8666 -wait -log /var/log/pwngrid-peer.log
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target
notify:
- reload systemd services
- name: add bettercap service to systemd
copy:
dest: /etc/systemd/system/bettercap.service
content: |
[Unit]
Description=bettercap api.rest service.
Documentation=https://bettercap.org
Wants=network.target
After=network.target
[Service]
Type=simple
PermissionsStartOnly=true
ExecStartPre=/usr/bin/monstart
ExecStart=/usr/bin/bettercap-launcher
ExecStopPost=/usr/bin/monstop
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target
notify:
- reload systemd services
- name: add pwnagotchi service to systemd
copy:
dest: /etc/systemd/system/pwnagotchi.service
content: |
[Unit]
Description=pwnagotchi Deep Reinforcement Learning instrumenting bettercap for WiFI pwning.
Documentation=https://pwnagotchi.ai
Wants=network.target
After=bettercap.service
[Service]
Type=simple
PermissionsStartOnly=true
ExecStart=/usr/bin/pwnagotchi-launcher
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target
notify:
- reload systemd services
- name: enable services
systemd:
name: "{{ item }}"

View File

@@ -2,13 +2,48 @@ import subprocess
import os
import logging
import time
import re
import pwnagotchi.ui.view as view
import pwnagotchi
version = '1.0.0RC3'
version = '1.2.1'
_name = None
def set_name(new_name):
if new_name is None:
return
new_name = new_name.strip()
if new_name == '':
return
if not re.match(r'^[a-zA-Z0-9\-]{2,25}$', new_name):
logging.warning("name '%s' is invalid: min length is 2, max length 25, only a-zA-Z0-9- allowed", new_name)
return
current = name()
if new_name != current:
global _name
logging.info("setting unit hostname '%s' -> '%s'" % (current, new_name))
with open('/etc/hostname', 'wt') as fp:
fp.write(new_name)
with open('/etc/hosts', 'rt') as fp:
prev = fp.read()
logging.debug("old hosts:\n%s\n" % prev)
with open('/etc/hosts', 'wt') as fp:
patched = prev.replace(current, new_name, -1)
logging.debug("new hosts:\n%s\n" % patched)
fp.write(patched)
os.system("hostname '%s'" % new_name)
pwnagotchi.reboot()
def name():
global _name
if _name is None:
@@ -17,16 +52,27 @@ def name():
return _name
def uptime():
with open('/proc/uptime') as fp:
return int(fp.read().split('.')[0])
def mem_usage():
out = subprocess.getoutput("free -m")
for line in out.split("\n"):
line = line.strip()
if line.startswith("Mem:"):
parts = list(map(int, line.split()[1:]))
tot = parts[0]
used = parts[1]
free = parts[2]
return used / tot
with open('/proc/meminfo') as fp:
for line in fp:
line = line.strip()
if line.startswith("MemTotal:"):
kb_mem_total = int(line.split()[1])
if line.startswith("MemFree:"):
kb_mem_free = int(line.split()[1])
if line.startswith("MemAvailable:"):
kb_mem_available = int(line.split()[1])
if line.startswith("Buffers:"):
kb_main_buffers = int(line.split()[1])
if line.startswith("Cached:"):
kb_main_cached = int(line.split()[1])
kb_mem_used = kb_mem_total - kb_mem_free - kb_main_cached - kb_main_buffers
return round(kb_mem_used / kb_mem_total, 1)
return 0
@@ -57,6 +103,39 @@ def shutdown():
if view.ROOT:
view.ROOT.on_shutdown()
# give it some time to refresh the ui
time.sleep(5)
time.sleep(10)
os.system("sync")
os.system("halt")
def restart(mode):
logging.warning("restarting in %s mode ..." % mode)
if mode == 'AUTO':
os.system("touch /root/.pwnagotchi-auto")
else:
os.system("touch /root/.pwnagotchi-manual")
os.system("service bettercap restart")
os.system("service pwnagotchi restart")
def reboot(mode=None):
if mode is not None:
mode = mode.upper()
logging.warning("rebooting in %s mode ..." % mode)
else:
logging.warning("rebooting ...")
if view.ROOT:
view.ROOT.on_rebooting()
# give it some time to refresh the ui
time.sleep(10)
if mode == 'AUTO':
os.system("touch /root/.pwnagotchi-auto")
elif mode == 'MANU':
os.system("touch /root/.pwnagotchi-manual")
os.system("sync")
os.system("shutdown -r now")

View File

@@ -2,13 +2,14 @@ import time
import json
import os
import re
import socket
from datetime import datetime
import logging
import _thread
import pwnagotchi
import pwnagotchi.utils as utils
import pwnagotchi.plugins as plugins
from pwnagotchi.ui.web.server import Server
from pwnagotchi.automata import Automata
from pwnagotchi.log import LastSession
from pwnagotchi.bettercap import Client
from pwnagotchi.mesh.utils import AsyncAdvertiser
@@ -17,13 +18,14 @@ from pwnagotchi.ai.train import AsyncTrainer
RECOVERY_DATA_FILE = '/root/.pwnagotchi-recovery'
class Agent(Client, AsyncAdvertiser, AsyncTrainer):
class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
def __init__(self, view, config, keypair):
Client.__init__(self, config['bettercap']['hostname'],
config['bettercap']['scheme'],
config['bettercap']['port'],
config['bettercap']['username'],
config['bettercap']['password'])
Automata.__init__(self, config, view)
AsyncAdvertiser.__init__(self, config, view, keypair)
AsyncTrainer.__init__(self, config)
@@ -32,24 +34,19 @@ class Agent(Client, AsyncAdvertiser, AsyncTrainer):
self._current_channel = 0
self._supported_channels = utils.iface_channels(config['main']['iface'])
self._view = view
self._view.set_agent(self)
self._web_ui = Server(self, self._config['ui']['display'])
self._access_points = []
self._last_pwnd = None
self._history = {}
self._handshakes = {}
self.last_session = LastSession(self._config)
self.mode = 'auto'
if not os.path.exists(config['bettercap']['handshakes']):
os.makedirs(config['bettercap']['handshakes'])
@staticmethod
def is_connected():
try:
socket.create_connection(("www.google.com", 80))
return True
except OSError:
pass
return False
def config(self):
return self._config
@@ -59,36 +56,6 @@ class Agent(Client, AsyncAdvertiser, AsyncTrainer):
def supported_channels(self):
return self._supported_channels
def set_starting(self):
self._view.on_starting()
def set_ready(self):
plugins.on('ready', self)
def set_free_channel(self, channel):
self._view.on_free_channel(channel)
plugins.on('free_channel', self, channel)
def set_bored(self):
self._view.on_bored()
plugins.on('bored', self)
def set_sad(self):
self._view.on_sad()
plugins.on('sad', self)
def set_excited(self):
self._view.on_excited()
plugins.on('excited', self)
def set_lonely(self):
self._view.on_lonely()
plugins.on('lonely', self)
def set_rebooting(self):
self._view.on_rebooting()
plugins.on('rebooting', self)
def setup_events(self):
logging.info("connecting to %s ..." % self.url)
@@ -145,8 +112,18 @@ class Agent(Client, AsyncAdvertiser, AsyncTrainer):
self.start_advertising()
def _wait_bettercap(self):
while True:
try:
s = self.session()
return
except:
logging.info("waiting for bettercap API to be available ...")
time.sleep(1)
def start(self):
self.start_ai()
self._wait_bettercap()
self.setup_events()
self.set_starting()
self.start_monitor_mode()
@@ -155,11 +132,6 @@ class Agent(Client, AsyncAdvertiser, AsyncTrainer):
self.next_epoch()
self.set_ready()
def wait_for(self, t, sleeping=True):
plugins.on('sleep' if sleeping else 'wait', self, t)
self._view.wait(t, sleeping)
self._epoch.track(sleep=True, inc=t)
def recon(self):
recon_time = self._config['personality']['recon_time']
max_inactive = self._config['personality']['max_inactive_scale']
@@ -192,7 +164,7 @@ class Agent(Client, AsyncAdvertiser, AsyncTrainer):
def set_access_points(self, aps):
self._access_points = aps
plugins.on('wifi_update', self, aps)
self._epoch.observe(aps, self._advertiser.peers() if self._advertiser is not None else ())
self._epoch.observe(aps, list(self._peers.values()))
return self._access_points
def get_access_points(self):
@@ -200,8 +172,11 @@ class Agent(Client, AsyncAdvertiser, AsyncTrainer):
aps = []
try:
s = self.session()
plugins.on("unfiltered_ap_list", self, s['wifi']['aps'])
for ap in s['wifi']['aps']:
if ap['hostname'] not in whitelist:
if ap['encryption'] == '' or ap['encryption'] == 'OPEN':
continue
elif ap['hostname'] not in whitelist:
if self._filter_included(ap):
aps.append(ap)
except Exception as e:
@@ -241,9 +216,9 @@ class Agent(Client, AsyncAdvertiser, AsyncTrainer):
return None
def _update_uptime(self, s):
secs = time.time() - self._started_at
secs = pwnagotchi.uptime()
self._view.set('uptime', utils.secs_to_hhmmss(secs))
self._view.set('epoch', '%04d' % self._epoch.epoch)
# self._view.set('epoch', '%04d' % self._epoch.epoch)
def _update_counters(self):
tot_aps = len(self._access_points)
@@ -273,22 +248,13 @@ class Agent(Client, AsyncAdvertiser, AsyncTrainer):
if new_shakes > 0:
self._view.on_handshakes(new_shakes)
def _update_advertisement(self, s):
run_handshakes = len(self._handshakes)
tot_handshakes = utils.total_unique_handshakes(self._config['bettercap']['handshakes'])
started = s['started_at'].split('.')[0]
started = datetime.strptime(started, '%Y-%m-%dT%H:%M:%S')
started = time.mktime(started.timetuple())
self._advertiser.update({ \
'pwnd_run': run_handshakes,
'pwnd_tot': tot_handshakes,
'uptime': time.time() - started,
'epoch': self._epoch.epoch})
def _update_peers(self):
peer = self._advertiser.closest_peer()
tot = self._advertiser.num_peers()
self._view.set_closest_peer(peer, tot)
self._view.set_closest_peer(self._closest_peer, len(self._peers))
def _reboot(self):
self.set_rebooting()
self._save_recovery_data()
pwnagotchi.reboot()
def _save_recovery_data(self):
logging.warning("writing recovery data to %s ..." % RECOVERY_DATA_FILE)
@@ -325,21 +291,21 @@ class Agent(Client, AsyncAdvertiser, AsyncTrainer):
self.run('events.clear')
logging.debug("event polling started ...")
while True:
time.sleep(1)
new_shakes = 0
s = self.session()
self._update_uptime(s)
if self._advertiser is not None:
self._update_advertisement(s)
self._update_peers()
self._update_counters()
logging.debug("polling events ...")
try:
s = self.session()
self._update_uptime(s)
self._update_advertisement(s)
self._update_peers()
self._update_counters()
for h in [e for e in self.events() if e['tag'] == 'wifi.client.handshake']:
filename = h['data']['file']
sta_mac = h['data']['station']
@@ -365,7 +331,7 @@ class Agent(Client, AsyncAdvertiser, AsyncTrainer):
plugins.on('handshake', self, filename, ap, sta)
except Exception as e:
logging.exception("error")
logging.error("error: %s" % e)
finally:
self._update_handshakes(new_shakes)
@@ -405,21 +371,6 @@ class Agent(Client, AsyncAdvertiser, AsyncTrainer):
return self._history[who] < self._config['personality']['max_interactions']
def _on_miss(self, who):
logging.info("it looks like %s is not in range anymore :/" % who)
self._epoch.track(miss=True)
self._view.on_miss(who)
def _on_error(self, who, e):
error = "%s" % e
# when we're trying to associate or deauth something that is not in range anymore
# (if we are moving), we get the following error from bettercap:
# error 400: 50:c7:bf:2e:d3:37 is an unknown BSSID or it is in the association skip list.
if 'is an unknown BSSID' in error:
self._on_miss(who)
else:
logging.error("%s" % e)
def associate(self, ap, throttle=0):
if self.is_stale():
logging.debug("recon is stale, skipping assoc(%s)" % ap['mac'])
@@ -496,46 +447,3 @@ class Agent(Client, AsyncAdvertiser, AsyncTrainer):
except Exception as e:
logging.error("error: %s" % e)
def is_stale(self):
return self._epoch.num_missed > self._config['personality']['max_misses_for_recon']
def any_activity(self):
return self._epoch.any_activity
def _reboot(self):
self.set_rebooting()
self._save_recovery_data()
logging.warning("rebooting the system ...")
os.system("/usr/bin/sync")
os.system("/usr/sbin/shutdown -r now")
def next_epoch(self):
was_stale = self.is_stale()
did_miss = self._epoch.num_missed
self._epoch.next()
# after X misses during an epoch, set the status to lonely
if was_stale:
logging.warning("agent missed %d interactions -> lonely" % did_miss)
self.set_lonely()
# after X times being bored, the status is set to sad
elif self._epoch.inactive_for >= self._config['personality']['sad_num_epochs']:
logging.warning("%d epochs with no activity -> sad" % self._epoch.inactive_for)
self.set_sad()
# after X times being inactive, the status is set to bored
elif self._epoch.inactive_for >= self._config['personality']['bored_num_epochs']:
logging.warning("%d epochs with no activity -> bored" % self._epoch.inactive_for)
self.set_bored()
# after X times being active, the status is set to happy / excited
elif self._epoch.active_for >= self._config['personality']['excited_num_epochs']:
logging.warning("%d epochs with activity -> excited" % self._epoch.active_for)
self.set_excited()
plugins.on('epoch', self, self._epoch.epoch - 1, self._epoch.data())
if self._epoch.blind_for >= self._config['main']['mon_max_blind_epochs']:
logging.critical("%d epochs without visible access points -> rebooting ..." % self._epoch.blind_for)
self._reboot()
self._epoch.blind_for = 0

View File

@@ -1,14 +1,13 @@
import os
import time
import warnings
import logging
# https://stackoverflow.com/questions/40426502/is-there-a-way-to-suppress-the-messages-tensorflow-prints/40426709
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2'}
import warnings
# https://stackoverflow.com/questions/15777951/how-to-suppress-pandas-future-warning
warnings.simplefilter(action='ignore', category=FutureWarning)
import logging
def load(config, agent, epoch, from_disk=True):
config = config['ai']
@@ -16,27 +15,51 @@ def load(config, agent, epoch, from_disk=True):
logging.info("ai disabled")
return False
logging.info("[ai] bootstrapping dependencies ...")
try:
begin = time.time()
from stable_baselines import A2C
from stable_baselines.common.policies import MlpLstmPolicy
from stable_baselines.common.vec_env import DummyVecEnv
logging.info("[ai] bootstrapping dependencies ...")
import pwnagotchi.ai.gym as wrappers
start = time.time()
from stable_baselines import A2C
logging.debug("[ai] A2C imported in %.2fs" % (time.time() - start))
env = wrappers.Environment(agent, epoch)
env = DummyVecEnv([lambda: env])
start = time.time()
from stable_baselines.common.policies import MlpLstmPolicy
logging.debug("[ai] MlpLstmPolicy imported in %.2fs" % (time.time() - start))
logging.info("[ai] bootstrapping model ...")
start = time.time()
from stable_baselines.common.vec_env import DummyVecEnv
logging.debug("[ai] DummyVecEnv imported in %.2fs" % (time.time() - start))
a2c = A2C(MlpLstmPolicy, env, **config['params'])
start = time.time()
import pwnagotchi.ai.gym as wrappers
logging.debug("[ai] gym wrapper imported in %.2fs" % (time.time() - start))
if from_disk and os.path.exists(config['path']):
logging.info("[ai] loading %s ..." % config['path'])
a2c.load(config['path'], env)
else:
logging.info("[ai] model created:")
for key, value in config['params'].items():
logging.info(" %s: %s" % (key, value))
env = wrappers.Environment(agent, epoch)
env = DummyVecEnv([lambda: env])
return a2c
logging.info("[ai] creating model ...")
start = time.time()
a2c = A2C(MlpLstmPolicy, env, **config['params'])
logging.debug("[ai] A2C created in %.2fs" % (time.time() - start))
if from_disk and os.path.exists(config['path']):
logging.info("[ai] loading %s ..." % config['path'])
start = time.time()
a2c.load(config['path'], env)
logging.debug("[ai] A2C loaded in %.2fs" % (time.time() - start))
else:
logging.info("[ai] model created:")
for key, value in config['params'].items():
logging.info(" %s: %s" % (key, value))
logging.debug("[ai] total loading time is %.2fs" % (time.time() - begin))
return a2c
except Exception as e:
logging.exception("error while starting AI")
logging.warning("[ai] AI not loaded!")
return False

View File

@@ -37,6 +37,12 @@ class Epoch(object):
self.num_hops = 0
# number of seconds sleeping
self.num_slept = 0
# number of peers seen during this epoch
self.num_peers = 0
# cumulative bond factor
self.tot_bond_factor = 0.0 # cum_bond_factor sounded really bad ...
# average bond factor
self.avg_bond_factor = 0.0
# any activity at all during this epoch?
self.any_activity = False
# when the current epoch started
@@ -74,10 +80,16 @@ class Epoch(object):
else:
self.blind_for = 0
bond_unit_scale = self.config['personality']['bond_encounters_factor']
self.num_peers = len(peers)
num_peers = self.num_peers + 1e-10 # avoid division by 0
self.tot_bond_factor = sum((peer.encounters for peer in peers)) / bond_unit_scale
self.avg_bond_factor = self.tot_bond_factor / num_peers
num_aps = len(aps) + 1e-10
num_sta = sum(len(ap['clients']) for ap in aps) + 1e-10
num_peers = len(peers) + 1e-10
aps_per_chan = [0.0] * wifi.NumChannels
sta_per_chan = [0.0] * wifi.NumChannels
peers_per_chan = [0.0] * wifi.NumChannels
@@ -162,6 +174,9 @@ class Epoch(object):
'active_for_epochs': self.active_for,
'missed_interactions': self.num_missed,
'num_hops': self.num_hops,
'num_peers': self.num_peers,
'tot_bond': self.tot_bond_factor,
'avg_bond': self.avg_bond_factor,
'num_deauths': self.num_deauths,
'num_associations': self.num_assocs,
'num_handshakes': self.num_shakes,
@@ -173,14 +188,18 @@ class Epoch(object):
self._epoch_data['reward'] = self._reward(self.epoch + 1, self._epoch_data)
self._epoch_data_ready.set()
logging.info("[epoch %d] duration=%s slept_for=%s blind=%d inactive=%d active=%d hops=%d missed=%d "
"deauths=%d assocs=%d handshakes=%d cpu=%d%% mem=%d%% temperature=%dC reward=%s" % (
logging.info("[epoch %d] duration=%s slept_for=%s blind=%d inactive=%d active=%d peers=%d tot_bond=%.2f "
"avg_bond=%.2f hops=%d missed=%d deauths=%d assocs=%d handshakes=%d cpu=%d%% mem=%d%% "
"temperature=%dC reward=%s" % (
self.epoch,
utils.secs_to_hhmmss(self.epoch_duration),
utils.secs_to_hhmmss(self.num_slept),
self.blind_for,
self.inactive_for,
self.active_for,
self.num_peers,
self.tot_bond_factor,
self.avg_bond_factor,
self.num_hops,
self.num_missed,
self.num_deauths,
@@ -195,6 +214,9 @@ class Epoch(object):
self.epoch_started = now
self.did_deauth = False
self.num_deauths = 0
self.num_peers = 0
self.tot_bond_factor = 0.0
self.avg_bond_factor = 0.0
self.did_associate = False
self.num_assocs = 0
self.num_missed = 0

View File

@@ -8,7 +8,6 @@ import logging
import pwnagotchi.plugins as plugins
import pwnagotchi.ai as ai
from pwnagotchi.ai.epoch import Epoch
class Stats(object):
@@ -88,7 +87,6 @@ class AsyncTrainer(object):
def __init__(self, config):
self._config = config
self._model = None
self._epoch = Epoch(config)
self._is_training = False
self._training_epochs = 0
self._nn_path = self._config['ai']['path']

144
pwnagotchi/automata.py Normal file
View File

@@ -0,0 +1,144 @@
import logging
import pwnagotchi.plugins as plugins
from pwnagotchi.ai.epoch import Epoch
# basic mood system
class Automata(object):
def __init__(self, config, view):
self._config = config
self._view = view
self._epoch = Epoch(config)
def _on_miss(self, who):
logging.info("it looks like %s is not in range anymore :/" % who)
self._epoch.track(miss=True)
self._view.on_miss(who)
def _on_error(self, who, e):
error = "%s" % e
# when we're trying to associate or deauth something that is not in range anymore
# (if we are moving), we get the following error from bettercap:
# error 400: 50:c7:bf:2e:d3:37 is an unknown BSSID or it is in the association skip list.
if 'is an unknown BSSID' in error:
self._on_miss(who)
else:
logging.error("%s" % e)
def set_starting(self):
self._view.on_starting()
def set_ready(self):
plugins.on('ready', self)
def in_good_mood(self):
return self._has_support_network_for(1.0)
def _has_support_network_for(self, factor):
bond_factor = self._config['personality']['bond_encounters_factor']
total_encounters = sum(peer.encounters for _, peer in self._peers.items())
support_factor = total_encounters / bond_factor
return support_factor >= factor
# triggered when it's a sad/bad day but you have good friends around ^_^
def set_grateful(self):
self._view.on_grateful()
plugins.on('grateful', self)
def set_lonely(self):
if not self._has_support_network_for(1.0):
logging.info("unit is lonely")
self._view.on_lonely()
plugins.on('lonely', self)
else:
logging.info("unit is grateful instead of lonely")
self.set_grateful()
def set_bored(self):
factor = self._epoch.inactive_for / self._config['personality']['bored_num_epochs']
if not self._has_support_network_for(factor):
logging.warning("%d epochs with no activity -> bored" % self._epoch.inactive_for)
self._view.on_bored()
plugins.on('bored', self)
else:
logging.info("unit is grateful instead of bored")
self.set_grateful()
def set_sad(self):
factor = self._epoch.inactive_for / self._config['personality']['sad_num_epochs']
if not self._has_support_network_for(factor):
logging.warning("%d epochs with no activity -> sad" % self._epoch.inactive_for)
self._view.on_sad()
plugins.on('sad', self)
else:
logging.info("unit is grateful instead of sad")
self.set_grateful()
def set_angry(self, factor):
if not self._has_support_network_for(factor):
logging.warning("%d epochs with no activity -> angry" % self._epoch.inactive_for)
self._view.on_angry()
plugins.on('angry', self)
else:
logging.info("unit is grateful instead of angry")
self.set_grateful()
def set_excited(self):
logging.warning("%d epochs with activity -> excited" % self._epoch.active_for)
self._view.on_excited()
plugins.on('excited', self)
def set_rebooting(self):
self._view.on_rebooting()
plugins.on('rebooting', self)
def wait_for(self, t, sleeping=True):
plugins.on('sleep' if sleeping else 'wait', self, t)
self._view.wait(t, sleeping)
self._epoch.track(sleep=True, inc=t)
def is_stale(self):
return self._epoch.num_missed > self._config['personality']['max_misses_for_recon']
def any_activity(self):
return self._epoch.any_activity
def next_epoch(self):
logging.debug("agent.next_epoch()")
was_stale = self.is_stale()
did_miss = self._epoch.num_missed
self._epoch.next()
# after X misses during an epoch, set the status to lonely or angry
if was_stale:
factor = did_miss / self._config['personality']['max_misses_for_recon']
if factor >= 2.0:
self.set_angry(factor)
else:
logging.warning("agent missed %d interactions -> lonely" % did_miss)
self.set_lonely()
# after X times being bored, the status is set to sad or angry
elif self._epoch.inactive_for >= self._config['personality']['sad_num_epochs']:
factor = self._epoch.inactive_for / self._config['personality']['sad_num_epochs']
if factor >= 2.0:
self.set_angry(factor)
else:
self.set_sad()
# after X times being inactive, the status is set to bored
elif self._epoch.inactive_for >= self._config['personality']['bored_num_epochs']:
self.set_bored()
# after X times being active, the status is set to happy / excited
elif self._epoch.active_for >= self._config['personality']['excited_num_epochs']:
self.set_excited()
elif self._epoch.active_for >= 5 and self._has_support_network_for(5.0):
self.set_grateful()
plugins.on('epoch', self, self._epoch.epoch - 1, self._epoch.data())
if self._epoch.blind_for >= self._config['main']['mon_max_blind_epochs']:
logging.critical("%d epochs without visible access points -> rebooting ..." % self._epoch.blind_for)
self._reboot()
self._epoch.blind_for = 0

View File

@@ -3,6 +3,20 @@ import requests
from requests.auth import HTTPBasicAuth
def decode(r, verbose_errors=True):
try:
return r.json()
except Exception as e:
if r.status_code == 200:
logging.error("error while decoding json: error='%s' resp='%s'" % (e, r.text))
else:
err = "error %d: %s" % (r.status_code, r.text.strip())
if verbose_errors:
logging.info(err)
raise Exception(err)
return r.text
class Client(object):
def __init__(self, hostname='localhost', scheme='http', port=8081, username='user', password='pass'):
self.hostname = hostname
@@ -13,27 +27,14 @@ class Client(object):
self.url = "%s://%s:%d/api" % (scheme, hostname, port)
self.auth = HTTPBasicAuth(username, password)
def _decode(self, r, verbose_errors=True):
try:
return r.json()
except Exception as e:
if r.status_code == 200:
logging.error("error while decoding json: error='%s' resp='%s'" % (e, r.text))
else:
err = "error %d: %s" % (r.status_code, r.text.strip())
if verbose_errors:
logging.info(err)
raise Exception(err)
return r.text
def session(self):
r = requests.get("%s/session" % self.url, auth=self.auth)
return self._decode(r)
return decode(r)
def events(self):
r = requests.get("%s/events" % self.url, auth=self.auth)
return self._decode(r)
return decode(r)
def run(self, command, verbose_errors=True):
r = requests.post("%s/session" % self.url, auth=self.auth, json={'cmd': command})
return self._decode(r, verbose_errors=verbose_errors)
return decode(r, verbose_errors=verbose_errors)

View File

@@ -6,66 +6,108 @@
#
# main algorithm configuration
main:
# if set this will set the hostname of the unit. min length is 2, max length 25, only a-zA-Z0-9- allowed
name: ''
# currently implemented: en (default), de, el, fr, it, mk, nl, ru, se, pt-BR, es, pt
lang: en
# custom plugins path, if null only default plugins with be loaded
custom_plugins:
# which plugins to load and enable
plugins:
grid:
enabled: true
report: false # don't report pwned networks by default!
exclude: # do not report the following networks (accepts both ESSIDs and BSSIDs)
- YourHomeNetworkHere
auto-update:
enabled: false
system: false # set to true to also enable system updates via apt
interval: 1 # every day
auto-backup:
enabled: false
interval: 1 # every day
files:
- /root/brain.nn
- /root/brain.json
- /root/handshakes/
- /etc/pwnagotchi/
- /etc/hostname
- /etc/hosts
- /etc/motd
- /var/log/pwnagotchi.log
commands:
- 'tar czf /tmp/backup.tar.gz {files}'
- 'scp /tmp/backup.tar.gz pwnagotchi@10.0.0.1:/home/pwnagotchi/backups/backup-$(date +%s).tar.gz'
net-pos:
enabled: false
api_key: 'test'
gps:
enabled: false
speed: 19200
device: /dev/ttyUSB0
twitter:
enabled: false
consumer_key: aaa
consumer_secret: aaa
access_token_key: aaa
access_token_secret: aaa
onlinehashcrack:
enabled: false
email: ~
wpa-sec:
enabled: false
api_key: ~
wigle:
enabled: false
api_key: ~
screen_refresh:
enabled: false
refresh_interval: 50
quickdic:
enabled: false
wordlist_folder: /opt/wordlists/
AircrackOnly:
enabled: false
grid:
enabled: true
report: false # don't report pwned networks by default!
exclude: # do not report the following networks (accepts both ESSIDs and BSSIDs)
- YourHomeNetworkHere
auto-update:
enabled: true
install: true # if false, it will only warn that updates are available, if true it will install them
interval: 1 # every 1 hour
auto-backup:
enabled: false
interval: 1 # every day
max_tries: 0 # 0=infinity
files:
- /root/brain.nn
- /root/brain.json
- /root/.api-report.json
- /root/handshakes/
- /root/peers/
- /etc/pwnagotchi/
- /var/log/pwnagotchi.log
commands:
- 'tar czf /root/pwnagotchi-backup.tar.gz {files}'
net-pos:
enabled: false
api_key: 'test'
gps:
enabled: false
speed: 19200
device: /dev/ttyUSB0
twitter:
enabled: false
consumer_key: aaa
consumer_secret: aaa
access_token_key: aaa
access_token_secret: aaa
onlinehashcrack:
enabled: false
email: ~
wpa-sec:
enabled: false
api_key: ~
api_url: "https://wpa-sec.stanev.org"
wigle:
enabled: false
api_key: ~
screen_refresh:
enabled: false
refresh_interval: 50
quickdic:
enabled: false
wordlist_folder: /opt/wordlists/
AircrackOnly:
enabled: false
bt-tether:
enabled: false # if you want to use this, set ui.display.video.address to 0.0.0.0
devices:
android-phone:
enabled: false
search_order: 1 # search for this first
mac: ~ # mac of your bluetooth device
ip: '192.168.44.44' # ip from which your pwnagotchi should be reachable
netmask: 24
interval: 1 # check every minute for device
scantime: 10 # search for 10 seconds
max_tries: 10 # after 10 tries of "not found"; don't try anymore
share_internet: false
priority: 1 # low routing priority; ios (prio: 999) would win here
ios-phone:
enabled: false
search_order: 2 # search for this second
mac: ~ # mac of your bluetooth device
ip: '172.20.10.6' # ip from which your pwnagotchi should be reachable
netmask: 24
interval: 5 # check every 5 minutes for device
scantime: 20
max_tries: 0 # infinity
share_internet: false
priority: 999 # routing priority
memtemp: # Display memory usage, cpu load and cpu temperature on screen
enabled: false
orientation: horizontal # horizontal/vertical
pawgps:
enabled: false
#The IP Address of your phone with Paw Server running, default (option is empty) is 192.168.44.1
ip: ''
gpio_buttons:
enabled: false
#The following is a list of the GPIO number for your button, and the command you want to run when it is pressed
gpios:
- 20: 'sudo touch /root/.pwnagotchi-auto && sudo systemctl restart pwnagotchi'
- 21: 'shutdown -h now'
# monitor interface to use
iface: mon0
# command to run to bring the mon interface up in case it's not up already
@@ -150,9 +192,36 @@ personality:
bored_num_epochs: 15
# number of inactive epochs that triggers the sad state
sad_num_epochs: 25
# number of encounters (times met on a channel) with another unit before considering it a friend and bond
# also used for cumulative bonding score of nearby units
bond_encounters_factor: 20000
# ui configuration
ui:
# here you can customize the faces
faces:
look_r: '( ⚆_⚆)'
look_l: '(☉_☉ )'
look_r_happy: '( ◕‿◕)'
look_l_happy: '(◕‿◕ )'
sleep: '(⇀‿‿↼)'
sleep2: '(≖‿‿≖)'
awake: '(◕‿‿◕)'
bored: '(-__-)'
intense: '(°▃▃°)'
cool: '(⌐■_■)'
happy: '(•‿‿•)'
excited: '(ᵔ◡◡ᵔ)'
grateful: '(^‿‿^)'
motivated: '(☼‿‿☼)'
demotivated: '(≖__≖)'
smart: '(✜‿‿✜)'
lonely: '(ب__ب)'
sad: '(╥☁╥ )'
angry: "(-_-')"
friend: '(♥‿‿♥)'
broken: '(☓‿‿☓)'
debug: '(#__#)'
# ePaper display can update every 3 secs anyway, set to 0 to only refresh for major data changes
# IMPORTANT: The lifespan of an eINK display depends on the cumulative amount of refreshes. If you want to
# preserve your display over time, you should set this value to 0.0 so that the display will be refreshed only
@@ -161,14 +230,21 @@ ui:
display:
enabled: true
rotation: 180
# Possible options inkyphat/inky, papirus/papi, waveshare_1/ws_1 or waveshare_2/ws_2
# Possible options inkyphat/inky, papirus/papi, waveshare_1/ws_1 or waveshare_2/ws_2, oledhat, lcdhat, waveshare154inch, waveshare27inch, dfrobot/df
type: 'waveshare_2'
# Possible options red/yellow/black (black used for monocromatic displays)
# Waveshare tri-color 2.13in display can be over-driven with color set as 'fastAndFurious'
# THIS IS POTENTIALLY DANGEROUS. DO NOT USE UNLESS YOU UNDERSTAND THAT IT COULD KILL YOUR DISPLAY
color: 'black'
video:
enabled: true
address: '10.0.0.2'
address: '0.0.0.0'
origin: null
port: 8080
# command to be executed when a new png frame is available
# for instance, to use with framebuffer based displays:
# on_frame: 'fbi --noverbose -a -d /dev/fb1 -T 1 /root/pwnagotchi.png > /dev/null 2>&1'
on_frame: ''
# bettercap rest api configuration

97
pwnagotchi/grid.py Normal file
View File

@@ -0,0 +1,97 @@
import subprocess
import socket
import requests
import json
import logging
import pwnagotchi
# pwngrid-peer is running on port 8666
API_ADDRESS = "http://127.0.0.1:8666/api/v1"
def is_connected():
try:
socket.create_connection(("www.google.com", 80))
return True
except OSError:
pass
return False
def call(path, obj=None):
url = '%s%s' % (API_ADDRESS, path)
if obj is None:
r = requests.get(url, headers=None)
else:
r = requests.post(url, headers=None, json=obj)
if r.status_code != 200:
raise Exception("(status %d) %s" % (r.status_code, r.text))
return r.json()
def advertise(enabled=True):
return call("/mesh/%s" % 'true' if enabled else 'false')
def set_advertisement_data(data):
return call("/mesh/data", obj=data)
def peers():
return call("/mesh/peers")
def closest_peer():
all = peers()
return all[0] if len(all) else None
def update_data(last_session):
brain = {}
try:
with open('/root/brain.json') as fp:
brain = json.load(fp)
except:
pass
data = {
'session': {
'duration': last_session.duration,
'epochs': last_session.epochs,
'train_epochs': last_session.train_epochs,
'avg_reward': last_session.avg_reward,
'min_reward': last_session.min_reward,
'max_reward': last_session.max_reward,
'deauthed': last_session.deauthed,
'associated': last_session.associated,
'handshakes': last_session.handshakes,
'peers': last_session.peers,
},
'uname': subprocess.getoutput("uname -a"),
'brain': brain,
'version': pwnagotchi.version
}
logging.debug("updating grid data: %s" % data)
call("/data", data)
def report_ap(essid, bssid):
try:
call("/report/ap", {
'essid': essid,
'bssid': bssid,
})
return True
except Exception as e:
logging.exception("error while reporting ap %s(%s)" % (essid, bssid))
return False
def inbox(page=1, with_pager=False):
obj = call("/inbox?p=%d" % page)
return obj["messages"] if not with_pager else obj

View File

@@ -16,6 +16,7 @@ class KeyPair(object):
self.priv_key = None
self.pub_path = "%s.pub" % self.priv_path
self.pub_key = None
self.fingerprint_path = os.path.join(path, "fingerprint")
self._view = view
if not os.path.exists(self.path):
@@ -26,7 +27,7 @@ class KeyPair(object):
if not os.path.exists(self.priv_path) or not os.path.exists(self.pub_path):
self._view.on_keys_generation()
logging.info("generating %s ..." % self.priv_path)
os.system("/usr/bin/ssh-keygen -t rsa -m PEM -b 4096 -N '' -f '%s'" % self.priv_path)
os.system("pwngrid -generate -keys '%s'" % self.path)
# load keys: they might be corrupted if the unit has been turned off during the generation, in this case
# the exception will remove the files and go back at the beginning of this loop.
@@ -46,6 +47,9 @@ class KeyPair(object):
self.pub_key_pem_b64 = base64.b64encode(pem_ascii).decode("ascii")
self.fingerprint = hashlib.sha256(pem_ascii).hexdigest()
with open(self.fingerprint_path, 'w+t') as fp:
fp.write(self.fingerprint)
# no exception, keys loaded correctly.
self._view.on_starting()
return

Binary file not shown.

View File

@@ -0,0 +1,226 @@
# pwnagotchi voice data.
# Copyright (C) 2019
# This file is distributed under the same license as the pwnagotchi package.
# FIRST AUTHOR <https://github.com/georgikoemdzhiev>, 2019.
#
#,
msgid ""
msgstr ""
"Project-Id-Version: 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-23 20:56+0200\n"
"PO-Revision-Date: 2019-10-23 20:56+0200\n"
"Last-Translator: Georgi Koemdzhiev <https://github.com/georgikoemdzhiev>\n"
"Language-Team: \n"
"Language: bulgarian\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "ZzzzZZzzzzZzzz"
msgstr ""
msgid "Hi, I'm Pwnagotchi! Starting ..."
msgstr "Здравей, аз съм Pwnagotchi! Стартиране ..."
msgid "New day, new hunt, new pwns!"
msgstr "Нов ден, нов лов, нови pwns!"
msgid "Hack the Planet!"
msgstr "Хакни планетата!"
msgid "AI ready."
msgstr "AI готов."
msgid "The neural network is ready."
msgstr "Невронната мрежа е готова."
msgid "Generating keys, do not turn off ..."
msgstr "Генериране на ключове, не изключвай ..."
#, python-brace-format
msgid "Hey, channel {channel} is free! Your AP will say thanks."
msgstr "Здравей, канал {channel} е свободен! твоя AP ще каже благодаря."
msgid "I'm bored ..."
msgstr "Скучно ми е ..."
msgid "Let's go for a walk!"
msgstr "Хайда да се поразходим!"
msgid "This is the best day of my life!"
msgstr "Това е най-добрият ден в живота ми!"
msgid "Shitty day :/"
msgstr "Тъп ден :/"
msgid "I'm extremely bored ..."
msgstr "Супер много ми е скучно ..."
msgid "I'm very sad ..."
msgstr "Много съм тъжен ..."
msgid "I'm sad"
msgstr "Тъжен съм"
msgid "I'm living the life!"
msgstr "Живота ми е фантастичен!"
msgid "I pwn therefore I am."
msgstr "Аз живея за да pwn-вам."
msgid "So many networks!!!"
msgstr "Толкова много мрежи!!!"
msgid "I'm having so much fun!"
msgstr "Толкова много се забавлявам!"
msgid "My crime is that of curiosity ..."
msgstr "Моето престъпление е това че съм любопитен ..."
#, python-brace-format
msgid "Hello {name}! Nice to meet you."
msgstr "Здравей {name}! Приятно ми е да се запознаем."
#, python-brace-format
msgid "Unit {name} is nearby!"
msgstr "Устройство {name} е наблизо!"
#, python-brace-format
msgid "Uhm ... goodbye {name}"
msgstr "Ами ... довиждане {name}"
#, python-brace-format
msgid "{name} is gone ..."
msgstr "{name} изчезна ..."
#, python-brace-format
msgid "Whoops ... {name} is gone."
msgstr "Упс ... {name} изчезна."
#, python-brace-format
msgid "{name} missed!"
msgstr "{name} загубен!"
msgid "Missed!"
msgstr "Загубен!"
msgid "Good friends are a blessing!"
msgstr "Добрите приятели са благословия!"
msgid "I love my friends!"
msgstr "Обичам приятелите си!"
msgid "Nobody wants to play with me ..."
msgstr "Никой не иска да си играе с мен ..."
msgid "I feel so alone ..."
msgstr "Чувствам се толкова самотен ..."
msgid "Where's everybody?!"
msgstr "Къде са всички?!"
#, python-brace-format
msgid "Napping for {secs}s ..."
msgstr "Заспивам за {secs} секунди ..."
msgid "Zzzzz"
msgstr "Zzzzz"
#, python-brace-format
msgid "ZzzZzzz ({secs}s)"
msgstr "ZzzZzzz ({secs}s)"
msgid "Good night."
msgstr "Лека нощ."
msgid "Zzz"
msgstr "Zzz"
#, python-brace-format
msgid "Waiting for {secs}s ..."
msgstr "Чакам {secs} секунди ..."
#, python-brace-format
msgid "Looking around ({secs}s)"
msgstr "Оглеждам се ({secs}секунди)"
#, python-brace-format
msgid "Hey {what} let's be friends!"
msgstr "Хей {what} нека станем приятели!"
#, python-brace-format
msgid "Associating to {what}"
msgstr "Свръзване с {what}"
#, python-brace-format
msgid "Yo {what}!"
msgstr "Ей {what}!"
#, python-brace-format
msgid "Just decided that {mac} needs no WiFi!"
msgstr "Реших, че {mac} не се нуждае от WiFi!"
#, python-brace-format
msgid "Deauthenticating {mac}"
msgstr "Неудостоверяване на {mac}"
#, python-brace-format
msgid "Kickbanning {mac}!"
msgstr "Ритам и прогонвам {mac}!"
#, python-brace-format
msgid "Cool, we got {num} new handshake{plural}!"
msgstr "Супер, имаме {num} нови handshake{plural}!"
#, python-brace-format
msgid "You have {count} new message{plural}!"
msgstr "Имате {count} нови съобщения!"
msgid "Ops, something went wrong ... Rebooting ..."
msgstr "Упс, нещо се обърка ... Рестартиране ..."
#, python-brace-format
msgid "Kicked {num} stations\n"
msgstr "Отхвърлих {num} станции\n"
#, python-brace-format
msgid "Made {num} new friends\n"
msgstr "Направих {num} нови приятели\n"
#, python-brace-format
msgid "Got {num} handshakes\n"
msgstr "Имам {num} handshakes\n"
msgid "Met 1 peer"
msgstr "Срещнах 1 връстник"
#, python-brace-format
msgid "Met {num} peers"
msgstr "Срещнах {num} връстници"
#, python-brace-format
msgid ""
"I've been pwning for {duration} and kicked {deauthed} clients! I've also met "
"{associated} new friends and ate {handshakes} handshakes! #pwnagotchi "
"#pwnlog #pwnlife #hacktheplanet #skynet"
msgstr "Аз pwn-вах за {duration} и отхвърлих {deauthed} clients! Също така срещнах {associated} нови приятели и изядох {handshakes} handshakes! #pwnagotchi "
"#pwnlog #pwnlife #hacktheplanet #skynet"
msgid "hours"
msgstr "часове"
msgid "minutes"
msgstr "минути"
msgid "seconds"
msgstr "секунди"
msgid "hour"
msgstr "час"
msgid "minute"
msgstr "минута"
msgid "second"
msgstr "секунда"

Binary file not shown.

View File

@@ -0,0 +1,225 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <511225068@qq.com>, 2019.
# 还有很多未翻译和翻译不准确,后期希望大家加入进来一起翻译!
# 翻译可以联系QQ群959559103 找 名字叫 初九 的 管理员
msgid ""
msgstr ""
"Project-Id-Version: 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-23 20:56+0200\n"
"PO-Revision-Date: 2019-11-02 10:00+0008\n"
"Last-Translator: 极客之眼-初九 <511225068@qq.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: chinese\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "ZzzzZZzzzzZzzz"
msgstr ""
msgid "Hi, I'm Pwnagotchi! Starting ..."
msgstr "主人,你好.我是WiFi狩猎兽..."
msgid "New day, new hunt, new pwns!"
msgstr "美好的一天,狩猎开始!"
msgid "Hack the Planet!"
msgstr "我要入侵整个地球!"
msgid "AI ready."
msgstr "人工智能已启动."
msgid "The neural network is ready."
msgstr "神经元网络已启动."
msgid "Generating keys, do not turn off ..."
msgstr "创建密钥中, 请勿断电..."
#, python-brace-format
msgid "Hey, channel {channel} is free! Your AP will say thanks."
msgstr ""
msgid "I'm bored ..."
msgstr "我无聊了..."
msgid "Let's go for a walk!"
msgstr "主人带我出门走走吧!"
msgid "This is the best day of my life!"
msgstr "这是我生命中最美好的一天!"
msgid "Shitty day :/"
msgstr "今天不开心 :/"
msgid "I'm extremely bored ..."
msgstr "主人,找点事做吧 ..."
msgid "I'm very sad ..."
msgstr "我很伤心..."
msgid "I'm sad"
msgstr "我伤心了"
msgid "I'm living the life!"
msgstr ""
msgid "I pwn therefore I am."
msgstr ""
msgid "So many networks!!!"
msgstr "哇,好多猎物!!!"
msgid "I'm having so much fun!"
msgstr "我玩的好开心!"
msgid "My crime is that of curiosity ..."
msgstr "我最大的缺点就是好奇..."
#, python-brace-format
msgid "Hello {name}! Nice to meet you."
msgstr "你好{name}!很高兴认识你."
#, python-brace-format
msgid "Unit {name} is nearby!"
msgstr ""
#, python-brace-format
msgid "Uhm ... goodbye {name}"
msgstr "额 ... 再见{name}"
#, python-brace-format
msgid "{name} is gone ..."
msgstr "{name} 它走了 ..."
#, python-brace-format
msgid "Whoops ... {name} is gone."
msgstr "哎呀... {name} 离开了."
#, python-brace-format
msgid "{name} missed!"
msgstr "刚刚错过了{name}!"
msgid "Missed!"
msgstr "刚刚错过了一个对的它"
msgid "Good friends are a blessing!"
msgstr "有个好朋友就是福气"
msgid "I love my friends!"
msgstr "我爱我的朋友!"
msgid "Nobody wants to play with me ..."
msgstr "没有人愿意和我玩耍..."
msgid "I feel so alone ..."
msgstr "我可能是天煞孤星..."
msgid "Where's everybody?!"
msgstr "朋友们都去哪里了?!"
#, python-brace-format
msgid "Napping for {secs}s ..."
msgstr "小憩{secs}s ..."
msgid "Zzzzz"
msgstr ""
#, python-brace-format
msgid "ZzzZzzz ({secs}s)"
msgstr ""
msgid "Good night."
msgstr "晚安宝贝."
msgid "Zzz"
msgstr ""
#, python-brace-format
msgid "Waiting for {secs}s ..."
msgstr "等待{secs}s ..."
#, python-brace-format
msgid "Looking around ({secs}s)"
msgstr "追踪四周猎物({secs}s)"
#, python-brace-format
msgid "Hey {what} let's be friends!"
msgstr "嗨{what}我们做朋友吧!"
#, python-brace-format
msgid "Associating to {what}"
msgstr "正在连接到{what}"
#, python-brace-format
msgid "Yo {what}!"
msgstr "追踪到你了{what}!"
#, python-brace-format
msgid "Just decided that {mac} needs no WiFi!"
msgstr "猎物{mac}不需要联网,我们给它断开!"
#, python-brace-format
msgid "Deauthenticating {mac}"
msgstr "开始攻击猎物{mac}"
#, python-brace-format
msgid "Kickbanning {mac}!"
msgstr "已捕获{mac}!"
#, python-brace-format
msgid "Cool, we got {num} new handshake{plural}!"
msgstr "太酷了, 我们抓到了{num}新的猎物{plural}!"
#, python-brace-format
msgid "You have {count} new message{plural}!"
msgstr "主人,有{count}新消息{plural}!"
msgid "Ops, something went wrong ... Rebooting ..."
msgstr "行动,额等等有点小问题... 重启ing ..."
#, python-brace-format
msgid "Kicked {num} stations\n"
msgstr "限制了{num}个猎物\n"
#, python-brace-format
msgid "Made {num} new friends\n"
msgstr "交了{num}新朋友\n"
#, python-brace-format
msgid "Got {num} handshakes\n"
msgstr "捕获了{num}握手包\n"
msgid "Met 1 peer"
msgstr ""
#, python-brace-format
msgid "Met {num} peers"
msgstr ""
#, python-brace-format
msgid ""
"I've been pwning for {duration} and kicked {deauthed} clients! I've also met "
"{associated} new friends and ate {handshakes} handshakes! #pwnagotchi "
"#pwnlog #pwnlife #hacktheplanet #skynet"
msgstr ""
msgid "hours"
msgstr "时"
msgid "minutes"
msgstr "分"
msgid "seconds"
msgstr "秒"
msgid "hour"
msgstr "时"
msgid "minute"
msgstr "分"
msgid "second"
msgstr "秒"

View File

@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-09 17:42+0200\n"
"POT-Creation-Date: 2019-10-23 20:56+0200\n"
"PO-Revision-Date: 2019-09-29 14:00+0200\n"
"Last-Translator: dadav <33197631+dadav@users.noreply.github.com>\n"
"Language-Team: DE <33197631+dadav@users.noreply.github.com>\n"
@@ -34,6 +34,9 @@ msgstr "KI bereit."
msgid "The neural network is ready."
msgstr "Das neurale Netz ist bereit."
msgid "Generating keys, do not turn off ..."
msgstr "Generiere Keys, nicht ausschalten ..."
#, python-brace-format
msgid "Hey, channel {channel} is free! Your AP will say thanks."
msgstr "Hey, Channel {channel} ist frei! Dein AP wir des dir danken."
@@ -75,11 +78,11 @@ msgid "My crime is that of curiosity ..."
msgstr "Mein Verbrechen ist das der Neugier ..."
#, python-brace-format
msgid "Hello {name}! Nice to meet you. {name}"
msgid "Hello {name}! Nice to meet you."
msgstr "Hallo {name}, nett Dich kennenzulernen."
#, python-brace-format
msgid "Unit {name} is nearby! {name}"
msgid "Unit {name} is nearby!"
msgstr "Gerät {name} ist in der nähe!!"
#, python-brace-format
@@ -101,6 +104,12 @@ msgstr "{name} verpasst!"
msgid "Missed!"
msgstr "Verpasst!"
msgid "Good friends are a blessing!"
msgstr "Gute Freunde sind ein Segen!"
msgid "I love my friends!"
msgstr "Ich liebe meine Freunde!"
msgid "Nobody wants to play with me ..."
msgstr "Niemand will mit mir spielen ..."
@@ -163,6 +172,10 @@ msgstr "Kicke {mac}!"
msgid "Cool, we got {num} new handshake{plural}!"
msgstr "Cool, wir haben {num} neue Handshake{plural}!"
#, python-brace-format
msgid "You have {count} new message{plural}!"
msgstr "Cool, wir haben {num} neue Handshake{plural}!"
msgid "Ops, something went wrong ... Rebooting ..."
msgstr "Ops, da ist etwas schief gelaufen ...Starte neu ..."

View File

@@ -3,12 +3,12 @@
# This file is distributed under the same license as the pwnagotchi package.
# FIRST AUTHOR <7271496+quantumsheep@users.noreply.github.com>, 2019.
#
#, fuzzy
#,
msgid ""
msgstr ""
"Project-Id-Version: 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-05 14:10+0200\n"
"POT-Creation-Date: 2019-10-23 18:37+0200\n"
"PO-Revision-Date: 2019-10-03 10:34+0200\n"
"Last-Translator: quantumsheep <7271496+quantumsheep@users.noreply.github."
"com>\n"
@@ -19,16 +19,16 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
msgid "ZzzzZZzzzzZzzz"
msgstr ""
msgstr "ZzzzZZzzzzZzzz"
msgid "Hi, I'm Pwnagotchi! Starting ..."
msgstr "Bonjour, je suis Pwnagotchi! Démarrage ..."
msgstr "Bonjour, je suis Pwnagotchi ! Démarrage..."
msgid "New day, new hunt, new pwns!"
msgstr "Nouveau jour, nouvelle chasse, nouveaux pwns !"
msgid "Hack the Planet!"
msgstr "Hack la planète!"
msgstr "Hack la planète !"
msgid "AI ready."
msgstr "L'IA est prête."
@@ -36,85 +36,88 @@ msgstr "L'IA est prête."
msgid "The neural network is ready."
msgstr "Le réseau neuronal est prêt."
msgid "Generating keys, do not turn off ..."
msgstr "Génération des clés, ne pas éteindre..."
#, python-brace-format
msgid "Hey, channel {channel} is free! Your AP will say thanks."
msgstr "Hey, le channel {channel} est libre! Ton point d'accès va te remercier."
msgstr "Hey, le canal {channel} est libre! Ton point d'accès va te remercier."
msgid "I'm bored ..."
msgstr "Je m'ennuie ..."
msgstr "Je m'ennuie..."
msgid "Let's go for a walk!"
msgstr "Allons faire un tour!"
msgstr "Allons faire un tour !"
msgid "This is the best day of my life!"
msgstr "C'est le meilleur jour de ma vie!"
msgstr "C'est le meilleur jour de ma vie !"
msgid "Shitty day :/"
msgstr "Journée de merde :/"
msgid "I'm extremely bored ..."
msgstr "Je m'ennuie énormément ..."
msgstr "Je m'ennuie énormément..."
msgid "I'm very sad ..."
msgstr "Je suis très triste ..."
msgstr "Je suis très triste..."
msgid "I'm sad"
msgstr "Je suis triste"
msgid "I'm living the life!"
msgstr "Je vis la vie!"
msgstr "Je vis la vie !"
msgid "I pwn therefore I am."
msgstr "Je pwn donc je suis."
msgid "So many networks!!!"
msgstr "Tellement de réseaux!!!"
msgstr "Tellement de réseaux !!!"
msgid "I'm having so much fun!"
msgstr "Je m'amuse tellement!"
msgstr "Je m'amuse tellement !"
msgid "My crime is that of curiosity ..."
msgstr "Mon crime, c'est la curiosité ..."
msgstr "Mon crime, c'est la curiosité..."
#, python-brace-format
msgid "Hello {name}! Nice to meet you. {name}"
msgstr "Bonjour {name}! Ravi de te rencontrer. {name}"
msgid "Hello {name}! Nice to meet you."
msgstr "Bonjour {name} ! Ravi de te rencontrer."
#, python-brace-format
msgid "Unit {name} is nearby! {name}"
msgstr "L'unité {name} est proche! {name}"
msgid "Unit {name} is nearby!"
msgstr "L'unité {name} est proche !"
#, python-brace-format
msgid "Uhm ... goodbye {name}"
msgstr "Hum ... au revoir {name}"
msgstr "Hum... au revoir {name}"
#, python-brace-format
msgid "{name} is gone ..."
msgstr "{name} est parti ..."
msgstr "{name} est part ..."
#, python-brace-format
msgid "Whoops ... {name} is gone."
msgstr "Oups ... {name} est parti."
msgstr "Oups... {name} est parti."
#, python-brace-format
msgid "{name} missed!"
msgstr "{name} raté!"
msgstr "{name} raté !"
msgid "Missed!"
msgstr "Raté!"
msgstr "Raté !"
msgid "Nobody wants to play with me ..."
msgstr "Personne ne veut jouer avec moi ..."
msgstr "Personne ne veut jouer avec moi..."
msgid "I feel so alone ..."
msgstr "Je me sens si seul ..."
msgstr "Je me sens si seul..."
msgid "Where's everybody?!"
msgstr "Où est tout le monde?!"
msgstr "Où est tout le monde ?!"
#, python-brace-format
msgid "Napping for {secs}s ..."
msgstr "Fais la sieste pendant {secs}s ..."
msgstr "Fais la sieste pendant {secs}s..."
msgid "Zzzzz"
msgstr ""
@@ -123,9 +126,15 @@ msgstr ""
msgid "ZzzZzzz ({secs}s)"
msgstr ""
msgid "Good night."
msgstr "Bonne nuit."
msgid "Zzz"
msgstr "Zzz"
#, python-brace-format
msgid "Waiting for {secs}s ..."
msgstr "Attends pendant {secs}s ..."
msgstr "Attends pendant {secs}s..."
#, python-brace-format
msgid "Looking around ({secs}s)"
@@ -133,7 +142,7 @@ msgstr "Regarde autour ({secs}s)"
#, python-brace-format
msgid "Hey {what} let's be friends!"
msgstr "Hey {what}, soyons amis!"
msgstr "Hey {what}, soyons amis !"
#, python-brace-format
msgid "Associating to {what}"
@@ -141,11 +150,11 @@ msgstr "Association à {what}"
#, python-brace-format
msgid "Yo {what}!"
msgstr ""
msgstr "Yo {what} !"
#, python-brace-format
msgid "Just decided that {mac} needs no WiFi!"
msgstr "Je viens de décider que {mac} n'a pas besoin de WiFi!"
msgstr "Je viens de décider que {mac} n'a pas besoin de WiFi !"
#, python-brace-format
msgid "Deauthenticating {mac}"
@@ -153,14 +162,18 @@ msgstr "Désauthentification de {mac}"
#, python-brace-format
msgid "Kickbanning {mac}!"
msgstr "Je kick et je bannis {mac}!"
msgstr "Je kick et je bannis {mac} !"
#, python-brace-format
msgid "Cool, we got {num} new handshake{plural}!"
msgstr "Cool, on a {num} nouveaux handshake{plural}!"
msgstr "Cool, on a {num} nouveaux handshake{plural} !"
#, python-brace-format
msgid "You have {count} new message{plural}!"
msgstr "Tu as {num} nouveaux message{plural} !"
msgid "Ops, something went wrong ... Rebooting ..."
msgstr "Oups, quelque chose s'est mal passé ... Redémarrage ..."
msgstr "Oups, quelque chose s'est mal passé... Redémarrage..."
#, python-brace-format
msgid "Kicked {num} stations\n"
@@ -187,24 +200,24 @@ msgid ""
"{associated} new friends and ate {handshakes} handshakes! #pwnagotchi "
"#pwnlog #pwnlife #hacktheplanet #skynet"
msgstr ""
"J'ai pwn durant {duration} et kick {deauthed} clients! J'ai aussi rencontré "
"{associated} nouveaux amis et dévoré {handshakes} handshakes! #pwnagotchi "
"J'ai pwn durant {duration} et kick {deauthed} clients ! J'ai aussi rencontré "
"{associated} nouveaux amis et dévoré {handshakes} handshakes ! #pwnagotchi "
"#pwnlog #pwnlife #hacktheplanet #skynet"
msgid "hours"
msgstr ""
msgstr "heures"
msgid "minutes"
msgstr ""
msgstr "minutes"
msgid "seconds"
msgstr ""
msgstr "secondes"
msgid "hour"
msgstr ""
msgstr "heure"
msgid "minute"
msgstr ""
msgstr "minute"
msgid "second"
msgstr ""
msgstr "seconde"

Binary file not shown.

View File

@@ -0,0 +1,215 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-09 17:42+0200\n"
"PO-Revision-Date: 2019-10-15 23:46+0100\n"
"Language: ga\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Last-Translator: \n"
"Language-Team: \n"
"X-Generator: Poedit 2.2.4\n"
msgid "ZzzzZZzzzzZzzz"
msgstr ""
msgid "Hi, I'm Pwnagotchi! Starting ..."
msgstr "Dia Duit, Pwnagotchi is ainm dom! Ag tosú ..."
msgid "New day, new hunt, new pwns!"
msgstr "Lá nua, seilg nua, pwns nua!"
msgid "Hack the Planet!"
msgstr "Haic An Phláinéid!"
msgid "AI ready."
msgstr "AI réidh."
msgid "The neural network is ready."
msgstr "Tá an líonra néarach réidh."
#, python-brace-format
msgid "Hey, channel {channel} is free! Your AP will say thanks."
msgstr "Hé, tá cainéal {channel} ar fail! Déarfaidh do PR go raibh maith agat."
msgid "I'm bored ..."
msgstr "Tá leadrán orm ..."
msgid "Let's go for a walk!"
msgstr "Siúil liom, le do thoil!"
msgid "This is the best day of my life!"
msgstr "Tá sé an lá is fearr i mo shaol!"
msgid "Shitty day :/"
msgstr "Tá lá damanta agam :/"
msgid "I'm extremely bored ..."
msgstr "Tá mé ag dul as mo mheabhair le leadrán ..."
msgid "I'm very sad ..."
msgstr "Ta brón an domhain orm ..."
msgid "I'm sad"
msgstr "Tá brón orm"
msgid "I'm living the life!"
msgstr "Tá an saol ar a thoil agam!"
msgid "I pwn therefore I am."
msgstr "Déanaim pwnáil, dá bhrí sin táim ann."
msgid "So many networks!!!"
msgstr "Gréasáin - Tá an iliomad acu ann!!!"
msgid "I'm having so much fun!"
msgstr "Tá craic iontach agam!"
msgid "My crime is that of curiosity ..."
msgstr "Ní haon pheaca é bheith fiosrach ..."
#, python-brace-format
msgid "Hello {name}! Nice to meet you. {name}"
msgstr "Dia Duit {name}! Is deas bualadh leat. {name}"
#, python-brace-format
msgid "Unit {name} is nearby! {name}"
msgstr "Aonad {name} in aice láimhe! {name}"
#, python-brace-format
msgid "Uhm ... goodbye {name}"
msgstr "Uhm... slán leat {name}"
#, python-brace-format
msgid "{name} is gone ..."
msgstr "Tá {name} imithe ..."
#, python-brace-format
msgid "Whoops ... {name} is gone."
msgstr "Hoips … Tá {name} imithe."
#, python-brace-format
msgid "{name} missed!"
msgstr "Chaill mé ar {name}!"
msgid "Missed!"
msgstr "Chaill mé é sin !"
msgid "Nobody wants to play with me ..."
msgstr "Níl aon duine ag iarraidh imirt liom ..."
msgid "I feel so alone ..."
msgstr "Tá uaigneas an domhain orm ..."
msgid "Where's everybody?!"
msgstr "Cá bhfuil gach duine?!"
#, python-brace-format
msgid "Napping for {secs}s ..."
msgstr "Néal a chodladh ar {secs}s ..."
msgid "Zzzzz"
msgstr ""
#, python-brace-format
msgid "ZzzZzzz ({secs}s)"
msgstr ""
msgid "Good night."
msgstr "Oíche mhaith."
msgid "Zzz"
msgstr ""
#, python-brace-format
msgid "Waiting for {secs}s ..."
msgstr "Fan ar {secs}s ..."
#, python-brace-format
msgid "Looking around ({secs}s)"
msgstr "Ag amharc uaim ar ({secs}s)"
#, python-brace-format
msgid "Hey {what} let's be friends!"
msgstr "Hé {what} déanaimis síocháin!"
#, python-brace-format
msgid "Associating to {what}"
msgstr "Ag coinneáil le {what}"
#, python-brace-format
msgid "Yo {what}!"
msgstr "Hé {what}!"
#, python-brace-format
msgid "Just decided that {mac} needs no WiFi!"
msgstr "Tá cinneadh déanta agam. Níl {mac} sin de dhíth air WiFi!"
#, python-brace-format
msgid "Deauthenticating {mac}"
msgstr "Bain fíordheimhniúde {mac}"
#, python-brace-format
msgid "Kickbanning {mac}!"
msgstr "Chiceáil mé agus cosc mé ar {mac}!"
#, python-brace-format
msgid "Cool, we got {num} new handshake{plural}!"
msgstr "Go hiontach, fuaireamar {num} handshake{plural}!"
msgid "Ops, something went wrong ... Rebooting ..."
msgstr "Hoips...Tháinig ainghléas éigin..."
#, python-brace-format
msgid "Kicked {num} stations\n"
msgstr "{num} stáisiún kick\n"
#, python-brace-format
msgid "Made {num} new friends\n"
msgstr "Rinne mé {num} cairde nua\n"
#, python-brace-format
msgid "Got {num} handshakes\n"
msgstr "Fuair me {num} cumarsáid thionscantach\n"
msgid "Met 1 peer"
msgstr "Bhuail mé piara amháin"
#, python-brace-format
msgid "Met {num} peers"
msgstr "Bhuail me {num} piara"
#, python-brace-format
msgid ""
"I've been pwning for {duration} and kicked {deauthed} clients! I've also met "
"{associated} new friends and ate {handshakes} handshakes! #pwnagotchi "
"#pwnlog #pwnlife #hacktheplanet #skynet"
msgstr ""
"Bhí me ag pwnáil ar {duration} agus chiceáil me ar {deauthed} cliaint! Chomh "
"maith, bhuail me {associated} cairde nua and d'ith mé {handshakes}! "
"#pwnagotchi #pwnlog #pwnlife #hacktheplanet #skynet"
msgid "hours"
msgstr "uair on chloig"
msgid "minutes"
msgstr "nóiméad"
msgid "seconds"
msgstr "soicind"
msgid "hour"
msgstr "uair an chloig"
msgid "minute"
msgstr "nóiméad"
msgid "second"
msgstr "soicind"

Binary file not shown.

View File

@@ -0,0 +1,212 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR 24534649+wytshadow@users.noreply.github.com, 2019.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-16 15:05+0200\n"
"PO-Revision-Date: 2019-10-16 15:05+0200\n"
"Last-Translator: wytshadow <24534649+wytshadow@users.noreply.github.com>\n"
"Language-Team: pwnagotchi <24534649+wytshadow@users.noreply.github.com>\n"
"Language: jp\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "ZzzzZZzzzzZzzz"
msgstr "すやすや〜"
msgid "Hi, I'm Pwnagotchi! Starting ..."
msgstr "こんにちは、ポウナゴッチです!始めている。。。"
msgid "New day, new hunt, new pwns!"
msgstr ""
msgid "Hack the Planet!"
msgstr "ハックザプラネット!"
msgid "AI ready."
msgstr "人工知能の準備ができました。"
msgid "The neural network is ready."
msgstr "ニューラルネットワークの準備ができました。"
#, python-brace-format
msgid "Hey, channel {channel} is free! Your AP will say thanks."
msgstr "ねえ、チャンネル{channel}は無料です! キミのAPは感謝を言います。"
msgid "I'm bored ..."
msgstr "退屈です。。。"
msgid "Let's go for a walk!"
msgstr "散歩に行きましょう!"
msgid "This is the best day of my life!"
msgstr "今日は私の人生で最高の日です!"
msgid "Shitty day :/"
msgstr ""
msgid "I'm extremely bored ..."
msgstr "とても退屈です。"
msgid "I'm very sad ..."
msgstr "とても悲しいです。。。"
msgid "I'm sad"
msgstr "悲しいです。"
msgid "I'm living the life!"
msgstr "人生を生きている!"
msgid "I pwn therefore I am."
msgstr ""
msgid "So many networks!!!"
msgstr "たくさんネットワークがある!!!"
msgid "I'm having so much fun!"
msgstr "とても楽しんでいます!"
msgid "My crime is that of curiosity ..."
msgstr ""
#, python-brace-format
msgid "Hello {name}! Nice to meet you. {name}"
msgstr "こんにちは{name}!初めまして。{name}"
#, python-brace-format
msgid "Unit {name} is nearby! {name}"
msgstr ""
#, python-brace-format
msgid "Uhm ... goodbye {name}"
msgstr "ええと。。。さようなら{name}"
#, python-brace-format
msgid "{name} is gone ..."
msgstr "{name}がなくなった。。。"
#, python-brace-format
msgid "Whoops ... {name} is gone."
msgstr "おっと。。。{name}がなくなった。"
#, python-brace-format
msgid "{name} missed!"
msgstr "{name}逃した!"
msgid "Missed!"
msgstr "逃した!"
msgid "Nobody wants to play with me ..."
msgstr "誰も僕と一緒にプレーしたくない。。。"
msgid "I feel so alone ..."
msgstr "僕は孤独を感じる。。。"
msgid "Where's everybody?!"
msgstr "みんなどこ?!"
#, python-brace-format
msgid "Napping for {secs}s ..."
msgstr "{secs}寝ている。"
msgid "Zzzzz"
msgstr "すや〜"
#, python-brace-format
msgid "ZzzZzzz ({secs}s)"
msgstr "すやすや〜 ({secs})"
msgid "Good night."
msgstr "お休みなさい。"
msgid "Zzz"
msgstr "す〜"
#, python-brace-format
msgid "Waiting for {secs}s ..."
msgstr "{secs}を待っている。。。"
#, python-brace-format
msgid "Looking around ({secs}s)"
msgstr "{secs}を探している。"
#, python-brace-format
msgid "Hey {what} let's be friends!"
msgstr "ちょっと{what}友だちになりましょう!"
#, python-brace-format
msgid "Associating to {what}"
msgstr ""
#, python-brace-format
msgid "Yo {what}!"
msgstr "よー{what}!"
#, python-brace-format
msgid "Just decided that {mac} needs no WiFi!"
msgstr ""
#, python-brace-format
msgid "Deauthenticating {mac}"
msgstr ""
#, python-brace-format
msgid "Kickbanning {mac}!"
msgstr ""
#, python-brace-format
msgid "Cool, we got {num} new handshake{plural}!"
msgstr "よし、{num}新しいハンドシェイクがある!"
msgid "Ops, something went wrong ... Rebooting ..."
msgstr "おっと!何かが間違っていた。。。リブートしている。。。"
#, python-brace-format
msgid "Kicked {num} stations\n"
msgstr ""
#, python-brace-format
msgid "Made {num} new friends\n"
msgstr "{num}人の新しい友達を作りました\n"
#, python-brace-format
msgid "Got {num} handshakes\n"
msgstr "{num}ハンドシェイクがある。\n"
msgid "Met 1 peer"
msgstr "1人の仲間を会いました。"
#, python-brace-format
msgid "Met {num} peers"
msgstr "{num}人の仲間を会いました。"
#, python-brace-format
msgid ""
"I've been pwning for {duration} and kicked {deauthed} clients! I've also met "
"{associated} new friends and ate {handshakes} handshakes! #pwnagotchi "
"#pwnlog #pwnlife #hacktheplanet #skynet"
msgstr ""
msgid "hours"
msgstr "時間"
msgid "minutes"
msgstr "分"
msgid "seconds"
msgstr "秒"
msgid "hour"
msgstr "時間"
msgid "minute"
msgstr "分"
msgid "second"
msgstr "秒"

Binary file not shown.

View File

@@ -0,0 +1,248 @@
# Polish voice data for pwnagotchi.
# Copyright (C) 2019
# This file is distributed under the same license as the pwnagotchi package.
# szymex73 <szymex73@gmail.com>, 2019.
#
msgid ""
msgstr ""
"Project-Id-Version: 0.1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-11-04 06:37+0100\n"
"PO-Revision-Date: 2019-10-21 10:55+0200\n"
"Last-Translator: gkrs <457603+gkrs@users.noreply.github.com>\n"
"Language-Team: PL <457603+gkrs@users.noreply.github.com>\n"
"Language: polish\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "ZzzzZZzzzzZzzz"
msgstr ""
msgid "Hi, I'm Pwnagotchi! Starting ..."
msgstr "Hej, jestem Pwnagotchi! Uruchamianie ..."
msgid "New day, new hunt, new pwns!"
msgstr "Nowy dzień, nowe łowy, nowe pwny!"
msgid "Hack the Planet!"
msgstr "Hakujmy planetę!"
msgid "AI ready."
msgstr "SI gotowa."
msgid "The neural network is ready."
msgstr "Sieć neuronowa jest gotowa."
msgid "Generating keys, do not turn off ..."
msgstr "Generuję klucze, nie wyłączaj ..."
#, python-brace-format
msgid "Hey, channel {channel} is free! Your AP will say thanks."
msgstr "Hej, kanał {channel} jest wolny! Twój AP będzie Ci wdzięczny."
msgid "Reading last session logs ..."
msgstr "Czytam logi z ostatniej sesji ..."
#, python-brace-format
msgid "Read {lines_so_far} log lines so far ..."
msgstr "Na razie przeczytałem {lines_so_far} linii logów ..."
msgid "I'm bored ..."
msgstr "Nudzi mi się ..."
msgid "Let's go for a walk!"
msgstr "Chodźmy na spacer!"
msgid "This is the best day of my life!"
msgstr "To najlepszy dzień mojego życia!"
msgid "Shitty day :/"
msgstr "Gówniany dzień :/"
msgid "I'm extremely bored ..."
msgstr "Straaaasznie się nudzę ..."
msgid "I'm very sad ..."
msgstr "Jest mi bardzo smutno ..."
msgid "I'm sad"
msgstr "Jest mi smutno"
msgid "Leave me alone ..."
msgstr "Zostaw mnie w spokoju ..."
msgid "I'm mad at you!"
msgstr "Wkurzam się na ciebie"
msgid "I'm living the life!"
msgstr "Cieszę się życiem!"
msgid "I pwn therefore I am."
msgstr "Pwnuję więc jestem."
msgid "So many networks!!!"
msgstr "Jak dużo sieci!!!"
msgid "I'm having so much fun!"
msgstr "Ale jest super!"
msgid "My crime is that of curiosity ..."
msgstr "Moją zbrodnią jest ciekawość ..."
#, python-brace-format
msgid "Hello {name}! Nice to meet you."
msgstr "Cześć {name}! Miło Cię poznać."
#, python-brace-format
msgid "Yo {name}! Sup?"
msgstr "Siema {name}! Co słychać?"
#, python-brace-format
msgid "Hey {name} how are you doing?"
msgstr "Hej {name} jak się masz?"
#, python-brace-format
msgid "Unit {name} is nearby!"
msgstr "Urządzenie {name} jest w pobliżu!"
#, python-brace-format
msgid "Uhm ... goodbye {name}"
msgstr "Umm ... żegnaj {name}"
#, python-brace-format
msgid "{name} is gone ..."
msgstr "{name} zniknął ..."
#, python-brace-format
msgid "Whoops ... {name} is gone."
msgstr "Ups ... {name} zniknął."
#, python-brace-format
msgid "{name} missed!"
msgstr "{name} pudło!"
msgid "Missed!"
msgstr "Pudło!"
msgid "Good friends are a blessing!"
msgstr "Dobrzy przyjaciele to błogosławieństwo!"
msgid "I love my friends!"
msgstr "Kocham moich przyjaciół!"
msgid "Nobody wants to play with me ..."
msgstr "Nikt nie chce się ze mną bawić ..."
msgid "I feel so alone ..."
msgstr "Czuję się taki samotny ..."
msgid "Where's everybody?!"
msgstr "Gdzie są wszyscy?!"
#, python-brace-format
msgid "Napping for {secs}s ..."
msgstr "Zdrzemnę się przez {secs}s ..."
msgid "Zzzzz"
msgstr ""
#, python-brace-format
msgid "ZzzZzzz ({secs}s)"
msgstr ""
msgid "Good night."
msgstr "Dobranoc."
msgid "Zzz"
msgstr ""
#, python-brace-format
msgid "Waiting for {secs}s ..."
msgstr "Czekam {secs}s ..."
#, python-brace-format
msgid "Looking around ({secs}s)"
msgstr "Rozglądam się ({secs}s)"
#, python-brace-format
msgid "Hey {what} let's be friends!"
msgstr "Hej {what} zostańmy przyjaciółmi!"
#, python-brace-format
msgid "Associating to {what}"
msgstr "Dołączam do {what}"
#, python-brace-format
msgid "Yo {what}!"
msgstr "Siema {what}!"
#, python-brace-format
msgid "Just decided that {mac} needs no WiFi!"
msgstr "Według mnie {mac} nie potrzebuje WiFi!"
#, python-brace-format
msgid "Deauthenticating {mac}"
msgstr "Rozłączam {mac}"
#, python-brace-format
msgid "Kickbanning {mac}!"
msgstr "Banuję {mac}!"
#, python-brace-format
msgid "Cool, we got {num} new handshake{plural}!"
msgstr "Super, zdobyliśmy {num} nowych handshake'ów!"
#, python-brace-format
msgid "You have {count} new message{plural}!"
msgstr "Masz {count} nowych wiadomości!"
msgid "Ops, something went wrong ... Rebooting ..."
msgstr "Ups, coś poszło nie tak ... Restaruję ..."
#, python-brace-format
msgid "Kicked {num} stations\n"
msgstr "Wyrzuciłem {num} stacji\n"
#, python-brace-format
msgid "Made {num} new friends\n"
msgstr "Zdobyłem {num} nowych przyjaciół\n"
#, python-brace-format
msgid "Got {num} handshakes\n"
msgstr "Zdobyłem {num} handshake'ów\n"
msgid "Met 1 peer"
msgstr "Spotkałem 1 kolegę"
#, python-brace-format
msgid "Met {num} peers"
msgstr "Spotkałem {num} kolegów"
#, python-brace-format
msgid ""
"I've been pwning for {duration} and kicked {deauthed} clients! I've also met "
"{associated} new friends and ate {handshakes} handshakes! #pwnagotchi "
"#pwnlog #pwnlife #hacktheplanet #skynet"
msgstr ""
"Pwnowałem {duration} i wyrzuciłem {deauthed} klientów! Spotkałem także "
"{associated} nowych przyjaciół i zjadłem {handshakes} handshake'ow! "
"#pwnagotchi #pwnlog #pwnlife #hacktheplanet #skynet"
msgid "hours"
msgstr "godzin"
msgid "minutes"
msgstr "minut"
msgid "seconds"
msgstr "sekund"
msgid "hour"
msgstr "godzina"
msgid "minute"
msgstr "minuta"
msgid "second"
msgstr "sekunda"

View File

@@ -29,10 +29,10 @@ msgid "New day, new hunt, new pwns!"
msgstr "Новый день, новая охота, новые взломы!"
msgid "Hack the Planet!"
msgstr "Взломаем всю планету!"
msgstr "Хак зе планет!"
msgid "AI ready."
msgstr "Искусственный интеллект готов."
msgstr "AI готов."
msgid "The neural network is ready."
msgstr "Нейронная сеть готова."
@@ -48,7 +48,7 @@ msgid "Let's go for a walk!"
msgstr "Пойдем прогуляемся!"
msgid "This is the best day of my life!"
msgstr "Это лучший день в моей жизни!"
msgstr "Лучший день в моей жизни!"
msgid "Shitty day :/"
msgstr "Дерьмовый день :/"
@@ -63,19 +63,19 @@ msgid "I'm sad"
msgstr "Мне грустно"
msgid "I'm living the life!"
msgstr "Я живу своей жизнью!"
msgstr "Угараю по полной!"
msgid "I pwn therefore I am."
msgstr "Я взламываю, поэтому я существую."
msgid "So many networks!!!"
msgstr "Так, много сетей!!!"
msgstr "Так много сетей!!!"
msgid "I'm having so much fun!"
msgstr "Мне так весело!"
msgid "My crime is that of curiosity ..."
msgstr "Моё преступление - это любопытство …"
msgstr "Моe преступление - это любопытство …"
#, python-brace-format
msgid "Hello {name}! Nice to meet you. {name}"
@@ -105,7 +105,7 @@ msgid "Missed!"
msgstr "Промахнулся!"
msgid "Nobody wants to play with me ..."
msgstr "Никто не хочет играть со мной "
msgstr "Никто не хочет со мной играть ..."
msgid "I feel so alone ..."
msgstr "Мне так одиноко …"

Binary file not shown.

View File

@@ -0,0 +1,228 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# damoklov <mishanya@protonmail.com>, 2019.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-23 20:56+0200\n"
"PO-Revision-Date: 2019-11-02 16:20+0200\n"
"Last-Translator: damoklov <mishanya@protonmail.com>\n"
"Language-Team: Ukrainian\n"
"Language: ua\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "ZzzzZZzzzzZzzz"
msgstr "ZzzzZZzzzzZzzz"
msgid "Hi, I'm Pwnagotchi! Starting ..."
msgstr "Привіт, я Pwnagotchi! Починаймо ..."
msgid "New day, new hunt, new pwns!"
msgstr "Новий день, нове полювання, нові проникнення!"
msgid "Hack the Planet!"
msgstr "Хакни цілу планету!"
msgid "AI ready."
msgstr "Штучний інтелект готовий."
msgid "The neural network is ready."
msgstr "Нейронна мережа готова."
msgid "Generating keys, do not turn off ..."
msgstr "Генерую ключі, не вимикай живлення ..."
#, python-brace-format
msgid "Hey, channel {channel} is free! Your AP will say thanks."
msgstr "Агов, канал {channel} вільний! Ваша точка доступу буде вдячна."
msgid "I'm bored ..."
msgstr "Мені сумно ..."
msgid "Let's go for a walk!"
msgstr "Нумо прогуляймось!"
msgid "This is the best day of my life!"
msgstr "Сьогодні найкращий день у моєму житті!"
msgid "Shitty day :/"
msgstr "Поганенький день :/"
msgid "I'm extremely bored ..."
msgstr "Мені геть сумно ..."
msgid "I'm very sad ..."
msgstr "Я дуже засмучений ..."
msgid "I'm sad"
msgstr "Я засмучений"
msgid "I'm living the life!"
msgstr "Ось таке у мене життя!"
msgid "I pwn therefore I am."
msgstr "Народжений, щоб зламувати."
msgid "So many networks!!!"
msgstr "Овва, стільки мереж!!!"
msgid "I'm having so much fun!"
msgstr "Мені так весело!"
msgid "My crime is that of curiosity ..."
msgstr "Мій єдиний злочин - це допитливість ..."
#, python-brace-format
msgid "Hello {name}! Nice to meet you."
msgstr "Привіт, {name}! Приємно познайомитись."
#, python-brace-format
msgid "Unit {name} is nearby!"
msgstr "Ціль {name} неподалік!"
#, python-brace-format
msgid "Uhm ... goodbye {name}"
msgstr "Що ж ... бувай, {name}"
#, python-brace-format
msgid "{name} is gone ..."
msgstr "{name} зникла ..."
#, python-brace-format
msgid "Whoops ... {name} is gone."
msgstr "Ой-ой ... {name} зникла."
#, python-brace-format
msgid "{name} missed!"
msgstr "{name} втрачено!"
msgid "Missed!"
msgstr "Не впіймав!"
msgid "Good friends are a blessing!"
msgstr "Справжні друзі - це чудово!"
msgid "I love my friends!"
msgstr "Я люблю своїх друзів!"
msgid "Nobody wants to play with me ..."
msgstr "Ніхто не хоче бавитись зі мною ..."
msgid "I feel so alone ..."
msgstr "Я почуваюсь вкрай самотньо ..."
msgid "Where's everybody?!"
msgstr "Куди всі зникли?!"
#, python-brace-format
msgid "Napping for {secs}s ..."
msgstr "Дрімаю {secs}с ..."
msgid "Zzzzz"
msgstr "Zzzzz"
#, python-brace-format
msgid "ZzzZzzz ({secs}s)"
msgstr "ZzzZzzz ({secs}с)"
msgid "Good night."
msgstr "Спокійної нічки."
msgid "Zzz"
msgstr "Zzz"
#, python-brace-format
msgid "Waiting for {secs}s ..."
msgstr "Очікую {secs}с ..."
#, python-brace-format
msgid "Looking around ({secs}s)"
msgstr "Роздивляюсь довкола ({secs}с)"
#, python-brace-format
msgid "Hey {what} let's be friends!"
msgstr "Агов, {what}, будьмо друзями!"
#, python-brace-format
msgid "Associating to {what}"
msgstr "Налагоджую зв'язок з {what}"
#, python-brace-format
msgid "Yo {what}!"
msgstr "Гей, {what}!"
#, python-brace-format
msgid "Just decided that {mac} needs no WiFi!"
msgstr "Вирішив, що {mac} більше не потребує WiFi!"
#, python-brace-format
msgid "Deauthenticating {mac}"
msgstr "Від'єднюю {mac}"
#, python-brace-format
msgid "Kickbanning {mac}!"
msgstr "Вилучаю {mac}!"
#, python-brace-format
msgid "Cool, we got {num} new handshake{plural}!"
msgstr "Отакої, у нас є {num} нових рукостискань!"
#, python-brace-format
msgid "You have {count} new message{plural}!"
msgstr "Нових повідомлень: {count}"
msgid "Ops, something went wrong ... Rebooting ..."
msgstr "Ой, щось пішло не так ... Перезавантажуюсь ..."
#, python-brace-format
msgid "Kicked {num} stations\n"
msgstr "Від'єднав {num} станцій\n"
#, python-brace-format
msgid "Made {num} new friends\n"
msgstr "Нових друзів у мене: {num}\n"
#, python-brace-format
msgid "Got {num} handshakes\n"
msgstr "Перехопив рукостискань: {num}\n"
msgid "Met 1 peer"
msgstr "Зустрівся з одним знайомим"
#, python-brace-format
msgid "Met {num} peers"
msgstr "Зустрівся з {num}-ма знайомими"
#, python-brace-format
msgid ""
"I've been pwning for {duration} and kicked {deauthed} clients! I've also met "
"{associated} new friends and ate {handshakes} handshakes! #pwnagotchi "
"#pwnlog #pwnlife #hacktheplanet #skynet"
msgstr ""
"Я зламував впродовж {duration} та від'єднав {deauthed} клієнтів! Я зустрів "
"{associated} нових друзів та схрумав {handshakes} рукостискань! #pwnagotchi "
"#pwnlog #pwnlife #hacktheplanet #skynet"
msgid "hours"
msgstr "годин"
msgid "minutes"
msgstr "хвилин"
msgid "seconds"
msgstr "секунд"
msgid "hour"
msgstr "година"
msgid "minute"
msgstr "хвилина"
msgid "second"
msgstr "секунда"

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-09 17:42+0200\n"
"POT-Creation-Date: 2019-11-04 12:57+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -35,10 +35,20 @@ msgstr ""
msgid "The neural network is ready."
msgstr ""
msgid "Generating keys, do not turn off ..."
msgstr ""
#, python-brace-format
msgid "Hey, channel {channel} is free! Your AP will say thanks."
msgstr ""
msgid "Reading last session logs ..."
msgstr ""
#, python-brace-format
msgid "Read {lines_so_far} log lines so far ..."
msgstr ""
msgid "I'm bored ..."
msgstr ""
@@ -60,6 +70,12 @@ msgstr ""
msgid "I'm sad"
msgstr ""
msgid "Leave me alone ..."
msgstr ""
msgid "I'm mad at you!"
msgstr ""
msgid "I'm living the life!"
msgstr ""
@@ -76,11 +92,19 @@ msgid "My crime is that of curiosity ..."
msgstr ""
#, python-brace-format
msgid "Hello {name}! Nice to meet you. {name}"
msgid "Hello {name}! Nice to meet you."
msgstr ""
#, python-brace-format
msgid "Unit {name} is nearby! {name}"
msgid "Yo {name}! Sup?"
msgstr ""
#, python-brace-format
msgid "Hey {name} how are you doing?"
msgstr ""
#, python-brace-format
msgid "Unit {name} is nearby!"
msgstr ""
#, python-brace-format
@@ -102,6 +126,12 @@ msgstr ""
msgid "Missed!"
msgstr ""
msgid "Good friends are a blessing!"
msgstr ""
msgid "I love my friends!"
msgstr ""
msgid "Nobody wants to play with me ..."
msgstr ""
@@ -164,6 +194,10 @@ msgstr ""
msgid "Cool, we got {num} new handshake{plural}!"
msgstr ""
#, python-brace-format
msgid "You have {count} new message{plural}!"
msgstr ""
msgid "Ops, something went wrong ... Rebooting ..."
msgstr ""

View File

@@ -2,6 +2,7 @@ import hashlib
import time
import re
import os
import logging
from datetime import datetime
from pwnagotchi.voice import Voice
@@ -87,56 +88,65 @@ class LastSession(object):
parts = line.split(']')
if len(parts) < 2:
continue
line_timestamp = parts[0].strip('[')
line = ']'.join(parts[1:])
stopped_at = self._parse_datetime(line_timestamp)
if started_at is None:
started_at = stopped_at
if LastSession.DEAUTH_TOKEN in line and line not in cache:
self.deauthed += 1
cache[line] = 1
try:
line_timestamp = parts[0].strip('[')
line = ']'.join(parts[1:])
stopped_at = self._parse_datetime(line_timestamp)
if started_at is None:
started_at = stopped_at
elif LastSession.ASSOC_TOKEN in line and line not in cache:
self.associated += 1
cache[line] = 1
if LastSession.DEAUTH_TOKEN in line and line not in cache:
self.deauthed += 1
cache[line] = 1
elif LastSession.HANDSHAKE_TOKEN in line and line not in cache:
self.handshakes += 1
cache[line] = 1
elif LastSession.ASSOC_TOKEN in line and line not in cache:
self.associated += 1
cache[line] = 1
elif LastSession.TRAINING_TOKEN in line:
self.train_epochs += 1
elif LastSession.HANDSHAKE_TOKEN in line and line not in cache:
self.handshakes += 1
cache[line] = 1
elif LastSession.EPOCH_TOKEN in line:
self.epochs += 1
m = LastSession.EPOCH_PARSER.findall(line)
if m:
epoch_num, epoch_data = m[0]
m = LastSession.EPOCH_DATA_PARSER.findall(epoch_data)
for key, value in m:
if key == 'reward':
reward = float(value)
self.avg_reward += reward
if reward < self.min_reward:
self.min_reward = reward
elif LastSession.TRAINING_TOKEN in line:
self.train_epochs += 1
elif reward > self.max_reward:
self.max_reward = reward
elif LastSession.EPOCH_TOKEN in line:
self.epochs += 1
m = LastSession.EPOCH_PARSER.findall(line)
if m:
epoch_num, epoch_data = m[0]
m = LastSession.EPOCH_DATA_PARSER.findall(epoch_data)
for key, value in m:
if key == 'reward':
reward = float(value)
self.avg_reward += reward
if reward < self.min_reward:
self.min_reward = reward
elif LastSession.PEER_TOKEN in line:
m = self._peer_parser.findall(line)
if m:
name, pubkey, rssi, sid, pwnd_tot, uptime = m[0]
if pubkey not in cache:
self.last_peer = Peer(sid, 1, int(rssi),
{'name': name,
'identity': pubkey,
'pwnd_tot': int(pwnd_tot)})
self.peers += 1
cache[pubkey] = self.last_peer
else:
cache[pubkey].adv['pwnd_tot'] = pwnd_tot
elif reward > self.max_reward:
self.max_reward = reward
elif LastSession.PEER_TOKEN in line:
m = self._peer_parser.findall(line)
if m:
name, pubkey, rssi, sid, pwnd_tot, uptime = m[0]
if pubkey not in cache:
self.last_peer = Peer({
'session_id': sid,
'channel': 1,
'rssi': int(rssi),
'identity': pubkey,
'advertisement': {
'name': name,
'pwnd_tot': int(pwnd_tot)
}})
self.peers += 1
cache[pubkey] = self.last_peer
else:
cache[pubkey].adv['pwnd_tot'] = pwnd_tot
except Exception as e:
logging.error("error parsing line '%s': %s" % (line, e))
if started_at is not None:
self.duration = stopped_at - started_at
@@ -157,28 +167,44 @@ class LastSession(object):
self.duration_human = ', '.join(self.duration_human)
self.avg_reward /= (self.epochs if self.epochs else 1)
def parse(self):
lines = []
def parse(self, ui, skip=False):
if skip:
logging.debug("skipping parsing of the last session logs ...")
else:
logging.debug("reading last session logs ...")
if os.path.exists(self.path):
with FileReadBackwards(self.path, encoding="utf-8") as fp:
for line in fp:
line = line.strip()
if line != "" and line[0] != '[':
continue
lines.append(line)
if LastSession.START_TOKEN in line:
break
lines.reverse()
ui.on_reading_logs()
if len(lines) == 0:
lines.append("Initial Session");
lines = []
self.last_session = lines
self.last_session_id = hashlib.md5(lines[0].encode()).hexdigest()
self.last_saved_session_id = self._get_last_saved_session_id()
if os.path.exists(self.path):
with FileReadBackwards(self.path, encoding="utf-8") as fp:
for line in fp:
line = line.strip()
if line != "" and line[0] != '[':
continue
lines.append(line)
if LastSession.START_TOKEN in line:
break
self._parse_stats()
lines_so_far = len(lines)
if lines_so_far % 100 == 0:
ui.on_reading_logs(lines_so_far)
lines.reverse()
if len(lines) == 0:
lines.append("Initial Session");
ui.on_reading_logs()
self.last_session = lines
self.last_session_id = hashlib.md5(lines[0].encode()).hexdigest()
self.last_saved_session_id = self._get_last_saved_session_id()
logging.debug("parsing last session logs (%d lines) ..." % len(lines))
self._parse_stats()
self.parsed = True
def is_new(self):

View File

@@ -1,4 +0,0 @@
import os
def new_session_id():
return ':'.join(['%02x' % b for b in os.urandom(6)])

View File

@@ -1,176 +0,0 @@
import time
import json
import _thread
import threading
import logging
from scapy.all import Dot11, Dot11Elt, RadioTap, sendp, sniff
import pwnagotchi.ui.faces as faces
import pwnagotchi.mesh.wifi as wifi
from pwnagotchi.mesh import new_session_id
from pwnagotchi.mesh.peer import Peer
def _dummy_peer_cb(peer):
pass
class Advertiser(object):
MAX_STALE_TIME = 300
def __init__(self, iface, name, version, identity, period=0.3, data={}):
self._iface = iface
self._period = period
self._running = False
self._stopped = threading.Event()
self._peers_lock = threading.Lock()
self._adv_lock = threading.Lock()
self._new_peer_cb = _dummy_peer_cb
self._lost_peer_cb = _dummy_peer_cb
self._peers = {}
self._frame = None
self._me = Peer(new_session_id(), 0, 0, {
'name': name,
'version': version,
'identity': identity,
'face': faces.FRIEND,
'pwnd_run': 0,
'pwnd_tot': 0,
'uptime': 0,
'epoch': 0,
'data': data
})
self.update()
def update(self, values={}):
with self._adv_lock:
for field, value in values.items():
self._me.adv[field] = value
self._frame = wifi.encapsulate(payload=json.dumps(self._me.adv), addr_from=self._me.session_id)
def on_peer(self, new_cb, lost_cb):
self._new_peer_cb = new_cb
self._lost_peer_cb = lost_cb
def on_face_change(self, old, new):
self.update({'face': new})
def start(self):
self._running = True
_thread.start_new_thread(self._sender, ())
_thread.start_new_thread(self._listener, ())
_thread.start_new_thread(self._pruner, ())
def num_peers(self):
with self._peers_lock:
return len(self._peers)
def peers(self):
with self._peers_lock:
return list(self._peers.values())
def closest_peer(self):
closest = None
with self._peers_lock:
for ident, peer in self._peers.items():
if closest is None or peer.is_closer(closest):
closest = peer
return closest
def stop(self):
self._running = False
self._stopped.set()
def _sender(self):
logging.info("started advertiser thread (period:%s sid:%s) ..." % (str(self._period), self._me.session_id))
while self._running:
try:
sendp(self._frame, iface=self._iface, verbose=False, count=1, inter=self._period)
except OSError as ose:
logging.warning("non critical issue while sending advertising packet: %s" % ose)
except Exception as e:
logging.exception("error")
time.sleep(self._period)
def _on_advertisement(self, src_session_id, channel, rssi, adv):
ident = adv['identity']
with self._peers_lock:
if ident not in self._peers:
peer = Peer(src_session_id, channel, rssi, adv)
logging.info("detected unit %s (v%s) on channel %d (%s dBm) [sid:%s pwnd_tot:%d uptime:%d]" % ( \
peer.full_name(),
peer.version(),
channel,
rssi,
src_session_id,
peer.pwnd_total(),
peer.uptime()))
self._peers[ident] = peer
self._new_peer_cb(peer)
else:
self._peers[ident].update(src_session_id, channel, rssi, adv)
def _parse_identity(self, radio, dot11, dot11elt):
payload = b''
while dot11elt:
payload += dot11elt.info
dot11elt = dot11elt.payload.getlayer(Dot11Elt)
if payload != b'':
adv = json.loads(payload)
self._on_advertisement( \
dot11.addr3,
wifi.freq_to_channel(radio.Channel),
radio.dBm_AntSignal,
adv)
def _is_broadcasted_advertisement(self, dot11):
# dst bcast + protocol signature + not ours
return dot11 is not None and \
dot11.addr1 == wifi.BroadcastAddress and \
dot11.addr2 == wifi.SignatureAddress and \
dot11.addr3 != self._me.session_id
def _is_frame_for_us(self, dot11):
# dst is us + protocol signature + not ours (why would we send a frame to ourself anyway?)
return dot11 is not None and \
dot11.addr1 == self._me.session_id and \
dot11.addr2 == wifi.SignatureAddress and \
dot11.addr3 != self._me.session_id
def _on_packet(self, p):
dot11 = p.getlayer(Dot11)
if self._is_broadcasted_advertisement(dot11):
try:
dot11elt = p.getlayer(Dot11Elt)
if dot11elt.ID == wifi.Dot11ElemID_Whisper:
self._parse_identity(p[RadioTap], dot11, dot11elt)
else:
raise Exception("unknown frame id %d" % dot11elt.ID)
except Exception as e:
logging.exception("error decoding packet from %s" % dot11.addr3)
def _listener(self):
# logging.info("started advertisements listener ...")
expr = "type mgt subtype beacon and ether src %s" % wifi.SignatureAddress
sniff(iface=self._iface, filter=expr, prn=self._on_packet, store=0, stop_filter=lambda x: self._stopped.isSet())
def _pruner(self):
while self._running:
time.sleep(10)
with self._peers_lock:
stale = []
for ident, peer in self._peers.items():
inactive_for = peer.inactive_for()
if inactive_for >= Advertiser.MAX_STALE_TIME:
logging.info("peer %s lost (inactive for %ds)" % (peer.full_name(), inactive_for))
self._lost_peer_cb(peer)
stale.append(ident)
for ident in stale:
del self._peers[ident]

View File

@@ -1,63 +1,89 @@
import time
import logging
import datetime
import pwnagotchi.mesh.wifi as wifi
import pwnagotchi.ui.faces as faces
def parse_rfc3339(dt):
if dt == "0001-01-01T00:00:00Z":
return datetime.datetime.now()
return datetime.datetime.strptime(dt.split('.')[0], "%Y-%m-%dT%H:%M:%S")
class Peer(object):
def __init__(self, sid, channel, rssi, adv):
self.first_seen = time.time()
self.last_seen = self.first_seen
self.session_id = sid
self.last_channel = channel
self.presence = [0] * wifi.NumChannels
self.adv = adv
self.rssi = rssi
self.presence[channel - 1] = 1
def __init__(self, obj):
now = time.time()
just_met = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
def update(self, sid, channel, rssi, adv):
if self.name() != adv['name']:
logging.info("peer %s changed name: %s -> %s" % (self.full_name(), self.name(), adv['name']))
try:
self.first_met = parse_rfc3339(obj.get('met_at', just_met))
self.first_seen = parse_rfc3339(obj.get('detected_at', just_met))
self.prev_seen = parse_rfc3339(obj.get('prev_seen_at', just_met))
except Exception as e:
logging.warning("error while parsing peer timestamps: %s" % e)
logging.debug(e, exc_info=True)
self.first_met = just_met
self.first_seen = just_met
self.prev_seen = just_met
if self.session_id != sid:
logging.info("peer %s changed session id: %s -> %s" % (self.full_name(), self.session_id, sid))
self.last_seen = now # should be seen_at
self.encounters = obj.get('encounters', 0)
self.session_id = obj.get('session_id', '')
self.last_channel = obj.get('channel', 1)
self.rssi = obj.get('rssi', 0)
self.adv = obj.get('advertisement', {})
self.presence[channel - 1] += 1
self.adv = adv
self.rssi = rssi
self.session_id = sid
def update(self, new):
if self.name() != new.name():
logging.info("peer %s changed name: %s -> %s" % (self.full_name(), self.name(), new.name()))
if self.session_id != new.session_id:
logging.info("peer %s changed session id: %s -> %s" % (self.full_name(), self.session_id, new.session_id))
self.adv = new.adv
self.rssi = new.rssi
self.session_id = new.session_id
self.last_seen = time.time()
self.prev_seen = new.prev_seen
self.first_met = new.first_met
self.encounters = new.encounters
def inactive_for(self):
return time.time() - self.last_seen
def _adv_field(self, name, default='???'):
return self.adv[name] if name in self.adv else default
def first_encounter(self):
return self.encounters == 1
def is_good_friend(self, config):
return self.encounters >= config['personality']['bond_encounters_factor']
def face(self):
return self._adv_field('face', default=faces.FRIEND)
return self.adv.get('face', faces.FRIEND)
def name(self):
return self._adv_field('name')
return self.adv.get('name', '???')
def identity(self):
return self._adv_field('identity')
return self.adv.get('identity', '???')
def full_name(self):
return "%s@%s" % (self.name(), self.identity())
def version(self):
return self._adv_field('version')
return self.adv.get('version', '1.0.0a')
def pwnd_run(self):
return int(self._adv_field('pwnd_run', default=0))
return int(self.adv.get('pwnd_run', 0))
def pwnd_total(self):
return int(self._adv_field('pwnd_tot', default=0))
return int(self.adv.get('pwnd_tot', 0))
def uptime(self):
return self._adv_field('uptime', default=0)
return self.adv.get('uptime', 0)
def epoch(self):
return self._adv_field('epoch', default=0)
return self.adv.get('epoch', 0)
def full_name(self):
return '%s@%s' % (self.name(), self.identity())

View File

@@ -1,8 +1,13 @@
import _thread
import logging
import time
import pwnagotchi
import pwnagotchi.utils as utils
import pwnagotchi.ui.faces as faces
import pwnagotchi.plugins as plugins
import pwnagotchi.grid as grid
from pwnagotchi.mesh.peer import Peer
class AsyncAdvertiser(object):
@@ -10,38 +15,96 @@ class AsyncAdvertiser(object):
self._config = config
self._view = view
self._keypair = keypair
self._advertiser = None
self._advertisement = {
'name': pwnagotchi.name(),
'version': pwnagotchi.version,
'identity': self._keypair.fingerprint,
'face': faces.FRIEND,
'pwnd_run': 0,
'pwnd_tot': 0,
'uptime': 0,
'epoch': 0,
'policy': self._config['personality']
}
self._peers = {}
self._closest_peer = None
def keypair(self):
return self._keypair
def fingerprint(self):
return self._keypair.fingerprint
def _update_advertisement(self, s):
self._advertisement['pwnd_run'] = len(self._handshakes)
self._advertisement['pwnd_tot'] = utils.total_unique_handshakes(self._config['bettercap']['handshakes'])
self._advertisement['uptime'] = pwnagotchi.uptime()
self._advertisement['epoch'] = self._epoch.epoch
grid.set_advertisement_data(self._advertisement)
def start_advertising(self):
_thread.start_new_thread(self._adv_worker, ())
def _adv_worker(self):
# this will take some time due to scapy being slow to be imported ...
from pwnagotchi.mesh.advertise import Advertiser
self._advertiser = Advertiser(
self._config['main']['iface'],
pwnagotchi.name(),
pwnagotchi.version,
self._keypair.fingerprint,
period=0.3,
data=self._config['personality'])
self._advertiser.on_peer(self._on_new_unit, self._on_lost_unit)
if self._config['personality']['advertise']:
self._advertiser.start()
self._view.on_state_change('face', self._advertiser.on_face_change)
_thread.start_new_thread(self._adv_poller, ())
grid.set_advertisement_data(self._advertisement)
grid.advertise(True)
self._view.on_state_change('face', self._on_face_change)
else:
logging.warning("advertising is disabled")
def _on_new_unit(self, peer):
def _on_face_change(self, old, new):
self._advertisement['face'] = new
grid.set_advertisement_data(self._advertisement)
def cumulative_encounters(self):
return sum(peer.encounters for _, peer in self._peers.items())
def _on_new_peer(self, peer):
logging.info("new peer %s detected (%d encounters)" % (peer.full_name(), peer.encounters))
self._view.on_new_peer(peer)
plugins.on('peer_detected', self, peer)
def _on_lost_unit(self, peer):
def _on_lost_peer(self, peer):
logging.info("lost peer %s" % peer.full_name())
self._view.on_lost_peer(peer)
plugins.on('peer_lost', self, peer)
def _adv_poller(self):
# give the system a few seconds to start the first time so that any expressions
# due to nearby units will be rendered properly
time.sleep(20)
while True:
try:
logging.debug("polling pwngrid-peer for peers ...")
grid_peers = grid.peers()
new_peers = {}
self._closest_peer = None
for obj in grid_peers:
peer = Peer(obj)
new_peers[peer.identity()] = peer
if self._closest_peer is None:
self._closest_peer = peer
# check who's gone
to_delete = []
for ident, peer in self._peers.items():
if ident not in new_peers:
to_delete.append(ident)
for ident in to_delete:
self._on_lost_peer(self._peers[ident])
del self._peers[ident]
for ident, peer in new_peers.items():
# check who's new
if ident not in self._peers:
self._peers[ident] = peer
self._on_new_peer(peer)
# update the rest
else:
self._peers[ident].update(peer)
except Exception as e:
logging.warning("error while polling pwngrid-peer: %s" % e)
logging.debug(e, exc_info=True)
time.sleep(3)

View File

@@ -1,8 +1,6 @@
SignatureAddress = 'de:ad:be:ef:de:ad'
BroadcastAddress = 'ff:ff:ff:ff:ff:ff'
Dot11ElemID_Whisper = 222
NumChannels = 140
def freq_to_channel(freq):
if freq <= 2472:
return int(((freq - 2412) / 5) + 1)
@@ -12,26 +10,3 @@ def freq_to_channel(freq):
return int(((freq - 5035) / 5) + 7)
else:
return 0
def encapsulate(payload, addr_from, addr_to=BroadcastAddress):
from scapy.all import Dot11, Dot11Beacon, Dot11Elt, RadioTap
radio = RadioTap()
dot11 = Dot11(type=0, subtype=8, addr1=addr_to, addr2=SignatureAddress, addr3=addr_from)
beacon = Dot11Beacon(cap='ESS')
frame = radio / dot11 / beacon
data_size = len(payload)
data_left = data_size
data_off = 0
chunk_size = 255
while data_left > 0:
sz = min(chunk_size, data_left)
chunk = payload[data_off: data_off + sz]
frame /= Dot11Elt(ID=Dot11ElemID_Whisper, info=chunk, len=sz)
data_off += sz
data_left -= sz
return frame

View File

@@ -7,23 +7,38 @@ default_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "defaul
loaded = {}
def dummy_callback():
pass
class Plugin:
@classmethod
def __init_subclass__(cls, **kwargs):
super().__init_subclass__(**kwargs)
global loaded
plugin_name = cls.__module__.split('.')[0]
plugin_instance = cls()
logging.debug("loaded plugin %s as %s" % (plugin_name, plugin_instance))
loaded[plugin_name] = plugin_instance
def on(event_name, *args, **kwargs):
global loaded
cb_name = 'on_%s' % event_name
for plugin_name, plugin in loaded.items():
if cb_name in plugin.__dict__:
# print("calling %s %s(%s)" %(cb_name, args, kwargs))
one(plugin_name, event_name, *args, **kwargs)
def one(plugin_name, event_name, *args, **kwargs):
global loaded
if plugin_name in loaded:
plugin = loaded[plugin_name]
cb_name = 'on_%s' % event_name
callback = getattr(plugin, cb_name, None)
if callback is not None and callable(callback):
try:
plugin.__dict__[cb_name](*args, **kwargs)
callback(*args, **kwargs)
except Exception as e:
logging.error("error while running %s.%s : %s" % (plugin_name, cb_name, e))
logging.error(e, exc_info=True)
def load_from_file(filename):
logging.debug("loading %s" % filename)
plugin_name = os.path.basename(filename.replace(".py", ""))
spec = importlib.util.spec_from_file_location(plugin_name, filename)
instance = importlib.util.module_from_spec(spec)
@@ -33,32 +48,33 @@ def load_from_file(filename):
def load_from_path(path, enabled=()):
global loaded
logging.debug("loading plugins from %s - enabled: %s" % (path, enabled))
for filename in glob.glob(os.path.join(path, "*.py")):
name, plugin = load_from_file(filename)
if name in loaded:
raise Exception("plugin %s already loaded from %s" % (name, plugin.__file__))
elif name not in enabled:
# print("plugin %s is not enabled" % name)
pass
else:
loaded[name] = plugin
plugin_name = os.path.basename(filename.replace(".py", ""))
if plugin_name in enabled:
try:
load_from_file(filename)
except Exception as e:
logging.warning("error while loading %s: %s" % (filename, e))
logging.debug(e, exc_info=True)
return loaded
def load(config):
enabled = [name for name, options in config['main']['plugins'].items() if 'enabled' in options and options['enabled']]
custom_path = config['main']['custom_plugins'] if 'custom_plugins' in config['main'] else None
enabled = [name for name, options in config['main']['plugins'].items() if
'enabled' in options and options['enabled']]
# load default plugins
loaded = load_from_path(default_path, enabled=enabled)
# set the options
for name, plugin in loaded.items():
plugin.__dict__['OPTIONS'] = config['main']['plugins'][name]
load_from_path(default_path, enabled=enabled)
# load custom ones
custom_path = config['main']['custom_plugins'] if 'custom_plugins' in config['main'] else None
if custom_path is not None:
loaded = load_from_path(custom_path, enabled=enabled)
# set the options
for name, plugin in loaded.items():
plugin.__dict__['OPTIONS'] = config['main']['plugins'][name]
load_from_path(custom_path, enabled=enabled)
# propagate options
for name, plugin in loaded.items():
plugin.options = config['main']['plugins'][name]
on('loaded')

View File

@@ -1,57 +1,57 @@
__author__ = 'pwnagotchi [at] rossmarks [dot] uk'
__version__ = '1.0.0'
__name__ = 'AircrackOnly'
__license__ = 'GPL3'
__description__ = 'confirm pcap contains handshake/PMKID or delete it'
import pwnagotchi.plugins as plugins
import logging
import subprocess
import string
import os
'''
Aircrack-ng needed, to install:
> apt-get install aircrack-ng
'''
import logging
import subprocess
import string
import re
import os
OPTIONS = dict()
class AircrackOnly(plugins.Plugin):
__author__ = 'pwnagotchi [at] rossmarks [dot] uk'
__version__ = '1.0.1'
__license__ = 'GPL3'
__description__ = 'confirm pcap contains handshake/PMKID or delete it'
def on_loaded():
logging.info("cleancap plugin loaded")
def __init__(self):
super().__init__(self)
self.text_to_set = ""
def on_handshake(agent, filename, access_point, client_station):
display = agent._view
todelete = 0
def on_loaded(self):
logging.info("aircrackonly plugin loaded")
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 result:
logging.info("[AircrackOnly] contains handshake")
else:
todetele = 1
def on_handshake(self, agent, filename, access_point, client_station):
display = agent._view
todelete = 0
handshakeFound = 0
if todelete == 0:
result = subprocess.run(('/usr/bin/aircrack-ng '+ filename +' | grep "PMKID" | awk \'{print $2}\''),shell=True, stdout=subprocess.PIPE)
result = result.stdout.decode('utf-8').translate({ord(c) :None for c in string.whitespace})
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 result:
logging.info("[AircrackOnly] contains PMKID")
else:
todetele = 1
handshakeFound = 1
logging.info("[AircrackOnly] contains handshake")
if todelete == 1:
os.remove(filename)
set_text("uncrackable pcap")
display.update(force=True)
if handshakeFound == 0:
result = subprocess.run(('/usr/bin/aircrack-ng ' + filename + ' | grep "PMKID" | awk \'{print $2}\''),
shell=True, stdout=subprocess.PIPE)
result = result.stdout.decode('utf-8').translate({ord(c): None for c in string.whitespace})
if result:
logging.info("[AircrackOnly] contains PMKID")
else:
todelete = 1
text_to_set = "";
def set_text(text):
global text_to_set
text_to_set = text
if todelete == 1:
os.remove(filename)
self.text_to_set = "Removed an uncrackable pcap"
display.update(force=True)
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 = ""
def on_ui_update(self, ui):
if self.text_to_set:
ui.set('face', "(>.<)")
ui.set('status', self.text_to_set)
self.text_to_set = ""

View File

@@ -1,46 +1,44 @@
__author__ = '33197631+dadav@users.noreply.github.com'
__version__ = '1.0.0'
__name__ = 'auto-backup'
__license__ = 'GPL3'
__description__ = 'This plugin backups files when internet is availaible.'
import pwnagotchi.plugins as plugins
from pwnagotchi.utils import StatusFile
import logging
import os
import subprocess
OPTIONS = dict()
READY = False
STATUS = StatusFile('/root/.auto-backup')
class AutoBackup(plugins.Plugin):
__author__ = '33197631+dadav@users.noreply.github.com'
__version__ = '1.0.0'
__license__ = 'GPL3'
__description__ = 'This plugin backups files when internet is available.'
def on_loaded():
global READY
def __init__(self):
self.ready = False
self.tries = 0
self.status = StatusFile('/root/.auto-backup')
if 'files' not in OPTIONS or ('files' in OPTIONS and OPTIONS['files'] is None):
logging.error("AUTO-BACKUP: No files to backup.")
return
def on_loaded(self):
for opt in ['files', 'interval', 'commands', 'max_tries']:
if opt not in self.options or (opt in self.options and self.options[opt] is None):
logging.error(f"AUTO-BACKUP: Option {opt} is not set.")
return
if 'interval' not in OPTIONS or ('interval' in OPTIONS and OPTIONS['interval'] is None):
logging.error("AUTO-BACKUP: Interval is not set.")
return
self.ready = True
logging.info("AUTO-BACKUP: Successfully loaded.")
if 'commands' not in OPTIONS or ('commands' in OPTIONS and OPTIONS['commands'] is None):
logging.error("AUTO-BACKUP: No commands given.")
return
READY = True
logging.info("AUTO-BACKUP: Successfuly loaded.")
def on_internet_available(agent):
global STATUS
if READY:
if STATUS.newer_then_days(OPTIONS['interval']):
def on_internet_available(self, agent):
if not self.ready:
return
files_to_backup = " ".join(OPTIONS['files'])
if self.options['max_tries'] and self.tries >= self.options['max_tries']:
return
if self.status.newer_then_days(self.options['interval']):
return
# Only backup existing files to prevent errors
existing_files = list(filter(lambda f: os.path.exists(f), self.options['files']))
files_to_backup = " ".join(existing_files)
try:
display = agent.view()
@@ -48,18 +46,20 @@ def on_internet_available(agent):
display.set('status', 'Backing up ...')
display.update()
for cmd in OPTIONS['commands']:
for cmd in self.options['commands']:
logging.info(f"AUTO-BACKUP: Running {cmd.format(files=files_to_backup)}")
process = subprocess.Popen(cmd.format(files=files_to_backup), shell=True, stdin=None,
stdout=open("/dev/null", "w"), stderr=None, executable="/bin/bash")
stdout=open("/dev/null", "w"), stderr=None, executable="/bin/bash")
process.wait()
if process.returncode > 0:
raise OSError(f"Command failed (rc: {process.returncode})")
logging.info("AUTO-BACKUP: backup done")
STATUS.update()
display.set('status', 'Backup done!')
display.update()
self.status.update()
except OSError as os_e:
self.tries += 1
logging.info(f"AUTO-BACKUP: Error: {os_e}")
display.set('status', 'Backup done!')
display.update()
display.set('status', 'Backup failed!')
display.update()

View File

@@ -1,60 +1,217 @@
__author__ = 'evilsocket@gmail.com'
__version__ = '1.0.0'
__name__ = 'auto-update'
__license__ = 'GPL3'
__description__ = 'This plugin performs an "apt update && apt upgrade" when internet is availaible.'
import os
import re
import logging
import subprocess
import requests
import platform
import shutil
import glob
import pkg_resources
import pwnagotchi
import pwnagotchi.plugins as plugins
from pwnagotchi.utils import StatusFile
OPTIONS = dict()
READY = False
STATUS = StatusFile('/root/.auto-update')
def check(version, repo, native=True):
logging.debug("checking remote version for %s, local is %s" % (repo, version))
info = {
'repo': repo,
'current': version,
'available': None,
'url': None,
'native': native,
'arch': platform.machine()
}
resp = requests.get("https://api.github.com/repos/%s/releases/latest" % repo)
latest = resp.json()
info['available'] = latest_ver = latest['tag_name'].replace('v', '')
is_arm = info['arch'].startswith('arm')
local = pkg_resources.parse_version(info['current'])
remote = pkg_resources.parse_version(latest_ver)
if remote > local:
if not native:
info['url'] = "https://github.com/%s/archive/%s.zip" % (repo, latest['tag_name'])
else:
# check if this release is compatible with arm6
for asset in latest['assets']:
download_url = asset['browser_download_url']
if download_url.endswith('.zip') and (
info['arch'] in download_url or (is_arm and 'armhf' in download_url)):
info['url'] = download_url
break
return info
def on_loaded():
global READY
if 'interval' not in OPTIONS or ('interval' in OPTIONS and OPTIONS['interval'] is None):
logging.error("auto-update: Interval is not set.")
return
READY = True
def make_path_for(name):
path = os.path.join("/tmp/updates/", name)
if os.path.exists(path):
logging.debug("[update] deleting %s" % path)
shutil.rmtree(path, ignore_errors=True, onerror=None)
os.makedirs(path)
return path
def run(cmd):
return subprocess.Popen(cmd, shell=True, stdin=None, stdout=open("/dev/null", "w"), stderr=None,
executable="/bin/bash")
def download_and_unzip(name, path, display, update):
target = "%s_%s.zip" % (name, update['available'])
target_path = os.path.join(path, target)
logging.info("[update] downloading %s to %s ..." % (update['url'], target_path))
display.update(force=True, new_data={'status': 'Downloading %s %s ...' % (name, update['available'])})
os.system('wget -q "%s" -O "%s"' % (update['url'], target_path))
logging.info("[update] extracting %s to %s ..." % (target_path, path))
display.update(force=True, new_data={'status': 'Extracting %s %s ...' % (name, update['available'])})
os.system('unzip "%s" -d "%s"' % (target_path, path))
def on_internet_available(agent):
global STATUS
def verify(name, path, source_path, display, update):
display.update(force=True, new_data={'status': 'Verifying %s %s ...' % (name, update['available'])})
if READY:
if STATUS.newer_then_days(OPTIONS['interval']):
checksums = glob.glob("%s/*.sha256" % path)
if len(checksums) == 0:
if update['native']:
logging.warning("[update] native update without SHA256 checksum file")
return False
else:
checksum = checksums[0]
logging.info("[update] verifying %s for %s ..." % (checksum, source_path))
with open(checksum, 'rt') as fp:
expected = fp.read().split('=')[1].strip().lower()
real = subprocess.getoutput('sha256sum "%s"' % source_path).split(' ')[0].strip().lower()
if real != expected:
logging.warning("[update] checksum mismatch for %s: expected=%s got=%s" % (source_path, expected, real))
return False
return True
def install(display, update):
name = update['repo'].split('/')[1]
path = make_path_for(name)
download_and_unzip(name, path, display, update)
source_path = os.path.join(path, name)
if not verify(name, path, source_path, display, update):
return False
logging.info("[update] installing %s ..." % name)
display.update(force=True, new_data={'status': 'Installing %s %s ...' % (name, update['available'])})
if update['native']:
dest_path = subprocess.getoutput("which %s" % name)
if dest_path == "":
logging.warning("[update] can't find path for %s" % name)
return False
logging.info("[update] stopping %s ..." % update['service'])
os.system("service %s stop" % update['service'])
os.system("mv %s %s" % (source_path, dest_path))
logging.info("[update] restarting %s ..." % update['service'])
os.system("service %s start" % update['service'])
else:
if not os.path.exists(source_path):
source_path = "%s-%s" % (source_path, update['available'])
# setup.py is going to install data files for us
os.system("cd %s && pip3 install ." % source_path)
return True
def parse_version(cmd):
out = subprocess.getoutput(cmd)
for part in out.split(' '):
part = part.replace('v', '').strip()
if re.search(r'^\d+\.\d+\.\d+.*$', part):
return part
raise Exception('could not parse version from "%s": output=\n%s' % (cmd, out))
class AutoUpdate(plugins.Plugin):
__author__ = 'evilsocket@gmail.com'
__version__ = '1.1.1'
__name__ = 'auto-update'
__license__ = 'GPL3'
__description__ = 'This plugin checks when updates are available and applies them when internet is available.'
def __init__(self):
self.ready = False
self.status = StatusFile('/root/.auto-update')
def on_loaded(self):
if 'interval' not in self.options or ('interval' in self.options and self.options['interval'] is None):
logging.error("[update] main.plugins.auto-update.interval is not set")
return
self.ready = True
logging.info("[update] plugin loaded.")
def on_internet_available(self, agent):
logging.debug("[update] internet connectivity is available (ready %s)" % self.ready)
if not self.ready:
return
if self.status.newer_then_hours(self.options['interval']):
logging.debug("[update] last check happened less than %d hours ago" % self.options['interval'])
return
logging.info("[update] checking for updates ...")
display = agent.view()
prev_status = display.get('status')
try:
display.set('status', 'Updating ...')
display.update()
display.update(force=True, new_data={'status': 'Checking for updates ...'})
logging.info("auto-update: updating pwnagotchi ...")
run('pip3 install --upgrade --upgrade-strategy only-if-needed pwnagotchi').wait()
to_install = []
to_check = [
('bettercap/bettercap', parse_version('bettercap -version'), True, 'bettercap'),
('evilsocket/pwngrid', parse_version('pwngrid -version'), True, 'pwngrid-peer'),
('evilsocket/pwnagotchi', pwnagotchi.version, False, 'pwnagotchi')
]
if OPTIONS['system']:
logging.info("auto-update: updating packages index ...")
run('apt update -y').wait()
for repo, local_version, is_native, svc_name in to_check:
info = check(local_version, repo, is_native)
if info['url'] is not None:
logging.warning(
"update for %s available (local version is '%s'): %s" % (
repo, info['current'], info['url']))
info['service'] = svc_name
to_install.append(info)
logging.info("auto-update: updating packages ...")
run('apt upgrade -y').wait()
num_updates = len(to_install)
num_installed = 0
if num_updates > 0:
if self.options['install']:
for update in to_install:
if install(display, update):
num_installed += 1
else:
prev_status = '%d new update%c available!' % (num_updates, 's' if num_updates > 1 else '')
logging.info("[update] done")
self.status.update()
if num_installed > 0:
display.update(force=True, new_data={'status': 'Rebooting ...'})
pwnagotchi.reboot()
logging.info("auto-update: complete.")
STATUS.update()
except Exception as e:
logging.exception("auto-update ERROR")
logging.error("[update] %s" % e)
display.set('status', 'Updated!')
display.update()
display.update(force=True, new_data={'status': prev_status if prev_status is not None else ''})

View File

@@ -0,0 +1,570 @@
import os
import time
import re
import logging
import subprocess
import dbus
from pwnagotchi.ui.components import LabeledValue
from pwnagotchi.ui.view import BLACK
import pwnagotchi.ui.fonts as fonts
from pwnagotchi.utils import StatusFile
import pwnagotchi.plugins as plugins
class BTError(Exception):
"""
Custom bluetooth exception
"""
pass
class BTNap:
"""
This class creates a bluetooth connection to the specified bt-mac
see https://github.com/bablokb/pi-btnap/blob/master/files/usr/local/sbin/btnap.service.py
"""
IFACE_BASE = 'org.bluez'
IFACE_DEV = 'org.bluez.Device1'
IFACE_ADAPTER = 'org.bluez.Adapter1'
IFACE_PROPS = 'org.freedesktop.DBus.Properties'
def __init__(self, mac):
self._mac = mac
@staticmethod
def get_bus():
"""
Get systembus obj
"""
bus = getattr(BTNap.get_bus, 'cached_obj', None)
if not bus:
bus = BTNap.get_bus.cached_obj = dbus.SystemBus()
return bus
@staticmethod
def get_manager():
"""
Get manager obj
"""
manager = getattr(BTNap.get_manager, 'cached_obj', None)
if not manager:
manager = BTNap.get_manager.cached_obj = dbus.Interface(
BTNap.get_bus().get_object(BTNap.IFACE_BASE, '/'),
'org.freedesktop.DBus.ObjectManager')
return manager
@staticmethod
def prop_get(obj, k, iface=None):
"""
Get a property of the obj
"""
if iface is None:
iface = obj.dbus_interface
return obj.Get(iface, k, dbus_interface=BTNap.IFACE_PROPS)
@staticmethod
def prop_set(obj, k, v, iface=None):
"""
Set a property of the obj
"""
if iface is None:
iface = obj.dbus_interface
return obj.Set(iface, k, v, dbus_interface=BTNap.IFACE_PROPS)
@staticmethod
def find_adapter(pattern=None):
"""
Find the bt adapter
"""
return BTNap.find_adapter_in_objects(BTNap.get_manager().GetManagedObjects(), pattern)
@staticmethod
def find_adapter_in_objects(objects, pattern=None):
"""
Finds the obj with a pattern
"""
bus, obj = BTNap.get_bus(), None
for path, ifaces in objects.items():
adapter = ifaces.get(BTNap.IFACE_ADAPTER)
if adapter is None:
continue
if not pattern or pattern == adapter['Address'] or path.endswith(pattern):
obj = bus.get_object(BTNap.IFACE_BASE, path)
yield dbus.Interface(obj, BTNap.IFACE_ADAPTER)
if obj is None:
raise BTError('Bluetooth adapter not found')
@staticmethod
def find_device(device_address, adapter_pattern=None):
"""
Finds the device
"""
return BTNap.find_device_in_objects(BTNap.get_manager().GetManagedObjects(),
device_address, adapter_pattern)
@staticmethod
def find_device_in_objects(objects, device_address, adapter_pattern=None):
"""
Finds the device in objects
"""
bus = BTNap.get_bus()
path_prefix = ''
if adapter_pattern:
if not isinstance(adapter_pattern, str):
adapter = adapter_pattern
else:
adapter = BTNap.find_adapter_in_objects(objects, adapter_pattern)
path_prefix = adapter.object_path
for path, ifaces in objects.items():
device = ifaces.get(BTNap.IFACE_DEV)
if device is None:
continue
if str(device['Address']).lower() == device_address.lower() and path.startswith(path_prefix):
obj = bus.get_object(BTNap.IFACE_BASE, path)
return dbus.Interface(obj, BTNap.IFACE_DEV)
raise BTError('Bluetooth device not found')
def power(self, on=True):
"""
Set power of devices to on/off
"""
logging.debug("BT-TETHER: Changing bluetooth device to %s", str(on))
try:
devs = list(BTNap.find_adapter())
devs = dict((BTNap.prop_get(dev, 'Address'), dev) for dev in devs)
except BTError as bt_err:
logging.error(bt_err)
return None
for dev_addr, dev in devs.items():
BTNap.prop_set(dev, 'Powered', on)
logging.debug('Set power of %s (addr %s) to %s', dev.object_path, dev_addr, str(on))
if devs:
return list(devs.values())[0]
return None
def is_paired(self):
"""
Check if already connected
"""
logging.debug("BT-TETHER: Checking if device is paired")
bt_dev = self.power(True)
if not bt_dev:
logging.debug("BT-TETHER: No bluetooth device found.")
return False
try:
dev_remote = BTNap.find_device(self._mac, bt_dev)
return bool(BTNap.prop_get(dev_remote, 'Paired'))
except BTError:
logging.debug("BT-TETHER: Device is not paired.")
return False
def wait_for_device(self, timeout=15):
"""
Wait for device
returns device if found None if not
"""
logging.debug("BT-TETHER: Waiting for device")
bt_dev = self.power(True)
if not bt_dev:
logging.debug("BT-TETHER: No bluetooth device found.")
return None
try:
logging.debug("BT-TETHER: Starting discovery ...")
bt_dev.StartDiscovery()
except Exception as bt_ex:
logging.error(bt_ex)
raise bt_ex
dev_remote = None
# could be set to 0, so check if > -1
while timeout > -1:
try:
dev_remote = BTNap.find_device(self._mac, bt_dev)
logging.debug("BT-TETHER: Using remote device (addr: %s): %s",
BTNap.prop_get(dev_remote, 'Address'), dev_remote.object_path)
break
except BTError:
logging.debug("BT-TETHER: Not found yet ...")
time.sleep(1)
timeout -= 1
try:
logging.debug("BT-TETHER: Stopping Discovery ...")
bt_dev.StopDiscovery()
except Exception as bt_ex:
logging.error(bt_ex)
raise bt_ex
return dev_remote
@staticmethod
def pair(device):
logging.debug('BT-TETHER: Trying to pair ...')
try:
device.Pair()
logging.debug('BT-TETHER: Successful paired with device ;)')
return True
except dbus.exceptions.DBusException as err:
if err.get_dbus_name() == 'org.bluez.Error.AlreadyExists':
logging.debug('BT-TETHER: Already paired ...')
return True
except Exception:
pass
return False
@staticmethod
def nap(device):
logging.debug('BT-TETHER: Trying to nap ...')
try:
logging.debug('BT-TETHER: Connecting to profile ...')
device.ConnectProfile('nap')
except Exception: # raises exception, but still works
pass
net = dbus.Interface(device, 'org.bluez.Network1')
try:
logging.debug('BT-TETHER: Connecting to nap network ...')
net.Connect('nap')
return net, True
except dbus.exceptions.DBusException as err:
if err.get_dbus_name() == 'org.bluez.Error.AlreadyConnected':
return net, True
connected = BTNap.prop_get(net, 'Connected')
if not connected:
return None, False
return net, True
class SystemdUnitWrapper:
"""
systemd wrapper
"""
def __init__(self, unit):
self.unit = unit
@staticmethod
def _action_on_unit(action, unit):
process = subprocess.Popen(f"systemctl {action} {unit}", shell=True, stdin=None,
stdout=open("/dev/null", "w"), stderr=None, executable="/bin/bash")
process.wait()
if process.returncode > 0:
return False
return True
@staticmethod
def daemon_reload():
"""
Calls systemctl daemon-reload
"""
process = subprocess.Popen("systemctl daemon-reload", shell=True, stdin=None,
stdout=open("/dev/null", "w"), stderr=None, executable="/bin/bash")
process.wait()
if process.returncode > 0:
return False
return True
def is_active(self):
"""
Checks if unit is active
"""
return SystemdUnitWrapper._action_on_unit('is-active', self.unit)
def is_enabled(self):
"""
Checks if unit is enabled
"""
return SystemdUnitWrapper._action_on_unit('is-enabled', self.unit)
def is_failed(self):
"""
Checks if unit is failed
"""
return SystemdUnitWrapper._action_on_unit('is-failed', self.unit)
def enable(self):
"""
Enables the unit
"""
return SystemdUnitWrapper._action_on_unit('enable', self.unit)
def disable(self):
"""
Disables the unit
"""
return SystemdUnitWrapper._action_on_unit('disable', self.unit)
def start(self):
"""
Starts the unit
"""
return SystemdUnitWrapper._action_on_unit('start', self.unit)
def stop(self):
"""
Stops the unit
"""
return SystemdUnitWrapper._action_on_unit('stop', self.unit)
def restart(self):
"""
Restarts the unit
"""
return SystemdUnitWrapper._action_on_unit('restart', self.unit)
class IfaceWrapper:
"""
Small wrapper to check and manage ifaces
see: https://github.com/rlisagor/pynetlinux/blob/master/pynetlinux/ifconfig.py
"""
def __init__(self, iface):
self.iface = iface
self.path = f"/sys/class/net/{iface}"
def exists(self):
"""
Checks if iface exists
"""
return os.path.exists(self.path)
def is_up(self):
"""
Checks if iface is ip
"""
return open(f"{self.path}/operstate", 'r').read().rsplit('\n') == 'up'
def set_addr(self, addr):
"""
Set the netmask
"""
process = subprocess.Popen(f"ip addr add {addr} dev {self.iface}", shell=True, stdin=None,
stdout=open("/dev/null", "w"), stderr=None, executable="/bin/bash")
process.wait()
if process.returncode == 2 or process.returncode == 0: # 2 = already set
return True
return False
@staticmethod
def set_route(gateway, device):
process = subprocess.Popen(f"ip route replace default via {gateway} dev {device}", shell=True, stdin=None,
stdout=open("/dev/null", "w"), stderr=None, executable="/bin/bash")
process.wait()
if process.returncode > 0:
return False
return True
class Device:
def __init__(self, name, share_internet, mac, ip, netmask, interval, priority=10, scantime=15, search_order=0, max_tries=0, **kwargs):
self.name = name
self.status = StatusFile(f'/root/.bt-tether-{name}')
self.status.update()
self.tries = 0
self.network = None
self.max_tries = max_tries
self.search_order = search_order
self.share_internet = share_internet
self.ip = ip
self.netmask = netmask
self.interval = interval
self.mac = mac
self.scantime = scantime
self.priority = priority
def connected(self):
"""
Checks if device is connected
"""
return self.network and BTNap.prop_get(self.network, 'Connected')
def interface(self):
"""
Returns the interface name or None
"""
if not self.connected():
return None
return BTNap.prop_get(self.network, 'Interface')
class BTTether(plugins.Plugin):
__author__ = '33197631+dadav@users.noreply.github.com'
__version__ = '1.0.0'
__license__ = 'GPL3'
__description__ = 'This makes the display reachable over bluetooth'
def __init__(self):
self.ready = False
self.options = dict()
self.devices = dict()
def on_loaded(self):
# new config
if 'devices' in self.options:
for device, options in self.options['devices'].items():
if 'enabled' in options and options['enabled']:
for device_opt in ['enabled', 'priority', 'scantime', 'search_order',
'max_tries', 'share_internet', 'mac', 'ip',
'netmask', 'interval']:
if device_opt not in options or (device_opt in options and options[device_opt] is None):
logging.error("BT-TETHER: Please specify the %s for device %s.",
device_opt, device)
break
else:
if options['enabled']:
self.devices[device] = Device(name=device, **options)
# legacy
if 'mac' in self.options:
for opt in ['share_internet', 'mac', 'ip', 'netmask', 'interval']:
if opt not in self.options or (opt in self.options and self.options[opt] is None):
logging.error("BT-TETHER: Please specify the %s in your config.yml.", opt)
return
self.devices['legacy'] = Device(name='legacy', **self.options)
if not self.devices:
logging.error("BT-TETHER: No valid devices found")
return
# ensure bluetooth is running
bt_unit = SystemdUnitWrapper('bluetooth.service')
if not bt_unit.is_active():
if not bt_unit.start():
logging.error("BT-TETHER: Can't start bluetooth.service")
return
logging.info("BT-TETHER: Sussessfully loaded ...")
self.ready = True
def on_ui_setup(self, ui):
ui.add_element('bluetooth', LabeledValue(color=BLACK, label='BT', value='-', position=(ui.width() / 2 - 15, 0),
label_font=fonts.Bold, text_font=fonts.Medium))
def on_ui_update(self, ui):
if not self.ready:
return
devices_to_try = list()
connected_priorities = list()
any_device_connected = False # if this is true, last status on screen should be C
for _, device in self.devices.items():
if device.connected():
connected_priorities.append(device.priority)
any_device_connected = True
continue
if not device.max_tries or (device.max_tries > device.tries):
if not device.status.newer_then_minutes(device.interval):
devices_to_try.append(device)
device.status.update()
device.tries += 1
sorted_devices = sorted(devices_to_try, key=lambda x: x.search_order)
for device in sorted_devices:
bt = BTNap(device.mac)
try:
logging.debug('BT-TETHER: Search %d secs for %s ...', device.scantime, device.name)
dev_remote = bt.wait_for_device(timeout=device.scantime)
if dev_remote is None:
logging.debug('BT-TETHER: Could not find %s, try again in %d minutes.', device.name, device.interval)
ui.set('bluetooth', 'NF')
continue
except Exception as bt_ex:
logging.error(bt_ex)
ui.set('bluetooth', 'NF')
continue
paired = bt.is_paired()
if not paired:
if BTNap.pair(dev_remote):
logging.debug('BT-TETHER: Paired with %s.', device.name)
else:
logging.debug('BT-TETHER: Pairing with %s failed ...', device.name)
ui.set('bluetooth', 'PE')
continue
else:
logging.debug('BT-TETHER: Already paired.')
logging.debug('BT-TETHER: Try to create nap connection with %s ...', device.name)
device.network, success = BTNap.nap(dev_remote)
interface = None
if success:
try:
interface = device.interface()
except Exception:
logging.debug('BT-TETHER: Could not establish nap connection with %s', device.name)
continue
if interface is None:
ui.set('bluetooth', 'BE')
logging.debug('BT-TETHER: Could not establish nap connection with %s', device.name)
continue
logging.debug('BT-TETHER: Created interface (%s)', interface)
ui.set('bluetooth', 'C')
any_device_connected = True
device.tries = 0 # reset tries
else:
logging.debug('BT-TETHER: Could not establish nap connection with %s', device.name)
ui.set('bluetooth', 'NF')
continue
addr = f"{device.ip}/{device.netmask}"
gateway = ".".join(device.ip.split('.')[:-1] + ['1'])
wrapped_interface = IfaceWrapper(interface)
logging.debug('BT-TETHER: Add ip to %s', interface)
if not wrapped_interface.set_addr(addr):
ui.set('bluetooth', 'AE')
logging.debug("BT-TETHER: Could not add ip to %s", interface)
continue
if device.share_internet:
if not connected_priorities or device.priority > max(connected_priorities):
logging.debug('BT-TETHER: Set default route to %s via %s', gateway, interface)
IfaceWrapper.set_route(gateway, interface)
connected_priorities.append(device.priority)
logging.debug('BT-TETHER: Change resolv.conf if necessary ...')
with open('/etc/resolv.conf', 'r+') as resolv:
nameserver = resolv.read()
if 'nameserver 9.9.9.9' not in nameserver:
logging.debug('BT-TETHER: Added nameserver')
resolv.seek(0)
resolv.write(nameserver + 'nameserver 9.9.9.9\n')
if any_device_connected:
ui.set('bluetooth', 'C')

View File

@@ -1,170 +1,159 @@
__author__ = 'evilsocket@gmail.com'
__version__ = '1.0.0'
__name__ = 'hello_world'
__license__ = 'GPL3'
__description__ = 'An example plugin for pwnagotchi that implements all the available callbacks.'
import logging
import pwnagotchi.plugins as plugins
from pwnagotchi.ui.components import LabeledValue
from pwnagotchi.ui.view import BLACK
import pwnagotchi.ui.fonts as fonts
# Will be set with the options in config.yml config['main']['plugins'][__name__]
OPTIONS = dict()
class Example(plugins.Plugin):
__author__ = 'evilsocket@gmail.com'
__version__ = '1.0.0'
__license__ = 'GPL3'
__description__ = 'An example plugin for pwnagotchi that implements all the available callbacks.'
# called when the plugin is loaded
def on_loaded():
logging.warning("WARNING: plugin %s should be disabled!" % __name__)
def __init__(self):
logging.debug("example plugin created")
# called when http://<host>:<port>/plugins/<plugin>/ is called
# must return a response
def on_webhook(self, path, args, req_method):
pass
# called in manual mode when there's internet connectivity
def on_internet_available(agent):
pass
# called when the plugin is loaded
def on_loaded(self):
logging.warning("WARNING: this plugin should be disabled! options = " % self.options)
# called when <host>:<port>/plugins/<pluginname> is opened
def on_webhook(self, response, path):
res = "<html><body><a>Hook triggered</a></body></html>"
response.send_response(200)
response.send_header('Content-type', 'text/html')
response.end_headers()
# called to setup the ui elements
def on_ui_setup(ui):
# add custom UI elements
ui.add_element('ups', LabeledValue(color=BLACK, label='UPS', value='0%/0V', position=(ui.width() / 2 - 25, 0),
label_font=fonts.Bold, text_font=fonts.Medium))
try:
response.wfile.write(bytes(res, "utf-8"))
except Exception as ex:
logging.error(ex)
# called in manual mode when there's internet connectivity
def on_internet_available(self, agent):
pass
# called when the ui is updated
def on_ui_update(ui):
# update those elements
some_voltage = 0.1
some_capacity = 100.0
# called to setup the ui elements
def on_ui_setup(self, ui):
# add custom UI elements
ui.add_element('ups', LabeledValue(color=BLACK, label='UPS', value='0%/0V', position=(ui.width() / 2 - 25, 0),
label_font=fonts.Bold, text_font=fonts.Medium))
ui.set('ups', "%4.2fV/%2i%%" % (some_voltage, some_capacity))
# called when the ui is updated
def on_ui_update(self, ui):
# update those elements
some_voltage = 0.1
some_capacity = 100.0
ui.set('ups', "%4.2fV/%2i%%" % (some_voltage, some_capacity))
# called when the hardware display setup is done, display is an hardware specific object
def on_display_setup(self, display):
pass
# called when the hardware display setup is done, display is an hardware specific object
def on_display_setup(display):
pass
# called when everything is ready and the main loop is about to start
def on_ready(self, agent):
logging.info("unit is ready")
# you can run custom bettercap commands if you want
# agent.run('ble.recon on')
# or set a custom state
# agent.set_bored()
# called when the AI finished loading
def on_ai_ready(self, agent):
pass
# called when everything is ready and the main loop is about to start
def on_ready(agent):
logging.info("unit is ready")
# you can run custom bettercap commands if you want
# agent.run('ble.recon on')
# or set a custom state
# agent.set_bored()
# called when the AI finds a new set of parameters
def on_ai_policy(self, agent, policy):
pass
# called when the AI starts training for a given number of epochs
def on_ai_training_start(self, agent, epochs):
pass
# called when the AI finished loading
def on_ai_ready(agent):
pass
# called after the AI completed a training epoch
def on_ai_training_step(self, agent, _locals, _globals):
pass
# called when the AI has done training
def on_ai_training_end(self, agent):
pass
# called when the AI finds a new set of parameters
def on_ai_policy(agent, policy):
pass
# called when the AI got the best reward so far
def on_ai_best_reward(self, agent, reward):
pass
# called when the AI got the worst reward so far
def on_ai_worst_reward(self, agent, reward):
pass
# called when the AI starts training for a given number of epochs
def on_ai_training_start(agent, epochs):
pass
# called when a non overlapping wifi channel is found to be free
def on_free_channel(self, agent, channel):
pass
# called when the status is set to bored
def on_bored(self, agent):
pass
# called after the AI completed a training epoch
def on_ai_training_step(agent, _locals, _globals):
pass
# called when the status is set to sad
def on_sad(self, agent):
pass
# called when the status is set to excited
def on_excited(aself, gent):
pass
# called when the AI has done training
def on_ai_training_end(agent):
pass
# called when the status is set to lonely
def on_lonely(self, agent):
pass
# called when the agent is rebooting the board
def on_rebooting(self, agent):
pass
# called when the AI got the best reward so far
def on_ai_best_reward(agent, reward):
pass
# called when the agent is waiting for t seconds
def on_wait(self, agent, t):
pass
# called when the agent is sleeping for t seconds
def on_sleep(self, agent, t):
pass
# called when the AI got the worst reward so far
def on_ai_worst_reward(agent, reward):
pass
# called when the agent refreshed its access points list
def on_wifi_update(self, agent, access_points):
pass
# called when the agent is sending an association frame
def on_association(self, agent, access_point):
pass
# called when a non overlapping wifi channel is found to be free
def on_free_channel(agent, channel):
pass
# called when the agent is deauthenticating a client station from an AP
def on_deauthentication(self, agent, access_point, client_station):
pass
# callend when the agent is tuning on a specific channel
def on_channel_hop(self, agent, channel):
pass
# called when the status is set to bored
def on_bored(agent):
pass
# called when a new handshake is captured, access_point and client_station are json objects
# if the agent could match the BSSIDs to the current list, otherwise they are just the strings of the BSSIDs
def on_handshake(self, agent, filename, access_point, client_station):
pass
# called when an epoch is over (where an epoch is a single loop of the main algorithm)
def on_epoch(self, agent, epoch, epoch_data):
pass
# called when the status is set to sad
def on_sad(agent):
pass
# called when a new peer is detected
def on_peer_detected(self, agent, peer):
pass
# called when the status is set to excited
def on_excited(agent):
pass
# called when the status is set to lonely
def on_lonely(agent):
pass
# called when the agent is rebooting the board
def on_rebooting(agent):
pass
# called when the agent is waiting for t seconds
def on_wait(agent, t):
pass
# called when the agent is sleeping for t seconds
def on_sleep(agent, t):
pass
# called when the agent refreshed its access points list
def on_wifi_update(agent, access_points):
pass
# called when the agent is sending an association frame
def on_association(agent, access_point):
pass
# callend when the agent is deauthenticating a client station from an AP
def on_deauthentication(agent, access_point, client_station):
pass
# callend when the agent is tuning on a specific channel
def on_channel_hop(agent, channel):
pass
# called when a new handshake is captured, access_point and client_station are json objects
# if the agent could match the BSSIDs to the current list, otherwise they are just the strings of the BSSIDs
def on_handshake(agent, filename, access_point, client_station):
pass
# called when an epoch is over (where an epoch is a single loop of the main algorithm)
def on_epoch(agent, epoch, epoch_data):
pass
# called when a new peer is detected
def on_peer_detected(agent, peer):
pass
# called when a known peer is lost
def on_peer_lost(agent, peer):
pass
# called when a known peer is lost
def on_peer_lost(self, agent, peer):
pass

View File

@@ -0,0 +1,40 @@
import logging
import RPi.GPIO as GPIO
import subprocess
import pwnagotchi.plugins as plugins
class GPIOButtons(plugins.Plugin):
__author__ = 'ratmandu@gmail.com'
__version__ = '1.0.0'
__license__ = 'GPL3'
__description__ = 'GPIO Button support plugin'
def __init__(self):
self.running = False
self.ports = {}
self.commands = None
def runCommand(self, channel):
command = self.ports[channel]
logging.info(f"Button Pressed! Running command: {command}")
process = subprocess.Popen(command, shell=True, stdin=None, stdout=open("/dev/null", "w"), stderr=None,
executable="/bin/bash")
process.wait()
def on_loaded(self):
logging.info("GPIO Button plugin loaded.")
# get list of GPIOs
gpios = self.options['gpios']
# set gpio numbering
GPIO.setmode(GPIO.BCM)
for i in gpios:
gpio = list(i)[0]
command = i[gpio]
self.ports[gpio] = command
GPIO.setup(gpio, GPIO.IN, GPIO.PUD_UP)
GPIO.add_event_detect(gpio, GPIO.FALLING, callback=self.runCommand, bouncetime=250)
logging.info("Added command: %s to GPIO #%d", command, gpio)

View File

@@ -1,45 +1,42 @@
__author__ = 'evilsocket@gmail.com'
__version__ = '1.0.0'
__name__ = 'gps'
__license__ = 'GPL3'
__description__ = 'Save GPS coordinates whenever an handshake is captured.'
import logging
import json
import os
running = False
OPTIONS = dict()
import pwnagotchi.plugins as plugins
def on_loaded():
logging.info("gps plugin loaded for %s" % OPTIONS['device'])
class GPS(plugins.Plugin):
__author__ = 'evilsocket@gmail.com'
__version__ = '1.0.0'
__license__ = 'GPL3'
__description__ = 'Save GPS coordinates whenever an handshake is captured.'
def __init__(self):
self.running = False
def on_ready(agent):
global running
def on_loaded(self):
logging.info("gps plugin loaded for %s" % self.options['device'])
if os.path.exists(OPTIONS['device']):
logging.info("enabling gps bettercap's module for %s" % OPTIONS['device'])
try:
agent.run('gps off')
except:
pass
def on_ready(self, agent):
if os.path.exists(self.options['device']):
logging.info("enabling gps bettercap's module for %s" % self.options['device'])
try:
agent.run('gps off')
except:
pass
agent.run('set gps.device %s' % OPTIONS['device'])
agent.run('set gps.speed %d' % OPTIONS['speed'])
agent.run('gps on')
running = True
else:
logging.warning("no GPS detected")
agent.run('set gps.device %s' % self.options['device'])
agent.run('set gps.speed %d' % self.options['speed'])
agent.run('gps on')
running = True
else:
logging.warning("no GPS detected")
def on_handshake(self, agent, filename, access_point, client_station):
if self.running:
info = agent.session()
gps = info['gps']
gps_filename = filename.replace('.pcap', '.gps.json')
def on_handshake(agent, filename, access_point, client_station):
if running:
info = agent.session()
gps = info['gps']
gps_filename = filename.replace('.pcap', '.gps.json')
logging.info("saving GPS to %s (%s)" % (gps_filename, gps))
with open(gps_filename, 'w+t') as fp:
json.dump(gps, fp)
logging.info("saving GPS to %s (%s)" % (gps_filename, gps))
with open(gps_filename, 'w+t') as fp:
json.dump(gps, fp)

View File

@@ -1,31 +1,12 @@
__author__ = 'evilsocket@gmail.com'
__version__ = '1.0.0'
__name__ = 'grid'
__license__ = 'GPL3'
__description__ = 'This plugin signals the unit cryptographic identity and list of pwned networks and list of pwned networks to api.pwnagotchi.ai'
import os
import logging
import requests
import time
import glob
import json
import subprocess
import pwnagotchi
import pwnagotchi.utils as utils
from pwnagotchi.ui.components import LabeledValue
from pwnagotchi.ui.view import BLACK
import pwnagotchi.ui.fonts as fonts
from pwnagotchi.utils import WifiInfo, extract_from_pcap
import re
OPTIONS = dict()
REPORT = utils.StatusFile('/root/.api-report.json', data_format='json')
UNREAD_MESSAGES = 0
TOTAL_MESSAGES = 0
def on_loaded():
logging.info("grid plugin loaded.")
import pwnagotchi.grid as grid
import pwnagotchi.plugins as plugins
from pwnagotchi.utils import StatusFile, WifiInfo, extract_from_pcap
def parse_pcap(filename):
@@ -40,6 +21,10 @@ def parse_pcap(filename):
# /root/handshakes/BSSID.pcap
essid, bssid = '', net_id
mac_re = re.compile('[0-9a-fA-F]{12}')
if not mac_re.match(bssid):
return '', ''
it = iter(bssid)
bssid = ':'.join([a + b for a, b in zip(it, it)])
@@ -56,146 +41,100 @@ def parse_pcap(filename):
return info[WifiInfo.ESSID], info[WifiInfo.BSSID]
def is_excluded(what):
for skip in OPTIONS['exclude']:
skip = skip.lower()
what = what.lower()
if skip in what or skip.replace(':', '') in what:
return True
return False
class Grid(plugins.Plugin):
__author__ = 'evilsocket@gmail.com'
__version__ = '1.0.1'
__license__ = 'GPL3'
__description__ = 'This plugin signals the unit cryptographic identity and list of pwned networks and list of pwned ' \
'networks to api.pwnagotchi.ai '
def __init__(self):
self.options = dict()
self.report = StatusFile('/root/.api-report.json', data_format='json')
def grid_call(path, obj=None):
# pwngrid-peer is running on port 8666
api_address = 'http://127.0.0.1:8666/api/v1%s' % path
if obj is None:
r = requests.get(api_address, headers=None)
else:
r = requests.post(api_address, headers=None, json=obj)
self.unread_messages = 0
self.total_messages = 0
if r.status_code != 200:
raise Exception("(status %d) %s" % (r.status_code, r.text))
return r.json()
def is_excluded(self, what):
for skip in self.options['exclude']:
skip = skip.lower()
what = what.lower()
if skip in what or skip.replace(':', '') in what:
return True
return False
def on_loaded(self):
logging.info("grid plugin loaded.")
def grid_update_data(last_session):
brain = {}
try:
with open('/root/brain.json') as fp:
brain = json.load(fp)
except:
pass
def set_reported(self, reported, net_id):
reported.append(net_id)
self.report.update(data={'reported': reported})
data = {
'session': {
'duration': last_session.duration,
'epochs': last_session.epochs,
'train_epochs': last_session.train_epochs,
'avg_reward': last_session.avg_reward,
'min_reward': last_session.min_reward,
'max_reward': last_session.max_reward,
'deauthed': last_session.deauthed,
'associated': last_session.associated,
'handshakes': last_session.handshakes,
'peers': last_session.peers,
},
'uname': subprocess.getoutput("uname -a"),
'brain': brain,
'version': pwnagotchi.version
}
logging.debug("updating grid data: %s" % data)
grid_call("/data", data)
def grid_report_ap(essid, bssid):
try:
grid_call("/report/ap", {
'essid': essid,
'bssid': bssid,
})
return True
except Exception as e:
logging.exception("error while reporting ap %s(%s)" % (essid, bssid))
return False
def grid_inbox():
return grid_call("/inbox")["messages"]
def on_ui_update(ui):
new_value = ' %d (%d)' % (UNREAD_MESSAGES, TOTAL_MESSAGES)
if not ui.has_element('mailbox') and TOTAL_MESSAGES > 0:
if ui.is_inky():
pos=(80, 0)
else:
pos=(100,0)
ui.add_element('mailbox',
LabeledValue(color=BLACK, label='MSG', value=new_value,
position=pos,
label_font=fonts.Bold,
text_font=fonts.Medium))
ui.set('mailbox', new_value)
def on_internet_available(agent):
global REPORT, UNREAD_MESSAGES, TOTAL_MESSAGES
logging.debug("internet available")
try:
grid_update_data(agent.last_session)
except Exception as e:
logging.error("error connecting to the pwngrid-peer service: %s" % e)
return
try:
def check_inbox(self, agent):
logging.debug("checking mailbox ...")
messages = grid.inbox()
self.total_messages = len(messages)
self.unread_messages = len([m for m in messages if m['seen_at'] is None])
messages = grid_inbox()
TOTAL_MESSAGES = len(messages)
UNREAD_MESSAGES = len([m for m in messages if m['seen_at'] is None])
if TOTAL_MESSAGES:
on_ui_update(agent.view())
logging.debug( " %d unread messages of %d total" % (UNREAD_MESSAGES, TOTAL_MESSAGES))
if self.unread_messages:
logging.debug("[grid] unread:%d total:%d" % (self.unread_messages, self.total_messages))
agent.view().on_unread_messages(self.unread_messages, self.total_messages)
def check_handshakes(self, agent):
logging.debug("checking pcaps")
pcap_files = glob.glob(os.path.join(agent.config()['bettercap']['handshakes'], "*.pcap"))
num_networks = len(pcap_files)
reported = REPORT.data_field_or('reported', default=[])
reported = self.report.data_field_or('reported', default=[])
num_reported = len(reported)
num_new = num_networks - num_reported
if num_new > 0:
if OPTIONS['report']:
if self.options['report']:
logging.info("grid: %d new networks to report" % num_new)
logging.debug("OPTIONS: %s" % OPTIONS)
logging.debug(" exclude: %s" % OPTIONS['exclude'])
logging.debug("self.options: %s" % self.options)
logging.debug(" exclude: %s" % self.options['exclude'])
for pcap_file in pcap_files:
net_id = os.path.basename(pcap_file).replace('.pcap', '')
if net_id not in reported:
if is_excluded(net_id):
logging.info("skipping %s due to exclusion filter" % pcap_file)
if self.is_excluded(net_id):
logging.debug("skipping %s due to exclusion filter" % pcap_file)
self.set_reported(reported, net_id)
continue
essid, bssid = parse_pcap(pcap_file)
if bssid:
if is_excluded(essid) or is_excluded(bssid):
if self.is_excluded(essid) or self.is_excluded(bssid):
logging.debug("not reporting %s due to exclusion filter" % pcap_file)
elif grid_report_ap(essid, bssid):
reported.append(net_id)
REPORT.update(data={'reported': reported})
self.set_reported(reported, net_id)
else:
if grid.report_ap(essid, bssid):
self.set_reported(reported, net_id)
time.sleep(1.5)
else:
logging.warning("no bssid found?!")
else:
logging.debug("grid: reporting disabled")
except Exception as e:
logging.exception("grid api error")
def on_internet_available(self, agent):
logging.debug("internet available")
try:
grid.update_data(agent.last_session)
except Exception as e:
logging.error("error connecting to the pwngrid-peer service: %s" % e)
logging.debug(e, exc_info=True)
return
try:
self.check_inbox(agent)
except Exception as e:
logging.error("[grid] error while checking inbox: %s" % e)
logging.debug(e, exc_info=True)
try:
self.check_handshakes(agent)
except Exception as e:
logging.error("[grid] error while checking pcaps: %s" % e)
logging.debug(e, exc_info=True)

View File

@@ -1,68 +1,67 @@
# tempmem shows memory infos and cpu temperature
# memtemp shows memory infos and cpu temperature
#
# totalmem usedmem freemem cputemp
# mem usage, cpu load, cpu temp
#
__author__ = 'https://github.com/xenDE'
__version__ = '1.0.0'
__name__ = 'memtemp'
__license__ = 'GPL3'
__description__ = 'A plugin that will add a memory and temperature indicator'
import struct
###############################################################
#
# Updated 18-10-2019 by spees <speeskonijn@gmail.com>
# - Changed the place where the data was displayed on screen
# - Made the data a bit more compact and easier to read
# - removed the label so we wont waste screen space
# - Updated version to 1.0.1
#
# 20-10-2019 by spees <speeskonijn@gmail.com>
# - Refactored to use the already existing functions
# - Now only shows memory usage in percentage
# - Added CPU load
# - Added horizontal and vertical orientation
#
###############################################################
from pwnagotchi.ui.components import LabeledValue
from pwnagotchi.ui.view import BLACK
import pwnagotchi.ui.fonts as fonts
import time
import pwnagotchi.plugins as plugins
import pwnagotchi
import logging
class MEMTEMP:
class MemTemp(plugins.Plugin):
__author__ = 'https://github.com/xenDE'
__version__ = '1.0.1'
__license__ = 'GPL3'
__description__ = 'A plugin that will display memory/cpu usage and temperature'
# set the minimum seconds before refresh the values
refresh_wait = 30
refresh_ts_last = time.time() - refresh_wait
def __init__(self):
# only import when the module is loaded and enabled
import os
def on_loaded(self):
logging.info("memtemp plugin loaded.")
def get_temp(self):
try:
temp = os.popen('/opt/vc/bin/vcgencmd measure_temp').readlines()[0].split('=')[1].replace("\n", '').replace("'","")
return 'cpu:' + temp
except:
return 'cpu:0.0C'
# cpu:37.4C
def mem_usage(self):
return int(pwnagotchi.mem_usage() * 100)
def get_mem_info(self):
try:
# includes RAM + Swap Memory:
# total, used, free = map(int, os.popen('free -t -m').readlines()[-1].split()[1:])
# without Swap, only real memory:
total, used, free = map(int, os.popen('free -t -m').readlines()[-3].split()[1:4])
return "tm:"+str(total)+" um:"+str(used)+" fm:"+str(free)
except:
return "tm:0 um:0 fm:0"
# tm:532 um:82 fm:353
def cpu_load(self):
return int(pwnagotchi.cpu_load() * 100)
def on_ui_setup(self, ui):
if ui.is_waveshare_v2():
h_pos = (180, 80)
v_pos = (180, 61)
else:
h_pos = (155, 76)
v_pos = (180, 61)
memtemp = None
if self.options['orientation'] == "horizontal":
ui.add_element('memtemp', LabeledValue(color=BLACK, label='', value='mem cpu temp\n - - -',
position=h_pos,
label_font=fonts.Small, text_font=fonts.Small))
elif self.options['orientation'] == "vertical":
ui.add_element('memtemp', LabeledValue(color=BLACK, label='', value=' mem:-\n cpu:-\ntemp:-',
position=v_pos,
label_font=fonts.Small, text_font=fonts.Small))
def on_ui_update(self, ui):
if self.options['orientation'] == "horizontal":
ui.set('memtemp',
" mem cpu temp\n %s%% %s%% %sc" % (self.mem_usage(), self.cpu_load(), pwnagotchi.temperature()))
def on_loaded():
global memtemp
memtemp = MEMTEMP()
def on_ui_setup(ui):
ui.add_element('memtemp', LabeledValue(color=BLACK, label='SYS', value='tm:0 um:0 fm:0 0.0C', position=(0, ui.height()-28),
label_font=fonts.Bold, text_font=fonts.Medium))
def on_ui_update(ui):
if time.time() > memtemp.refresh_ts_last + memtemp.refresh_wait:
ui.set('memtemp', "%s %s" % (memtemp.get_mem_info(), memtemp.get_temp()))
memtemp.refresh_ts_last = time.time()
elif self.options['orientation'] == "vertical":
ui.set('memtemp',
" mem:%s%%\n cpu:%s%%\ntemp:%sc" % (self.mem_usage(), self.cpu_load(), pwnagotchi.temperature()))

View File

@@ -1,144 +1,139 @@
__author__ = 'zenzen san'
__version__ = '1.0.0'
__name__ = 'net-pos'
__license__ = 'GPL3'
__description__ = """Saves a json file with the access points with more signal
whenever a handshake is captured.
When internet is available the files are converted in geo locations
using Mozilla LocationService """
import logging
import json
import os
import requests
import time
import pwnagotchi.plugins as plugins
from pwnagotchi.utils import StatusFile
MOZILLA_API_URL = 'https://location.services.mozilla.com/v1/geolocate?key={api}'
ALREADY_SAVED = None
SKIP = None
READY = False
OPTIONS = {}
def on_loaded():
global ALREADY_SAVED
global SKIP
global READY
class NetPos(plugins.Plugin):
__author__ = 'zenzen san'
__version__ = '2.0.1'
__license__ = 'GPL3'
__description__ = """Saves a json file with the access points with more signal
whenever a handshake is captured.
When internet is available the files are converted in geo locations
using Mozilla LocationService """
SKIP = list()
def __init__(self):
self.report = StatusFile('/root/.net_pos_saved', data_format='json')
self.skip = list()
self.ready = False
if 'api_key' not in OPTIONS or ('api_key' in OPTIONS and OPTIONS['api_key'] is None):
logging.error("NET-POS: api_key isn't set. Can't use mozilla's api.")
return
def on_loaded(self):
if 'api_key' not in self.options or ('api_key' in self.options and self.options['api_key'] is None):
logging.error("NET-POS: api_key isn't set. Can't use mozilla's api.")
return
try:
with open('/root/.net_pos_saved', 'r') as f:
ALREADY_SAVED = f.read().splitlines()
except OSError:
logging.warning('NET-POS: No net-pos-file found.')
ALREADY_SAVED = []
self.ready = True
logging.info("net-pos plugin loaded.")
READY = True
logging.info("net-pos plugin loaded.")
def _append_saved(self, path):
to_save = list()
if isinstance(path, str):
to_save.append(path)
elif isinstance(path, list):
to_save += path
else:
raise TypeError("Expected list or str, got %s" % type(path))
def _append_saved(path):
to_save = list()
if isinstance(path, str):
to_save.append(path)
elif isinstance(path, list):
to_save += path
else:
raise TypeError("Expected list or str, got %s" % type(path))
with open('/root/.net_pos_saved', 'a') as saved_file:
for x in to_save:
saved_file.write(x + "\n")
with open('/root/.net_pos_saved', 'a') as saved_file:
for x in to_save:
saved_file.write(x + "\n")
def on_internet_available(self, agent):
if self.ready:
config = agent.config()
display = agent.view()
reported = self.report.data_field_or('reported', default=list())
handshake_dir = config['bettercap']['handshakes']
def on_internet_available(agent):
global SKIP
all_files = os.listdir(handshake_dir)
all_np_files = [os.path.join(handshake_dir, filename)
for filename in all_files
if filename.endswith('.net-pos.json')]
new_np_files = set(all_np_files) - set(reported) - set(self.skip)
if READY:
config = agent.config()
display = agent.view()
handshake_dir = config['bettercap']['handshakes']
all_files = os.listdir(handshake_dir)
all_np_files = [os.path.join(handshake_dir, filename)
for filename in all_files
if filename.endswith('.net-pos.json')]
new_np_files = set(all_np_files) - set(ALREADY_SAVED) - set(SKIP)
if new_np_files:
logging.info("NET-POS: Found {num} new net-pos files. Fetching positions ...", len(new_np_files))
display.set('status', f"Found {len(new_np_files)} new net-pos files. Fetching positions ...")
display.update(force=True)
for idx, np_file in enumerate(new_np_files):
geo_file = np_file.replace('.net-pos.json', '.geo.json')
if os.path.exists(geo_file):
# got already the position
ALREADY_SAVED.append(np_file)
_append_saved(np_file)
continue
try:
geo_data = _get_geo_data(np_file) # returns json obj
except requests.exceptions.RequestException as req_e:
logging.error("NET-POS: %s", req_e)
SKIP += np_file
except json.JSONDecodeError as js_e:
logging.error("NET-POS: %s", js_e)
SKIP += np_file
except OSError as os_e:
logging.error("NET-POS: %s", os_e)
SKIP += np_file
with open(geo_file, 'w+t') as sf:
json.dump(geo_data, sf)
ALREADY_SAVED.append(np_file)
_append_saved(np_file)
display.set('status', f"Fetching positions ({idx+1}/{len(new_np_files)})")
if new_np_files:
logging.info("NET-POS: Found %d new net-pos files. Fetching positions ...", len(new_np_files))
display.set('status', f"Found {len(new_np_files)} new net-pos files. Fetching positions ...")
display.update(force=True)
for idx, np_file in enumerate(new_np_files):
geo_file = np_file.replace('.net-pos.json', '.geo.json')
if os.path.exists(geo_file):
# got already the position
reported.append(np_file)
self.report.update(data={'reported': reported})
continue
def on_handshake(agent, filename, access_point, client_station):
netpos = _get_netpos(agent)
netpos_filename = filename.replace('.pcap', '.net-pos.json')
logging.info("NET-POS: Saving net-location to %s", netpos_filename)
try:
geo_data = self._get_geo_data(np_file) # returns json obj
except requests.exceptions.RequestException as req_e:
logging.error("NET-POS: %s", req_e)
self.skip += np_file
continue
except json.JSONDecodeError as js_e:
logging.error("NET-POS: %s", js_e)
self.skip += np_file
continue
except OSError as os_e:
logging.error("NET-POS: %s", os_e)
self.skip += np_file
continue
try:
with open(netpos_filename, 'w+t') as fp:
json.dump(netpos, fp)
except OSError as os_e:
logging.error("NET-POS: %s", os_e)
with open(geo_file, 'w+t') as sf:
json.dump(geo_data, sf)
reported.append(np_file)
self.report.update(data={'reported': reported})
def _get_netpos(agent):
aps = agent.get_access_points()
netpos = {}
netpos['wifiAccessPoints'] = list()
# 6 seems a good number to save a wifi networks location
for access_point in sorted(aps, key=lambda i: i['rssi'], reverse=True)[:6]:
netpos['wifiAccessPoints'].append({'macAddress': access_point['mac'],
'signalStrength': access_point['rssi']})
return netpos
display.set('status', f"Fetching positions ({idx + 1}/{len(new_np_files)})")
display.update(force=True)
def _get_geo_data(path, timeout=30):
geourl = MOZILLA_API_URL.format(api=OPTIONS['api_key'])
def on_handshake(self, agent, filename, access_point, client_station):
netpos = self._get_netpos(agent)
netpos["ts"] = int("%.0f" % time.time())
netpos_filename = filename.replace('.pcap', '.net-pos.json')
logging.info("NET-POS: Saving net-location to %s", netpos_filename)
try:
with open(path, "r") as json_file:
data = json.load(json_file)
except json.JSONDecodeError as js_e:
raise js_e
except OSError as os_e:
raise os_e
try:
with open(netpos_filename, 'w+t') as net_pos_file:
json.dump(netpos, net_pos_file)
except OSError as os_e:
logging.error("NET-POS: %s", os_e)
try:
result = requests.post(geourl,
json=data,
timeout=timeout)
return result.json()
except requests.exceptions.RequestException as req_e:
raise req_e
def _get_netpos(self, agent):
aps = agent.get_access_points()
netpos = dict()
netpos['wifiAccessPoints'] = list()
# 6 seems a good number to save a wifi networks location
for access_point in sorted(aps, key=lambda i: i['rssi'], reverse=True)[:6]:
netpos['wifiAccessPoints'].append({'macAddress': access_point['mac'],
'signalStrength': access_point['rssi']})
return netpos
def _get_geo_data(self, path, timeout=30):
geourl = MOZILLA_API_URL.format(api=self.options['api_key'])
try:
with open(path, "r") as json_file:
data = json.load(json_file)
except json.JSONDecodeError as js_e:
raise js_e
except OSError as os_e:
raise os_e
try:
result = requests.post(geourl,
json=data,
timeout=timeout)
return_geo = result.json()
if data["ts"]:
return_geo["ts"] = data["ts"]
return return_geo
except requests.exceptions.RequestException as req_e:
raise req_e

View File

@@ -1,87 +1,105 @@
__author__ = '33197631+dadav@users.noreply.github.com'
__version__ = '1.0.0'
__name__ = 'onlinehashcrack'
__license__ = 'GPL3'
__description__ = 'This plugin automatically uploades handshakes to https://onlinehashcrack.com'
import os
import logging
import re
import requests
READY = False
ALREADY_UPLOADED = None
OPTIONS = dict()
from pwnagotchi.utils import StatusFile
import pwnagotchi.plugins as plugins
def on_loaded():
"""
Gets called when the plugin gets loaded
"""
global READY
global EMAIL
global ALREADY_UPLOADED
class OnlineHashCrack(plugins.Plugin):
__author__ = '33197631+dadav@users.noreply.github.com'
__version__ = '2.0.0'
__license__ = 'GPL3'
__description__ = 'This plugin automatically uploads handshakes to https://onlinehashcrack.com'
if not 'email' in OPTIONS or ('email' in OPTIONS and OPTIONS['email'] is None):
logging.error("OHC: Email isn't set. Can't upload to onlinehashcrack.com")
return
def __init__(self):
self.ready = False
self.report = StatusFile('/root/.ohc_uploads', data_format='json')
self.skip = list()
try:
with open('/root/.ohc_uploads', 'r') as f:
ALREADY_UPLOADED = f.read().splitlines()
except OSError:
logging.warning('OHC: No upload-file found.')
ALREADY_UPLOADED = []
def on_loaded(self):
"""
Gets called when the plugin gets loaded
"""
if 'email' not in self.options or ('email' in self.options and self.options['email'] is None):
logging.error("OHC: Email isn't set. Can't upload to onlinehashcrack.com")
return
READY = True
if 'whitelist' not in self.options:
self.options['whitelist'] = []
# remove special characters from whitelist APs to match on-disk format
self.options['whitelist'] = set(map(lambda x: re.sub(r'[^a-zA-Z0-9]', '', x), self.options['whitelist']))
def _upload_to_ohc(path, timeout=30):
"""
Uploads the file to onlinehashcrack.com
"""
with open(path, 'rb') as file_to_upload:
data = {'email': OPTIONS['email']}
payload = {'file': file_to_upload}
self.ready = True
def _filter_handshake_file(self, handshake_filename):
try:
result = requests.post('https://api.onlinehashcrack.com',
data=data,
files=payload,
timeout=timeout)
if 'already been sent' in result.text:
logging.warning(f"{path} was already uploaded.")
except requests.exceptions.RequestException as e:
logging.error(f"OHC: Got an exception while uploading {path} -> {e}")
raise e
basename = os.path.basename(handshake_filename)
ssid, bssid = basename.split('_')
# remove the ".pcap" from the bssid (which is really just the end of the filename)
bssid = bssid[:-5]
except:
# something failed in our parsing of the filename. let the file through
return True
return ssid not in self.options['whitelist'] and bssid not in self.options['whitelist']
def on_internet_available(agent):
"""
Called in manual mode when there's internet connectivity
"""
if READY:
display = agent.view()
config = agent.config()
def _upload_to_ohc(self, path, timeout=30):
"""
Uploads the file to onlinehashcrack.com
"""
with open(path, 'rb') as file_to_upload:
data = {'email': self.options['email']}
payload = {'file': file_to_upload}
handshake_dir = config['bettercap']['handshakes']
handshake_filenames = os.listdir(handshake_dir)
handshake_paths = [os.path.join(handshake_dir, filename) for filename in handshake_filenames if filename.endswith('.pcap')]
handshake_new = set(handshake_paths) - set(ALREADY_UPLOADED)
try:
result = requests.post('https://api.onlinehashcrack.com',
data=data,
files=payload,
timeout=timeout)
if 'already been sent' in result.text:
logging.warning(f"{path} was already uploaded.")
except requests.exceptions.RequestException as e:
logging.error(f"OHC: Got an exception while uploading {path} -> {e}")
raise e
if handshake_new:
logging.info("OHC: Internet connectivity detected. Uploading new handshakes to onelinehashcrack.com")
def on_internet_available(self, agent):
"""
Called in manual mode when there's internet connectivity
"""
if self.ready:
display = agent.view()
config = agent.config()
reported = self.report.data_field_or('reported', default=list())
for idx, handshake in enumerate(handshake_new):
display.set('status', f"Uploading handshake to onlinehashcrack.com ({idx + 1}/{len(handshake_new)})")
display.update(force=True)
try:
_upload_to_ohc(handshake)
ALREADY_UPLOADED.append(handshake)
with open('/root/.ohc_uploads', 'a') as f:
f.write(handshake + "\n")
logging.info(f"OHC: Successfuly uploaded {handshake}")
except requests.exceptions.RequestException:
pass
except OSError as os_e:
logging.error(f"OHC: Got the following error: {os_e}")
handshake_dir = config['bettercap']['handshakes']
handshake_filenames = os.listdir(handshake_dir)
handshake_paths = [os.path.join(handshake_dir, filename) for filename in handshake_filenames if
filename.endswith('.pcap')]
# pull out whitelisted APs
handshake_paths = filter(lambda path: self._filter_handshake_file(path), handshake_paths)
handshake_new = set(handshake_paths) - set(reported) - set(self.skip)
if handshake_new:
logging.info("OHC: Internet connectivity detected. Uploading new handshakes to onelinehashcrack.com")
for idx, handshake in enumerate(handshake_new):
display.set('status',
f"Uploading handshake to onlinehashcrack.com ({idx + 1}/{len(handshake_new)})")
display.update(force=True)
try:
self._upload_to_ohc(handshake)
reported.append(handshake)
self.report.update(data={'reported': reported})
logging.info(f"OHC: Successfully uploaded {handshake}")
except requests.exceptions.RequestException as req_e:
self.skip.append(handshake)
logging.error("OHC: %s", req_e)
continue
except OSError as os_e:
self.skip.append(handshake)
logging.error("OHC: %s", os_e)
continue

View File

@@ -0,0 +1,32 @@
import logging
import requests
import pwnagotchi.plugins as plugins
'''
You need an bluetooth connection to your android phone which is running PAW server with the GPS "hack" from Systemic:
https://raw.githubusercontent.com/systemik/pwnagotchi-bt-tether/master/GPS-via-PAW
'''
class PawGPS(plugins.Plugin):
__author__ = 'leont'
__version__ = '1.0.0'
__name__ = 'pawgps'
__license__ = 'GPL3'
__description__ = 'Saves GPS coordinates whenever an handshake is captured. The GPS data is get from PAW on android '
def on_loaded(self):
logging.info("PAW-GPS loaded")
if 'ip' not in self.options or ('ip' in self.options and self.options['ip'] is None):
logging.info("PAW-GPS: No IP Address in the config file is defined, it uses the default (192.168.44.1)")
def on_handshake(self, agent, filename, access_point, client_station):
if 'ip' not in self.options or ('ip' in self.options and self.options['ip'] is None):
ip = "192.168.44.1"
gps = requests.get('http://' + ip + '/gps.xhtml')
gps_filename = filename.replace('.pcap', '.gps.json')
logging.info("saving GPS to %s (%s)" % (gps_filename, gps))
with open(gps_filename, 'w+t') as f:
f.write(gps.text)

View File

@@ -1,8 +1,8 @@
__author__ = 'pwnagotchi [at] rossmarks [dot] uk'
__version__ = '1.0.0'
__name__ = 'quickdic'
__license__ = 'GPL3'
__description__ = 'Run a quick dictionary scan against captured handshakes'
import logging
import subprocess
import string
import re
import pwnagotchi.plugins as plugins
'''
Aircrack-ng needed, to install:
@@ -11,42 +11,41 @@ Upload wordlist files in .txt format to folder in config file (Default: /opt/wor
Cracked handshakes stored in handshake folder as [essid].pcap.cracked
'''
import logging
import subprocess
import string
import re
OPTIONS = dict()
class QuickDic(plugins.Plugin):
__author__ = 'pwnagotchi [at] rossmarks [dot] uk'
__version__ = '1.0.0'
__license__ = 'GPL3'
__description__ = 'Run a quick dictionary scan against captured handshakes'
def on_loaded():
logging.info("Quick dictionary check plugin loaded")
def __init__(self):
self.text_to_set = ""
def on_handshake(agent, filename, access_point, client_station):
display = agent._view
def on_loaded(self):
logging.info("Quick dictionary check plugin loaded")
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 `echo '+OPTIONS['wordlist_folder']+'*.txt | sed \'s/\ /,/g\'` -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":
key = re.search('\[(.*)\]', result2)
pwd = str(key.group(1))
set_text("Cracked password: "+pwd)
display.update(force=True)
def on_handshake(self, 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 `echo ' + self.options[
'wordlist_folder'] + '*.txt | sed \'s/\ /,/g\'` -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":
key = re.search('\[(.*)\]', result2)
pwd = str(key.group(1))
self.text_to_set = "Cracked password: " + pwd
display.update(force=True)
text_to_set = "";
def set_text(text):
global text_to_set
text_to_set = 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 = ""
def on_ui_update(self, ui):
if self.text_to_set:
ui.set('face', "(·ω·)")
ui.set('status', self.text_to_set)
self.text_to_set = ""

View File

@@ -1,24 +1,23 @@
__author__ = 'pwnagotcchi [at] rossmarks [dot] uk'
__version__ = '1.0.0'
__name__ = 'screen_refresh'
__license__ = 'GPL3'
__description__ = 'Refresh he e-ink display after X amount of updates'
import logging
OPTIONS = dict()
update_count = 0;
import pwnagotchi.plugins as plugins
def on_loaded():
logging.info("Screen refresh plugin loaded")
class ScreenRefresh(plugins.Plugin):
__author__ = 'pwnagotchi [at] rossmarks [dot] uk'
__version__ = '1.0.0'
__license__ = 'GPL3'
__description__ = 'Refresh he e-ink display after X amount of updates'
def __init__(self):
self.update_count = 0;
def on_ui_update(ui):
global update_count
update_count += 1
if update_count == OPTIONS['refresh_interval']:
ui._init_display()
ui.set('status', "Screen cleaned")
logging.info("Screen refreshing")
update_count = 0
def on_loaded(self):
logging.info("Screen refresh plugin loaded")
def on_ui_update(self, ui):
self.update_count += 1
if self.update_count == self.options['refresh_interval']:
ui.init_display()
ui.set('status', "Screen cleaned")
logging.info("Screen refreshing")
self.update_count = 0

View File

@@ -1,50 +1,49 @@
__author__ = '33197631+dadav@users.noreply.github.com'
__version__ = '1.0.0'
__name__ = 'twitter'
__license__ = 'GPL3'
__description__ = 'This plugin creates tweets about the recent activity of pwnagotchi'
import logging
from pwnagotchi.voice import Voice
OPTIONS = dict()
def on_loaded():
logging.info("twitter plugin loaded.")
import pwnagotchi.plugins as plugins
# called in manual mode when there's internet connectivity
def on_internet_available(agent):
config = agent.config()
display = agent.view()
last_session = agent.last_session
class Twitter(plugins.Plugin):
__author__ = 'evilsocket@gmail.com'
__version__ = '1.0.0'
__license__ = 'GPL3'
__description__ = 'This plugin creates tweets about the recent activity of pwnagotchi'
if last_session.is_new() and last_session.handshakes > 0:
try:
import tweepy
except ImportError:
logging.error("Couldn't import tweepy")
return
def on_loaded(self):
logging.info("twitter plugin loaded.")
logging.info("detected a new session and internet connectivity!")
# called in manual mode when there's internet connectivity
def on_internet_available(self, agent):
config = agent.config()
display = agent.view()
last_session = agent.last_session
picture = '/dev/shm/pwnagotchi.png'
if last_session.is_new() and last_session.handshakes > 0:
try:
import tweepy
except ImportError:
logging.error("Couldn't import tweepy")
return
display.on_manual_mode(last_session)
display.update(force=True)
display.image().save(picture, 'png')
display.set('status', 'Tweeting...')
display.update(force=True)
logging.info("detected a new session and internet connectivity!")
try:
auth = tweepy.OAuthHandler(OPTIONS['consumer_key'], OPTIONS['consumer_secret'])
auth.set_access_token(OPTIONS['access_token_key'], OPTIONS['access_token_secret'])
api = tweepy.API(auth)
picture = '/root/pwnagotchi.png'
tweet = Voice(lang=config['main']['lang']).on_last_session_tweet(last_session)
api.update_with_media(filename=picture, status=tweet)
last_session.save_session_id()
display.on_manual_mode(last_session)
display.update(force=True)
display.image().save(picture, 'png')
display.set('status', 'Tweeting...')
display.update(force=True)
logging.info("tweeted: %s" % tweet)
except Exception as e:
logging.exception("error while tweeting")
try:
auth = tweepy.OAuthHandler(self.options['consumer_key'], self.options['consumer_secret'])
auth.set_access_token(self.options['access_token_key'], self.options['access_token_secret'])
api = tweepy.API(auth)
tweet = Voice(lang=config['main']['lang']).on_last_session_tweet(last_session)
api.update_with_media(filename=picture, status=tweet)
last_session.save_session_id()
logging.info("tweeted: %s" % tweet)
except Exception as e:
logging.exception("error while tweeting")

View File

@@ -1,23 +1,18 @@
# Based on UPS Lite v1.1 from https://github.com/xenDE
#
# funtions for get UPS status - needs enable "i2c" in raspi-config
# functions for get UPS status - needs enable "i2c" in raspi-config
#
# https://github.com/linshuqin329/UPS-Lite
#
# For Raspberry Pi Zero Ups Power Expansion Board with Integrated Serial Port S3U4
# https://www.ebay.de/itm/For-Raspberry-Pi-Zero-Ups-Power-Expansion-Board-with-Integrated-Serial-Port-S3U4/323873804310
# https://www.aliexpress.com/item/32888533624.html
__author__ = 'evilsocket@gmail.com'
__version__ = '1.0.0'
__name__ = 'ups_lite'
__license__ = 'GPL3'
__description__ = 'A plugin that will add a voltage indicator for the UPS Lite v1.1'
import struct
from pwnagotchi.ui.components import LabeledValue
from pwnagotchi.ui.view import BLACK
import pwnagotchi.ui.fonts as fonts
import pwnagotchi.plugins as plugins
# TODO: add enable switch in config.yml an cleanup all to the best place
@@ -47,18 +42,21 @@ class UPS:
return 0.0
ups = None
class UPSLite(plugins.Plugin):
__author__ = 'evilsocket@gmail.com'
__version__ = '1.0.0'
__license__ = 'GPL3'
__description__ = 'A plugin that will add a voltage indicator for the UPS Lite v1.1'
def __init__(self):
self.ups = None
def on_loaded():
global ups
ups = UPS()
def on_loaded(self):
self.ups = UPS()
def on_ui_setup(self, ui):
ui.add_element('ups', LabeledValue(color=BLACK, label='UPS', value='0%/0V', position=(ui.width() / 2 - 25, 0),
label_font=fonts.Bold, text_font=fonts.Medium))
def on_ui_setup(ui):
ui.add_element('ups', LabeledValue(color=BLACK, label='UPS', value='0%/0V', position=(ui.width() / 2 - 25, 0),
label_font=fonts.Bold, text_font=fonts.Medium))
def on_ui_update(ui):
ui.set('ups', "%4.2fV/%2i%%" % (ups.voltage(), ups.capacity()))
def on_ui_update(self, ui):
ui.set('ups', "%4.2fV/%2i%%" % (self.ups.voltage(), self.ups.capacity()))

View File

@@ -1,9 +1,3 @@
__author__ = '33197631+dadav@users.noreply.github.com'
__version__ = '1.0.0'
__name__ = 'wigle'
__license__ = 'GPL3'
__description__ = 'This plugin automatically uploades collected wifis to wigle.net'
import os
import logging
import json
@@ -11,112 +5,8 @@ from io import StringIO
import csv
from datetime import datetime
import requests
from pwnagotchi.mesh.wifi import freq_to_channel
from pwnagotchi.utils import WifiInfo, FieldNotFoundError, extract_from_pcap
READY = False
ALREADY_UPLOADED = None
SKIP = None
OPTIONS = dict()
AKMSUITE_TYPES = {
0x00: "Reserved",
0x01: "802.1X",
0x02: "PSK",
}
def _handle_packet(packet, result):
from scapy.all import RadioTap, Dot11Elt, Dot11Beacon, rdpcap, Scapy_Exception, Dot11, Dot11ProbeResp, Dot11AssoReq, \
Dot11ReassoReq, Dot11EltRSN, Dot11EltVendorSpecific, Dot11EltMicrosoftWPA
"""
Analyze each packet and extract the data from Dot11 layers
"""
if hasattr(packet, 'cap') and 'privacy' in packet.cap:
# packet is encrypted
if 'encryption' not in result:
result['encryption'] = set()
if packet.haslayer(Dot11Beacon):
if packet.haslayer(Dot11Beacon)\
or packet.haslayer(Dot11ProbeResp)\
or packet.haslayer(Dot11AssoReq)\
or packet.haslayer(Dot11ReassoReq):
if 'bssid' not in result and hasattr(packet[Dot11], 'addr3'):
result['bssid'] = packet[Dot11].addr3
if 'essid' not in result and hasattr(packet[Dot11Elt], 'info'):
result['essid'] = packet[Dot11Elt].info
if 'channel' not in result and hasattr(packet[Dot11Elt:3], 'info'):
result['channel'] = int(ord(packet[Dot11Elt:3].info))
if packet.haslayer(RadioTap):
if 'rssi' not in result and hasattr(packet[RadioTap], 'dBm_AntSignal'):
result['rssi'] = packet[RadioTap].dBm_AntSignal
if 'channel' not in result and hasattr(packet[RadioTap], 'ChannelFrequency'):
result['channel'] = freq_to_channel(packet[RadioTap].ChannelFrequency)
# see: https://fossies.org/linux/scapy/scapy/layers/dot11.py
if packet.haslayer(Dot11EltRSN):
if hasattr(packet[Dot11EltRSN], 'akm_suites'):
auth = AKMSUITE_TYPES.get(packet[Dot11EltRSN].akm_suites[0].suite)
result['encryption'].add(f"WPA2/{auth}")
else:
result['encryption'].add("WPA2")
if packet.haslayer(Dot11EltVendorSpecific)\
and (packet.haslayer(Dot11EltMicrosoftWPA)
or packet.info.startswith(b'\x00P\xf2\x01\x01\x00')):
if hasattr(packet, 'akm_suites'):
auth = AKMSUITE_TYPES.get(packet.akm_suites[0].suite)
result['encryption'].add(f"WPA2/{auth}")
else:
result['encryption'].add("WPA2")
# end see
return result
def _analyze_pcap(pcap):
from scapy.all import RadioTap, Dot11Elt, Dot11Beacon, rdpcap, Scapy_Exception, Dot11, Dot11ProbeResp, Dot11AssoReq, \
Dot11ReassoReq, Dot11EltRSN, Dot11EltVendorSpecific, Dot11EltMicrosoftWPA
"""
Iterate over the packets and extract data
"""
result = dict()
try:
packets = rdpcap(pcap)
for packet in packets:
result = _handle_packet(packet, result)
except Scapy_Exception as sc_e:
raise sc_e
return result
def on_loaded():
"""
Gets called when the plugin gets loaded
"""
global READY
global ALREADY_UPLOADED
global SKIP
SKIP = list()
if 'api_key' not in OPTIONS or ('api_key' in OPTIONS and OPTIONS['api_key'] is None):
logging.error("WIGLE: api_key isn't set. Can't upload to wigle.net")
return
try:
with open('/root/.wigle_uploads', 'r') as f:
ALREADY_UPLOADED = f.read().splitlines()
except OSError:
logging.warning('WIGLE: No upload-file found.')
ALREADY_UPLOADED = []
READY = True
from pwnagotchi.utils import WifiInfo, FieldNotFoundError, extract_from_pcap, StatusFile
import pwnagotchi.plugins as plugins
def _extract_gps_data(path):
@@ -141,16 +31,19 @@ def _format_auth(data):
out = f"{out}[{auth}]"
return out
def _transform_wigle_entry(gps_data, pcap_data):
"""
Transform to wigle entry in file
"""
dummy = StringIO()
# write kismet header
dummy.write("WigleWifi-1.4,appRelease=20190201,model=Kismet,release=2019.02.01.{},device=kismet,display=kismet,board=kismet,brand=kismet\n")
dummy.write("MAC,SSID,AuthMode,FirstSeen,Channel,RSSI,CurrentLatitude,CurrentLongitude,AltitudeMeters,AccuracyMeters,Type")
dummy.write(
"WigleWifi-1.4,appRelease=20190201,model=Kismet,release=2019.02.01.{},device=kismet,display=kismet,board=kismet,brand=kismet\n")
dummy.write(
"MAC,SSID,AuthMode,FirstSeen,Channel,RSSI,CurrentLatitude,CurrentLongitude,AltitudeMeters,AccuracyMeters,Type")
writer = csv.writer(dummy, delimiter=",", quoting=csv.QUOTE_NONE)
writer = csv.writer(dummy, delimiter=",", quoting=csv.QUOTE_NONE, escapechar="\\")
writer.writerow([
pcap_data[WifiInfo.BSSID],
pcap_data[WifiInfo.ESSID],
@@ -162,10 +55,11 @@ def _transform_wigle_entry(gps_data, pcap_data):
gps_data['Latitude'],
gps_data['Longitude'],
gps_data['Altitude'],
0, # accuracy?
0, # accuracy?
'WIFI'])
return dummy.getvalue()
def _send_to_wigle(lines, api_key, timeout=30):
"""
Uploads the file to wigle-net
@@ -196,89 +90,100 @@ def _send_to_wigle(lines, api_key, timeout=30):
raise re_e
def on_internet_available(agent):
from scapy.all import RadioTap, Dot11Elt, Dot11Beacon, rdpcap, Scapy_Exception, Dot11, Dot11ProbeResp, Dot11AssoReq, \
Dot11ReassoReq, Dot11EltRSN, Dot11EltVendorSpecific, Dot11EltMicrosoftWPA
"""
Called in manual mode when there's internet connectivity
"""
global ALREADY_UPLOADED
global SKIP
class Wigle(plugins.Plugin):
__author__ = '33197631+dadav@users.noreply.github.com'
__version__ = '2.0.0'
__license__ = 'GPL3'
__description__ = 'This plugin automatically uploads collected wifis to wigle.net'
if READY:
config = agent.config()
display = agent.view()
def __init__(self):
self.ready = False
self.report = StatusFile('/root/.wigle_uploads', data_format='json')
self.skip = list()
handshake_dir = config['bettercap']['handshakes']
all_files = os.listdir(handshake_dir)
all_gps_files = [os.path.join(handshake_dir, filename)
for filename in all_files
if filename.endswith('.gps.json')]
new_gps_files = set(all_gps_files) - set(ALREADY_UPLOADED) - set(SKIP)
def on_loaded(self):
if 'api_key' not in self.options or ('api_key' in self.options and self.options['api_key'] is None):
logging.error("WIGLE: api_key isn't set. Can't upload to wigle.net")
return
self.ready = True
if new_gps_files:
logging.info("WIGLE: Internet connectivity detected. Uploading new handshakes to wigle.net")
def on_internet_available(self, agent):
from scapy.all import Scapy_Exception
"""
Called in manual mode when there's internet connectivity
"""
if self.ready:
config = agent.config()
display = agent.view()
reported = self.report.data_field_or('reported', default=list())
csv_entries = list()
no_err_entries = list()
handshake_dir = config['bettercap']['handshakes']
all_files = os.listdir(handshake_dir)
all_gps_files = [os.path.join(handshake_dir, filename)
for filename in all_files
if filename.endswith('.gps.json')]
new_gps_files = set(all_gps_files) - set(reported) - set(self.skip)
for gps_file in new_gps_files:
pcap_filename = gps_file.replace('.gps.json', '.pcap')
if new_gps_files:
logging.info("WIGLE: Internet connectivity detected. Uploading new handshakes to wigle.net")
if not os.path.exists(pcap_filename):
logging.error("WIGLE: Can't find pcap for %s", gps_file)
SKIP.append(gps_file)
continue
csv_entries = list()
no_err_entries = list()
try:
gps_data = _extract_gps_data(gps_file)
except OSError as os_err:
logging.error("WIGLE: %s", os_err)
SKIP.append(gps_file)
continue
except json.JSONDecodeError as json_err:
logging.error("WIGLE: %s", json_err)
SKIP.append(gps_file)
continue
for gps_file in new_gps_files:
pcap_filename = gps_file.replace('.gps.json', '.pcap')
if gps_data['Latitude'] == 0 and gps_data['Longitude'] == 0:
logging.warning("WIGLE: Not enough gps-informations for %s. Trying again next time.", gps_file)
SKIP.append(gps_file)
continue
if not os.path.exists(pcap_filename):
logging.error("WIGLE: Can't find pcap for %s", gps_file)
self.skip.append(gps_file)
continue
try:
gps_data = _extract_gps_data(gps_file)
except OSError as os_err:
logging.error("WIGLE: %s", os_err)
self.skip.append(gps_file)
continue
except json.JSONDecodeError as json_err:
logging.error("WIGLE: %s", json_err)
self.skip.append(gps_file)
continue
try:
pcap_data = extract_from_pcap(pcap_filename, [WifiInfo.BSSID,
WifiInfo.ESSID,
WifiInfo.ENCRYPTION,
WifiInfo.CHANNEL,
WifiInfo.RSSI])
except FieldNotFoundError:
logging.error("WIGLE: Could not extract all informations. Skip %s", gps_file)
SKIP.append(gps_file)
continue
except Scapy_Exception as sc_e:
logging.error("WIGLE: %s", sc_e)
SKIP.append(gps_file)
continue
if gps_data['Latitude'] == 0 and gps_data['Longitude'] == 0:
logging.warning("WIGLE: Not enough gps-information for %s. Trying again next time.", gps_file)
self.skip.append(gps_file)
continue
new_entry = _transform_wigle_entry(gps_data, pcap_data)
csv_entries.append(new_entry)
no_err_entries.append(gps_file)
try:
pcap_data = extract_from_pcap(pcap_filename, [WifiInfo.BSSID,
WifiInfo.ESSID,
WifiInfo.ENCRYPTION,
WifiInfo.CHANNEL,
WifiInfo.RSSI])
except FieldNotFoundError:
logging.error("WIGLE: Could not extract all information. Skip %s", gps_file)
self.skip.append(gps_file)
continue
except Scapy_Exception as sc_e:
logging.error("WIGLE: %s", sc_e)
self.skip.append(gps_file)
continue
if csv_entries:
display.set('status', "Uploading gps-data to wigle.net ...")
display.update(force=True)
try:
_send_to_wigle(csv_entries, OPTIONS['api_key'])
ALREADY_UPLOADED += no_err_entries
with open('/root/.wigle_uploads', 'a') as up_file:
for gps in no_err_entries:
up_file.write(gps + "\n")
logging.info("WIGLE: Successfuly uploaded %d files", len(no_err_entries))
except requests.exceptions.RequestException as re_e:
SKIP += no_err_entries
logging.error("WIGLE: Got an exception while uploading %s", re_e)
except OSError as os_e:
SKIP += no_err_entries
logging.error("WIGLE: Got the following error: %s", os_e)
new_entry = _transform_wigle_entry(gps_data, pcap_data)
csv_entries.append(new_entry)
no_err_entries.append(gps_file)
if csv_entries:
display.set('status', "Uploading gps-data to wigle.net ...")
display.update(force=True)
try:
_send_to_wigle(csv_entries, self.options['api_key'])
reported += no_err_entries
self.report.update(data={'reported': reported})
logging.info("WIGLE: Successfully uploaded %d files", len(no_err_entries))
except requests.exceptions.RequestException as re_e:
self.skip += no_err_entries
logging.error("WIGLE: Got an exception while uploading %s", re_e)
except OSError as os_e:
self.skip += no_err_entries
logging.error("WIGLE: Got the following error: %s", os_e)

View File

@@ -1,86 +1,84 @@
__author__ = '33197631+dadav@users.noreply.github.com'
__version__ = '1.0.0'
__name__ = 'wpa-sec'
__license__ = 'GPL3'
__description__ = 'This plugin automatically uploades handshakes to https://wpa-sec.stanev.org'
import os
import logging
import requests
READY = False
ALREADY_UPLOADED = None
from pwnagotchi.utils import StatusFile
import pwnagotchi.plugins as plugins
def on_loaded():
"""
Gets called when the plugin gets loaded
"""
global READY
global API_KEY
global ALREADY_UPLOADED
class WpaSec(plugins.Plugin):
__author__ = '33197631+dadav@users.noreply.github.com'
__version__ = '2.0.1'
__license__ = 'GPL3'
__description__ = 'This plugin automatically uploads handshakes to https://wpa-sec.stanev.org'
if not 'api_key' in OPTIONS or ('api_key' in OPTIONS and OPTIONS['api_key'] is None):
logging.error("WPA_SEC: API-KEY isn't set. Can't upload to wpa-sec.stanev.org")
return
def __init__(self):
self.ready = False
self.report = StatusFile('/root/.wpa_sec_uploads', data_format='json')
self.options = dict()
self.skip = list()
try:
with open('/root/.wpa_sec_uploads', 'r') as f:
ALREADY_UPLOADED = f.read().splitlines()
except OSError:
logging.warning('WPA_SEC: No upload-file found.')
ALREADY_UPLOADED = []
def _upload_to_wpasec(self, path, timeout=30):
"""
Uploads the file to https://wpa-sec.stanev.org, or another endpoint.
"""
with open(path, 'rb') as file_to_upload:
cookie = {'key': self.options['api_key']}
payload = {'file': file_to_upload}
READY = True
try:
result = requests.post(self.options['api_url'],
cookies=cookie,
files=payload,
timeout=timeout)
if ' already submitted' in result.text:
logging.warning("%s was already submitted.", path)
except requests.exceptions.RequestException as req_e:
raise req_e
def on_loaded(self):
"""
Gets called when the plugin gets loaded
"""
if 'api_key' not in self.options or ('api_key' in self.options and self.options['api_key'] is None):
logging.error("WPA_SEC: API-KEY isn't set. Can't upload to wpa-sec.stanev.org")
return
def _upload_to_wpasec(path, timeout=30):
"""
Uploads the file to wpa-sec.stanev.org
"""
with open(path, 'rb') as file_to_upload:
headers = {'key': OPTIONS['api_key']}
payload = {'file': file_to_upload}
if 'api_url' not in self.options or ('api_url' in self.options and self.options['api_url'] is None):
logging.error("WPA_SEC: API-URL isn't set. Can't upload, no endpoint configured.")
return
try:
result = requests.post('https://wpa-sec.stanev.org/?submit',
headers=headers,
files=payload,
timeout=timeout)
if ' already submitted' in result.text:
logging.warning(f"{path} was already submitted.")
except requests.exceptions.RequestException as e:
logging.error(f"WPA_SEC: Got an exception while uploading {path} -> {e}")
raise e
self.ready = True
def on_internet_available(self, agent):
"""
Called in manual mode when there's internet connectivity
"""
if self.ready:
config = agent.config()
display = agent.view()
reported = self.report.data_field_or('reported', default=list())
def on_internet_available(agent):
"""
Called in manual mode when there's internet connectivity
"""
if READY:
config = agent.config()
display = agent.view()
handshake_dir = config['bettercap']['handshakes']
handshake_filenames = os.listdir(handshake_dir)
handshake_paths = [os.path.join(handshake_dir, filename) for filename in handshake_filenames if
filename.endswith('.pcap')]
handshake_new = set(handshake_paths) - set(reported) - set(self.skip)
handshake_dir = config['bettercap']['handshakes']
handshake_filenames = os.listdir(handshake_dir)
handshake_paths = [os.path.join(handshake_dir, filename) for filename in handshake_filenames if filename.endswith('.pcap')]
handshake_new = set(handshake_paths) - set(ALREADY_UPLOADED)
if handshake_new:
logging.info("WPA_SEC: Internet connectivity detected. Uploading new handshakes to wpa-sec.stanev.org")
if handshake_new:
logging.info("WPA_SEC: Internet connectivity detected.\
Uploading new handshakes to wpa-sec.stanev.org")
for idx, handshake in enumerate(handshake_new):
display.set('status', f"Uploading handshake to wpa-sec.stanev.org ({idx + 1}/{len(handshake_new)})")
display.update(force=True)
try:
_upload_to_wpasec(handshake)
ALREADY_UPLOADED.append(handshake)
with open('/root/.wpa_sec_uploads', 'a') as f:
f.write(handshake + "\n")
logging.info(f"WPA_SEC: Successfuly uploaded {handshake}")
except requests.exceptions.RequestException:
pass
except OSError as os_e:
logging.error(f"WPA_SEC: Got the following error: {os_e}")
for idx, handshake in enumerate(handshake_new):
display.set('status', f"Uploading handshake to wpa-sec.stanev.org ({idx + 1}/{len(handshake_new)})")
display.update(force=True)
try:
self._upload_to_wpasec(handshake)
reported.append(handshake)
self.report.update(data={'reported': reported})
logging.info("WPA_SEC: Successfully uploaded %s", handshake)
except requests.exceptions.RequestException as req_e:
self.skip.append(handshake)
logging.error("WPA_SEC: %s", req_e)
continue
except OSError as os_e:
logging.error("WPA_SEC: %s", os_e)
continue

View File

@@ -1,251 +1,79 @@
import _thread
from threading import Lock
from PIL import Image
import shutil
import logging
import os
import pwnagotchi, pwnagotchi.plugins as plugins
import logging
import threading
from pwnagotchi.ui.view import WHITE, View
from http.server import BaseHTTPRequestHandler, HTTPServer
class VideoHandler(BaseHTTPRequestHandler):
_lock = Lock()
_index = """<html>
<head>
<title>%s</title>
<style>
.block {
-webkit-appearance: button;
-moz-appearance: button;
appearance: button;
display: block;
cursor: pointer;
text-align: center;
}
</style>
</head>
<body>
<div style="position: absolute; top:0; left:0; width:100%%;">
<img src="/ui" id="ui" style="width:100%%"/>
<br/>
<hr/>
<form action="/shutdown" onsubmit="return confirm('This will halt the unit, continue?');">
<input type="submit" class="block" value="Shutdown"/>
</form>
</div>
<script type="text/javascript">
window.onload = function() {
var image = document.getElementById("ui");
function updateImage() {
image.src = image.src.split("?")[0] + "?" + new Date().getTime();
}
setInterval(updateImage, %d);
}
</script>
</body>
</html>"""
@staticmethod
def render(img):
with VideoHandler._lock:
img.save("/root/pwnagotchi.png", format='PNG')
def log_message(self, format, *args):
return
def do_GET(self):
if self.path == '/':
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
try:
self.wfile.write(bytes(self._index % (pwnagotchi.name(), 1000), "utf8"))
except:
pass
elif self.path.startswith('/shutdown'):
pwnagotchi.shutdown()
elif self.path.startswith('/ui'):
with self._lock:
self.send_response(200)
self.send_header('Content-type', 'image/png')
self.end_headers()
try:
with open("/root/pwnagotchi.png", 'rb') as fp:
shutil.copyfileobj(fp, self.wfile)
except:
pass
else:
self.send_response(404)
import pwnagotchi.plugins as plugins
import pwnagotchi.ui.hw as hw
from pwnagotchi.ui.view import View
class Display(View):
def __init__(self, config, state={}):
super(Display, self).__init__(config, state)
self._enabled = config['ui']['display']['enabled']
self._rotation = config['ui']['display']['rotation']
self._video_enabled = config['ui']['display']['video']['enabled']
self._video_port = config['ui']['display']['video']['port']
self._video_address = config['ui']['display']['video']['address']
self._display_type = config['ui']['display']['type']
self._display_color = config['ui']['display']['color']
super(Display, self).__init__(config, hw.display_for(config), state)
config = config['ui']['display']
self._render_cb = None
self._display = None
self._httpd = None
self._enabled = config['enabled']
self._rotation = config['rotation']
if self._enabled:
self._init_display()
else:
self.on_render(self._on_view_rendered)
logging.warning("display module is disabled")
self.init_display()
if self._video_enabled:
_thread.start_new_thread(self._http_serve, ())
self._canvas_next_event = threading.Event()
self._canvas_next = None
self._render_thread_instance = threading.Thread(
target=self._render_thread,
daemon=True
)
self._render_thread_instance.start()
def _http_serve(self):
if self._video_address is not None:
self._httpd = HTTPServer((self._video_address, self._video_port), VideoHandler)
logging.info("ui available at http://%s:%d/" % (self._video_address, self._video_port))
self._httpd.serve_forever()
else:
logging.info("could not get ip of usb0, video server not starting")
def set_ready(self):
self._webui.start()
def is_inky(self):
return self._display_type in ('inkyphat', 'inky')
return self._implementation.name == 'inky'
def is_papirus(self):
return self._display_type in ('papirus', 'papi')
return self._implementation.name == 'papirus'
def is_waveshare_v1(self):
return self._display_type in ('waveshare_1', 'ws_1', 'waveshare1', 'ws1')
return self._implementation.name == 'waveshare_1'
def is_waveshare_v2(self):
return self._display_type in ('waveshare_2', 'ws_2', 'waveshare2', 'ws2')
return self._implementation.name == 'waveshare_2'
def is_waveshare27inch(self):
return self._implementation.name == 'waveshare27inch'
def is_waveshare29inch(self):
return self._implementation.name == 'waveshare29inch'
def is_oledhat(self):
return self._implementation.name == 'oledhat'
def is_lcdhat(self):
return self._implementation.name == 'lcdhat'
def is_dfrobot(self):
return self._implementation.name == 'dfrobot'
def is_waveshare154inch(self):
return self._implementation.name == 'waveshare154inch'
def is_waveshare213d(self):
return self._implementation.name == 'waveshare213d'
def is_waveshare_any(self):
return self.is_waveshare_v1() or self.is_waveshare_v2()
def _init_display(self):
if self.is_inky():
logging.info("initializing inky display")
from inky import InkyPHAT
self._display = InkyPHAT(self._display_color)
self._display.set_border(InkyPHAT.BLACK)
self._render_cb = self._inky_render
elif self.is_papirus():
logging.info("initializing papirus display")
from pwnagotchi.ui.papirus.epd import EPD
os.environ['EPD_SIZE'] = '2.0'
self._display = EPD()
self._display.clear()
self._render_cb = self._papirus_render
elif self.is_waveshare_v1():
if self._display_color == 'black':
logging.info("initializing waveshare v1 display in monochromatic mode")
from pwnagotchi.ui.waveshare.v1.epd2in13 import EPD
self._display = EPD()
self._display.init(self._display.lut_full_update)
self._display.Clear(0xFF)
self._display.init(self._display.lut_partial_update)
self._render_cb = self._waveshare_render
else:
logging.info("initializing waveshare v1 display 3-color mode")
from pwnagotchi.ui.waveshare.v1.epd2in13bc import EPD
self._display = EPD()
self._display.init()
self._display.Clear()
self._render_cb = self._waveshare_bc_render
elif self.is_waveshare_v2():
logging.info("initializing waveshare v2 display")
from pwnagotchi.ui.waveshare.v2.waveshare import EPD
self._display = EPD()
self._display.init(self._display.FULL_UPDATE)
self._display.Clear(WHITE)
self._display.init(self._display.PART_UPDATE)
self._render_cb = self._waveshare_render
def init_display(self):
if self._enabled:
self._implementation.initialize()
plugins.on('display_setup', self._implementation)
else:
logging.critical("unknown display type %s" % self._display_type)
plugins.on('display_setup', self._display)
logging.warning("display module is disabled")
self.on_render(self._on_view_rendered)
def clear(self):
if self._display is None:
logging.error("no display object created")
elif self.is_inky():
self._display.Clear()
elif self.is_papirus():
self._display.clear()
elif self.is_waveshare_any():
self._display.Clear(WHITE)
else:
logging.critical("unknown display type %s" % self._display_type)
def _inky_render(self):
if self._display_color != 'mono':
display_colors = 3
else:
display_colors = 2
img_buffer = self._canvas.convert('RGB').convert('P', palette=1, colors=display_colors)
if self._display_color == 'red':
img_buffer.putpalette([
255, 255, 255, # index 0 is white
0, 0, 0, # index 1 is black
255, 0, 0 # index 2 is red
])
elif self._display_color == 'yellow':
img_buffer.putpalette([
255, 255, 255, # index 0 is white
0, 0, 0, # index 1 is black
255, 255, 0 # index 2 is yellow
])
else:
img_buffer.putpalette([
255, 255, 255, # index 0 is white
0, 0, 0 # index 1 is black
])
self._display.set_image(img_buffer)
try:
self._display.show()
except:
logging.exception("error while rendering on inky")
def _papirus_render(self):
self._display.display(self._canvas)
self._display.partial_update()
def _waveshare_render(self):
buf = self._display.getbuffer(self._canvas)
if self.is_waveshare_v1():
self._display.display(buf)
elif self.is_waveshare_v2():
self._display.displayPartial(buf)
def _waveshare_bc_render(self):
buf_black = self._display.getbuffer(self._canvas)
# emptyImage = Image.new('1', (self._display.height, self._display.width), 255)
# buf_color = self._display.getbuffer(emptyImage)
# self._display.display(buf_black,buf_color)
# Custom display function that only handles black
# Was included in epd2in13bc.py
self._display.displayBlack(buf_black)
self._implementation.clear()
def image(self):
img = None
@@ -253,10 +81,23 @@ class Display(View):
img = self._canvas if self._rotation == 0 else self._canvas.rotate(-self._rotation)
return img
def _render_thread(self):
"""Used for non-blocking screen updating."""
while True:
self._canvas_next_event.wait()
self._canvas_next_event.clear()
self._implementation.render(self._canvas_next)
def _on_view_rendered(self, img):
VideoHandler.render(img)
try:
if self._config['ui']['display']['video']['on_frame'] != '':
os.system(self._config['ui']['display']['video']['on_frame'])
except Exception as e:
logging.error("%s" % e)
if self._enabled:
self._canvas = (img if self._rotation == 0 else img.rotate(self._rotation))
if self._render_cb is not None:
self._render_cb()
if self._implementation is not None:
self._canvas_next = self._canvas
self._canvas_next_event.set()

View File

@@ -1,18 +1,27 @@
LOOK_R = '(⌐■_■)'
LOOK_L = '(■_■¬)'
LOOK_R = '( ⚆_⚆)'
LOOK_L = '(☉_☉ )'
LOOK_R_HAPPY = '( ◕‿◕)'
LOOK_L_HAPPY = '(◕‿◕ )'
SLEEP = '(⇀‿‿↼)'
SLEEP2 = '(≖‿‿≖)'
AWAKE = '(◕‿‿◕)'
BORED = '(-__-)'
INTENSE = '(°▃▃°)'
COOL = '(⊙☁◉┐)'
COOL = '(⌐■_■)'
HAPPY = '(•‿‿•)'
GRATEFUL = '(^‿‿^)'
EXCITED = '(ᵔ◡◡ᵔ)'
MOTIVATED = '(☼‿‿☼)'
DEMOTIVATED = '(≖__≖)'
SMART = '(✜‿‿✜)'
LONELY = '(ب__ب)'
SAD = '(╥☁╥ )'
ANGRY = "(-_-')"
FRIEND = '(♥‿‿♥)'
BROKEN = '(☓‿‿☓)'
DEBUG = '(#__#)'
def load_from_config(config):
for face_name, face_value in config.items():
globals()[face_name.upper()] = face_value

View File

@@ -0,0 +1,47 @@
from pwnagotchi.ui.hw.inky import Inky
from pwnagotchi.ui.hw.papirus import Papirus
from pwnagotchi.ui.hw.oledhat import OledHat
from pwnagotchi.ui.hw.lcdhat import LcdHat
from pwnagotchi.ui.hw.dfrobot import DFRobot
from pwnagotchi.ui.hw.waveshare1 import WaveshareV1
from pwnagotchi.ui.hw.waveshare2 import WaveshareV2
from pwnagotchi.ui.hw.waveshare27inch import Waveshare27inch
from pwnagotchi.ui.hw.waveshare29inch import Waveshare29inch
from pwnagotchi.ui.hw.waveshare154inch import Waveshare154inch
from pwnagotchi.ui.hw.waveshare213d import Waveshare213d
def display_for(config):
# config has been normalized already in utils.load_config
if config['ui']['display']['type'] == 'inky':
return Inky(config)
elif config['ui']['display']['type'] == 'papirus':
return Papirus(config)
if config['ui']['display']['type'] == 'oledhat':
return OledHat(config)
if config['ui']['display']['type'] == 'lcdhat':
return LcdHat(config)
if config['ui']['display']['type'] == 'dfrobot':
return DFRobot(config)
elif config['ui']['display']['type'] == 'waveshare_1':
return WaveshareV1(config)
elif config['ui']['display']['type'] == 'waveshare_2':
return WaveshareV2(config)
elif config['ui']['display']['type'] == 'waveshare27inch':
return Waveshare27inch(config)
elif config['ui']['display']['type'] == 'waveshare29inch':
return Waveshare29inch(config)
elif config['ui']['display']['type'] == 'waveshare154inch':
return Waveshare154inch(config)
elif config['ui']['display']['type'] == 'waveshare213d':
return Waveshare213d(config)

40
pwnagotchi/ui/hw/base.py Normal file
View File

@@ -0,0 +1,40 @@
import pwnagotchi.ui.fonts as fonts
class DisplayImpl(object):
def __init__(self, config, name):
self.name = name
self.config = config['ui']['display']
self._layout = {
'width': 0,
'height': 0,
'face': (0, 0),
'name': (0, 0),
'channel': (0, 0),
'aps': (0, 0),
'uptime': (0, 0),
'line1': (0, 0),
'line2': (0, 0),
'friend_face': (0, 0),
'friend_name': (0, 0),
'shakes': (0, 0),
'mode': (0, 0),
# status is special :D
'status': {
'pos': (0, 0),
'font': fonts.Medium,
'max': 20
}
}
def layout(self):
raise NotImplementedError
def initialize(self):
raise NotImplementedError
def render(self, canvas):
raise NotImplementedError
def clear(self):
raise NotImplementedError

View File

@@ -0,0 +1,43 @@
import logging
import pwnagotchi.ui.fonts as fonts
from pwnagotchi.ui.hw.base import DisplayImpl
class DFRobot(DisplayImpl):
def __init__(self, config):
super(DFRobot, self).__init__(config, 'dfrobot')
self._display = None
def layout(self):
fonts.setup(10, 9, 10, 35)
self._layout['width'] = 250
self._layout['height'] = 122
self._layout['face'] = (0, 40)
self._layout['name'] = (5, 20)
self._layout['channel'] = (0, 0)
self._layout['aps'] = (28, 0)
self._layout['uptime'] = (185, 0)
self._layout['line1'] = [0, 14, 250, 14]
self._layout['line2'] = [0, 108, 250, 108]
self._layout['friend_face'] = (0, 92)
self._layout['friend_name'] = (40, 94)
self._layout['shakes'] = (0, 109)
self._layout['mode'] = (225, 109)
self._layout['status'] = {
'pos': (125, 20),
'font': fonts.Medium,
'max': 20
}
return self._layout
def initialize(self):
logging.info("initializing dfrobot display")
from pwnagotchi.ui.hw.libs.dfrobot.dfrobot import DFRobot
self._display = DFRobot()
def render(self, canvas):
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear(0xFF)

82
pwnagotchi/ui/hw/inky.py Normal file
View File

@@ -0,0 +1,82 @@
import logging
import pwnagotchi.ui.fonts as fonts
from pwnagotchi.ui.hw.base import DisplayImpl
class Inky(DisplayImpl):
def __init__(self, config):
super(Inky, self).__init__(config, 'inky')
self._display = None
def layout(self):
fonts.setup(10, 8, 10, 28)
self._layout['width'] = 212
self._layout['height'] = 104
self._layout['face'] = (0, 37)
self._layout['name'] = (5, 18)
self._layout['channel'] = (0, 0)
self._layout['aps'] = (30, 0)
self._layout['uptime'] = (147, 0)
self._layout['line1'] = [0, 12, 212, 12]
self._layout['line2'] = [0, 92, 212, 92]
self._layout['friend_face'] = (0, 76)
self._layout['friend_name'] = (40, 78)
self._layout['shakes'] = (0, 93)
self._layout['mode'] = (187, 93)
self._layout['status'] = {
'pos': (102, 18),
'font': fonts.Small,
'max': 20
}
return self._layout
def initialize(self):
logging.info("initializing inky display")
if self.config['color'] == 'fastAndFurious':
logging.info("Initializing Inky in 2-color FAST MODE")
logging.info("THIS MAY BE POTENTIALLY DANGEROUS. NO WARRANTY IS PROVIDED")
logging.info("USE THIS DISPLAY IN THIS MODE AT YOUR OWN RISK")
from pwnagotchi.ui.hw.libs.inkyphat.inkyphatfast import InkyPHATFast
self._display = InkyPHATFast('black')
self._display.set_border(InkyPHATFast.BLACK)
else:
from inky import InkyPHAT
self._display = InkyPHAT(self.config['color'])
self._display.set_border(InkyPHAT.BLACK)
def render(self, canvas):
if self.config['color'] == 'black' or self.config['color'] == 'fastAndFurious':
display_colors = 2
else:
display_colors = 3
img_buffer = canvas.convert('RGB').convert('P', palette=1, colors=display_colors)
if self.config['color'] == 'red':
img_buffer.putpalette([
255, 255, 255, # index 0 is white
0, 0, 0, # index 1 is black
255, 0, 0 # index 2 is red
])
elif self.config['color'] == 'yellow':
img_buffer.putpalette([
255, 255, 255, # index 0 is white
0, 0, 0, # index 1 is black
255, 255, 0 # index 2 is yellow
])
else:
img_buffer.putpalette([
255, 255, 255, # index 0 is white
0, 0, 0 # index 1 is black
])
self._display.set_image(img_buffer)
try:
self._display.show()
except:
logging.exception("error while rendering on inky")
def clear(self):
self._display.Clear()

View File

@@ -0,0 +1,46 @@
import logging
import pwnagotchi.ui.fonts as fonts
from pwnagotchi.ui.hw.base import DisplayImpl
class LcdHat(DisplayImpl):
def __init__(self, config):
super(LcdHat, self).__init__(config, 'lcdhat')
self._display = None
def layout(self):
fonts.setup(10, 9, 10, 35)
self._layout['width'] = 240
self._layout['height'] = 240
self._layout['face'] = (0, 40)
self._layout['name'] = (5, 20)
self._layout['channel'] = (0, 0)
self._layout['aps'] = (28, 0)
self._layout['uptime'] = (175, 0)
self._layout['line1'] = [0, 14, 240, 14]
self._layout['line2'] = [0, 108, 240, 108]
self._layout['friend_face'] = (0, 92)
self._layout['friend_name'] = (40, 94)
self._layout['shakes'] = (0, 109)
self._layout['mode'] = (215, 109)
self._layout['status'] = {
'pos': (125, 20),
'font': fonts.Medium,
'max': 20
}
return self._layout
def initialize(self):
logging.info("initializing lcdhat display")
from pwnagotchi.ui.hw.libs.waveshare.lcdhat.epd import EPD
self._display = EPD()
self._display.init()
self._display.clear()
def render(self, canvas):
self._display.display(canvas)
def clear(self):
self._display.clear()

View File

@@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random
Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@@ -0,0 +1,66 @@
# DFRobot display support
import logging
from . import dfrobot_epaper
#Resolution of display
WIDTH = 250
HEIGHT = 122
RASPBERRY_SPI_BUS = 0
RASPBERRY_SPI_DEV = 0
RASPBERRY_PIN_CS = 27
RASPBERRY_PIN_CD = 17
RASPBERRY_PIN_BUSY = 4
class DFRobot:
def __init__(self):
self._display = dfrobot_epaper.DFRobot_Epaper_SPI(RASPBERRY_SPI_BUS, RASPBERRY_SPI_DEV, RASPBERRY_PIN_CS, RASPBERRY_PIN_CD, RASPBERRY_PIN_BUSY)
self._display.begin()
self.clear(0xFF)
self.FULL = self._display.FULL
self.PART = self._display.PART
def getbuffer(self, image):
if HEIGHT % 8 == 0:
linewidth = HEIGHT // 8
else:
linewidth = HEIGHT // 8 + 1
buf = [0xFF] * (linewidth * WIDTH)
image_monocolor = image.convert('1')
imwidth, imheight = image_monocolor.size
pixels = image_monocolor.load()
if (imwidth == HEIGHT and imheight == WIDTH):
for y in range(imheight):
for x in range(imwidth):
if pixels[x,y] == 0:
x = imwidth - x
buf[x // 8 + y * linewidth] &= ~(0x80 >> (x % 8))
elif (imwidth == WIDTH and imheight == HEIGHT):
for y in range(imheight):
for x in range(imwidth):
newx = y
newy = WIDTH - x - 1
if pixels[x,y] == 0:
newy = imwidth - newy - 1
buf[newx // 8 + newy * linewidth] &= ~(0x80 >> (y % 8))
return buf
def flush(self, type):
self._display.flush(type)
def display(self, buf):
self._display.setBuffer(buf)
self.flush(self._display.PART)
def clear(self, color):
if HEIGHT % 8 == 0:
linewidth = HEIGHT // 8
else:
linewidth = HEIGHT // 8 + 1
buf = [color] * (linewidth * WIDTH)
self._display.setBuffer(buf)
self.flush(self._display.FULL)

View File

@@ -0,0 +1,208 @@
# -*- coding:utf-8 -*-
import time
import sys
sys.path.append("..")
try:
from .spi import SPI
from .gpio import GPIO
except:
print("unknown platform")
exit()
CONFIG_IL0376F = {
}
CONFIG_IL3895 = {
}
class DFRobot_Epaper:
XDOT = 128
YDOT = 250
FULL = True
PART = False
def __init__(self, width = 250, height = 122):
# length = width * height // 8
length = 4000
self._displayBuffer = bytearray(length)
i = 0
while i < length:
self._displayBuffer[i] = 0xff
i = i + 1
self._isBusy = False
self._busyExitEdge = GPIO.RISING
def _busyCB(self, channel):
self._isBusy = False
def setBusyExitEdge(self, edge):
if edge != GPIO.HIGH and edge != GPIO.LOW:
return
self._busyEdge = edge
def begin(self):
pass
# self.setBusyCB(self._busyCB)
# self._powerOn()
def setBuffer(self, buffer):
self._displayBuffer = buffer
def pixel(self, x, y, color):
if x < 0 or x >= self._width:
return
if y < 0 or y >= self._height:
return
x = int(x)
y = int(y)
m = int(x * 16 + (y + 1) / 8)
sy = int((y + 1) % 8)
if color == self.WHITE:
if sy != 0:
self._displayBuffer[m] = self._displayBuffer[m] | int(pow(2, 8 - sy))
else:
self._displayBuffer[m - 1] = self._displayBuffer[m - 1] | 1
elif color == self.BLACK:
if sy != 0:
self._displayBuffer[m] = self._displayBuffer[m] & (0xff - int(pow(2, 8 - sy)))
else:
self._displayBuffer[m - 1] = self._displayBuffer[m - 1] & 0xfe
def _setWindow(self, x, y):
hres = y // 8
hres = hres << 3
vres_h = x >> 8
vres_l = x & 0xff
self.writeCmdAndData(0x61, [hres, vres_h, vres_l])
def _initLut(self, mode):
if mode == self.FULL:
self.writeCmdAndData(0x32, [0x22,0x55,0xAA,0x55,0xAA,0x55,0xAA,
0x11,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x1E,0x1E,0x1E,0x1E,0x1E,
0x1E,0x1E,0x1E,0x01,0x00,0x00,0x00,0x00])
elif mode == self.PART:
self.writeCmdAndData(0x32, [0x18,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x0F,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00])
def _setRamData(self, xStart, xEnd, yStart, yStart1, yEnd, yEnd1):
self.writeCmdAndData(0x44, [xStart, xEnd])
self.writeCmdAndData(0x45, [yStart, yStart1, yEnd, yEnd1])
def _setRamPointer(self, x, y, y1):
self.writeCmdAndData(0x4e, [x])
self.writeCmdAndData(0x4f, [y, y1])
def _init(self):
self.writeCmdAndData(0x01, [(self.YDOT - 1) % 256, (self.YDOT - 1) // 256, 0x00])
self.writeCmdAndData(0x0c, [0xd7, 0xd6, 0x9d])
self.writeCmdAndData(0x2c, [0xa8])
self.writeCmdAndData(0x3a, [0x1a])
self.writeCmdAndData(0x3b, [0x08])
self.writeCmdAndData(0x11, [0x01])
self._setRamData(0x00, (self.XDOT - 1) // 8, (self.YDOT - 1) % 256, (self.YDOT - 1) // 256, 0x00, 0x00)
self._setRamPointer(0x00, (self.YDOT - 1) % 256, (self.YDOT - 1) // 256)
def _writeDisRam(self, sizeX, sizeY):
if sizeX % 8 != 0:
sizeX = sizeX + (8 - sizeX % 8)
sizeX = sizeX // 8
self.writeCmdAndData(0x24, self._displayBuffer[0: sizeX * sizeY])
def _updateDis(self, mode):
if mode == self.FULL:
self.writeCmdAndData(0x22, [0xc7])
elif mode == self.PART:
self.writeCmdAndData(0x22, [0x04])
else:
return
self.writeCmdAndData(0x20, [])
self.writeCmdAndData(0xff, [])
def _waitBusyExit(self):
temp = 0
while self.readBusy() != False:
time.sleep(0.01)
temp = temp + 1
if (temp % 200) == 0:
print("waitBusyExit")
def _powerOn(self):
self.writeCmdAndData(0x22, [0xc0])
self.writeCmdAndData(0x20, [])
def _powerOff(self):
self.writeCmdAndData(0x12, [])
self.writeCmdAndData(0x82, [0x00])
self.writeCmdAndData(0x01, [0x02, 0x00, 0x00, 0x00, 0x00])
self.writeCmdAndData(0x02, [])
def _disPart(self, xStart, xEnd, yStart, yEnd):
self._setRamData(xStart // 8, xEnd // 8, yEnd % 256, yEnd // 256, yStart % 256, yStart // 256)
self._setRamPointer(xStart // 8, yEnd % 256, yEnd // 256)
self._writeDisRam(xEnd - xStart, yEnd - yStart + 1)
self._updateDis(self.PART)
def flush(self, mode):
if mode != self.FULL and mode != self.PART:
return
self._init()
self._initLut(mode)
self._powerOn()
if mode == self.PART:
self._disPart(0, self.XDOT - 1, 0, self.YDOT - 1)
else:
self._setRamPointer(0x00, (self.YDOT - 1) % 256, (self.YDOT - 1) // 256)
self._writeDisRam(self.XDOT, self.YDOT)
self._updateDis(mode)
def startDrawBitmapFile(self, x, y):
self._bitmapFileStartX = x
self._bitmapFileStartY = y
def bitmapFileHelper(self, buf):
for i in range(len(buf) // 3):
addr = i * 3
if buf[addr] == 0x00 and buf[addr + 1] == 0x00 and buf[addr + 2] == 0x00:
self.pixel(self._bitmapFileStartX, self._bitmapFileStartY, self.BLACK)
else:
self.pixel(self._bitmapFileStartX, self._bitmapFileStartY, self.WHITE)
self._bitmapFileStartX += 1
def endDrawBitmapFile(self):
self.flush(self.PART)
class DFRobot_Epaper_SPI(DFRobot_Epaper):
def __init__(self, bus, dev, cs, cd, busy):
DFRobot_Epaper.__init__(self)
self._spi = SPI(bus, dev)
self._cs = GPIO(cs, GPIO.OUT)
self._cd = GPIO(cd, GPIO.OUT)
self._busy = GPIO(busy, GPIO.IN)
def writeCmdAndData(self, cmd, data = []):
self._waitBusyExit()
self._cs.setOut(GPIO.LOW)
self._cd.setOut(GPIO.LOW)
self._spi.transfer([cmd])
self._cd.setOut(GPIO.HIGH)
self._spi.transfer(data)
self._cs.setOut(GPIO.HIGH)
def readBusy(self):
return self._busy.read()
def setBusyCB(self, cb):
self._busy.setInterrupt(self._busyExitEdge, cb)

View File

@@ -0,0 +1,64 @@
# -*- coding:utf-8 -*-
import time
import RPi.GPIO as RPIGPIO
RPIGPIO.setmode(RPIGPIO.BCM)
RPIGPIO.setwarnings(False)
class GPIO:
HIGH = RPIGPIO.HIGH
LOW = RPIGPIO.LOW
OUT = RPIGPIO.OUT
IN = RPIGPIO.IN
RISING = RPIGPIO.RISING
FALLING = RPIGPIO.FALLING
BOTH = RPIGPIO.BOTH
def __init__(self, pin, mode, defaultOut = HIGH):
self._pin = pin
self._fInt = None
self._intDone = True
self._intMode = None
if mode == self.OUT:
RPIGPIO.setup(pin, mode)
if defaultOut == self.HIGH:
RPIGPIO.output(pin, defaultOut)
else:
RPIGPIO.output(pin, self.LOW)
else:
RPIGPIO.setup(pin, self.IN, pull_up_down = RPIGPIO.PUD_UP)
def setOut(self, level):
if level:
RPIGPIO.output(self._pin, self.HIGH)
else:
RPIGPIO.output(self._pin, self.LOW)
def _intCB(self, status):
if self._intDone:
self._intDone = False
time.sleep(0.02)
if self._intMode == self.BOTH:
self._fInt()
elif self._intMode == self.RISING and self.read() == self.HIGH:
self._fInt()
elif self._intMode == self.FALLING and self.read() == self.LOW:
self._fInt()
self._intDone = True
def setInterrupt(self, mode, cb):
if mode != self.RISING and mode != self.FALLING and mode != self.BOTH:
return
self._intMode = mode
RPIGPIO.add_event_detect(self._pin, mode, self._intCB)
self._fInt = cb
def read(self):
return RPIGPIO.input(self._pin)
def cleanup(self):
RPIGPIO.cleanup()

View File

@@ -0,0 +1,21 @@
# -*- coding:utf-8 -*-
import spidev
class SPI:
MODE_1 = 1
MODE_2 = 2
MODE_3 = 3
MODE_4 = 4
def __init__(self, bus, dev, speed = 3900000, mode = MODE_4):
self._bus = spidev.SpiDev()
self._bus.open(bus, dev)
self._bus.no_cs = True
self._bus.max_speed_hz = speed
def transfer(self, buf):
if len(buf):
return self._bus.xfer(buf)
return []

View File

@@ -0,0 +1,24 @@
from inky.inky import Inky, CS0_PIN, DC_PIN, RESET_PIN, BUSY_PIN
class InkyFast(Inky):
def __init__(self, resolution=(400, 300), colour='black', cs_pin=CS0_PIN, dc_pin=DC_PIN, reset_pin=RESET_PIN,
busy_pin=BUSY_PIN, h_flip=False, v_flip=False):
super(InkyFast, self).__init__(resolution, colour, cs_pin, dc_pin, reset_pin, busy_pin, h_flip, v_flip)
self._luts['black'] = [
0b01001000, 0b10100000, 0b00010000, 0b00010000, 0b00010011, 0b00000000, 0b00000000,
0b01001000, 0b10100000, 0b10000000, 0b00000000, 0b00000011, 0b00000000, 0b00000000,
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
0b01001000, 0b10100101, 0b00000000, 0b10111011, 0b00000000, 0b00000000, 0b00000000,
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
# The following timings have been reduced to avoid the fade to black
0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x04, 0x04, 0x04, 0x04,
0x04, 0x08, 0x08, 0x10, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
]

View File

@@ -0,0 +1,27 @@
"""Inky pHAT e-Ink Display Driver."""
from . import inkyfast
class InkyPHATFast(inkyfast.InkyFast):
"""Inky wHAT e-Ink Display Driver."""
WIDTH = 212
HEIGHT = 104
WHITE = 0
BLACK = 1
RED = 2
YELLOW = 2
def __init__(self, colour):
"""Initialise an Inky pHAT Display.
:param colour: one of red, black or yellow, default: black
"""
inkyfast.InkyFast.__init__(
self,
resolution=(self.WIDTH, self.HEIGHT),
colour=colour,
h_flip=False,
v_flip=False)

View File

@@ -15,7 +15,7 @@
from PIL import Image
from PIL import ImageOps
from pwnagotchi.ui.papirus.lm75b import LM75B
from pwnagotchi.ui.hw.libs.papirus.lm75b import LM75B
import re
import os
import sys
@@ -47,7 +47,7 @@ to use:
image = Image.new('1', epd.size, 0)
# draw on image
epd.clear() # clear the panel
epd.display(image) # tranfer image data
epd.display(image) # transfer image data
epd.update() # refresh the panel image - not needed if auto=true
"""
@@ -173,7 +173,7 @@ to use:
# attempt grayscale conversion, and then to single bit
# better to do this before calling this if the image is to
# be dispayed several times
# be displayed several times
if image.mode != "1":
image = ImageOps.grayscale(image).convert("1", dither=Image.FLOYDSTEINBERG)

View File

@@ -0,0 +1,166 @@
import spidev
import RPi.GPIO as GPIO
import time
import numpy as np
class ST7789(object):
"""class for ST7789 240*240 1.3inch OLED displays."""
def __init__(self, spi, rst=27, dc=25, bl=24):
self.width = 240
self.height = 240
# Initialize DC RST pin
self._dc = dc
self._rst = rst
self._bl = bl
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(self._dc, GPIO.OUT)
GPIO.setup(self._rst, GPIO.OUT)
GPIO.setup(self._bl, GPIO.OUT)
GPIO.output(self._bl, GPIO.HIGH)
# Initialize SPI
self._spi = spi
self._spi.max_speed_hz = 40000000
""" Write register address and data """
def command(self, cmd):
GPIO.output(self._dc, GPIO.LOW)
self._spi.writebytes([cmd])
def data(self, val):
GPIO.output(self._dc, GPIO.HIGH)
self._spi.writebytes([val])
def Init(self):
"""Initialize display"""
self.reset()
self.command(0x36)
self.data(0x70) # self.data(0x00)
self.command(0x3A)
self.data(0x05)
self.command(0xB2)
self.data(0x0C)
self.data(0x0C)
self.data(0x00)
self.data(0x33)
self.data(0x33)
self.command(0xB7)
self.data(0x35)
self.command(0xBB)
self.data(0x19)
self.command(0xC0)
self.data(0x2C)
self.command(0xC2)
self.data(0x01)
self.command(0xC3)
self.data(0x12)
self.command(0xC4)
self.data(0x20)
self.command(0xC6)
self.data(0x0F)
self.command(0xD0)
self.data(0xA4)
self.data(0xA1)
self.command(0xE0)
self.data(0xD0)
self.data(0x04)
self.data(0x0D)
self.data(0x11)
self.data(0x13)
self.data(0x2B)
self.data(0x3F)
self.data(0x54)
self.data(0x4C)
self.data(0x18)
self.data(0x0D)
self.data(0x0B)
self.data(0x1F)
self.data(0x23)
self.command(0xE1)
self.data(0xD0)
self.data(0x04)
self.data(0x0C)
self.data(0x11)
self.data(0x13)
self.data(0x2C)
self.data(0x3F)
self.data(0x44)
self.data(0x51)
self.data(0x2F)
self.data(0x1F)
self.data(0x1F)
self.data(0x20)
self.data(0x23)
self.command(0x21)
self.command(0x11)
self.command(0x29)
def reset(self):
"""Reset the display"""
GPIO.output(self._rst, GPIO.HIGH)
time.sleep(0.01)
GPIO.output(self._rst, GPIO.LOW)
time.sleep(0.01)
GPIO.output(self._rst, GPIO.HIGH)
time.sleep(0.01)
def SetWindows(self, Xstart, Ystart, Xend, Yend):
# set the X coordinates
self.command(0x2A)
self.data(0x00) # Set the horizontal starting point to the high octet
self.data(Xstart & 0xff) # Set the horizontal starting point to the low octet
self.data(0x00) # Set the horizontal end to the high octet
self.data((Xend - 1) & 0xff) # Set the horizontal end to the low octet
# set the Y coordinates
self.command(0x2B)
self.data(0x00)
self.data((Ystart & 0xff))
self.data(0x00)
self.data((Yend - 1) & 0xff)
self.command(0x2C)
def ShowImage(self, Image, Xstart, Ystart):
"""Set buffer to value of Python Imaging Library image."""
"""Write display buffer to physical display"""
imwidth, imheight = Image.size
if imwidth != self.width or imheight != self.height:
raise ValueError('Image must be same dimensions as display \
({0}x{1}).'.format(self.width, self.height))
img = np.asarray(Image)
pix = np.zeros((self.width, self.height, 2), dtype=np.uint8)
pix[..., [0]] = np.add(np.bitwise_and(img[..., [0]], 0xF8), np.right_shift(img[..., [1]], 5))
pix[..., [1]] = np.add(np.bitwise_and(np.left_shift(img[..., [1]], 3), 0xE0), np.right_shift(img[..., [2]], 3))
pix = pix.flatten().tolist()
self.SetWindows(0, 0, self.width, self.height)
GPIO.output(self._dc, GPIO.HIGH)
for i in range(0, len(pix), 4096):
self._spi.writebytes(pix[i:i + 4096])
def clear(self):
"""Clear contents of image buffer"""
_buffer = [0xff] * (self.width * self.height * 2)
self.SetWindows(0, 0, self.width, self.height)
GPIO.output(self._dc, GPIO.HIGH)
for i in range(0, len(_buffer), 4096):
self._spi.writebytes(_buffer[i:i + 4096])

Binary file not shown.

View File

@@ -0,0 +1,21 @@
# /*****************************************************************************
# * | File : config.py
# * | Author : Guillaume Giraudon
# * | Info :
# *----------------
# * | This version: V1.0
# * | Date : 2019-10-18
# * | Info :
# ******************************************************************************/
import spidev
# Pin definition
RST_PIN = 27
DC_PIN = 25
BL_PIN = 24
Device_SPI = 1
Device_I2C = 0
Device = Device_SPI
spi = spidev.SpiDev(0, 0)

Some files were not shown because too many files have changed in this diff Show More