Skip to content

Commit

Permalink
Code import into new repository (long overdue)
Browse files Browse the repository at this point in the history
  • Loading branch information
girst committed Aug 20, 2016
0 parents commit bc85b80
Show file tree
Hide file tree
Showing 40 changed files with 22,127 additions and 0 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions README.md
@@ -0,0 +1,42 @@
# Hardpass Prototype, v.1
A Raspberry Pi Zero based WiFi Enabled Hardware Password Manager

## Currently Implemented:
- OLED (demo)
- USB Gadgets (full)
- USB HID send keys progam

## TODO
- OLED: Menu program
- WiFi: compile & install driver
- Button Matrix (same program as OLED)

## Install ESP driver
If you want to use the ESP8266 on the SDIO pins of the Pi, download and install the driver from Andrew Litt.
```sh
# on the pi:
git clone https://github.com/al177/esp8089.git
make && sudo make install
```

## In this repository
This repository contains:
* USB HID progam `scan` with examples in `./send_hid`
* OLED menu system in `./oled`, using the `ArduiPi_OLED` driver from http://hallard.me
* Patcher and installer for `pass` in `./pass`
* KiCAD schematic and PCB layout in `./kicad`


## Setting up
To automatically load necessary kernel modules for the OLED on boot, run as root on the Pi:
```sh
echo "i2c-dev">>/etc/modules
echo "dwc2">>/etc/modules
```

A small systemd unit file is included; place it in `/etc/systemd/system/` and modify it, so it points to `init_usb.sh`, which you can also modify to your needs.

