Skip to content

Instantly share code, notes, and snippets.

@TylerOderkirk
Created May 4, 2018 03:41
Show Gist options
  • Save TylerOderkirk/c4baaeffcea8d5616b14b91a5314eda8 to your computer and use it in GitHub Desktop.
Save TylerOderkirk/c4baaeffcea8d5616b14b91a5314eda8 to your computer and use it in GitHub Desktop.
dreamproxy hg r2
# from https://forum.micropython.org/viewtopic.php?p=19988&sid=7aaeff853648d6cd65371661708c1fba#p19988
import network
import time
import uos
from machine import Pin
led = Pin(2, Pin.OUT)
led.off() # actually turns it on
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
#sta_if.scan()
ap_if = network.WLAN(network.AP_IF)
ap_if.active(False)
def beacon(ssid, channel, times):
packet = bytearray([0x80,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xb8,0xe8,0x56,0x33,0xde,0x01,0xb8,0xe8,0x56,0x33,0xde,0x01,0xc0,0x6c,0x83,0x51,0xf7,0x8f,0x0f,0x00,0x00,0x00,0x64,0x00,0x01,0x04,0x00,0x00])
packet[37] = len(ssid)
packet.extend(ssid)
packet.extend(bytearray([0x01,0x08,0x82,0x84,0x8b,0x96,0x24,0x30,0x48,0x6c,0x03,0x01,0x01]))
packet[-1] = channel
for i in range(times):
packet[10] = packet[16] = uos.urandom(1)[0] # encode url here?
packet[11] = packet[17] = uos.urandom(1)[0]
packet[12] = packet[18] = uos.urandom(1)[0]
packet[13] = packet[19] = uos.urandom(1)[0]
packet[14] = packet[20] = uos.urandom(1)[0]
packet[15] = packet[21] = uos.urandom(1)[0]
sta_if.freedom(channel, packet)
time.sleep_ms(10)
while True:
print("sending beacons...")
beacon("dreamproxy012345678901234567890A", 1, 200) # http://bit.ly/_7q_
print("sleeping...")
time.sleep(.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment