mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
hc06 scripts
This commit is contained in:
parent
fe6cbfc8fd
commit
325825d4a8
3 changed files with 155 additions and 5 deletions
45
tools/btaddon/hc06_console_AT.py
Executable file
45
tools/btaddon/hc06_console_AT.py
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import time
|
||||
import serial
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print('Usage: %s <baudrate>' % sys.argv[0])
|
||||
sys.exit(1)
|
||||
baudrate = int(sys.argv[1])
|
||||
ser = serial.Serial(
|
||||
port='/dev/ttyUSB0',
|
||||
baudrate=baudrate,
|
||||
parity=serial.PARITY_NONE,
|
||||
stopbits=serial.STOPBITS_ONE,
|
||||
bytesize=serial.EIGHTBITS
|
||||
)
|
||||
|
||||
ser.isOpen()
|
||||
ser.write(b'AT')
|
||||
out = b''
|
||||
time.sleep(1)
|
||||
while ser.inWaiting() > 0:
|
||||
out += ser.read(1)
|
||||
if out != b'OK':
|
||||
ser.close()
|
||||
print("HC-06 dongle not found. Abort.")
|
||||
exit(1)
|
||||
print('Enter your commands below.\r\nInsert "exit" to leave the application.')
|
||||
|
||||
while 1 :
|
||||
# get keyboard input
|
||||
inp = input(">> ")
|
||||
inp = inp.encode('utf8')
|
||||
if inp == 'exit':
|
||||
ser.close()
|
||||
exit()
|
||||
else:
|
||||
ser.write(inp)
|
||||
out = b''
|
||||
time.sleep(1)
|
||||
while ser.inWaiting() > 0:
|
||||
out += ser.read(1)
|
||||
if out != b'':
|
||||
print("<< " + out.decode('utf8'))
|
Loading…
Add table
Add a link
Reference in a new issue