This repository has been archived by the owner on Sep 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
pro_t1p.js
160 lines (94 loc) · 6.6 KB
/
pro_t1p.js
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
function (
// ═════════════════════════════════════════════════════════════
// Pro T1p - T1 lock cracker for hackmud
// ═════════════════════════════════════════════════════════════
// https://github.com/ScottHamper/hackmud
//
// I created this script as a challenge to see how much T1
// cracker functionality I could pack into a single <= 500 char
// script without needing to store anything in the database.
//
// Regarding performance, the script is mostly optimized for
// each of the lock types (in terms of guesses needed):
//
// ┌──────────────┬──────────────┐
// │ Theoretical │ Pro T1p │
// ├──────┬───────┼──────┬───────┤
// │ Best │ Worst │ Best │ Worst │
// ┌────────┼──────┼───────┼──────┼───────┤
// │ EZ_21 │ 1 │ 3 │ 1 │ 3 │
// │ EZ_35 │ 1 │ 12 │ 2 │ 13 │
// │ EZ_40 │ 1 │ 27 │ 2 │ 28 │
// │ c001 │ 1 │ 8 │ 2 │ 9 │
// │ c002 │ 1 │ 8 │ 2 │ 9 │
// │ c003 │ 1 │ 8 │ 3 │ 10 │
// │ l0cket │ 1 │ 8 │ 1 │ 8 │
// └────────┴──────┴───────┴──────┴───────┘
//
// NOTE: This script will only work when set as private.
// ─────────────────────────────────────────────────────────────
// Key for previous cracked lock/parameter
z,
// Name of the current lock/parameter being cracked
l,
// Response from target
// Initialized to bogus "response" that won't cause loop body regex to throw an exception
r = 'N_',
// Template string tag function that decodes whitespace into an array of "normal" strings.
w = s => s[0].replace(/./g, c => c < ' ' | 0).replace(/.{8}/g, c => String.fromCharCode('0b' + c)).split`
`,
// Template string tag function that decodes whitespace into an array of numbers.
n = x => w(x).map(n => +n),
// Colors
// ["red", "orange", "yellow", "lime", "green", "cyan", "blue", "purple",
// "red", "orange", "yellow", "lime", "green", "cyan", "blue", "purple"]
k = w`
`
) {
for (;
// After any single lock has been cracked, `r` will be either:
// - "`NLOCK_UNLOCKED`\nConnection terminated."
// - "`NLOCK_UNLOCKED` {LOCK}\n`VLOCK_ERROR`\nDenied access by {MANUFACTURER} `N{LOCK}` lock."
// Only the "Connection terminated" response has "nn" in it.
!r[w` `]`nn`;
// This happens after the loop body below.
// Gets the appropriate key array for the current lock,
// and brute forces the lock.
z = (l[4] ? {
// EZ_21, EZ_35, EZ_40
// ["release", "open", "unlock"]
E: w`
`,
// digit (EZ_35)
// [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
d: n`
`,
// ez_prime (EZ_40)
// [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
e: n`
`,
// l0cket
// ["vc2c7q", "cmppiq", "tvfkyq", "uphlaw", "6hh8xw", "xwz7ja", "sa23uw", "72umy0"]
l: w`
`
}[l[0]] || [
+l[3] ?
// c002_complement; c003_triad_x
k[k[w` `](z) + (l[11]|4)]
// color_digit
: z[w` `]
]
// c00x
: k
// Cracking function - tries each value in an array for
// the current lock/parameter, and short-circuits once
// it finds the correct value.
// Only the "is not the correct {PARAMETER}" message contains "th".
).find(v => !(c[l] = v, r = a.t.call(c))[w` `]`th`)
)
// Find the last blue-colored word in the last line of output.
// This should be the name of the next lock/parameter to crack,
// but will throw an exception if the loc no longer exists or
// is currently breached.
[,l] = r[w` `](w` `)
}