-
Notifications
You must be signed in to change notification settings - Fork 224
/
bruteforce.py
executable file
·78 lines (67 loc) · 1.9 KB
/
bruteforce.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/python
# bruteforce.py - try random numbers to login to sector 0
#
# Adam Laurie <[email protected]>
# http://rfidiot.org/
#
# This code is copyright (c) Adam Laurie, 2006, All rights reserved.
# For non-commercial use only, the following terms apply - for all other
# uses, please contact the author:
#
# This code is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This code is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
import rfidiot
import random
import sys
import os
try:
card= rfidiot.card
except:
print "Couldn't open reader!"
os._exit(True)
args= rfidiot.args
help= rfidiot.help
card.info('bruteforce v0.1i')
card.select()
print 'Card ID: ' + card.uid
finished = 0
tries = 0
print ' Tries: %s\r' % tries,
sys.stdout.flush()
while not finished:
tries += 1
if tries % 10 == 0:
print ' Tries: %s\r' % tries,
sys.stdout.flush()
if len(args) == 1:
key= args[0]
if len(key) != 12:
print ' Static Key must be 12 HEX characters!'
os._exit(True)
print 'Trying static key: ' + key
else:
key = '%012x' % random.getrandbits(48)
for type in ['AA', 'BB']:
card.select()
if card.login(0,type,key):
print '\nlogin succeeded after %d tries!' % tries
print 'key: ' + type + ' ' + key
finished = 1
break
elif card.errorcode != 'X' and card.errorcode != '6982' and card.errorcode != '6200':
print '\nerror!'
print 'key: ' + type + ' ' + key
print 'error code: ' + card.errorcode
finished = 1
break
if finished:
break
os._exit(False)