├── .DS_Store ├── Halloween-Hacking ├── Halloween-Hacking-(10-23-22-NSL).pdf └── code │ ├── animations.py │ ├── basic-button-test.py │ ├── basic-led.py │ ├── faces │ ├── jack-o-nugg-left-inv.bmp │ ├── jack-o-nugg-left.bmp │ ├── jack-o-nugg-right-inv.bmp │ ├── jack-o-nugg-right.bmp │ ├── spooky-nugg-inv.bmp │ └── spooky-nugg.bmp │ ├── lib │ ├── adafruit_display_text │ │ ├── __init__.mpy │ │ ├── bitmap_label.mpy │ │ └── label.mpy │ ├── adafruit_displayio_sh1106.py │ ├── adafruit_framebuf.mpy │ └── adafruit_led_animation │ │ ├── __init__.mpy │ │ ├── animation │ │ ├── __init__.mpy │ │ ├── blink.mpy │ │ ├── chase.mpy │ │ ├── colorcycle.mpy │ │ ├── comet.mpy │ │ ├── customcolorchase.mpy │ │ ├── grid_rain.mpy │ │ ├── pulse.mpy │ │ ├── rainbow.mpy │ │ ├── rainbowchase.mpy │ │ ├── rainbowcomet.mpy │ │ ├── rainbowsparkle.mpy │ │ ├── solid.mpy │ │ ├── sparkle.mpy │ │ └── sparklepulse.mpy │ │ ├── color.mpy │ │ ├── grid.mpy │ │ ├── group.mpy │ │ ├── helper.mpy │ │ └── sequence.mpy │ └── packetmonitor.py ├── Intro-to-Data-Exfiltration ├── Intro-to-Data-Exfiltration-(10-07-22-NSL).pdf └── scripts │ ├── linux.sh │ ├── mac.sh │ └── win.bat ├── Keystroke-Injection-Fundamentals └── Keystroke-Injection-Fundamentals-(09-10-22-NSL).pdf ├── README.md ├── USB-Nugget-Quickstart ├── Soldering-&-USB-Attack-Workshop-(03-19-23-Crash-Space) .pdf ├── Soldering-&-USB-Attack-Workshop-(04-29-23-OHS).pdf └── Soldering-&-USB-Attack-Workshop-(11-06-22-Supercon).pdf └── WiFi-Hacking-Quickstart ├── WiFi-Hacking-Quickstart-(01-15-23).pdf └── code ├── 1_basic_led.py ├── 2_led_animations.py ├── 3_led_sequences.py ├── 4_hardware_test.py ├── 5_packet_monitor.py ├── 6_canarytoken.py ├── faces ├── jack-o-nugg-left-inv.bmp ├── jack-o-nugg-left.bmp ├── jack-o-nugg-right-inv.bmp ├── jack-o-nugg-right.bmp ├── spooky-nugg-inv.bmp └── spooky-nugg.bmp └── lib ├── adafruit_display_text ├── __init__.mpy ├── bitmap_label.mpy └── label.mpy ├── adafruit_displayio_sh1106.py ├── adafruit_framebuf.mpy ├── adafruit_led_animation ├── __init__.mpy ├── animation │ ├── __init__.mpy │ ├── blink.mpy │ ├── chase.mpy │ ├── colorcycle.mpy │ ├── comet.mpy │ ├── customcolorchase.mpy │ ├── grid_rain.mpy │ ├── pulse.mpy │ ├── rainbow.mpy │ ├── rainbowchase.mpy │ ├── rainbowcomet.mpy │ ├── rainbowsparkle.mpy │ ├── solid.mpy │ ├── sparkle.mpy │ └── sparklepulse.mpy ├── color.mpy ├── grid.mpy ├── group.mpy ├── helper.mpy └── sequence.mpy └── adafruit_requests.mpy /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/.DS_Store -------------------------------------------------------------------------------- /Halloween-Hacking/Halloween-Hacking-(10-23-22-NSL).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/Halloween-Hacking-(10-23-22-NSL).pdf -------------------------------------------------------------------------------- /Halloween-Hacking/code/animations.py: -------------------------------------------------------------------------------- 1 | import board 2 | import neopixel 3 | 4 | from adafruit_led_animation.animation.sparklepulse import SparklePulse 5 | from adafruit_led_animation.animation.blink import Blink 6 | from adafruit_led_animation.animation.rainbow import Rainbow 7 | from adafruit_led_animation.animation.rainbowchase import RainbowChase 8 | from adafruit_led_animation.animation.rainbowcomet import RainbowComet 9 | from adafruit_led_animation.animation.colorcycle import ColorCycle 10 | 11 | from adafruit_led_animation.sequence import AnimationSequence 12 | 13 | from adafruit_led_animation.color import * 14 | 15 | # Update to match the pin connected to your NeoPixels 16 | pixel_pin = board.IO12 17 | # Update to match the number of NeoPixels you have connected 18 | pixel_num = 11 19 | 20 | pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False) 21 | 22 | sparkle_pulse = SparklePulse(pixels, speed=0.05, period=3, color=JADE) 23 | rainbow = Rainbow(pixels, speed=0.1, period=2) 24 | rainbow_chase = RainbowChase(pixels, speed=0.1, size=5, spacing=3, step=50) 25 | rainbow_comet = RainbowComet(pixels, speed=0.1, tail_length=7, bounce=True) 26 | colorcycle = ColorCycle(pixels, 0.5, colors=[MAGENTA, ORANGE, TEAL]) 27 | 28 | animations = AnimationSequence( 29 | rainbow_comet, rainbow_chase,sparkle_pulse, colorcycle, advance_interval=5, auto_clear=True, random_order=True 30 | ) 31 | 32 | while True: 33 | #rainbow_chase.animate() 34 | #rainbow_comet.animate() 35 | #sparkle_pulse.animate() 36 | #rainbow.animate() 37 | #colorcycle.animate() 38 | 39 | #String together animations 40 | animations.animate() 41 | 42 | 43 | -------------------------------------------------------------------------------- /Halloween-Hacking/code/basic-button-test.py: -------------------------------------------------------------------------------- 1 | # Nugget Demo, by @AngelinaTsuboi using Adafruit CircuitPython 2 | # Objective: A gentle introduction into the Nugget OLED interface, button input, and Neopixel programming 3 | # Functionality: Change Nugget Faces and Neopixel Color when a specific arrow key is pressed 4 | import time 5 | import random 6 | import board 7 | import neopixel 8 | from digitalio import DigitalInOut, Direction, Pull 9 | from board import SCL, SDA 10 | import busio 11 | import displayio 12 | import adafruit_framebuf 13 | import adafruit_displayio_sh1106 14 | 15 | ## Screen setup and function to change image on the screen 16 | faceImage = "faces/derpcat.bmp" 17 | displayio.release_displays() 18 | WIDTH = 130 # Change these to the right size for your display! 19 | HEIGHT = 64 20 | 21 | i2c = busio.I2C(SCL, SDA) # Create the I2C interface. 22 | display_bus = displayio.I2CDisplay(i2c, device_address=0x3c) 23 | display = adafruit_displayio_sh1106.SH1106(display_bus, width=WIDTH, height=HEIGHT) # Create the SH1106 OLED class. 24 | 25 | def NugFace(faceImage): ## Make a function to put cat face onto screen 26 | bitmap = displayio.OnDiskBitmap(faceImage) # Setup the file as the bitmap data source 27 | tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader) # Create a TileGrid to hold the bitmap 28 | group = displayio.Group() # Create a Group to hold the TileGrid 29 | group.append(tile_grid) # Add the TileGrid to the Group 30 | display.show(group) # Add the Group to the Display 31 | 32 | NugFace(faceImage) #@# Show menu 33 | 34 | ## Neopixel Setup 35 | 36 | pixel_pin = board.IO12 # Specify the pin that the neopixel is connected to (GPIO 12) 37 | num_pixels = 1; delay = .1 # Set number of neopixels & delay between color changes in seconds 38 | pixel = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.3) # Create neopixel and set brightness to 30% 39 | 40 | def SetColor(color): # Define function with one input (color we want to set) 41 | for i in range(0, num_pixels): # Addressing all 1 neopixels in a loop 42 | pixel[i] = (color) # Set all neopixels a color 43 | 44 | ## Button Setup 45 | 46 | #ButtonDict = {'up': 'IO9', 'down': 'IO18', 'left': 'IO11', 'right': 'IO14'} man these suck to use for indexing what was I thinking 47 | LabelList = ['up', 'down', 'left', 'right'] 48 | PinList = ['IO9', 'IO18', 'IO11', 'IO14'] 49 | 50 | # Set up Arrow Keys 51 | 52 | upBtn = DigitalInOut(board.IO9) 53 | upBtn.direction = Direction.INPUT 54 | upBtn.pull = Pull.UP 55 | up_prev_state = upBtn.value 56 | 57 | downBtn = DigitalInOut(board.IO18) 58 | downBtn.direction = Direction.INPUT 59 | downBtn.pull = Pull.UP 60 | down_prev_state = downBtn.value 61 | 62 | leftBtn = DigitalInOut(board.IO11) 63 | leftBtn.direction = Direction.INPUT 64 | leftBtn.pull = Pull.UP 65 | left_prev_state = leftBtn.value 66 | 67 | rightBtn = DigitalInOut(board.IO7) 68 | rightBtn.direction = Direction.INPUT 69 | rightBtn.pull = Pull.UP 70 | right_prev_state = rightBtn.value 71 | 72 | ## Set up variables to check on the state of buttons and see if they have been pressed 73 | 74 | ButtonList = [upBtn, downBtn, leftBtn, rightBtn] 75 | StateList = [up_prev_state, down_prev_state, left_prev_state, right_prev_state] 76 | SetColor([0,0, 255]) 77 | 78 | while True: 79 | for i in range(0,4): 80 | cur_state = ButtonList[i].value 81 | if cur_state != StateList[i]: 82 | if not cur_state: 83 | print(LabelList[i], "is pressed") 84 | if LabelList[i] == 'up': 85 | faceImage = "faces/goofnug.bmp" 86 | SetColor([255,0,0]) 87 | elif LabelList[i] == 'down': 88 | faceImage = "faces/boocat.bmp" 89 | SetColor([0,255,0]) 90 | elif LabelList[i] == 'right': 91 | faceImage = "faces/derpcat.bmp" 92 | SetColor([0,0, 255]) 93 | else: 94 | faceImage = "faces/uwu.bmp" 95 | SetColor([247,158,240]) 96 | NugFace(faceImage) 97 | StateList[i] = cur_state 98 | 99 | -------------------------------------------------------------------------------- /Halloween-Hacking/code/basic-led.py: -------------------------------------------------------------------------------- 1 | import board 2 | import neopixel 3 | import time 4 | 5 | # NeoPixel pin & number of NeoPixels 6 | pixel_pin = board.IO12 7 | pixel_num = 11 8 | 9 | #initialize NeoPixels 10 | pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=.1) 11 | 12 | # cycle through pixels and set to solid color 13 | for i in range(0,pixel_num): 14 | pixels[i] = (0,255,0) 15 | time.sleep(1) 16 | -------------------------------------------------------------------------------- /Halloween-Hacking/code/faces/jack-o-nugg-left-inv.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/faces/jack-o-nugg-left-inv.bmp -------------------------------------------------------------------------------- /Halloween-Hacking/code/faces/jack-o-nugg-left.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/faces/jack-o-nugg-left.bmp -------------------------------------------------------------------------------- /Halloween-Hacking/code/faces/jack-o-nugg-right-inv.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/faces/jack-o-nugg-right-inv.bmp -------------------------------------------------------------------------------- /Halloween-Hacking/code/faces/jack-o-nugg-right.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/faces/jack-o-nugg-right.bmp -------------------------------------------------------------------------------- /Halloween-Hacking/code/faces/spooky-nugg-inv.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/faces/spooky-nugg-inv.bmp -------------------------------------------------------------------------------- /Halloween-Hacking/code/faces/spooky-nugg.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/faces/spooky-nugg.bmp -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_display_text/__init__.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_display_text/__init__.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_display_text/bitmap_label.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_display_text/bitmap_label.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_display_text/label.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_display_text/label.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_displayio_sh1106.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries 2 | # SPDX-FileCopyrightText: Copyright (c) 2021 ladyada for Adafruit Industries 3 | # 4 | # SPDX-License-Identifier: MIT 5 | """ 6 | `adafruit_displayio_sh1106` 7 | ================================================================================ 8 | 9 | DisplayIO compatible library for SH1106 OLED displays 10 | 11 | 12 | * Author(s): ladyada 13 | 14 | Implementation Notes 15 | -------------------- 16 | 17 | **Hardware:** 18 | 19 | **Software and Dependencies:** 20 | 21 | * Adafruit CircuitPython firmware for the supported boards: 22 | https://github.com/adafruit/circuitpython/releases 23 | 24 | """ 25 | 26 | # imports 27 | import displayio 28 | 29 | __version__ = "0.0.0-auto.0" 30 | __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SH1106.git" 31 | 32 | 33 | # Sequence from sh1106 framebuf driver formatted for displayio init 34 | _INIT_SEQUENCE = ( 35 | b"\xae\x00" # display off, sleep mode 36 | b"\xd5\x01\x80" # divide ratio/oscillator: divide by 2, fOsc (POR) 37 | b"\xa8\x01\x3f" # multiplex ratio = 64 (POR) 38 | b"\xd3\x01\x00" # set display offset mode = 0x0 39 | b"\x40\x00" # set start line 40 | b"\xad\x01\x8b" # turn on DC/DC 41 | b"\xa1\x00" # segment remap = 1 (POR=0, down rotation) 42 | b"\xc8\x00" # scan decrement 43 | b"\xda\x01\x12" # set com pins 44 | b"\x81\x01\xff" # contrast setting = 0xff 45 | b"\xd9\x01\x1f" # pre-charge/dis-charge period mode: 2 DCLKs/2 DCLKs (POR) 46 | b"\xdb\x01\x40" # VCOM deselect level = 0.770 (POR) 47 | b"\x20\x01\x20" # 48 | b"\x33\x00" # turn on VPP to 9V 49 | b"\xa6\x00" # normal (not reversed) display 50 | b"\xa4\x00" # entire display off, retain RAM, normal status (POR) 51 | b"\xaf\x00" # DISPLAY_ON 52 | ) 53 | 54 | 55 | class SH1106(displayio.Display): 56 | """ 57 | SH1106 driver for use with DisplayIO 58 | 59 | :param bus: The bus that the display is connected to. 60 | :param int width: The width of the display. Maximum of 132 61 | :param int height: The height of the display. Maximum of 64 62 | :param int rotation: The rotation of the display. 0, 90, 180 or 270. 63 | """ 64 | 65 | def __init__(self, bus, **kwargs): 66 | init_sequence = bytearray(_INIT_SEQUENCE) 67 | super().__init__( 68 | bus, 69 | init_sequence, 70 | **kwargs, 71 | color_depth=1, 72 | grayscale=True, 73 | pixels_in_byte_share_row=False, # in vertical (column) mode 74 | data_as_commands=True, # every byte will have a command byte preceeding 75 | brightness_command=0x81, 76 | single_byte_bounds=True, 77 | # for sh1107 use column and page addressing. 78 | # lower column command = 0x00 - 0x0F 79 | # upper column command = 0x10 - 0x17 80 | # set page address = 0xB0 - 0xBF (16 pages) 81 | SH1107_addressing=True, 82 | ) 83 | self._is_awake = True # Display starts in active state (_INIT_SEQUENCE) 84 | 85 | @property 86 | def is_awake(self): 87 | """ 88 | The power state of the display. (read-only) 89 | 90 | `True` if the display is active, `False` if in sleep mode. 91 | """ 92 | return self._is_awake 93 | 94 | def sleep(self): 95 | """ 96 | Put display into sleep mode. The display uses < 5uA in sleep mode. 97 | 98 | Sleep mode does the following: 99 | 100 | 1) Stops the oscillator and DC-DC circuits 101 | 2) Stops the OLED drive 102 | 3) Remembers display data and operation mode active prior to sleeping 103 | 4) The MP can access (update) the built-in display RAM 104 | """ 105 | if self._is_awake: 106 | self.bus.send(int(0xAE), "") # 0xAE = display off, sleep mode 107 | self._is_awake = False 108 | 109 | def wake(self): 110 | """ 111 | Wake display from sleep mode 112 | """ 113 | if not self._is_awake: 114 | self.bus.send(int(0xAF), "") # 0xAF = display on 115 | self._is_awake = True 116 | -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_framebuf.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_framebuf.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/__init__.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/__init__.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/animation/__init__.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/animation/__init__.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/animation/blink.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/animation/blink.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/animation/chase.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/animation/chase.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/animation/colorcycle.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/animation/colorcycle.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/animation/comet.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/animation/comet.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/animation/customcolorchase.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/animation/customcolorchase.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/animation/grid_rain.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/animation/grid_rain.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/animation/pulse.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/animation/pulse.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/animation/rainbow.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/animation/rainbow.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/animation/rainbowchase.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/animation/rainbowchase.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/animation/rainbowcomet.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/animation/rainbowcomet.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/animation/rainbowsparkle.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/animation/rainbowsparkle.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/animation/solid.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/animation/solid.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/animation/sparkle.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/animation/sparkle.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/animation/sparklepulse.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/animation/sparklepulse.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/color.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/color.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/grid.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/grid.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/group.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/group.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/helper.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/helper.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/lib/adafruit_led_animation/sequence.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Halloween-Hacking/code/lib/adafruit_led_animation/sequence.mpy -------------------------------------------------------------------------------- /Halloween-Hacking/code/packetmonitor.py: -------------------------------------------------------------------------------- 1 | import gc 2 | import time 3 | import board 4 | import digitalio 5 | import supervisor 6 | import random 7 | import wifi 8 | import espidf 9 | import ipaddress 10 | import socketpool 11 | import ssl 12 | import neopixel 13 | from board import SCL, SDA 14 | import busio 15 | import displayio 16 | import adafruit_framebuf 17 | import adafruit_displayio_sh1106 18 | 19 | displayio.release_displays() 20 | 21 | WIDTH = 130 # Change these to the right size for your display! 22 | HEIGHT = 64 23 | BORDER = 1 24 | 25 | i2c = busio.I2C(SCL, SDA) # Create the I2C interface. 26 | display_bus = displayio.I2CDisplay(i2c, device_address=0x3c) 27 | display = adafruit_displayio_sh1106.SH1106(display_bus, width=WIDTH, height=HEIGHT) # Create the SH1106 OLED class. 28 | 29 | pixel_pin = board.IO12 # Specify the pin that the neopixel is connected to (GPIO 12) 30 | num_pixels = 1 # Set number of neopixels 31 | pixel = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.6) # Create neopixel and set brightness to 30% 32 | 33 | def SetAll(color): # Define function with one input (color we want to set) 34 | for i in range(0, num_pixels): # Addressing all 11 neopixels in a loop 35 | pixel[i] = (color) # Set all neopixels a color 36 | 37 | def NugEyes(IMAGE): 38 | bitmap = displayio.OnDiskBitmap(IMAGE) # Setup the file as the bitmap data source 39 | tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader) # Create a TileGrid to hold the bitmap 40 | group = displayio.Group() # Create a Group to hold the TileGrid 41 | group.append(tile_grid) # Add the TileGrid to the Group 42 | display.show(group) # Add the Group to the Display 43 | 44 | def DeauthCheck(newPacket): 45 | if subt_names[fd["subt"]] == "Deauthentication": 46 | NugEyes("/faces/spooky-nugg-inv.bmp") 47 | SetAll([159, 43, 104]) 48 | else: 49 | NugEyes("/faces/jack-o-nugg-left-inv.bmp") 50 | SetAll([255,127,0]) 51 | 52 | PARSE_HEADER = True 53 | PARSE_BODY = True # if True, PARSE_HEADER must be True 54 | PARSE_IES = False # if True, PARSE_BODY must be True 55 | 56 | type_names = ("mgmt", "ctrl", "data", "extn") 57 | 58 | subt_names = ("Association Req.", "Association Resp.", "ReAssociation Req.", "ReAssociation Resp.", 59 | "Probe Request", "Probe Request", "Timing", "Reserved", 60 | "Beacon Frame", "ATIM", "Dissassociation", "Auth", 61 | "Deauthentication", "Action", "ActionN", "ReservedF",) 62 | 63 | fixed = (4,6,10,6, 64 | 0,12,0,0, 65 | 12,0,2,6, 66 | 2,0,0,0,) 67 | 68 | ie_names = {0: "0_SSID", 69 | 1: "1_Rates", 70 | 2: "2_FH", 71 | 3: "3_DS", 72 | 4: "4_CF", 73 | 5: "5_TIM", 74 | 6: "6_IBSS", 75 | 7: "7_Country", 76 | 8: "8_HopParam", 77 | 9: "9_HopTable", 78 | 10: "10_Req", 79 | 16: "16_Challenge", 80 | 32: "32_PowConst", 81 | 33: "33_PowCapab", 82 | 34: "34_TPCReq", 83 | 35: "35_TPCRep", 84 | 36: "36_Chans", 85 | 37: "37_ChSwitch", 86 | 38: "38_MeasReq", 87 | 39: "39_MeasRep", 88 | 40: "40_Quiet", 89 | 41: "41_IBSSDFS", 90 | 42: "42_ERP", 91 | 48: "48_Robust", 92 | 50: "50_XRates", 93 | 221: "221_WPA",} 94 | 95 | def check_type(mac): 96 | # determine MAC type 97 | mactype = "" 98 | try: 99 | # mac_int = int('0x' + mac[1], base=16) # not supported in CP 100 | mac_int = int("".join(("0x", mac[0:2]))) 101 | if (mac_int & 0b0011) == 0b0011: # 3,7,B,F LOCAL MULTICAST 102 | mactype = "L_M" 103 | elif (mac_int & 0b0010) == 0b0010: # 2,3,6,7,A,B,E,F LOCAL 104 | mactype = "LOC" 105 | elif (mac_int & 0b0001) == 0b0001: # 1,3,5,7,9,B,D,F MULTICAST 106 | mactype = "MUL" 107 | else: # 0,4,8,C VENDOR (or unassigned) 108 | mactype = "VEN" 109 | except (ValueError, IndexError) as e: 110 | pass 111 | return mactype 112 | 113 | def parse_header(fd, buf): 114 | fd["type"] = (buf[0] & 0b00001100) >> 2 115 | fd["typename"] = type_names[fd["type"]] 116 | fd["subt"] = (buf[0] & 0b11110000) >> 4 117 | fd["subtname"] = subt_names[fd["subt"]] 118 | fd["fc0"] = buf[0] 119 | fd["fc1"] = buf[1] 120 | fd["dur"] = (buf[3] << 8) + buf[2] 121 | fd["a1"] = ":".join("%02X" % _ for _ in buf[4:10]) 122 | fd["a2"] = ":".join("%02X" % _ for _ in buf[10:16]) 123 | fd["a3"] = ":".join("%02X" % _ for _ in buf[16:22]) 124 | fd["a1_type"] = check_type(fd["a1"]) 125 | fd["a2_type"] = check_type(fd["a2"]) 126 | fd["a3_type"] = check_type(fd["a3"]) 127 | fd["seq"] = ((buf[22] & 0b00001111) << 8) + buf[23] 128 | fd["frag"] = (buf[22] & 0b11110000) >> 4 129 | return fd 130 | 131 | def parse_body(fd, buf): 132 | ies = {} 133 | fd["ssid"] = "" 134 | pos = 24 + fixed[fd["subt"]] 135 | while pos < fd["len"] - 1: 136 | try: 137 | ie_id = buf[pos] 138 | ie_len = buf[pos + 1] 139 | ie_start = pos + 2 140 | ie_end = ie_start + ie_len 141 | 142 | if (ie_id == 0): 143 | if (ie_len > 0): 144 | # if fd["subt"] in (1, 4, 5, 8): 145 | ssid = "" 146 | for _ in range(ie_start, ie_end): 147 | ssid = ssid + chr(buf[_]) 148 | fd["ssid"] = ssid 149 | 150 | # if SSID wasn't in the first IE, too bad... 151 | if not PARSE_IES: 152 | break; 153 | 154 | ie_body = "".join("%02X" % _ for _ in buf[ie_start : ie_end]) 155 | if ie_id in ie_names: 156 | ies[ie_names[ie_id]] = ie_body 157 | else: 158 | ies[ie_id] = ie_body 159 | except IndexError as e: # 32 32 33 160 | print("IndexError", e, pos, ie_end, fd["len"]) 161 | pos = ie_end 162 | fd["ies"] = ies 163 | return fd 164 | 165 | def get_packet(): 166 | fd = {} 167 | fd["qlen"] = monitor.queued() 168 | fd["lost"] = monitor.lost() 169 | received = monitor.packet() 170 | if received != {}: 171 | fd["len"] = received[wifi.Packet.LEN] 172 | fd["ch"] = received[wifi.Packet.CH] 173 | fd["rssi"] = received[wifi.Packet.RSSI] 174 | 175 | if PARSE_HEADER: 176 | fd = parse_header(fd, received[wifi.Packet.RAW]) 177 | if PARSE_BODY: 178 | fd = parse_body(fd, received[wifi.Packet.RAW]) 179 | print("CH:{} RSSI:{} TYPE:{} SRC:{} DST:{}".format(fd["ch"],fd["rssi"],fd["subtname"],fd["a2"],fd["a1"])) 180 | return fd 181 | 182 | print("-"*49) 183 | print("Starting Monitor...") 184 | monitor = wifi.Monitor() 185 | print("-"*49) 186 | 187 | while True: 188 | try: 189 | monitor.channel = random.randrange(1, 12) 190 | fd = get_packet() 191 | if len(fd) > 2: 192 | if PARSE_HEADER: 193 | DeauthCheck(subt_names[fd["subt"]]) 194 | except RuntimeError as e: 195 | print("RuntimeError", e) 196 | -------------------------------------------------------------------------------- /Intro-to-Data-Exfiltration/Intro-to-Data-Exfiltration-(10-07-22-NSL).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Intro-to-Data-Exfiltration/Intro-to-Data-Exfiltration-(10-07-22-NSL).pdf -------------------------------------------------------------------------------- /Intro-to-Data-Exfiltration/scripts/linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ll `ls` > /media/$USER/NUGGET/dir.txt 4 | ifconfig > /media/$USER/NUGGET/ip.txt -------------------------------------------------------------------------------- /Intro-to-Data-Exfiltration/scripts/mac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ls -l > /Volumes/NUGGET/dir.txt 4 | ifconfig > /Volumes/NUGGET/ip.txt 5 | -------------------------------------------------------------------------------- /Intro-to-Data-Exfiltration/scripts/win.bat: -------------------------------------------------------------------------------- 1 | dir /s /b /a > D:/dir.txt 2 | ipconfig /all > D:ip.txt -------------------------------------------------------------------------------- /Keystroke-Injection-Fundamentals/Keystroke-Injection-Fundamentals-(09-10-22-NSL).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/Keystroke-Injection-Fundamentals/Keystroke-Injection-Fundamentals-(09-10-22-NSL).pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nugget Workshops 2 | This repository contains archives of Nugget related classes and workshops. 3 | 4 | ## ⌨️ WiFi Hacking Quickstart 5 | Soldering, coding, WiFi hacking, and more! This workshop is a "sample platter" that gives a brief introduction to WiFi hacking & programming. We use CircuitPython to practice reconnaissance by creating a WiFi-reactive light project that alerts you if your home network is under attack! 6 | `Beginner` `Intermediate` 7 | 8 | ## 🎃 Halloween Hacking 9 | Soldering, coding, WiFi hacking, and more! This workshop is a "sample platter" that gives a brief introduction to WiFi hacking & programming. We use CircuitPython to practice reconnaissance by creating a WiFi-reactive Halloween light strip that alerts you if your home network is under attack! 10 | `Beginner` `Intermediate` 11 | 12 | ## ⌨️ Keystroke Injection Fundamentals 13 | This workshop covers how hackers use USB as an attack vector, and walks beginners through creating their own keystroke injection payloads on a Nugget. Attendees learn the basic hacking methodology and how to apply this to creating effective payloads. 14 | `Beginner` `Intermediate` 15 | 16 | ## 💾 Intro to Data Exfiltration 17 | This workshop gives a basic introduction to data exfiltration techniques including remote, local, and side channel attacks. We use the Nugget to try out data exfiltration to a remote C2 server, run attacks over WiFi, and also explore local stagers / exfiltration with the USB Nugget's built-in flash storage! 18 | `Intermediate` 19 | 20 | 21 | 22 | ## ⚙️ USB Nugget Quickstart 23 | Conference-style workshops that give a quickstart introduction to the USB Nugget as an HID / keystroke injection attack tool, and also walk beginners through assembling their own PCB's! 24 | `Beginner` 25 | - [Nov 06 2022] [Alex Lynd @ Hackaday Supercon](https://hackaday.com/2022/10/25/2022-hackaday-supercon-joe-kingpin-grand-keynote-and-workshops-galore/) 26 | - [Mar 19 2023] [Alex Lynd & Angelina TsuBoi @ Crash Space](https://github.com/HakCat-Tech/Nugget-Workshops/blob/main/USB-Nugget-Quickstart/Soldering-%26-USB-Attack-Workshop-(03-19-23-Crash-Space)%20.pdf) 27 | -------------------------------------------------------------------------------- /USB-Nugget-Quickstart/Soldering-&-USB-Attack-Workshop-(03-19-23-Crash-Space) .pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/USB-Nugget-Quickstart/Soldering-&-USB-Attack-Workshop-(03-19-23-Crash-Space) .pdf -------------------------------------------------------------------------------- /USB-Nugget-Quickstart/Soldering-&-USB-Attack-Workshop-(04-29-23-OHS).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/USB-Nugget-Quickstart/Soldering-&-USB-Attack-Workshop-(04-29-23-OHS).pdf -------------------------------------------------------------------------------- /USB-Nugget-Quickstart/Soldering-&-USB-Attack-Workshop-(11-06-22-Supercon).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/USB-Nugget-Quickstart/Soldering-&-USB-Attack-Workshop-(11-06-22-Supercon).pdf -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/WiFi-Hacking-Quickstart-(01-15-23).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/WiFi-Hacking-Quickstart-(01-15-23).pdf -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/1_basic_led.py: -------------------------------------------------------------------------------- 1 | # Alex Lynd, 2023 2 | # fill in the variables and make the code work! 3 | 4 | # import libraries 5 | import board 6 | import neopixel 7 | import time 8 | 9 | # NeoPixel pin & number of NeoPixels 10 | pixel_pin = # IO Pin here! 11 | pixel_num = # Number of Pixels here! 12 | 13 | #initialize NeoPixels 14 | pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=) # brightness here! 0-1 15 | 16 | 17 | # CHALLENGE: create an infinite loop that also resets the pixels 18 | 19 | # cycle through pixels and set to solid color 20 | for i in range(0,pixel_num): 21 | pixels[i] = (,,) 22 | time.sleep(1) 23 | -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/2_led_animations.py: -------------------------------------------------------------------------------- 1 | # Alex Lynd, 2023 2 | # Basic script to test Adafruit LED animations! 3 | 4 | import board 5 | import neopixel 6 | 7 | # import a bunch of animations! 8 | from adafruit_led_animation.animation.sparklepulse import SparklePulse 9 | from adafruit_led_animation.animation.blink import Blink 10 | from adafruit_led_animation.animation.rainbow import Rainbow 11 | from adafruit_led_animation.animation.rainbowchase import RainbowChase 12 | from adafruit_led_animation.animation.rainbowcomet import RainbowComet 13 | from adafruit_led_animation.animation.colorcycle import ColorCycle 14 | 15 | # import preset colors! 16 | # RED, YELLOW, ORANGE, GREEN, TEAL, CYAN, BLUE, PURPLE, MAGENTA, WHITE, BLACK, GOLD, PINK, AQUA, JADE, AMBER, OLD_LACE 17 | from adafruit_led_animation.color import * 18 | 19 | # NeoPixel Pin & Number 20 | pixel_pin = board.IO12 21 | pixel_num = 11 22 | 23 | # initialize NeoPixel strip 24 | pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.1, auto_write=False) 25 | 26 | # initialize some animations! 27 | # try modifying the parameters to see how they change! 28 | 29 | # PERIOD: num of seconds for total animation, SPEED: refresh rate for each pixel 30 | 31 | rainbow = Rainbow(pixels, speed=.01, period=5) 32 | #sparkle_pulse = SparklePulse(pixels, speed=0.05, period=4, color=JADE) 33 | #rainbow_chase = RainbowChase(pixels, speed=0.1, size=5, spacing=3, step=50) 34 | #rainbow_comet = RainbowComet(pixels, speed=0.1, tail_length=, bounce=True) 35 | #colorcycle = ColorCycle(pixels, 0.5, colors=[#color, #color, #color]) 36 | 37 | # uncomment these to try out an animation! 38 | while True: 39 | #rainbow_chase.animate() 40 | #rainbow_comet.animate() 41 | #sparkle_pulse.animate() 42 | rainbow.animate() 43 | #colorcycle.animate() 44 | 45 | -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/3_led_sequences.py: -------------------------------------------------------------------------------- 1 | from led_animations import * 2 | from adafruit_led_animation.sequence import AnimationSequence 3 | 4 | animations = AnimationSequence( 5 | rainbow, rainbow_chase, colorcycle, advance_interval=5, auto_clear=True, random_order=True 6 | ) 7 | 8 | while True: 9 | animations.animate() 10 | -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/4_hardware_test.py: -------------------------------------------------------------------------------- 1 | # Nugget Demo, by @AngelinaTsuboi using Adafruit CircuitPython 2 | # Objective: A gentle introduction into the Nugget OLED interface, button input, and Neopixel programming 3 | # Functionality: Change Nugget Faces and Neopixel Color when a specific arrow key is pressed 4 | import time 5 | import random 6 | import board 7 | import neopixel 8 | from digitalio import DigitalInOut, Direction, Pull 9 | from board import SCL, SDA 10 | import busio 11 | import displayio 12 | import adafruit_framebuf 13 | import adafruit_displayio_sh1106 14 | 15 | ## Screen setup and function to change image on the screen 16 | faceImage = "faces/spooky-nugg-inv.bmp" 17 | displayio.release_displays() 18 | WIDTH = 130 # Change these to the right size for your display! 19 | HEIGHT = 64 20 | 21 | i2c = busio.I2C(SCL, SDA) # Create the I2C interface. 22 | display_bus = displayio.I2CDisplay(i2c, device_address=0x3c) 23 | display = adafruit_displayio_sh1106.SH1106(display_bus, width=WIDTH, height=HEIGHT) # Create the SH1106 OLED class. 24 | 25 | def NugFace(faceImage): ## Make a function to put cat face onto screen 26 | bitmap = displayio.OnDiskBitmap(faceImage) # Setup the file as the bitmap data source 27 | tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader) # Create a TileGrid to hold the bitmap 28 | group = displayio.Group() # Create a Group to hold the TileGrid 29 | group.append(tile_grid) # Add the TileGrid to the Group 30 | display.show(group) # Add the Group to the Display 31 | 32 | NugFace(faceImage) #@# Show menu 33 | 34 | ## Neopixel Setup 35 | 36 | pixel_pin = board.IO12 # Specify the pin that the neopixel is connected to (GPIO 12) 37 | num_pixels = 1; delay = .1 # Set number of neopixels & delay between color changes in seconds 38 | pixel = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.3) # Create neopixel and set brightness to 30% 39 | 40 | def SetColor(color): # Define function with one input (color we want to set) 41 | for i in range(0, num_pixels): # Addressing all 1 neopixels in a loop 42 | pixel[i] = (color) # Set all neopixels a color 43 | 44 | ## Button Setup 45 | 46 | #ButtonDict = {'up': 'IO9', 'down': 'IO18', 'left': 'IO11', 'right': 'IO14'} man these suck to use for indexing what was I thinking 47 | LabelList = ['up', 'down', 'left', 'right'] 48 | PinList = ['IO9', 'IO18', 'IO11', 'IO14'] 49 | 50 | # Set up Arrow Keys 51 | 52 | upBtn = DigitalInOut(board.IO9) 53 | upBtn.direction = Direction.INPUT 54 | upBtn.pull = Pull.UP 55 | up_prev_state = upBtn.value 56 | 57 | downBtn = DigitalInOut(board.IO18) 58 | downBtn.direction = Direction.INPUT 59 | downBtn.pull = Pull.UP 60 | down_prev_state = downBtn.value 61 | 62 | leftBtn = DigitalInOut(board.IO11) 63 | leftBtn.direction = Direction.INPUT 64 | leftBtn.pull = Pull.UP 65 | left_prev_state = leftBtn.value 66 | 67 | rightBtn = DigitalInOut(board.IO7) 68 | rightBtn.direction = Direction.INPUT 69 | rightBtn.pull = Pull.UP 70 | right_prev_state = rightBtn.value 71 | 72 | ## Set up variables to check on the state of buttons and see if they have been pressed 73 | 74 | ButtonList = [upBtn, downBtn, leftBtn, rightBtn] 75 | StateList = [up_prev_state, down_prev_state, left_prev_state, right_prev_state] 76 | SetColor([0,0, 255]) 77 | 78 | while True: 79 | for i in range(0,4): 80 | cur_state = ButtonList[i].value 81 | if cur_state != StateList[i]: 82 | if not cur_state: 83 | print(LabelList[i], "is pressed") 84 | if LabelList[i] == 'up': 85 | faceImage = "faces/spooky-nugg-inv.bmp" 86 | SetColor([255,0,0]) 87 | elif LabelList[i] == 'down': 88 | faceImage = "faces/spooky-nugg-inv.bmp" 89 | SetColor([0,255,0]) 90 | elif LabelList[i] == 'right': 91 | faceImage = "faces/jack-o-nugg-right-inv.bmp" 92 | SetColor([0,0, 255]) 93 | else: 94 | faceImage = "faces/jack-o-nugg-left-inv.bmp" 95 | SetColor([247,158,240]) 96 | NugFace(faceImage) 97 | StateList[i] = cur_state 98 | 99 | -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/5_packet_monitor.py: -------------------------------------------------------------------------------- 1 | import gc, time, board, neopixel 2 | from board import SCL, SDA 3 | 4 | import digitalio 5 | import supervisor 6 | import random 7 | import wifi 8 | import espidf 9 | import ipaddress 10 | import socketpool 11 | import ssl 12 | 13 | import busio 14 | import displayio 15 | import adafruit_framebuf 16 | import adafruit_displayio_sh1106 17 | 18 | from adafruit_led_animation.color import * 19 | 20 | displayio.release_displays() 21 | 22 | 23 | # Initialize the Screen! # 24 | # ----------------------------------------# 25 | 26 | WIDTH = 130 27 | HEIGHT = 64 28 | i2c = busio.I2C(SCL, SDA) 29 | display_bus = displayio.I2CDisplay(i2c, device_address=0x3c) 30 | display = adafruit_displayio_sh1106.SH1106(display_bus, width=WIDTH, height=HEIGHT) # Create the SH1106 OLED class. 31 | 32 | # Initialize NeoPixels! # 33 | # ----------------------------------------# 34 | 35 | pixel_pin = board.IO12 36 | num_pixels = 1 37 | pixel = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.6) 38 | 39 | def SetAll(color): # Define function with one input (color we want to set) 40 | for i in range(0, num_pixels): # Addressing all 11 neopixels in a loop 41 | pixel[i] = (color) # Set all neopixels a color 42 | 43 | def NugEyes(IMAGE): 44 | bitmap = displayio.OnDiskBitmap(IMAGE) # Setup the file as the bitmap data source 45 | tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader) # Create a TileGrid to hold the bitmap 46 | group = displayio.Group() # Create a Group to hold the TileGrid 47 | group.append(tile_grid) # Add the TileGrid to the Group 48 | display.show(group) # Add the Group to the Display 49 | 50 | # Initialize the Screen! # 51 | # ----------------------------------------# 52 | 53 | 54 | # Some Wi-Fi functions # 55 | # ----------------------------------------# 56 | 57 | PARSE_HEADER = True 58 | PARSE_BODY = True # if True, PARSE_HEADER must be True 59 | PARSE_IES = False # if True, PARSE_BODY must be True 60 | 61 | type_names = ("mgmt", "ctrl", "data", "extn") 62 | 63 | subt_names = ("Association Req.", "Association Resp.", "ReAssociation Req.", "ReAssociation Resp.", 64 | "Probe Request", "Probe Request", "Timing", "Reserved", 65 | "Beacon Frame", "ATIM", "Dissassociation", "Auth", 66 | "Deauthentication", "Action", "ActionN", "ReservedF",) 67 | 68 | fixed = (4,6,10,6, 69 | 0,12,0,0, 70 | 12,0,2,6, 71 | 2,0,0,0,) 72 | 73 | ie_names = {0: "0_SSID", 74 | 1: "1_Rates", 75 | 2: "2_FH", 76 | 3: "3_DS", 77 | 4: "4_CF", 78 | 5: "5_TIM", 79 | 6: "6_IBSS", 80 | 7: "7_Country", 81 | 8: "8_HopParam", 82 | 9: "9_HopTable", 83 | 10: "10_Req", 84 | 16: "16_Challenge", 85 | 32: "32_PowConst", 86 | 33: "33_PowCapab", 87 | 34: "34_TPCReq", 88 | 35: "35_TPCRep", 89 | 36: "36_Chans", 90 | 37: "37_ChSwitch", 91 | 38: "38_MeasReq", 92 | 39: "39_MeasRep", 93 | 40: "40_Quiet", 94 | 41: "41_IBSSDFS", 95 | 42: "42_ERP", 96 | 48: "48_Robust", 97 | 50: "50_XRates", 98 | 221: "221_WPA",} 99 | 100 | def check_type(mac): 101 | # determine MAC type 102 | mactype = "" 103 | try: 104 | # mac_int = int('0x' + mac[1], base=16) # not supported in CP 105 | mac_int = int("".join(("0x", mac[0:2]))) 106 | if (mac_int & 0b0011) == 0b0011: # 3,7,B,F LOCAL MULTICAST 107 | mactype = "L_M" 108 | elif (mac_int & 0b0010) == 0b0010: # 2,3,6,7,A,B,E,F LOCAL 109 | mactype = "LOC" 110 | elif (mac_int & 0b0001) == 0b0001: # 1,3,5,7,9,B,D,F MULTICAST 111 | mactype = "MUL" 112 | else: # 0,4,8,C VENDOR (or unassigned) 113 | mactype = "VEN" 114 | except (ValueError, IndexError) as e: 115 | pass 116 | return mactype 117 | 118 | def parse_header(fd, buf): 119 | fd["type"] = (buf[0] & 0b00001100) >> 2 120 | fd["typename"] = type_names[fd["type"]] 121 | fd["subt"] = (buf[0] & 0b11110000) >> 4 122 | fd["subtname"] = subt_names[fd["subt"]] 123 | fd["fc0"] = buf[0] 124 | fd["fc1"] = buf[1] 125 | fd["dur"] = (buf[3] << 8) + buf[2] 126 | fd["a1"] = ":".join("%02X" % _ for _ in buf[4:10]) 127 | fd["a2"] = ":".join("%02X" % _ for _ in buf[10:16]) 128 | fd["a3"] = ":".join("%02X" % _ for _ in buf[16:22]) 129 | fd["a1_type"] = check_type(fd["a1"]) 130 | fd["a2_type"] = check_type(fd["a2"]) 131 | fd["a3_type"] = check_type(fd["a3"]) 132 | fd["seq"] = ((buf[22] & 0b00001111) << 8) + buf[23] 133 | fd["frag"] = (buf[22] & 0b11110000) >> 4 134 | return fd 135 | 136 | def parse_body(fd, buf): 137 | ies = {} 138 | fd["ssid"] = "" 139 | pos = 24 + fixed[fd["subt"]] 140 | while pos < fd["len"] - 1: 141 | try: 142 | ie_id = buf[pos] 143 | ie_len = buf[pos + 1] 144 | ie_start = pos + 2 145 | ie_end = ie_start + ie_len 146 | 147 | if (ie_id == 0): 148 | if (ie_len > 0): 149 | # if fd["subt"] in (1, 4, 5, 8): 150 | ssid = "" 151 | for _ in range(ie_start, ie_end): 152 | ssid = ssid + chr(buf[_]) 153 | fd["ssid"] = ssid 154 | 155 | # if SSID wasn't in the first IE, too bad... 156 | if not PARSE_IES: 157 | break; 158 | 159 | ie_body = "".join("%02X" % _ for _ in buf[ie_start : ie_end]) 160 | if ie_id in ie_names: 161 | ies[ie_names[ie_id]] = ie_body 162 | else: 163 | ies[ie_id] = ie_body 164 | except IndexError as e: # 32 32 33 165 | print("IndexError", e, pos, ie_end, fd["len"]) 166 | pos = ie_end 167 | fd["ies"] = ies 168 | return fd 169 | 170 | # Parse & print packet! # 171 | # ----------------------------------------# 172 | 173 | def get_packet(): 174 | fd = {} 175 | fd["qlen"] = monitor.queued() 176 | fd["lost"] = monitor.lost() 177 | received = monitor.packet() 178 | if received != {}: 179 | fd["len"] = received[wifi.Packet.LEN] 180 | fd["ch"] = received[wifi.Packet.CH] 181 | fd["rssi"] = received[wifi.Packet.RSSI] 182 | 183 | if PARSE_HEADER: 184 | fd = parse_header(fd, received[wifi.Packet.RAW]) 185 | if PARSE_BODY: 186 | fd = parse_body(fd, received[wifi.Packet.RAW]) 187 | print("CH:{} RSSI:{} TYPE:{} SRC:{} DST:{}".format(fd["ch"],fd["rssi"],fd["subtname"],fd["a2"],fd["a1"])) 188 | return fd 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | # Program Logic Starts Here! # 197 | # ----------------------------------------# 198 | 199 | # function to control Deauth Detection 200 | def DeauthCheck(newPacket): 201 | if subt_names[fd["subt"]] == "Deauthentication": 202 | NugEyes("/faces/spooky-nugg-inv.bmp") 203 | SetAll(RED) 204 | else: 205 | NugEyes("/faces/jack-o-nugg-left-inv.bmp") 206 | SetAll(TEAL) 207 | 208 | print("-"*49) 209 | print("Starting Monitor...") 210 | monitor = wifi.Monitor() 211 | print("-"*49) 212 | 213 | # infinite packet monitor 214 | while True: 215 | try: 216 | monitor.channel = random.randrange(1, 12) # ghetto channel hopping 217 | fd = get_packet() 218 | if len(fd) > 2: 219 | if PARSE_HEADER: 220 | DeauthCheck(subt_names[fd["subt"]]) # check packet subtype for deauthentication 221 | 222 | except RuntimeError as e: 223 | print("RuntimeError", e) 224 | -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/6_canarytoken.py: -------------------------------------------------------------------------------- 1 | import gc 2 | import time 3 | import board 4 | import digitalio 5 | import supervisor 6 | import random 7 | import wifi 8 | import espidf 9 | import ipaddress 10 | import socketpool 11 | import ssl 12 | import neopixel 13 | from board import SCL, SDA 14 | import busio 15 | import displayio 16 | import adafruit_framebuf 17 | import adafruit_displayio_sh1106 18 | import adafruit_requests as requests 19 | 20 | canary_url = "https://canarytokens.com/TOKEN_ID" 21 | 22 | displayio.release_displays() 23 | 24 | WIDTH = 130 # Change these to the right size for your display! 25 | HEIGHT = 64 26 | BORDER = 1 27 | 28 | i2c = busio.I2C(SCL, SDA) # Create the I2C interface. 29 | display_bus = displayio.I2CDisplay(i2c, device_address=0x3c) 30 | display = adafruit_displayio_sh1106.SH1106(display_bus, width=WIDTH, height=HEIGHT) # Create the SH1106 OLED class. 31 | 32 | pixel_pin = board.IO12 # Specify the pin that the neopixel is connected to (GPIO 12) 33 | num_pixels = 1 # Set number of neopixels 34 | pixel = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.6) # Create neopixel and set brightness to 30% 35 | 36 | def SetAll(color): # Define function with one input (color we want to set) 37 | for i in range(0, num_pixels): # Addressing all 11 neopixels in a loop 38 | pixel[i] = (color) # Set all neopixels a color 39 | 40 | def NugEyes(IMAGE): 41 | bitmap = displayio.OnDiskBitmap(IMAGE) # Setup the file as the bitmap data source 42 | tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader) # Create a TileGrid to hold the bitmap 43 | group = displayio.Group() # Create a Group to hold the TileGrid 44 | group.append(tile_grid) # Add the TileGrid to the Group 45 | display.show(group) # Add the Group to the Display 46 | 47 | def DeauthCheck(newPacket): 48 | if subt_names[fd["subt"]] == "Deauthentication": 49 | NugEyes("/faces/spooky-nugg-inv.bmp") 50 | response = requests.get(canary_url) 51 | print(response.status_code) 52 | SetAll(RED) 53 | else: 54 | NugEyes("/faces/jack-o-nugg-left-inv.bmp") 55 | SetAll(GREEN) 56 | 57 | PARSE_HEADER = True 58 | PARSE_BODY = True # if True, PARSE_HEADER must be True 59 | PARSE_IES = False # if True, PARSE_BODY must be True 60 | 61 | type_names = ("mgmt", "ctrl", "data", "extn") 62 | 63 | subt_names = ("Association Req.", "Association Resp.", "ReAssociation Req.", "ReAssociation Resp.", 64 | "Probe Request", "Probe Request", "Timing", "Reserved", 65 | "Beacon Frame", "ATIM", "Dissassociation", "Auth", 66 | "Deauthentication", "Action", "ActionN", "ReservedF",) 67 | 68 | fixed = (4,6,10,6, 69 | 0,12,0,0, 70 | 12,0,2,6, 71 | 2,0,0,0,) 72 | 73 | ie_names = {0: "0_SSID", 74 | 1: "1_Rates", 75 | 2: "2_FH", 76 | 3: "3_DS", 77 | 4: "4_CF", 78 | 5: "5_TIM", 79 | 6: "6_IBSS", 80 | 7: "7_Country", 81 | 8: "8_HopParam", 82 | 9: "9_HopTable", 83 | 10: "10_Req", 84 | 16: "16_Challenge", 85 | 32: "32_PowConst", 86 | 33: "33_PowCapab", 87 | 34: "34_TPCReq", 88 | 35: "35_TPCRep", 89 | 36: "36_Chans", 90 | 37: "37_ChSwitch", 91 | 38: "38_MeasReq", 92 | 39: "39_MeasRep", 93 | 40: "40_Quiet", 94 | 41: "41_IBSSDFS", 95 | 42: "42_ERP", 96 | 48: "48_Robust", 97 | 50: "50_XRates", 98 | 221: "221_WPA",} 99 | 100 | def check_type(mac): 101 | # determine MAC type 102 | mactype = "" 103 | try: 104 | # mac_int = int('0x' + mac[1], base=16) # not supported in CP 105 | mac_int = int("".join(("0x", mac[0:2]))) 106 | if (mac_int & 0b0011) == 0b0011: # 3,7,B,F LOCAL MULTICAST 107 | mactype = "L_M" 108 | elif (mac_int & 0b0010) == 0b0010: # 2,3,6,7,A,B,E,F LOCAL 109 | mactype = "LOC" 110 | elif (mac_int & 0b0001) == 0b0001: # 1,3,5,7,9,B,D,F MULTICAST 111 | mactype = "MUL" 112 | else: # 0,4,8,C VENDOR (or unassigned) 113 | mactype = "VEN" 114 | except (ValueError, IndexError) as e: 115 | pass 116 | return mactype 117 | 118 | def parse_header(fd, buf): 119 | fd["type"] = (buf[0] & 0b00001100) >> 2 120 | fd["typename"] = type_names[fd["type"]] 121 | fd["subt"] = (buf[0] & 0b11110000) >> 4 122 | fd["subtname"] = subt_names[fd["subt"]] 123 | fd["fc0"] = buf[0] 124 | fd["fc1"] = buf[1] 125 | fd["dur"] = (buf[3] << 8) + buf[2] 126 | fd["a1"] = ":".join("%02X" % _ for _ in buf[4:10]) 127 | fd["a2"] = ":".join("%02X" % _ for _ in buf[10:16]) 128 | fd["a3"] = ":".join("%02X" % _ for _ in buf[16:22]) 129 | fd["a1_type"] = check_type(fd["a1"]) 130 | fd["a2_type"] = check_type(fd["a2"]) 131 | fd["a3_type"] = check_type(fd["a3"]) 132 | fd["seq"] = ((buf[22] & 0b00001111) << 8) + buf[23] 133 | fd["frag"] = (buf[22] & 0b11110000) >> 4 134 | return fd 135 | 136 | def parse_body(fd, buf): 137 | ies = {} 138 | fd["ssid"] = "" 139 | pos = 24 + fixed[fd["subt"]] 140 | while pos < fd["len"] - 1: 141 | try: 142 | ie_id = buf[pos] 143 | ie_len = buf[pos + 1] 144 | ie_start = pos + 2 145 | ie_end = ie_start + ie_len 146 | 147 | if (ie_id == 0): 148 | if (ie_len > 0): 149 | # if fd["subt"] in (1, 4, 5, 8): 150 | ssid = "" 151 | for _ in range(ie_start, ie_end): 152 | ssid = ssid + chr(buf[_]) 153 | fd["ssid"] = ssid 154 | 155 | # if SSID wasn't in the first IE, too bad... 156 | if not PARSE_IES: 157 | break; 158 | 159 | ie_body = "".join("%02X" % _ for _ in buf[ie_start : ie_end]) 160 | if ie_id in ie_names: 161 | ies[ie_names[ie_id]] = ie_body 162 | else: 163 | ies[ie_id] = ie_body 164 | except IndexError as e: # 32 32 33 165 | print("IndexError", e, pos, ie_end, fd["len"]) 166 | pos = ie_end 167 | fd["ies"] = ies 168 | return fd 169 | 170 | def get_packet(): 171 | fd = {} 172 | fd["qlen"] = monitor.queued() 173 | fd["lost"] = monitor.lost() 174 | received = monitor.packet() 175 | if received != {}: 176 | fd["len"] = received[wifi.Packet.LEN] 177 | fd["ch"] = received[wifi.Packet.CH] 178 | fd["rssi"] = received[wifi.Packet.RSSI] 179 | 180 | if PARSE_HEADER: 181 | fd = parse_header(fd, received[wifi.Packet.RAW]) 182 | if PARSE_BODY: 183 | fd = parse_body(fd, received[wifi.Packet.RAW]) 184 | print("CH:{} RSSI:{} TYPE:{} SRC:{} DST:{}".format(fd["ch"],fd["rssi"],fd["subtname"],fd["a2"],fd["a1"])) 185 | return fd 186 | 187 | print("-"*49) 188 | print("Starting Monitor...") 189 | monitor = wifi.Monitor() 190 | print("-"*49) 191 | 192 | while True: 193 | try: 194 | monitor.channel = random.randrange(1, 12) 195 | fd = get_packet() 196 | if len(fd) > 2: 197 | if PARSE_HEADER: 198 | DeauthCheck(subt_names[fd["subt"]]) 199 | except RuntimeError as e: 200 | print("RuntimeError", e) 201 | -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/faces/jack-o-nugg-left-inv.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/faces/jack-o-nugg-left-inv.bmp -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/faces/jack-o-nugg-left.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/faces/jack-o-nugg-left.bmp -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/faces/jack-o-nugg-right-inv.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/faces/jack-o-nugg-right-inv.bmp -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/faces/jack-o-nugg-right.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/faces/jack-o-nugg-right.bmp -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/faces/spooky-nugg-inv.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/faces/spooky-nugg-inv.bmp -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/faces/spooky-nugg.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/faces/spooky-nugg.bmp -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_display_text/__init__.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_display_text/__init__.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_display_text/bitmap_label.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_display_text/bitmap_label.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_display_text/label.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_display_text/label.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_displayio_sh1106.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries 2 | # SPDX-FileCopyrightText: Copyright (c) 2021 ladyada for Adafruit Industries 3 | # 4 | # SPDX-License-Identifier: MIT 5 | """ 6 | `adafruit_displayio_sh1106` 7 | ================================================================================ 8 | 9 | DisplayIO compatible library for SH1106 OLED displays 10 | 11 | 12 | * Author(s): ladyada 13 | 14 | Implementation Notes 15 | -------------------- 16 | 17 | **Hardware:** 18 | 19 | **Software and Dependencies:** 20 | 21 | * Adafruit CircuitPython firmware for the supported boards: 22 | https://github.com/adafruit/circuitpython/releases 23 | 24 | """ 25 | 26 | # imports 27 | import displayio 28 | 29 | __version__ = "0.0.0-auto.0" 30 | __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SH1106.git" 31 | 32 | 33 | # Sequence from sh1106 framebuf driver formatted for displayio init 34 | _INIT_SEQUENCE = ( 35 | b"\xae\x00" # display off, sleep mode 36 | b"\xd5\x01\x80" # divide ratio/oscillator: divide by 2, fOsc (POR) 37 | b"\xa8\x01\x3f" # multiplex ratio = 64 (POR) 38 | b"\xd3\x01\x00" # set display offset mode = 0x0 39 | b"\x40\x00" # set start line 40 | b"\xad\x01\x8b" # turn on DC/DC 41 | b"\xa1\x00" # segment remap = 1 (POR=0, down rotation) 42 | b"\xc8\x00" # scan decrement 43 | b"\xda\x01\x12" # set com pins 44 | b"\x81\x01\xff" # contrast setting = 0xff 45 | b"\xd9\x01\x1f" # pre-charge/dis-charge period mode: 2 DCLKs/2 DCLKs (POR) 46 | b"\xdb\x01\x40" # VCOM deselect level = 0.770 (POR) 47 | b"\x20\x01\x20" # 48 | b"\x33\x00" # turn on VPP to 9V 49 | b"\xa6\x00" # normal (not reversed) display 50 | b"\xa4\x00" # entire display off, retain RAM, normal status (POR) 51 | b"\xaf\x00" # DISPLAY_ON 52 | ) 53 | 54 | 55 | class SH1106(displayio.Display): 56 | """ 57 | SH1106 driver for use with DisplayIO 58 | 59 | :param bus: The bus that the display is connected to. 60 | :param int width: The width of the display. Maximum of 132 61 | :param int height: The height of the display. Maximum of 64 62 | :param int rotation: The rotation of the display. 0, 90, 180 or 270. 63 | """ 64 | 65 | def __init__(self, bus, **kwargs): 66 | init_sequence = bytearray(_INIT_SEQUENCE) 67 | super().__init__( 68 | bus, 69 | init_sequence, 70 | **kwargs, 71 | color_depth=1, 72 | grayscale=True, 73 | pixels_in_byte_share_row=False, # in vertical (column) mode 74 | data_as_commands=True, # every byte will have a command byte preceeding 75 | brightness_command=0x81, 76 | single_byte_bounds=True, 77 | # for sh1107 use column and page addressing. 78 | # lower column command = 0x00 - 0x0F 79 | # upper column command = 0x10 - 0x17 80 | # set page address = 0xB0 - 0xBF (16 pages) 81 | SH1107_addressing=True, 82 | ) 83 | self._is_awake = True # Display starts in active state (_INIT_SEQUENCE) 84 | 85 | @property 86 | def is_awake(self): 87 | """ 88 | The power state of the display. (read-only) 89 | 90 | `True` if the display is active, `False` if in sleep mode. 91 | """ 92 | return self._is_awake 93 | 94 | def sleep(self): 95 | """ 96 | Put display into sleep mode. The display uses < 5uA in sleep mode. 97 | 98 | Sleep mode does the following: 99 | 100 | 1) Stops the oscillator and DC-DC circuits 101 | 2) Stops the OLED drive 102 | 3) Remembers display data and operation mode active prior to sleeping 103 | 4) The MP can access (update) the built-in display RAM 104 | """ 105 | if self._is_awake: 106 | self.bus.send(int(0xAE), "") # 0xAE = display off, sleep mode 107 | self._is_awake = False 108 | 109 | def wake(self): 110 | """ 111 | Wake display from sleep mode 112 | """ 113 | if not self._is_awake: 114 | self.bus.send(int(0xAF), "") # 0xAF = display on 115 | self._is_awake = True 116 | -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_framebuf.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_framebuf.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/__init__.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/__init__.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/__init__.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/__init__.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/blink.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/blink.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/chase.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/chase.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/colorcycle.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/colorcycle.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/comet.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/comet.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/customcolorchase.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/customcolorchase.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/grid_rain.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/grid_rain.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/pulse.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/pulse.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/rainbow.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/rainbow.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/rainbowchase.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/rainbowchase.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/rainbowcomet.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/rainbowcomet.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/rainbowsparkle.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/rainbowsparkle.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/solid.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/solid.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/sparkle.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/sparkle.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/sparklepulse.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/animation/sparklepulse.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/color.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/color.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/grid.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/grid.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/group.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/group.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/helper.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/helper.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/sequence.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_led_animation/sequence.mpy -------------------------------------------------------------------------------- /WiFi-Hacking-Quickstart/code/lib/adafruit_requests.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevKitty-io/Nugget-Workshops/9747dee47dadfd705bdbca9ce95e571dbc3763a8/WiFi-Hacking-Quickstart/code/lib/adafruit_requests.mpy --------------------------------------------------------------------------------