This commit is contained in:
Simone Margaritelli 2019-10-08 14:54:20 +02:00
commit 415217fbef
3 changed files with 86 additions and 82 deletions

View File

@ -22,15 +22,8 @@ branches:
cache: cache:
apt: true apt: true
before_script: before_script:
- wget https://download.qemu.org/qemu-4.1.0.tar.xz
- tar xvJf qemu-4.1.0.tar.xz
- cd qemu-4.1.0
- "./configure --target-list=arm-softmmu"
- make -j$(nproc)
- sudo make install
- cd $TRAVIS_BUILD_DIR
- sudo apt-get -y update || true - sudo apt-get -y update || true
- sudo apt-get -y install qemu-user-static binfmt-support bmap-tools kpartx - sudo apt-get -y install qemu-system-arm qemu-user-static binfmt-support bmap-tools kpartx
- sudo update-binfmts --display - sudo update-binfmts --display
script: script:
- sudo make clean - sudo make clean

View File

@ -15,6 +15,7 @@
"type": "shell", "type": "shell",
"inline": [ "inline": [
"sed -i 's/^\\([^#]\\)/#\\1/g' /etc/ld.so.preload", "sed -i 's/^\\([^#]\\)/#\\1/g' /etc/ld.so.preload",
"dpkg-architecture",
"apt-get -y update", "apt-get -y update",
"apt-get install -y ansible" "apt-get install -y ansible"
] ]

View File

@ -11,11 +11,11 @@
- "dtoverlay=dwc2" - "dtoverlay=dwc2"
- "dtparam=spi=on" - "dtparam=spi=on"
- "dtoverlay=spi1-3cs" - "dtoverlay=spi1-3cs"
- "dtoverlay=pi3-disable-bt"
- "dtparam=audio=off"
services: services:
enable: enable:
- dphys-swapfile.service - dphys-swapfile.service
- pwnagotchi.service
- bettercap.service
disable: disable:
- apt-daily.timer - apt-daily.timer
- apt-daily.service - apt-daily.service
@ -26,23 +26,6 @@
- triggerhappy.service - triggerhappy.service
- ifup@wlan0.service - ifup@wlan0.service
packages: 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: apt:
remove: remove:
- rasberrypi-net-mods - rasberrypi-net-mods
@ -57,6 +40,7 @@
- git - git
- build-essential - build-essential
- python3-pip - python3-pip
- python3-mpi4py
- unzip - unzip
- gawk - gawk
- libopenmpi-dev - libopenmpi-dev
@ -65,6 +49,7 @@
- libqtgui4 - libqtgui4
- libqt4-test - libqt4-test
- libopenjp2-7 - libopenjp2-7
- libtiff5
- tcpdump - tcpdump
- lsof - lsof
- libilmbase23 - libilmbase23
@ -76,6 +61,7 @@
- libpcap-dev - libpcap-dev
- libusb-1.0-0-dev - libusb-1.0-0-dev
- libnetfilter-queue-dev - libnetfilter-queue-dev
- libopenmpi3
- dphys-swapfile - dphys-swapfile
- kalipi-kernel - kalipi-kernel
- kalipi-bootloader - kalipi-bootloader
@ -88,26 +74,7 @@
- fonts-dejavu - fonts-dejavu
- fonts-dejavu-core - fonts-dejavu-core
- fonts-dejavu-extra - fonts-dejavu-extra
- python3-crypto
- python3-requests
- python3-yaml
- python3-smbus
- python3-inkyphat
- python3-numpy
- python3-pil - 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: bettercap:
query: "assets[?contains(name, 'armv6l')].browser_download_url" query: "assets[?contains(name, 'armv6l')].browser_download_url"
@ -171,16 +138,30 @@
command: "python3 -c 'import sys;print(sys.path.pop())'" command: "python3 -c 'import sys;print(sys.path.pop())'"
register: pip_target register: pip_target
- name: install pip packages - name: clone pwnagotchi repository
pip: git:
name: "{{packages.pip.install}}" repo: https://github.com/evilsocket/pwnagotchi.git
extra_args: "--no-deps --extra-index-url=https://www.piwheels.hostedpi.com/simple/ --prefer-binary --no-cache-dir --platform=armv6l --target={{ pip_target.stdout }}" dest: /usr/local/src/pwnagotchi
- name: install grpcio - name: build pwnagotchi wheel
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" command: "python3 setup.py sdist bdist_wheel"
args:
chdir: /usr/local/src/pwnagotchi
- 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 }}"
- name: install tensorflow - 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" 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 }}"
- name: install pwnagotchi wheel and dependencies
pip:
name: "{{ lookup('fileglob', '/usr/local/src/pwnagotchi/dist/pwnagotchi*.whl') }}"
extra_args: "--no-cache-dir"
- name: fetch bettercap release information - name: fetch bettercap release information
uri: uri:
@ -208,22 +189,6 @@
chdir: /tmp/caplets chdir: /tmp/caplets
target: install target: install
- name: clone pwnagotchi repository
git:
repo: https://github.com/evilsocket/pwnagotchi.git
dest: /tmp/pwnagotchi
- name: copy pwnagotchi files to final destination
copy:
src: /tmp/pwnagotchi/sdcard/rootfs/root/pwnagotchi/
dest: /root/pwnagotchi/
mode: preserve
- name: remove pwnagotchi files from temporary repository
file:
path: /tmp/pwnagotchi
state: absent
- name: create cpuusage script - name: create cpuusage script
copy: copy:
dest: /usr/bin/cpuusage dest: /usr/bin/cpuusage
@ -270,9 +235,9 @@
/usr/bin/bootblink 10 & /usr/bin/bootblink 10 &
# start a detached screen session with bettercap # start a detached screen session with bettercap
if ifconfig | grep usb0 | grep RUNNING; then if ifconfig | grep usb0 | grep RUNNING; then
/usr/bin/pwnagotchi --manual /usr/local/bin/pwnagotchi --manual
else else
/usr/bin/pwnagotchi /usr/local/bin/pwnagotchi
fi fi
- name: create monstart script - name: create monstart script
@ -307,7 +272,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
sudo /opt/vc/bin/tvservice -o sudo /opt/vc/bin/tvservice -o
- name: configure rc.local - name: add HDMI powersave to rc.local
blockinfile: blockinfile:
path: /etc/rc.local path: /etc/rc.local
insertbefore: "exit 0" insertbefore: "exit 0"
@ -315,7 +280,6 @@
if ! /opt/vc/bin/tvservice -s | grep HDMI; then if ! /opt/vc/bin/tvservice -s | grep HDMI; then
/opt/vc/bin/tvservice -o /opt/vc/bin/tvservice -o
fi fi
/root/pwnagotchi/scripts/startup.sh &
- name: create /etc/pwnagotchi/config.yml - name: create /etc/pwnagotchi/config.yml
blockinfile: blockinfile:
@ -390,13 +354,6 @@
regexp: '(.*)$' regexp: '(.*)$'
line: '\1 modules-load=dwc2,g_ether' line: '\1 modules-load=dwc2,g_ether'
- name: configure ssh
lineinfile:
dest: /etc/ssh/sshd_config
backup: no
regexp: '#?PermitRootLogin (.*)$'
line: 'PermitRootLogin yes'
- name: configure motd - name: configure motd
copy: copy:
dest: /etc/motd dest: /etc/motd
@ -410,17 +367,63 @@
apt: apt:
autoremove: yes autoremove: yes
- 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
ExecStart=/usr/bin/bettercap -no-colors -caplet pwnagotchi
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 - name: enable services
systemd: systemd:
name: "{{services.enable}}" name: "{{ item }}"
state: started state: started
enabled: yes enabled: yes
with_items: "{{ services.enable }}"
- name: disable unecessary services - name: disable unecessary services
systemd: systemd:
name: "{{services.disable}}" name: "{{ item }}"
state: stopped state: stopped
enabled: no enabled: no
with_items: "{{ services.disable }}"
- name: remove ssh keys - name: remove ssh keys
file: file:
@ -428,3 +431,10 @@
path: "{{item}}" path: "{{item}}"
with_fileglob: with_fileglob:
- "/etc/ssh/ssh_host*_key*" - "/etc/ssh/ssh_host*_key*"
handlers:
- name: reload systemd services
systemd:
daemon_reload: yes