Skip to content

Instantly share code, notes, and snippets.

@aidantwoods
Created June 17, 2017 22:46
Show Gist options
  • Save aidantwoods/e84cd8b4f3724aef19a88b4fdd302268 to your computer and use it in GitHub Desktop.
Save aidantwoods/e84cd8b4f3724aef19a88b4fdd302268 to your computer and use it in GitHub Desktop.
Aidan:/Volumes/boot $ echo 'dtoverlay=dwc2' > config.txt
Aidan:/Volumes/boot $ vi cmdline.txt
Aidan:/Volumes/boot $ > ssh
Aidan:/Volumes/boot $ cd
Aidan:~ $ diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful
Aidan:~ $ ssh pi@raspberrypi.local
The authenticity of host 'raspberrypi.local (fe80::85b8:cd81:3d29:e860%en6)' can't be established.
ECDSA key fingerprint is SHA256:V8HC9p+8Vrhx28f3i9uWAGm7CfK9m5qennklVY9lB8s.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'raspberrypi.local,fe80::85b8:cd81:3d29:e860%en6' (ECDSA) to the list of known hosts.
pi@raspberrypi.local's password:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
pi@raspberrypi:~ $ passwd
Changing password for pi.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
pi@raspberrypi:~ $ sudo passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
pi@raspberrypi:~ $ sudo su
root@raspberrypi:/home/pi# nano /etc/wpa_supplicant/wpa_supplicant.conf
root@raspberrypi:/home/pi# nano /etc/network/interfaces
root@raspberrypi:/home/pi# ifconfig wlan0 up
root@raspberrypi:/home/pi# ifdown wlan0
Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/wlan0/b8:27:eb:4a:3d:de
Sending on LPF/wlan0/b8:27:eb:4a:3d:de
Sending on Socket/fallback
root@raspberrypi:/home/pi# ifup wlan0
Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/wlan0/b8:27:eb:4a:3d:de
Sending on LPF/wlan0/b8:27:eb:4a:3d:de
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPOFFER from 192.168.0.1
DHCPACK from 192.168.0.1
bound to 192.168.0.23 -- renewal in 35833 seconds.
root@raspberrypi:/home/pi# exit
pi@raspberrypi:~ $ gpg
gpg: directory `/home/pi/.gnupg' created
gpg: new configuration file `/home/pi/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/pi/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/pi/.gnupg/secring.gpg' created
gpg: keyring `/home/pi/.gnupg/pubring.gpg' created
gpg: Go ahead and type your message ...
gpg: processing message failed: eof
pi@raspberrypi:~ $ gpg --recv-keys 9A6A8EFAA512BBB9
gpg: requesting key A512BBB9 from hkp server keys.gnupg.net
gpg: /home/pi/.gnupg/trustdb.gpg: trustdb created
gpg: key A512BBB9: public key "Aidan Woods <aidantwoods@gmail.com>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
pi@raspberrypi:~ $ wget https://gist.githubusercontent.com/aidantwoods/87b720761fd88973b7740b4b425fd66a/raw/4e23f1d59ebe59796064d7be756c74ed36050c05/install-hid.sh.asc
--2017-06-17 21:40:39-- https://gist.githubusercontent.com/aidantwoods/87b720761fd88973b7740b4b425fd66a/raw/4e23f1d59ebe59796064d7be756c74ed36050c05/install-hid.sh.asc
Resolving gist.githubusercontent.com (gist.githubusercontent.com)... 151.101.60.133
Connecting to gist.githubusercontent.com (gist.githubusercontent.com)|151.101.60.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1597 (1.6K) [text/plain]
Saving to: ‘install-hid.sh.asc’
install-hid.sh.asc 100%[====================================>] 1.56K --.-KB/s in 0s
2017-06-17 21:40:39 (3.61 MB/s) - ‘install-hid.sh.asc’ saved [1597/1597]
pi@raspberrypi:~ $ gpg --edit-key aidan
gpg (GnuPG) 1.4.18; Copyright (C) 2014 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
pub 4096R/A512BBB9 created: 2016-11-20 expires: 2020-11-19 usage: SC
trust: unknown validity: unknown
sub 4096R/3CEF3959 created: 2016-11-20 expires: 2020-11-19 usage: E
[ unknown] (1). Aidan Woods <aidantwoods@gmail.com>
gpg> trust
pub 4096R/A512BBB9 created: 2016-11-20 expires: 2020-11-19 usage: SC
trust: unknown validity: unknown
sub 4096R/3CEF3959 created: 2016-11-20 expires: 2020-11-19 usage: E
[ unknown] (1). Aidan Woods <aidantwoods@gmail.com>
Please decide how far you trust this user to correctly verify other users' keys
(by looking at passports, checking fingerprints from different sources, etc.)
1 = I don't know or won't say
2 = I do NOT trust
3 = I trust marginally
4 = I trust fully
5 = I trust ultimately
m = back to the main menu
Your decision? 5
Do you really want to set this key to ultimate trust? (y/N) y
pub 4096R/A512BBB9 created: 2016-11-20 expires: 2020-11-19 usage: SC
trust: ultimate validity: unknown
sub 4096R/3CEF3959 created: 2016-11-20 expires: 2020-11-19 usage: E
[ unknown] (1). Aidan Woods <aidantwoods@gmail.com>
Please note that the shown key validity is not necessarily correct
unless you restart the program.
gpg> q
pi@raspberrypi:~ $ wget https://gist.githubusercontent.com/aidantwoods/87b720761fd88973b7740b4b425fd66a/raw/4e23f1d59ebe59796064d7be756c74ed36050c05/install-hid.sh.asc
--2017-06-17 21:41:42-- https://gist.githubusercontent.com/aidantwoods/87b720761fd88973b7740b4b425fd66a/raw/4e23f1d59ebe59796064d7be756c74ed36050c05/install-hid.sh.asc
Resolving gist.githubusercontent.com (gist.githubusercontent.com)... 151.101.16.133
Connecting to gist.githubusercontent.com (gist.githubusercontent.com)|151.101.16.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1597 (1.6K) [text/plain]
Saving to: ‘install-hid.sh.asc’
install-hid.sh.asc 100%[====================================>] 1.56K --.-KB/s in 0s
2017-06-17 21:41:42 (3.33 MB/s) - ‘install-hid.sh.asc’ saved [1597/1597]
pi@raspberrypi:~ $ gpg -o install-hid.sh -d install-hid.sh.asc && chmod +x install-hid.sh && ./install-hid.sh
gpg: Signature made Sat 17 Jun 2017 21:38:31 UTC using RSA key ID A512BBB9
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: next trustdb check due at 2020-11-19
gpg: Good signature from "Aidan Woods <aidantwoods@gmail.com>"
gpg: Signature made Sat 17 Jun 2017 17:57:11 UTC using RSA key ID A512BBB9
gpg: Good signature from "Aidan Woods <aidantwoods@gmail.com>"
gpg: Signature made Sat 17 Jun 2017 17:57:14 UTC using RSA key ID A512BBB9
gpg: Good signature from "Aidan Woods <aidantwoods@gmail.com>"
pi@raspberrypi:~ $ sudo reboot
Broadcast message from pi@raspberrypi on pts/0 (Sat 2017-06-17 21:43:04 UTC):
The system is going down for reboot NOW!
pi@raspberrypi:~ $ Connection to raspberrypi.local closed by remote host.
Connection to raspberrypi.local closed.
Aidan:~ $ ssh pi@raspberrypi.local
Warning: Permanently added the ECDSA host key for IP address 'fe80::fd65:54a4:75c4:aa5e%en6' to the list of known hosts.
pi@raspberrypi.local's password:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Apr 10 10:00:55 2017 from fe80::1ca9:e69f:a977:5c6c%usb0
pi@raspberrypi:~ $ sudo nano /boot/cmdline.txt
pi@raspberrypi:~ $ sudo reboot
Broadcast message from pi@raspberrypi on pts/0 (Sat 2017-06-17 21:45:40 UTC):
The system is going down for reboot NOW!
pi@raspberrypi:~ $ Connection to raspberrypi.local closed by remote host.
Connection to raspberrypi.local closed.
Aidan:~ $ ssh pi@raspberrypi.local
Warning: Permanently added the ECDSA host key for IP address '192.168.0.23' to the list of known hosts.
pi@raspberrypi.local's password:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Jun 17 22:39:53 2017 from fe80::7d:32b:f1b:cdf%usb0
pi@raspberrypi:~ $ sudo ./hid.sh
pi@raspberrypi:~ $ ls /dev/hidg0
/dev/hidg0
pi@raspberrypi:~ $ echo "a" | sudo ./hid_gadget_test /dev/hidg0 keyboard
api@raspberrypi:~ $ a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment