Advertisement
Guest User

Untitled

a guest
Nov 20th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.90 KB | None | 0 0
  1. import serial
  2. import time
  3. from itertools import *
  4.  
  5. def main():
  6.     part1 = 'A'
  7.     part2 = '1'
  8.     part3 = '1'
  9.     chars = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
  10.     nums = ['0','1','2','3','4','5','6','7','8','9']
  11.     com = input("Enter COM port the Chameleon is on: ")
  12.     ser = serial.Serial(com.upper())
  13.     ser.write(str.encode('config=MF_ULTRALIGHT\r')) #sets the config to Mifare Ultralight
  14.     ser.write(str.encode('setting=1\r')) #sets the slot to slot 1
  15.  
  16.     for length in range(1, 3):  # only do lengths of 1 + 2
  17.         to_attempt = product(chars, repeat=length)
  18.         for attempt in to_attempt:
  19.             part1 = (''.join(attempt)) #The Randomly generated section
  20.  
  21.             for length in range(1, 2):  # only do lengths of 1
  22.                 to_attempt = product(nums, repeat=length)
  23.                 for attempt in to_attempt:
  24.                     part2 = (''.join(attempt)) #The Randomly generated section
  25.  
  26.                     for length in range(1, 2):  # only do lengths of 1
  27.                         to_attempt = product(nums, repeat=length)
  28.                         for attempt in to_attempt:
  29.                             part3 = (''.join(attempt)) #The Randomly generated section
  30.  
  31.                             uid = '04'+part1+'C'+part2+'1AEF2A8'+part3
  32.                             #Final step before sending generated UID to Chameleon. The hardcoded strings are the constants in my particular UID that don't change.
  33.                             #You will have to nest a new loop for each section of the UID that is randomly generated.
  34.                             print(uid)
  35.                             ser.write(str.encode('uid='+uid+'\r'))
  36.                             msg = ser.readline()
  37.                             print(msg)
  38.                             time.sleep(2)
  39.  
  40.  
  41.  
  42. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement