Software python + autoit pentru YHY632A Rfid
'''
Created on May 1, 2013
@author: azrael-sub7
'''
import rfidCard
import argparse
import sys
if __name__ == '__main__':
cardDumpData = ""
cardDumpKeys = ""
port = ""
band = ""
parser = argparse.ArgumentParser(
prog='YHY632WriterPython',
description='''
This program will copy data from a mifare 1k whole dump
and write on a rfid mifare 1k tag if you provide the
correct keys \n
Simple usage: exemple --cardDumpData cardDumWithDataToCopy.dmp --cardDumpKeys cardDumWithKeysToUse.dmp \n
''',
epilog='''
A Whole Card Dump look like this : \n
Layout: 64 * [16 Bytes BLOCK] (16 KEYS A and B Keys For each 4 Block )\n
Data Diagram:\n
ADDRESS-00--------16 Bytes: SPECIAL BLOCK:------------\n
ADDRESS-01--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-02--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-03--------16 Bytes: KEYS BLOCK :------------\n
\n
ADDRESS-04--------16 Bytes: SPECIAL BLOCK:------------\n
ADDRESS-05--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-06--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-07--------16 Bytes: KEYS BLOCK :------------\n
\n
[................ Repeat Until ..... .................]\n
ADDRESS-60---------16 Bytes: SPECIAL BLOCK:------------\n
ADDRESS-61--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-62--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-63--------16 Bytes: KEYS BLOCK :------------\n
''')
parser.add_argument('--cardDumpData', dest='cardDumpData', action='store_const',
const=sum, default=max,
help='File path to card dump ( data from the dump will be copied )')
parser.add_argument('--cardDumpKeys', dest='cardDumpKeys', action='store_const',
const=sum, default=max,
help='File path to card dump ( keys form the dump will be used )')
parser.add_argument('--port', dest='port', action='store_const',
const=sum, default=max,
help='port where you have the device connected ex: 3( default value) ( see device manager )')
parser.add_argument('--band', dest='band', action='store_const',
const=sum, default=max,
help='band rate to transmit message: ussualy 9600(default value) ( see device manager )')
args = parser.parse_args()
port = 1
band = 9600
fCardFile = file('1.dmp', 'rb')
fCardFileContentsList = bytearray(fCardFile.read())
fCardFile.close()
allSectorsC1 = dict()
for i in range(0,16):allSectorsC1[int(i)] = fCardFileContentsList[0+64*i:64*(1+i)]
fCardFile = file('2.dmp', 'rb')
fCardFileContentsList = bytearray(fCardFile.read())
fCardFile.close()
allSectorsC2 = dict()
for i in range(0,16):allSectorsC2[int(i)] = fCardFileContentsList[0+64*i:64*(1+i)]
if not len(sys.argv):
card = rfidCard.rfidCard()
card.connectDev()
card.selectCard()
card.writeCardData(allSectorsC2, allSectorsC1)
else:
#band = int(band)
#port = int(port)
if((band > 1) and (port > 1)):
card = rfidCard.rfidCard(port,band)
else:
card = rfidCard.rfidCard();
card.connectDev()
card.selectCard()
card.writeCardData(allSectorsC2, allSectorsC1)
card.printCard(allSectorsC2)
Clasa :
'''
Created on May 1, 2013
@author: azrael-sub7
'''
import rfidCard
import argparse
import sys
if __name__ == '__main__':
cardDumpData = ""
cardDumpKeys = ""
port = ""
band = ""
parser = argparse.ArgumentParser(
prog='YHY632WriterPython',
description='''
This program will copy data from a mifare 1k whole dump
and write on a rfid mifare 1k tag if you provide the
correct keys \n
Simple usage: exemple --cardDumpData cardDumWithDataToCopy.dmp --cardDumpKeys cardDumWithKeysToUse.dmp \n
''',
epilog='''
A Whole Card Dump look like this : \n
Layout: 64 * [16 Bytes BLOCK] (16 KEYS A and B Keys For each 4 Block )\n
Data Diagram:\n
ADDRESS-00--------16 Bytes: SPECIAL BLOCK:------------\n
ADDRESS-01--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-02--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-03--------16 Bytes: KEYS BLOCK :------------\n
\n
ADDRESS-04--------16 Bytes: SPECIAL BLOCK:------------\n
ADDRESS-05--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-06--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-07--------16 Bytes: KEYS BLOCK :------------\n
\n
[................ Repeat Until ..... .................]\n
ADDRESS-60---------16 Bytes: SPECIAL BLOCK:------------\n
ADDRESS-61--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-62--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-63--------16 Bytes: KEYS BLOCK :------------\n
''')
parser.add_argument('--cardDumpData', dest='cardDumpData', action='store_const',
const=sum, default=max,
help='File path to card dump ( data from the dump will be copied )')
parser.add_argument('--cardDumpKeys', dest='cardDumpKeys', action='store_const',
const=sum, default=max,
help='File path to card dump ( keys form the dump will be used )')
parser.add_argument('--port', dest='port', action='store_const',
const=sum, default=max,
help='port where you have the device connected ex: 3( default value) ( see device manager )')
parser.add_argument('--band', dest='band', action='store_const',
const=sum, default=max,
help='band rate to transmit message: ussualy 9600(default value) ( see device manager )')
args = parser.parse_args()
port = 1
band = 9600
fCardFile = file('1.dmp', 'rb')
fCardFileContentsList = bytearray(fCardFile.read())
fCardFile.close()
allSectorsC1 = dict()
for i in range(0,16):allSectorsC1[int(i)] = fCardFileContentsList[0+64*i:64*(1+i)]
fCardFile = file('2.dmp', 'rb')
fCardFileContentsList = bytearray(fCardFile.read())
fCardFile.close()
allSectorsC2 = dict()
for i in range(0,16):allSectorsC2[int(i)] = fCardFileContentsList[0+64*i:64*(1+i)]
if not len(sys.argv):
card = rfidCard.rfidCard()
card.connectDev()
card.selectCard()
card.writeCardData(allSectorsC2, allSectorsC1)
else:
#band = int(band)
#port = int(port)
if((band > 1) and (port > 1)):
card = rfidCard.rfidCard(port,band)
else:
card = rfidCard.rfidCard();
card.connectDev()
card.selectCard()
card.writeCardData(allSectorsC2, allSectorsC1)
card.printCard(allSectorsC2)
Si versiunea autoit la fel în două fișiere unul l-am ținut pentru GUI și unul pentru restul:
Gui:
'''
Created on May 1, 2013
@author: azrael-sub7
'''
import rfidCard
import argparse
import sys
if __name__ == '__main__':
cardDumpData = ""
cardDumpKeys = ""
port = ""
band = ""
parser = argparse.ArgumentParser(
prog='YHY632WriterPython',
description='''
This program will copy data from a mifare 1k whole dump
and write on a rfid mifare 1k tag if you provide the
correct keys \n
Simple usage: exemple --cardDumpData cardDumWithDataToCopy.dmp --cardDumpKeys cardDumWithKeysToUse.dmp \n
''',
epilog='''
A Whole Card Dump look like this : \n
Layout: 64 * [16 Bytes BLOCK] (16 KEYS A and B Keys For each 4 Block )\n
Data Diagram:\n
ADDRESS-00--------16 Bytes: SPECIAL BLOCK:------------\n
ADDRESS-01--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-02--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-03--------16 Bytes: KEYS BLOCK :------------\n
\n
ADDRESS-04--------16 Bytes: SPECIAL BLOCK:------------\n
ADDRESS-05--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-06--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-07--------16 Bytes: KEYS BLOCK :------------\n
\n
[................ Repeat Until ..... .................]\n
ADDRESS-60---------16 Bytes: SPECIAL BLOCK:------------\n
ADDRESS-61--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-62--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-63--------16 Bytes: KEYS BLOCK :------------\n
''')
parser.add_argument('--cardDumpData', dest='cardDumpData', action='store_const',
const=sum, default=max,
help='File path to card dump ( data from the dump will be copied )')
parser.add_argument('--cardDumpKeys', dest='cardDumpKeys', action='store_const',
const=sum, default=max,
help='File path to card dump ( keys form the dump will be used )')
parser.add_argument('--port', dest='port', action='store_const',
const=sum, default=max,
help='port where you have the device connected ex: 3( default value) ( see device manager )')
parser.add_argument('--band', dest='band', action='store_const',
const=sum, default=max,
help='band rate to transmit message: ussualy 9600(default value) ( see device manager )')
args = parser.parse_args()
port = 1
band = 9600
fCardFile = file('1.dmp', 'rb')
fCardFileContentsList = bytearray(fCardFile.read())
fCardFile.close()
allSectorsC1 = dict()
for i in range(0,16):allSectorsC1[int(i)] = fCardFileContentsList[0+64*i:64*(1+i)]
fCardFile = file('2.dmp', 'rb')
fCardFileContentsList = bytearray(fCardFile.read())
fCardFile.close()
allSectorsC2 = dict()
for i in range(0,16):allSectorsC2[int(i)] = fCardFileContentsList[0+64*i:64*(1+i)]
if not len(sys.argv):
card = rfidCard.rfidCard()
card.connectDev()
card.selectCard()
card.writeCardData(allSectorsC2, allSectorsC1)
else:
#band = int(band)
#port = int(port)
if((band > 1) and (port > 1)):
card = rfidCard.rfidCard(port,band)
else:
card = rfidCard.rfidCard();
card.connectDev()
card.selectCard()
card.writeCardData(allSectorsC2, allSectorsC1)
card.printCard(allSectorsC2)
Si main:
'''
Created on May 1, 2013
@author: azrael-sub7
'''
import rfidCard
import argparse
import sys
if __name__ == '__main__':
cardDumpData = ""
cardDumpKeys = ""
port = ""
band = ""
parser = argparse.ArgumentParser(
prog='YHY632WriterPython',
description='''
This program will copy data from a mifare 1k whole dump
and write on a rfid mifare 1k tag if you provide the
correct keys \n
Simple usage: exemple --cardDumpData cardDumWithDataToCopy.dmp --cardDumpKeys cardDumWithKeysToUse.dmp \n
''',
epilog='''
A Whole Card Dump look like this : \n
Layout: 64 * [16 Bytes BLOCK] (16 KEYS A and B Keys For each 4 Block )\n
Data Diagram:\n
ADDRESS-00--------16 Bytes: SPECIAL BLOCK:------------\n
ADDRESS-01--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-02--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-03--------16 Bytes: KEYS BLOCK :------------\n
\n
ADDRESS-04--------16 Bytes: SPECIAL BLOCK:------------\n
ADDRESS-05--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-06--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-07--------16 Bytes: KEYS BLOCK :------------\n
\n
[................ Repeat Until ..... .................]\n
ADDRESS-60---------16 Bytes: SPECIAL BLOCK:------------\n
ADDRESS-61--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-62--------16 Bytes: DATA BLOCK :------------\n
ADDRESS-63--------16 Bytes: KEYS BLOCK :------------\n
''')
parser.add_argument('--cardDumpData', dest='cardDumpData', action='store_const',
const=sum, default=max,
help='File path to card dump ( data from the dump will be copied )')
parser.add_argument('--cardDumpKeys', dest='cardDumpKeys', action='store_const',
const=sum, default=max,
help='File path to card dump ( keys form the dump will be used )')
parser.add_argument('--port', dest='port', action='store_const',
const=sum, default=max,
help='port where you have the device connected ex: 3( default value) ( see device manager )')
parser.add_argument('--band', dest='band', action='store_const',
const=sum, default=max,
help='band rate to transmit message: ussualy 9600(default value) ( see device manager )')
args = parser.parse_args()
port = 1
band = 9600
fCardFile = file('1.dmp', 'rb')
fCardFileContentsList = bytearray(fCardFile.read())
fCardFile.close()
allSectorsC1 = dict()
for i in range(0,16):allSectorsC1[int(i)] = fCardFileContentsList[0+64*i:64*(1+i)]
fCardFile = file('2.dmp', 'rb')
fCardFileContentsList = bytearray(fCardFile.read())
fCardFile.close()
allSectorsC2 = dict()
for i in range(0,16):allSectorsC2[int(i)] = fCardFileContentsList[0+64*i:64*(1+i)]
if not len(sys.argv):
card = rfidCard.rfidCard()
card.connectDev()
card.selectCard()
card.writeCardData(allSectorsC2, allSectorsC1)
else:
#band = int(band)
#port = int(port)
if((band > 1) and (port > 1)):
card = rfidCard.rfidCard(port,band)
else:
card = rfidCard.rfidCard();
card.connectDev()
card.selectCard()
card.writeCardData(allSectorsC2, allSectorsC1)
card.printCard(allSectorsC2)
Comments
Loading comments...