working branch

This commit is contained in:
David Bryan 2019-10-21 19:02:17 +01:00
parent df64743886
commit 56929e4892
4 changed files with 25 additions and 11036 deletions

11008
jquery.js vendored

File diff suppressed because it is too large Load diff

5
jquery.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import os, string, subprocess, sys
import os, string, subprocess, sys, time
#import subprocess
from flask import Flask, flash, redirect, render_template, \
@ -9,9 +9,12 @@ from flask import Flask, flash, redirect, render_template, \
from datetime import datetime
debug=1
proxmark3_rdv4_dir='/home/pi/proxmark3'
proxmark3_rdv4_client=proxmark3_rdv4_dir + '/client/proxmark3'
logfile = "/home/pi/coffee-is-hot.log"
logfile = "/home/pi/card-reads.log"
# Setup a dictionary for the serial port types
serial_port_list = { '/dev/tty.usbmodemiceman1', '/dev/ttyACM0' }
def get_card_data(data):
#print(data)
@ -38,16 +41,17 @@ def exists(path):
return False
return True
# What serial port are we using? On Mac its tty.usbmodemiceman1, on a Pi it's /dev/ttyACM0
if(exists('/dev/tty.usbmodemiceman1')):
serial_device='/dev/tty.usbmodemiceman1'
print('Serial port set to: ' + serial_device)
elif(exists('/dev/ttyACM0')):
serial_device='/dev/ttyACM0'
print('Serial port set to: ' + serial_device)
else:
print("Serial port not found.... exiting")
sys.exit(1)
serial_port = 0
while not serial_port:
print("Looking for the serial port to use...")
for device in set(serial_port_list):
if(exists(device)):
serial_port=device
print("Setting serial port to: " + serial_port)
if not serial_port:
delay=10
print("Serial device not found.... sleeping "+ str(delay) +" seconds - connect your Proxmark3-rdv4...")
time.sleep(delay)
if(True):
app = Flask(__name__, instance_relative_config=True)
@ -79,7 +83,7 @@ if(True):
@app.route('/read/lf')
def read_lf_card():
cardnumber = subprocess.run([proxmark3_rdv4_client, serial_device, '-c', 'lf search'], capture_output=True)
cardnumber = subprocess.run([proxmark3_rdv4_client, serial_port, '-c', 'lf search'], capture_output=True)
if('ERROR: serial port' in cardnumber.stdout.decode('ASCII')):
flash('Serial port error')
return redirect(url_for('index'))
@ -89,7 +93,7 @@ if(True):
card_read=1
#return 'Hello, World!\n<br>Raw Card Number:' + raw_cardnumber + '<br> Card ID:' + card_number + ' FC:' + facility_code
card = get_card_data(cardnumber.stdout.decode('ASCII'))
print(card)
if debug: print(card)
current_time = datetime.now().isoformat(timespec='seconds')
print(str(current_time) + ' _Card Used_ ' + card, file=open(logfile, "a"))
return render_template('main.html',
@ -102,7 +106,7 @@ if(True):
@app.route('/read/hid')
def read_hid_card():
cardnumber = subprocess.run([proxmark3_rdv4_client, serial_device, '-c', 'lf hid read'], capture_output=True)
cardnumber = subprocess.run([proxmark3_rdv4_client, serial_port, '-c', 'lf hid read'], capture_output=True)
if('ERROR: serial port' in cardnumber.stdout.decode('ASCII')):
flash('Serial port error')
return redirect(url_for('index'))
@ -110,10 +114,9 @@ if(True):
if(cardnumber.returncode == 0):
if('HID Prox TAG ID:' in cardnumber.stdout.decode('ASCII')):
card = get_card_data(cardnumber.stdout.decode('ASCII'))
print(card)
if(debug): print("Card number:" + str(card))
current_time=str(datetime.now().isoformat(timespec='seconds'))
print(current_time)
print(current_time + ' _Card Used_ ' + card, file=open(logfile, "a"))
print(current_time + ' _Card Used_ ' + str(card), file=open(logfile, "a"))
card_read=1
#return 'Hello, World!\n<br>Raw Card Number:' + raw_cardnumber + '<br> Card ID:' + card_number + ' FC:' + facility_code
return render_template('main.html',
@ -132,7 +135,7 @@ if(True):
raw_cardnumber = request.args.get('raw_cardnumber')
print('Got card raw: ' + str(raw_cardnumber))
write_hid = subprocess.run([proxmark3_rdv4_client, serial_device, '-c', 'lf t55xx wipe ; lf hid clone ' + raw_cardnumber + ' ; lf hid read' ], capture_output=True)
write_hid = subprocess.run([proxmark3_rdv4_client, serial_port, '-c', 'lf t55xx wipe ; lf hid clone ' + raw_cardnumber + ' ; lf hid read' ], capture_output=True)
if('ERROR: serial port' in write_hid.stdout.decode('ASCII')):
flash('Serial port error')
return redirect(url_for('index'))
@ -149,7 +152,7 @@ if(True):
@app.route('/wipe_card')
def wipe_card():
wipe_card = subprocess.run([proxmark3_rdv4_client, serial_device, '-c', 'lf t55xx wipe' ], capture_output=True)
wipe_card = subprocess.run([proxmark3_rdv4_client, serial_port, '-c', 'lf t55xx wipe' ], capture_output=True)
if('ERROR: serial port' in wipe_card.stdout.decode('ASCII')):
flash('Serial port error')
return redirect(url_for('index'))
@ -161,8 +164,8 @@ if(True):
@app.route('/provision_card')
def make_new_card():
# This writes a FC of 127, and a card ID of 31337 to the t5577 cards
#new_hid_id = subprocess.run([proxmark3_rdv4_client, serial_device, '-c', 'lf t55xx wipe ; lf hid clone 2004FEF4D3 ; lf hid read' ], capture_output=True)
new_hid_id = subprocess.run([proxmark3_rdv4_client, serial_device, '-c', 'lf hid clone 1029a0f4d2 ; lf hid read' ], capture_output=True)
#new_hid_id = subprocess.run([proxmark3_rdv4_client, serial_port, '-c', 'lf t55xx wipe ; lf hid clone 2004FEF4D3 ; lf hid read' ], capture_output=True)
new_hid_id = subprocess.run([proxmark3_rdv4_client, serial_port, '-c', 'lf hid clone 1029a0f4d2 ; lf hid read' ], capture_output=True)
if('ERROR: serial port' in new_hid_id.stdout.decode('ASCII')):
flash('Serial port error')
return redirect(url_for('index'))