This repository has been archived by the owner on Jan 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 84
/
Copy pathpwgen-fsi-hex.py
69 lines (61 loc) · 2.31 KB
/
pwgen-fsi-hex.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
#!/usr/bin/python
# Copyright 2009: dogbert <[email protected]>
#
# This program 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 program 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# This script generates master passwords which can be used to unlock
# the BIOS passwords of most Fujitsu Siemens laptops (Lifebook, Amilo etc.).
# You have to install python for running this script.
import os
# d'oh
def generateCRC16Table():
table = []
for i in range(0, 256):
crc = (i << 8)
for j in range(0, 8):
if crc & 0x8000:
crc = (crc << 1) ^ 0x1021
else:
crc = (crc << 1)
table.append(crc & 0xFFFF)
return table
# D'OH
def calculateHash(word, table):
hash = 0
for c in word:
d = table[(ord(c) ^ (hash >> 8)) % 256]
hash = ((hash << 8) ^ d) & 0xFFFF
return hash
def hashToString(hash):
return (chr(ord('0') + ((hash>>12) % 16) % 10) + chr(ord('0') + ((hash>>8) % 16) % 10) + chr(ord('0') + ((hash>>4) % 16) % 10) + chr(ord('0') + ((hash>>0) % 16) % 10))
def decryptCode(code, table):
return hashToString(calculateHash(code[0:4], table)) + hashToString(calculateHash(code[4:8], table))
print("Master Password Generator for FSI laptops (hexadecimal digits version)")
print("Copyright (C) 2009 dogbert <[email protected]>")
print("")
print("After entering the wrong password for the third time, you will receive a")
print("hexadecimal code from which the master password can be calculated,")
print("e.g. 0A1B2D3E or AAAA-BBBB-CCCC-DEAD-BEEF")
print("")
print("Please enter the code: ")
code = input().replace('-', '')
if len(code) == 20: code = code[12:20]
table = generateCRC16Table()
password = decryptCode(code.upper(), table)
print("The master password is: " + password)
if (os.name == 'nt'):
print("Press a key to exit...")
_ = input()