-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
179 lines (163 loc) · 4.82 KB
/
index.html
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LOLDrivers-webclient</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/crypto-js.js"></script>
<script src="assets/wasm_exec.js"></script>
<script>
const go = new Go();
WebAssembly.instantiateStreaming(
fetch("assets/loldrivers-webclient.wasm"),
go.importObject
).then((result) => {
go.run(result.instance);
});
</script>
</head>
<body>
<h1>LOLDrivers-webclient</h1>
<main>
<p>
Please press the button below and choose a folder to scan for
known vulnerable and known malicious Windows drivers using
<a href="https://loldrivers.io">loldrivers.io</a>. No data is
being sent to any server. This scanning happens locally in your
browser thanks to the
<a
href="https://developer.mozilla.org/en-US/docs/Web/API/File_System_API"
>File System API</a
>.
</p>
<p>The default Windows driver directories are:</p>
<ul>
<li>C:\Windows\System32\drivers</li>
<li>C:\Windows\System32\DriverStore\FileRepository</li>
<li>C:\WINDOWS\inf</li>
</ul>
<button id="select-folder-button" disabled>Loading...</button>
<div id="results" style="display: none">
<h2>Results</h2>
<p>Processed files: <span id="file-counter">0</span></p>
<p>Matches: <span id="match-counter">0</span></p>
<ul id="match-list"></ul>
</div>
</main>
<footer>
<hr />
<p>
Made with ❤️ and Club-Mate by
<a href="https://github.com/rtfmkiesel" target="_blank"
>@rtfmkiesel</a
>
</p>
</footer>
</body>
<script>
let fileCounter = 0; // To count how many file were processed
let matchCounter = 0; // To count how many matches were found
async function selectFolder() {
const dirHandle = await window.showDirectoryPicker(); // File System API
document.getElementById("results").style.display = "block";
await walkDirectory(dirHandle).then(() => {
document.getElementById("file-counter").innerText =
fileCounter + ", finished";
});
}
// Walk the dir
async function walkDirectory(dirHandle) {
for await (const entry of dirHandle.values()) {
try {
if (entry.kind === "file") {
const file = await entry.getFile();
await lookupFile(file, entry.name); // Found a file, lookup file
} else if (entry.kind === "directory") {
await walkDirectory(entry); // Found a directory, walk again
}
} catch (error) {
console.error(`Error processing ${entry.name}:`, error);
// Optionally, display a message to the user or increment a counter for failed files
}
}
}
async function lookupFile(fileHandle, name) {
const fileArrayBuffer = await fileHandle.arrayBuffer();
const fileContent = new Uint8Array(fileArrayBuffer);
const md5Hash = CryptoJS.MD5(
CryptoJS.lib.WordArray.create(fileContent)
).toString();
const sha1Hash = CryptoJS.SHA1(
CryptoJS.lib.WordArray.create(fileContent)
).toString();
const sha256Hash = CryptoJS.SHA256(
CryptoJS.lib.WordArray.create(fileContent)
).toString();
let response = await lookupHash(md5Hash);
if (!response.ok) {
// No MD5, try SHA1
response = await lookupHash(sha1Hash);
if (!response.ok) {
// No SHA1, try SHA256
response = await lookupHash(sha256Hash);
}
}
if (response.ok) {
addFileToList(name, JSON.parse(response.driver));
}
fileCounter++;
document.getElementById("file-counter").innerText = fileCounter;
}
function addFileToList(name, driver) {
const li = document.createElement("li");
li.innerHTML = `${name} <a href="https://loldrivers.io/drivers/${driver.Id}" target="_blank">↗</a>`;
li.className = "match-entry";
document.getElementById("match-list").appendChild(li);
matchCounter++;
document.getElementById("match-counter").innerText = matchCounter;
}
if ("showDirectoryPicker" in window) {
document
.getElementById("select-folder-button")
.addEventListener("click", selectFolder);
} else {
document.querySelector("main").innerHTML =
"<p>Your browser does not support the <a href='https://developer.mozilla.org/en-US/docs/Web/API/File_System_API'>File System API↗</a>. Please switch to a compatible browser like Chrome or Edge.</p>";
}
</script>
<style>
body {
max-width: 70ch;
margin: 1rem auto;
font-family: monospace;
font-size: large;
line-height: 1.75;
color: #d0d0d0;
background-color: #0c0d10;
}
button {
font-family: monospace;
font-size: large;
}
a,
a:active {
color: aqua;
}
footer {
margin-top: 1rem;
}
.match-entry {
color: rgb(255, 50, 50);
}
@media (prefers-color-scheme: light) {
body {
color: rgb(31, 31, 31);
background-color: #fff;
}
a,
a:active {
color: blue;
}
}
</style>
</html>