diff --git a/builder/pwnagotchi.yml b/builder/pwnagotchi.yml index 515ee70..a8dca14 100644 --- a/builder/pwnagotchi.yml +++ b/builder/pwnagotchi.yml @@ -3,28 +3,135 @@ - 127.0.0.1 become: yes vars: - pwn_hostname: "pwnagotchi" - pwn_version: "master" + pwnagotchi: + hostname: "{{ lookup('env', 'PWN_HOSTNAME') | default('pwnagotchi', true) }}" + version: "{{ lookup('env', 'PWN_VERSION') | default('master', true) }} " + system: + boot_options: + - "dtoverlay=dwc2" + - "dtparam=spi=on" + - "dtoverlay=spi1-3cs" + - "dtoverlay=pi3-disable-bt" + - "dtparam=audio=off" + services: + enable: + - dphys-swapfile.service + - getty@ttyGS0.service + disable: + - apt-daily.timer + - apt-daily.service + - apt-daily-upgrade.timer + - apt-daily-upgrade.service + - wpa_supplicant.service + - bluetooth.service + - triggerhappy.service + - ifup@wlan0.service + packages: + pip: + install: + - inky + - smbus2 + - absl-py>=0.1.6 + - enum34 + - gast==0.2.2 + - google_pasta + - opt_einsum + - scapy + - gym + - keras_applications>=1.0.6 + - keras_preprocessing>=1.0.5 + - stable-baselines + - file_read_backwards + - tensorflow_estimator>=1.14.0,<1.15.0 + - tensorboard>=1.13.0,<1.14.0 + apt: + remove: + - rasberrypi-net-mods + - dhcpcd5 + - triggerhappy + - wpa_supplicant + - nfs-common + install: + - vim + - screen + - golang + - git + - build-essential + - python3-pip + - unzip + - gawk + - libopenmpi-dev + - libatlas-base-dev + - libjasper-dev + - libqtgui4 + - libqt4-test + - libopenjp2-7 + - tcpdump + - lsof + - libilmbase23 + - libopenexr23 + - libgstreamer1.0-0 + - libavcodec58 + - libavformat58 + - libswscale5 + - libpcap-dev + - libusb-1.0-0-dev + - libnetfilter-queue-dev + - dphys-swapfile + - kalipi-kernel + - kalipi-bootloader + - kalipi-re4son-firmware + - kalipi-kernel-headers + - libraspberrypi0 + - libraspberrypi-dev + - libraspberrypi-doc + - libraspberrypi-bin + - fonts-dejavu + - fonts-dejavu-core + - fonts-dejavu-extra + - python3-crypto + - python3-requests + - python3-yaml + - python3-smbus + - python3-inkyphat + - python3-numpy + - python3-pil + - python3-tweepy + - python3-opencv + - python3-termcolor + - python3-astor + - python3-backports.weakref + - python3-h5py + - python3-six + - python3-protobuf + - python3-wrapt + - python3-wheel + - python3-mock + - python3-scipy + - python3-cloudpickle + + bettercap: + query: "assets[?contains(name, 'armv6l')].browser_download_url" tasks: - name: selected hostname debug: - msg: "{{ pwn_hostname }}" + msg: "{{ pwnagotchi.hostname }}" - name: build version debug: - msg: "{{ pwn_version }}" + msg: "{{ pwnagotchi.version }}" - name: change hostname hostname: - name: "{{pwn_hostname}}" + name: "{{pwnagotchi.hostname}}" - name: add hostname to /etc/hosts lineinfile: dest: /etc/hosts regexp: '^127\.0\.0\.1[ \t]+localhost' - line: '127.0.0.1 localhost {{pwn_hostname}} {{pwn_hostname}}.local' + line: '127.0.0.1 localhost {{pwnagotchi.hostname}} {{pwnagotchi.hostname}}.local' state: present - name: Add re4son-kernel repo key @@ -41,88 +148,55 @@ apt: update_cache: yes + - name: remove unecessary apt packages + apt: + name: "{{ packages.apt.remove }}" + state: absent + purge: yes + - name: upgrade apt distro apt: upgrade: dist - name: install packages apt: - name: "{{ packages }}" + name: "{{ packages.apt.install }}" state: present - vars: - packages: - - vim - - screen - - golang - - git - - build-essential - - python3-pip - - gawk - - libopenmpi-dev - - libatlas-base-dev - - libjasper-dev - - libqtgui4 - - libqt4-test - - libopenjp2-7 - - tcpdump - - lsof - - libilmbase23 - - libopenexr23 - - libgstreamer1.0-0 - - libavcodec58 - - libavformat58 - - libswscale5 - - libpcap-dev - - libusb-1.0-0-dev - - libnetfilter-queue-dev - - dphys-swapfile - - kalipi-kernel - - kalipi-bootloader - - kalipi-re4son-firmware - - kalipi-kernel-headers - - libraspberrypi0 - - libraspberrypi-dev - - libraspberrypi-doc - - libraspberrypi-bin - - fonts-dejavu - - fonts-dejavu-core - - fonts-dejavu-extra - name: configure dphys-swapfile file: path: /etc/dphys-swapfile content: "CONF_SWAPSIZE=1024" - - name: disable unecessary services - systemd: - name: "{{services}}" - state: stopped - enabled: no - vars: - services: - - apt-daily.timer - - apt-daily.service - - apt-daily-upgrade.timer - - apt-daily-upgrade.service - - bluetooth.service - - triggerhappy.service + - name: acquire python3 pip target + command: "python3 -c 'import sys;print(sys.path.pop())'" + register: pip_target - - name: enable dphys-swapfile service - systemd: - name: dphys-swapfile.service - state: started - enabled: yes + - name: install pip packages + pip: + name: "{{packages.pip.install}}" + extra_args: "--no-deps --extra-index-url=https://www.piwheels.hostedpi.com/simple/ --prefer-binary --no-cache-dir --platform=armv6l --target={{ pip_target.stdout }}" - - name: build bettercap - command: go get -u github.com/bettercap/bettercap - environment: - GOPATH: /root/go - GOROOT: /usr/lib/go + - name: install grpcio + command: "pip3 install --no-deps --extra-index-url=https://www.piwheels.hostedpi.com/simple/ --no-cache-dir --prefer-binary --platform=armv6l --only-binary=:all: --target={{ pip_target.stdout }} https://www.piwheels.hostedpi.com/simple/grpcio/grpcio-1.24.1-cp37-cp37m-linux_armv6l.whl" - - name: install bettercap - copy: - src: /root/go/bin/bettercap - dest: /usr/bin/bettercap + - name: install tensorflow + command: "pip3 install --no-deps --extra-index-url=https://www.piwheels.hostedpi.com/simple/ --no-cache-dir --prefer-binary --platform=armv6l --only-binary=:all: --target={{ pip_target.stdout }} https://www.piwheels.org/simple/tensorflow/tensorflow-1.13.1-cp37-none-linux_armv6l.whl" + + - name: fetch bettercap release information + uri: + url: https://api.github.com/repos/bettercap/bettercap/releases/latest + return_content: yes + register: bettercap_release + + - name: download and install bettercap + unarchive: + src: "{{ bettercap_release.content | from_json | json_query(bettercap.query) | first }}" + dest: /usr/bin + remote_src: yes + exclude: + - README.md + - LICENSE.md mode: 0755 - name: clone bettercap caplets @@ -151,10 +225,6 @@ path: /tmp/pwnagotchi state: absent - - name: install python modules - pip: - requirements: /root/pwnagotchi/scripts/requirements.txt - - name: create cpuusage script copy: dest: /usr/bin/cpuusage @@ -249,11 +319,7 @@ insertafter: EOF line: '{{ item }}' with_items: - - "dtoverlay=dwc2" - - "dtparam=spi=on" - - "dtoverlay=spi1-3cs" - - "dtoverlay=pi3-disable-bt" - - "dtparam=audio=off" + - "{{system.boot_options}}" - name: change root partition replace: @@ -269,7 +335,7 @@ state: present backup: no regexp: '(.*)$' - line: '\1 modules-load=dwc2,g_ether' + line: '\1 modules-load=dwc2,g_cdc' - name: configure ssh lineinfile: @@ -281,7 +347,7 @@ - name: configure motd copy: dest: /etc/motd - content: "(◕‿‿◕) {{pwn_hostname}} (pwnagotchi-{{pwn_version}})" + content: "(◕‿‿◕) {{pwnagotchi.hostname}} (pwnagotchi-{{pwnagotchi.version}})" - name: clean apt cache apt: @@ -291,16 +357,21 @@ apt: autoremove: yes + - name: enable services + systemd: + name: "{{services.enable}}" + state: started + enabled: yes + + - name: disable unecessary services + systemd: + name: "{{services.disable}}" + state: stopped + enabled: no + - name: remove ssh keys file: state: absent path: "{{item}}" - with_items: - - /etc/ssh/ssh_host_rsa_key - - /etc/ssh/ssh_host_rsa_key.pub - - /etc/ssh/ssh_host_dsa_key - - /etc/ssh/ssh_host_dsa_key.pub - - /etc/ssh/ssh_host/ecdsa_key - - /etc/ssh/ssh_host/ecdsa_key.pub - - /etc/ssh/ssh_host_ed25519_key - - /etc/ssh/ssh_host_ed25519_key.pub + with_fileglob: + - "/etc/ssh/ssh_host*_key*" diff --git a/docs/configure.md b/docs/configure.md index 733abc9..d2bb0f5 100644 --- a/docs/configure.md +++ b/docs/configure.md @@ -40,6 +40,8 @@ For instance, you can change `main.lang` to one of the supported languages: - macedonian - italian - french +- russian +- swedish ## Display Selection diff --git a/docs/install.md b/docs/install.md index 6902979..203a38f 100644 --- a/docs/install.md +++ b/docs/install.md @@ -2,6 +2,9 @@ The project has been developed to run on a Raspberry Pi 0 W configured as an [USB Ethernet gadget](https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/ethernet-gadget) device in order to connect to it via USB. However, given the proper configuration tweaks, any GNU/Linux computer with a WiFi interface that supports monitor mode could be used. +*An important note about the AI:* a network trained with a specific WiFi interface will only work with another interface if it supports +the same exact WiFi channels of the first one. For instance, you can not use a neural network trained on a Raspberry Pi Zero W (that only supports 2.4Ghz channels) with a 5Ghz antenna, but you'll need to train one from scratch for those channels. + ## Required Hardware - [Raspberry Pi Zero W](https://www.raspberrypi.org/products/raspberry-pi-zero-w/). diff --git a/sdcard/rootfs/root/pwnagotchi/config.yml b/sdcard/rootfs/root/pwnagotchi/config.yml index bbc93b8..a93a7e8 100644 --- a/sdcard/rootfs/root/pwnagotchi/config.yml +++ b/sdcard/rootfs/root/pwnagotchi/config.yml @@ -1,6 +1,6 @@ # main algorithm configuration main: - # currently implemented: en (default), de, el, fr, it, mk, nl, se + # currently implemented: en (default), de, el, fr, it, mk, nl, ru, se lang: en # custom plugins path, if null only default plugins with be loaded custom_plugins: @@ -15,7 +15,7 @@ main: files: - /root/brain.nn - /root/brain.json - - /root/custom.yaml + - /root/custom.yml - /root/handshakes - /etc/ssh - /etc/hostname @@ -24,7 +24,7 @@ main: - /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).tar.gz' + - 'scp /tmp/backup.tar.gz pwnagotchi@10.0.0.1:/home/pwnagotchi/backups/backup-$(date +%s).tar.gz' gps: enabled: false twitter: diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/__init__.py b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/__init__.py index c894d45..dd6c38a 100644 --- a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/__init__.py +++ b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/__init__.py @@ -1,6 +1,6 @@ import subprocess -version = '1.0.0plz2' +version = '1.0.0plz3' _name = None diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/locale/ru/LC_MESSAGES/voice.mo b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/locale/ru/LC_MESSAGES/voice.mo new file mode 100644 index 0000000..08fae17 Binary files /dev/null and b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/locale/ru/LC_MESSAGES/voice.mo differ diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/locale/ru/LC_MESSAGES/voice.po b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/locale/ru/LC_MESSAGES/voice.po new file mode 100644 index 0000000..796bf17 --- /dev/null +++ b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/locale/ru/LC_MESSAGES/voice.po @@ -0,0 +1,205 @@ +# 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 <25989971+adolfaka@users.noreply.github.com>, 2019. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-10-03 16:47+0200\n" +"PO-Revision-Date: 2019-10-05 18:50+0300\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.2.4\n" +"Last-Translator: Elliot Manson\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n" +"Language: ru_RU\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 "Нейронная сеть готова." + +#, 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. {name}" +msgstr "Привет, {name}! Приятно познакомиться. {name}" + +#, python-brace-format +msgid "Unit {name} is nearby! {name}" +msgstr "Цель {name} близко! {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 "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}c)" + +#, python-brace-format +msgid "Waiting for {secs}s ..." +msgstr "Ждем {secs}c …" + +#, 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 "Йоy {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} новое рукопожатие!" + +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 "hour" +msgstr "час" + +msgid "minutes" +msgstr "минут" + +msgid "minute" +msgstr "минуту" diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/plugins/default/auto-backup.py b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/plugins/default/auto-backup.py index 7312201..731a40f 100644 --- a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/plugins/default/auto-backup.py +++ b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/plugins/default/auto-backup.py @@ -30,6 +30,7 @@ def on_loaded(): return READY = True + logging.info("AUTO-BACKUP: Successfuly loaded.") def on_internet_available(display, config, log): @@ -41,11 +42,17 @@ def on_internet_available(display, config, log): files_to_backup = " ".join(OPTIONS['files']) try: + logging.info("AUTO-BACKUP: Backing up ...") display.set('status', 'Backing up ...') display.update() for cmd in OPTIONS['commands']: - subprocess.call(cmd.format(files=files_to_backup).split(), stdout=open(os.devnull, 'wb')) + 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") + process.wait() + if process.returncode > 0: + raise OSError(f"Command failed (rc: {process.returncode})") logging.info("AUTO-BACKUP: backup done") STATUS.update()