Comments (1)
Use obfuscated serial Number of the Raspberry Pi for the SSID. Sample code below
# http://stackoverflow.com/questions/8554286/obfuscating-an-id
PRIME = 11184829
PRIME_INVERSE = 21962901
MODULO_BASE = 33554432
def getserial():
# Extract serial from cpuinfo file
cpuserial = "0000000000000000"
try:
f = open('/proc/cpuinfo','r')
for line in f:
if line[0:6]=='Serial':
cpuserial = line[10:26]
f.close()
except:
cpuserial = "ERROR000000000"
return cpuserial
def obfuscate_id(id):
number = map_id_to_number(id)
return number_to_code(number)
def deobfuscate_code(code):
number = code_to_number(code)
return map_number_to_id(number)
def map_id_to_number(id):
return (id * PRIME) % MODULO_BASE
def map_number_to_id(id):
return (id * PRIME_INVERSE) % MODULO_BASE
def number_to_code(number):
number = int(number)
if (number >> 25) > 0 or number < 0:
return None
result = ''
for i in range(4, -1, -1):
symbol_index = number >> i*5 & 0x1F
symbol = valueToSymbol[symbol_index]
result += symbol
return result
def code_to_number(code):
result = 0
if len(code) != 5:
return None
try:
for i in range(0, 5):
symbol = code[4-i]
value = symbolToValue[symbol]
result += value << i*5
return result
except KeyError:
return None
valueToSymbol = {
0x00: 'A',
0x01: '9',
0x02: 'U',
0x03: 'F',
0x04: 'G',
0x05: '7',
0x06: 'Q',
0x07: 'M',
0x08: '3',
0x09: 'N',
0x0A: 'X',
0x0B: '4',
0x0C: 'S',
0x0D: 'E',
0x0E: 'D',
0x0F: 'P',
0x10: 'Z',
0x11: 'L',
0x12: 'R',
0x13: 'H',
0x14: '8',
0x15: 'W',
0x16: 'Y',
0x17: 'C',
0x18: 'V',
0x19: '1',
0x1A: '2',
0x1B: 'B',
0x1C: 'K',
0x1D: 'T',
0x1E: '5',
0x1F: '6'
}
symbolToValue = {
'A': 0x00,
'9': 0x01,
'U': 0x02,
'F': 0x03,
'G': 0x04,
'7': 0x05,
'Q': 0x06,
'M': 0x07,
'3': 0x08,
'N': 0x09,
'X': 0x0A,
'4': 0x0B,
'S': 0x0C,
'E': 0x0D,
'D': 0x0E,
'P': 0x0F,
'Z': 0x10,
'L': 0x11,
'R': 0x12,
'H': 0x13,
'8': 0x14,
'W': 0x15,
'Y': 0x16,
'C': 0x17,
'V': 0x18,
'1': 0x19,
'2': 0x1A,
'B': 0x1B,
'K': 0x1C,
'T': 0x1D,
'5': 0x1E,
'6': 0x1F
}
serial = getserial()
serial_int = int(serial.translate(None, ".- "), 16)
obfusecated_serial = obfuscate_id(serial_int)
from fabscanpi-build-raspbian.
Related Issues (18)
- apt-cacher-ng stopped working ( 2016-01-01 ) HOT 1
- Fix trap and loop device issue HOT 5
- Chrome Interface issues HOT 1
- 503 Service Unavailable on haproxy, when fabscanpi server is down
- Add (optional) swap support to image.
- pi-gen build fails while creating loop devices. HOT 2
- issue: Scan Freezes after Texture scanning HOT 3
- fabscan login
- fabscan login
- Add Xvfb as virtual x-server HOT 1
- Add meshlab server HOT 1
- add wifi support and make fabscanpi a AP HOT 2
- fix fabscan pi server start after firstboot script HOT 1
- add autoreset option for new FabScanPi HAT and avrdude HOT 1
- FabScan PI HAT support, missing libs and configs. HOT 1
- Add strace package. HOT 1
- add second ip address range for debug HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fabscanpi-build-raspbian.