## License
I hereby release my work under the GNU GPLv3 where applicable. The complete license text, if not included, can be read at `https://www.gnu.org/licenses/gpl-3.0.txt`. Where the GPLv3 isn't applicable, the work is released under the Creative Commons Attribution-ShareAlike 4.0 International.
This repository also includes the ArduiPi_OLED library from [hallard](https://github.com/hallard); see [this website](http://hallard.me/adafruit-oled-display-driver-for-pi/) for details.
and the kicad-ESP8266 library from [jdunmire](https://github.com/jdunmire/kicad-ESP8266), which is released under the Creative Commons Attribution-ShareAlike 4.0 International License.
11 changes: 11 additions & 0 deletions hardpass.service
@@ -0,0 +1,11 @@
[Unit]
Description=Hardpass Initialisation
DefaultDependencies=true

[Service]
Type=simple
ExecStart=/home/pi/hardpass/init_usb.sh
WordkingDirectory=/home/pi/

[Install]
WantedBy=local-fs.target
70 changes: 70 additions & 0 deletions init_usb.sh
@@ -0,0 +1,70 @@
#!/bin/bash
# this file is from: https://github.com/ckuethe/usbarmory/wiki/USB-Gadgets
echo "creating composite mass-storage, serial, ethernet, hid..."
modprobe libcomposite

# assumes a disk image exists here...
FILE=/home/pi/hardpass/usbdisk.img
mkdir -p ${FILE/img/d}
mount -o loop,ro,offset=2048 -t vfat $FILE ${FILE/img/d}
cd /sys/kernel/config/usb_gadget/

mkdir -p g1
cd g1
#echo '' > UDC

echo 0x1d6b > idVendor # Linux Foundation
echo 0x0104 > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice # v1.0.0
echo 0x0200 > bcdUSB # USB2

mkdir -p strings/0x409
echo "fedcba9876543210" > strings/0x409/serialnumber
echo "girst" > strings/0x409/manufacturer
echo "Hardpass" > strings/0x409/product

N="usb0"
mkdir -p functions/acm.$N
mkdir -p functions/ecm.$N
mkdir -p functions/hid.$N
mkdir -p functions/mass_storage.$N

# first byte of address must be even
HOST="48:6f:73:74:50:43" # "HostPC"
SELF="42:61:64:55:53:42" # "BadUSB"
echo $HOST > functions/ecm.$N/host_addr
echo $SELF > functions/ecm.$N/dev_addr

echo 1 > functions/mass_storage.$N/stall
echo 0 > functions/mass_storage.$N/lun.0/cdrom
echo 0 > functions/mass_storage.$N/lun.0/ro
echo 0 > functions/mass_storage.$N/lun.0/nofua
echo $FILE > functions/mass_storage.$N/lun.0/file

echo 1 > functions/hid.usb0/protocol
echo 1 > functions/hid.usb0/subclass
echo 8 > functions/hid.usb0/report_length
echo -ne \\x05\\x01\\x09\\x06\\xa1\\x01\\x05\\x07\\x19\\xe0\\x29\\xe7\\x15\\x00\\x25\\x01\\x75\\x01\\x95\\x08\\x81\\x02\\x95\\x01\\x75\\x08\\x81\\x03\\x95\\x05\\x75\\x01\\x05\\x08\\x19\\x01\\x29\\x05\\x91\\x02\\x95\\x01\\x75\\x03\\x91\\x03\\x95\\x06\\x75\\x08\\x15\\x00\\x25\\x65\\x05\\x07\\x19\\x00\\x29\\x65\\x81\\x00\\xc0 > functions/hid.usb0/report_desc


C=1
mkdir -p configs/c.$C/strings/0x409
echo "Config $C: ECM network" > configs/c.$C/strings/0x409/configuration
echo 250 > configs/c.$C/MaxPower
ln -s functions/acm.$N configs/c.$C/
ln -s functions/ecm.$N configs/c.$C/
ln -s functions/mass_storage.$N configs/c.$C/
ln -s functions/hid.$N configs/c.$C/

# this lists available UDC drivers
ls /sys/class/udc > UDC

ifconfig $N 10.0.0.1 netmask 255.255.255.252 up
route add -net default gw 10.0.0.2
echo "done. "
#echo "initializing demo menu..."
#while 1; do
# /home/pi/hardpass/oled/run.sh
#done &
echo "starting shutdown 'daemon'"
/home/pi/hardpass/shutdown/shutdown-button.sh &
26 changes: 26 additions & 0 deletions kicad/README.txt
@@ -0,0 +1,26 @@
hardpass PCB files
Copyright 2016 Tobias Girstmair, github.com/girst
Released as GPLv3, with exception to the libraries included.

written on KiCad 4.0.3 on Ubuntu 16.04

Included are the following Libraries:
ESP-12 Footprint:
https://github.com/jdunmire/kicad-ESP8266
Copyright 2015 J.Dunmire
Creative Commons Attribution-ShareAlike 4.0
hardpass.pretty:
(C) 2015/2016 github.com/girst
CC-BY-SA
My own library, slightly modifying some default parts and the ESP-12E footprint from J.Dunmire.

(not included) FPC connector:
https://www.snapeda.com/parts/XF2M-2015-1A-R100/Omron/view-part/
CC-BY-SA w/ Design Exclusion
This is probably a good connector, but I haven't tried it yet.

There are TWO PCB designs included:
To use the default one without the ESP12E, keep the naming as it is.
To use the one with the ESP12E footprint, rename hardpass-esp12e.kicad_pcb to hardpass-pcb.kicad_pcb

To the best of my knowledge, nothing but the above listed material in this folder is copyrighted. If your work has been included against the term of its license, please contact me through the github issue tracker at http://github.com/girst/<NAME-OF-PROJECT>/issues.
56 changes: 56 additions & 0 deletions kicad/hardpass-pcb/.rpt
@@ -0,0 +1,56 @@
** Drc report for /home/tobias/Documents/kicad/hardpass-pcb/hardpass-pcb.kicad_pcb **
** Created on 2016-08-20 16:13:17 **

** Found 1 DRC errors **
ErrType(4): Track near pad
@ (128,750 mm,131,000 mm): Via 0,600 mm net [OLED_SCL] (5) on layers F.Cu/B.Cu
@ (131,000 mm,131,550 mm): Pad 6 on B.Cu, Non-copper of U2

** Found 15 unconnected pads **
ErrType(2): Unconnected pads
@ (127,270 mm,136,130 mm): Pad 1 on B.Cu, Non-copper of P1 net +3V3
@ (131,000 mm,127,550 mm): Pad 8 on B.Cu, Non-copper of U2
ErrType(2): Unconnected pads
@ (127,270 mm,128,510 mm): Pad 7 on B.Cu, Non-copper of P1 net ESP_CHPD
@ (131,000 mm,137,550 mm): Pad 3 on B.Cu, Non-copper of U2
ErrType(2): Unconnected pads
@ (127,270 mm,120,890 mm): Pad 13 on B.Cu, Non-copper of P1 net SD_D3
@ (173,875 mm,78,425 mm): Pad 2 on B.Cu, Non-copper of R15
ErrType(2): Unconnected pads
@ (127,270 mm,118,350 mm): Pad 15 on B.Cu, Non-copper of P1 net ESP_CLK
@ (178,875 mm,78,425 mm): Pad 2 on B.Cu, Non-copper of R17
ErrType(2): Unconnected pads
@ (166,375 mm,78,425 mm): Pad 2 on B.Cu, Non-copper of R12 net SD_CMD
@ (124,730 mm,118,350 mm): Pad 16 on B.Cu, Non-copper of P1
ErrType(2): Unconnected pads
@ (124,730 mm,115,810 mm): Pad 18 on B.Cu, Non-copper of P1 net SD_D0
@ (168,875 mm,78,425 mm): Pad 2 on B.Cu, Non-copper of R13
ErrType(2): Unconnected pads
@ (176,375 mm,78,425 mm): Pad 2 on B.Cu, Non-copper of R16 net SD_D1
@ (124,730 mm,110,730 mm): Pad 22 on B.Cu, Non-copper of P1
ErrType(2): Unconnected pads
@ (127,270 mm,90,410 mm): Pad 37 on B.Cu, Non-copper of P1 net SD_D2
@ (171,375 mm,78,425 mm): Pad 2 on B.Cu, Non-copper of R14
ErrType(2): Unconnected pads
@ (151,575 mm,137,450 mm): Pad 2 on F.Cu, Non-copper of SW12 net ROW_4
@ (143,625 mm,137,450 mm): Pad 2 on F.Cu, Non-copper of SW12
ErrType(2): Unconnected pads
@ (132,990 mm,125,800 mm): Pad 9 on B.Cu, Non-copper of U2 net Net-(R12-Pad1)
@ (166,375 mm,81,325 mm): Pad 1 on B.Cu, Non-copper of R12
ErrType(2): Unconnected pads
@ (168,875 mm,81,325 mm): Pad 1 on B.Cu, Non-copper of R13 net Net-(R13-Pad1)
@ (134,990 mm,125,800 mm): Pad 10 on B.Cu, Non-copper of U2
ErrType(2): Unconnected pads
@ (171,375 mm,81,325 mm): Pad 1 on B.Cu, Non-copper of R14 net Net-(R14-Pad1)
@ (136,990 mm,125,800 mm): Pad 11 on B.Cu, Non-copper of U2
ErrType(2): Unconnected pads
@ (173,875 mm,81,325 mm): Pad 1 on B.Cu, Non-copper of R15 net Net-(R15-Pad1)
@ (138,990 mm,125,800 mm): Pad 12 on B.Cu, Non-copper of U2
ErrType(2): Unconnected pads
@ (176,375 mm,81,325 mm): Pad 1 on B.Cu, Non-copper of R16 net Net-(R16-Pad1)
@ (140,990 mm,125,800 mm): Pad 13 on B.Cu, Non-copper of U2
ErrType(2): Unconnected pads
@ (178,875 mm,81,325 mm): Pad 1 on B.Cu, Non-copper of R17 net Net-(R17-Pad1)
@ (142,990 mm,125,800 mm): Pad 14 on B.Cu, Non-copper of U2

** End of Report **
53 changes: 53 additions & 0 deletions kicad/hardpass-pcb/.rpt.rpt
@@ -0,0 +1,53 @@
** Drc report for /home/tobias/Documents/kicad/hardpass-pcb/hardpass-pcb.kicad_pcb **
** Created on 2016-08-20 16:14:00 **

** Found 0 DRC errors **

** Found 15 unconnected pads **
ErrType(2): Unconnected pads
@ (127,270 mm,136,130 mm): Pad 1 on B.Cu, Non-copper of P1 net +3V3
@ (131,000 mm,127,550 mm): Pad 8 on B.Cu, Non-copper of U2
ErrType(2): Unconnected pads
@ (127,270 mm,128,510 mm): Pad 7 on B.Cu, Non-copper of P1 net ESP_CHPD
@ (131,000 mm,137,550 mm): Pad 3 on B.Cu, Non-copper of U2
ErrType(2): Unconnected pads
@ (127,270 mm,120,890 mm): Pad 13 on B.Cu, Non-copper of P1 net SD_D3
@ (173,875 mm,78,425 mm): Pad 2 on B.Cu, Non-copper of R15
ErrType(2): Unconnected pads
@ (127,270 mm,118,350 mm): Pad 15 on B.Cu, Non-copper of P1 net ESP_CLK
@ (178,875 mm,78,425 mm): Pad 2 on B.Cu, Non-copper of R17
ErrType(2): Unconnected pads
@ (166,375 mm,78,425 mm): Pad 2 on B.Cu, Non-copper of R12 net SD_CMD
@ (124,730 mm,118,350 mm): Pad 16 on B.Cu, Non-copper of P1
ErrType(2): Unconnected pads
@ (124,730 mm,115,810 mm): Pad 18 on B.Cu, Non-copper of P1 net SD_D0
@ (168,875 mm,78,425 mm): Pad 2 on B.Cu, Non-copper of R13
ErrType(2): Unconnected pads
@ (176,375 mm,78,425 mm): Pad 2 on B.Cu, Non-copper of R16 net SD_D1
@ (124,730 mm,110,730 mm): Pad 22 on B.Cu, Non-copper of P1
ErrType(2): Unconnected pads
@ (127,270 mm,90,410 mm): Pad 37 on B.Cu, Non-copper of P1 net SD_D2
@ (171,375 mm,78,425 mm): Pad 2 on B.Cu, Non-copper of R14
ErrType(2): Unconnected pads
@ (151,575 mm,137,450 mm): Pad 2 on F.Cu, Non-copper of SW12 net ROW_4
@ (143,625 mm,137,450 mm): Pad 2 on F.Cu, Non-copper of SW12
ErrType(2): Unconnected pads
@ (132,990 mm,125,800 mm): Pad 9 on B.Cu, Non-copper of U2 net Net-(R12-Pad1)
@ (166,375 mm,81,325 mm): Pad 1 on B.Cu, Non-copper of R12
ErrType(2): Unconnected pads
@ (168,875 mm,81,325 mm): Pad 1 on B.Cu, Non-copper of R13 net Net-(R13-Pad1)
@ (134,990 mm,125,800 mm): Pad 10 on B.Cu, Non-copper of U2
ErrType(2): Unconnected pads
@ (171,375 mm,81,325 mm): Pad 1 on B.Cu, Non-copper of R14 net Net-(R14-Pad1)
@ (136,990 mm,125,800 mm): Pad 11 on B.Cu, Non-copper of U2
ErrType(2): Unconnected pads
@ (173,875 mm,81,325 mm): Pad 1 on B.Cu, Non-copper of R15 net Net-(R15-Pad1)
@ (138,990 mm,125,800 mm): Pad 12 on B.Cu, Non-copper of U2
ErrType(2): Unconnected pads
@ (176,375 mm,81,325 mm): Pad 1 on B.Cu, Non-copper of R16 net Net-(R16-Pad1)
@ (140,990 mm,125,800 mm): Pad 13 on B.Cu, Non-copper of U2
ErrType(2): Unconnected pads
@ (178,875 mm,81,325 mm): Pad 1 on B.Cu, Non-copper of R17 net Net-(R17-Pad1)
@ (142,990 mm,125,800 mm): Pad 14 on B.Cu, Non-copper of U2

** End of Report **

0 comments on commit bc85b80

Please sign in to comment.