-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecoder.html
More file actions
76 lines (62 loc) · 3.55 KB
/
decoder.html
File metadata and controls
76 lines (62 loc) · 3.55 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Decode MongoDB ObjectIds to reveal the timestamp, machine identifier, process identifier, and counter.">
<meta name="keywords" content="MongoDB, ObjectId, Decode, Tools, Cyberpunk, Hacker, Database">
<meta property="og:title" content="MongoDB ObjectId Decoder">
<meta property="og:description" content="Easily decode MongoDB ObjectIds to understand their underlying components. Perfect for pentesters, developers and database enthusiasts.">
<meta property="og:image" content="https://mongoid-tools.threatrazor.net/mongoid-tools-1200.jpg">
<meta property="og:url" content="https://mongoid-tools.threatrazor.net/decoder.html">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="MongoDB ObjectId Decoder">
<meta name="twitter:description" content="Easily decode MongoDB ObjectIds to understand their underlying components. Perfect for pentesters, developers and database enthusiasts.">
<meta name="twitter:image" content="https://mongoid-tools.threatrazor.net/mongoid-tools-1200.jpg">
<title>MongoDB ObjectId Decoder</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>MongoDB ObjectId Decoder</h1>
<div class="error" id="error"></div>
<input type="text" id="objectIdInput" placeholder="Enter a MongoDB ObjectId">
<button onclick="decodeObjectId()">Decode</button>
<div class="output" id="output"></div>
<div class="footer">
<p>Created by <a href="https://github.com/ExZyle" target="_blank">@ExZyle</a>.</p>
</div>
<script>
function decodeObjectId() {
const oidStr = document.getElementById("objectIdInput").value;
const errorDiv = document.getElementById("error");
const outputDiv = document.getElementById("output");
errorDiv.innerHTML = "";
outputDiv.innerHTML = "";
// Validate the ObjectId
if (!/^[0-9a-fA-F]{24}$/.test(oidStr)) {
errorDiv.innerHTML = "Invalid ObjectId format. Please provide a valid 24-character hexadecimal string.";
return;
}
// Convert the ObjectId string to a Buffer
const buffer = new Uint8Array(oidStr.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
// Extract the timestamp (first 4 bytes)
const timestamp = new Date((buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3]) * 1000);
// Extract the machine identifier (next 3 bytes)
const machineId = Array.from(buffer.slice(4, 7)).map(byte => byte.toString(16).padStart(2, '0')).join('');
// Extract the process identifier (next 2 bytes)
const processId = (buffer[7] << 8 | buffer[8]);
// Extract the counter (last 3 bytes)
const counter = (buffer[9] << 16 | buffer[10] << 8 | buffer[11]);
// Display the details
outputDiv.innerHTML = `
<p><strong>ObjectId:</strong> ${oidStr}</p>
<p><strong>Timestamp:</strong> ${timestamp.toISOString()} (UTC)</p>
<p><strong>Timestamp (Local):</strong> ${timestamp.toLocaleString()}</p>
<p><strong>Machine Identifier:</strong> ${machineId}</p>
<p><strong>Process Identifier:</strong> ${processId}</p>
<p><strong>Counter:</strong> ${counter}</p>
`;
}
</script>
</body>
</html>