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 82
/
pwgen-asus.py
executable file
·107 lines (92 loc) · 3.06 KB
/
pwgen-asus.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/python
# Copyright 2016: dogbert <dogber1@gmail.com>
#
# 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 Asus laptops.
# You have to install python for running this script.
import os
def shuffle1(a1, a2):
v3 = 2
for i in range(0, a2):
v4 = v3
v5 = a1
while v5 > 0:
if (v5 < v4):
v5, v4 = v4, v5
v5 %= v4
if (v4 != 1):
v3 += 1;
if (v3 < a1):
continue
return v3
def shuffle2(a1, a2, a3):
if (a1 >= a3):
a1 %= a3
result = a1
if (a2 != 1):
for i in range(0, a2 - 1):
result = a1 * result % a3;
return result
def initTable(table, i1=11, i2=19, i3=6):
table[0] = chr(i1 + ord('0'))
table[1] = chr(i2 + ord('0'))
table[2] = chr(i3 + ord('0'))
table[3] = "6"
table[4] = "7"
table[5] = "8"
table[6] = "9"
chksum = 0
for i in range(0, 7):
chksum += ord(table[i])
for i in range(7, 32):
chksum = 33676 * chksum + 12345
table[i] = chr(((chksum >> 16) & 0x7FFF) % 43 + ord('0'))
v3 = i1 * i2
v4 = shuffle1((i1 - 1) * (i2 - 1), i3)
for i in range(0, 32):
table[i] = chr(shuffle2(ord(table[i]) - ord('0'), v4, v3))
return table
def calculatePassword(date, table):
date = int(date.replace("-", ""), 16)
chksum = date
password = ""
for i in range(8):
chksum = 33676 * chksum + 12345
index = (chksum >> 16) & 31
pwdC = ord(table[index]) % 36
if pwdC > 9:
password += chr(pwdC + ord('7'))
else:
password += chr(pwdC + ord('0'))
return password
table = initTable([''] * 32)
print("Master Password Generator for Asus laptops (system date version)")
print("Copyright (C) 2016 dogbert <dogber1@gmail.com>")
print("")
print("When asked for a password, enter an incorrect password, then press Alt+R. A prompt with the system date will appear, e.g. 2013-12-31")
print("")
print("Please enter the system date: ")
inDate = raw_input().strip().replace('/', '-').replace('.', '-')
password = calculatePassword(inDate, table)
print("")
print("The master password is: " + password)
print("")
print("Please note that the password is encoded for US QWERTY keyboard layouts.")
if (os.name == 'nt'):
print("Press a key to exit...")
raw_input()