Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
elif MCUPROXY is not None:
return getDongleHTTP(remote_host=MCUPROXY, debug=debug)
elif TCP_PROXY is not None:
return getDongleTCP(server=TCP_PROXY[0], port=TCP_PROXY[1], debug=debug)
dev = None
hidDevicePath = None
ledger = True
for hidDevice in hid.enumerate(0, 0):
if hidDevice['vendor_id'] == 0x2c97:
if ('interface_number' in hidDevice and hidDevice['interface_number'] == 0) or ('usage_page' in hidDevice and hidDevice['usage_page'] == 0xffa0):
hidDevicePath = hidDevice['path']
if hidDevicePath is not None:
dev = hid.device()
dev.open_path(hidDevicePath)
dev.set_nonblocking(True)
return HIDDongleHIDAPI(dev, ledger, debug)
if PCSC:
connection = None
for reader in readers():
try:
connection = reader.createConnection()
connection.connect()
if selectCommand != None:
response, sw1, sw2 = connection.transmit(toBytes("00A4040010FF4C4547522E57414C5430312E493031"))
sw = (sw1 << 8) | sw2
if sw == 0x9000:
break
else:
connection.disconnect()
connection = None
else:
break
def getDongle(debug=False, selectCommand=None):
if APDUGEN:
return HIDDongleHIDAPI(None, True, debug)
if not U2FKEY is None:
return getDongleU2F(scrambleKey=U2FKEY, debug=debug)
elif MCUPROXY is not None:
return getDongleHTTP(remote_host=MCUPROXY, debug=debug)
elif TCP_PROXY is not None:
return getDongleTCP(server=TCP_PROXY[0], port=TCP_PROXY[1], debug=debug)
dev = None
hidDevicePath = None
ledger = True
for hidDevice in hid.enumerate(0, 0):
if hidDevice['vendor_id'] == 0x2c97:
if ('interface_number' in hidDevice and hidDevice['interface_number'] == 0) or ('usage_page' in hidDevice and hidDevice['usage_page'] == 0xffa0):
hidDevicePath = hidDevice['path']
if hidDevicePath is not None:
dev = hid.device()