forked from steveseguin/vdo.ninja
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathip.html
More file actions
157 lines (141 loc) · 5.12 KB
/
ip.html
File metadata and controls
157 lines (141 loc) · 5.12 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IP Address Decoder</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 600px;
margin: 0 auto;
padding: 20px;
background-color: #f5f5f5;
}
.container {
background-color: white;
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
h1 {
color: #333;
margin-top: 0;
}
.input-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input, textarea {
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box;
font-family: monospace;
}
textarea {
height: 80px;
resize: vertical;
}
button {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 15px;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
.result {
margin-top: 20px;
}
footer {
margin-top: 20px;
text-align: center;
color: #777;
font-size: 0.8em;
}
</style>
</head>
<body>
<div class="container">
<h1>IP Address Decoder</h1>
<div class="input-group">
<label for="obfuscatedInput">Obfuscated Username:</label>
<input type="text" id="obfuscatedInput" placeholder="Enter encoded string (with or without timestamp part)">
</div>
<button id="decodeButton">Decode IP Address</button>
<div class="result">
<label for="decodedOutput">Decoded IP Address:</label>
<textarea id="decodedOutput" readonly></textarea>
</div>
</div>
<footer>
<p>IP Address Decoder Tool</p>
</footer>
<script>
function decodeIpAddress(obfuscatedUsername) {
try {
// Get the obfuscated part (remove timestamp part if it exists)
let encoded = obfuscatedUsername;
if (obfuscatedUsername.includes(':')) {
encoded = obfuscatedUsername.split(':')[1];
}
// 1. Move last character to the beginning
if (encoded.length > 1) {
const lastChar = encoded.charAt(encoded.length - 1);
encoded = lastChar + encoded.substring(0, encoded.length - 1);
}
// 2. Restore base64 standard format
encoded = encoded
.replace(/-/g, '+')
.replace(/_/g, '/');
// Add padding if needed
while (encoded.length % 4) {
encoded += '=';
}
// 3. Decode base64
const decoded = atob(encoded);
// 4. Remove the salt
const salt = "x";
if (decoded.endsWith(salt)) {
return decoded.substring(0, decoded.length - salt.length);
}
return decoded;
} catch (e) {
console.error('Error decoding IP:', e);
return 'Error: ' + e.message;
}
}
document.getElementById('decodeButton').addEventListener('click', function() {
const obfuscatedUsername = document.getElementById('obfuscatedInput').value.trim();
if (!obfuscatedUsername) {
document.getElementById('decodedOutput').value = 'Please enter an obfuscated username';
return;
}
const decodedIp = decodeIpAddress(obfuscatedUsername);
document.getElementById('decodedOutput').value = decodedIp || 'Failed to decode';
});
// Add sample data functionality
function addSampleData() {
const sampleButton = document.createElement('button');
sampleButton.textContent = 'Try Sample Data';
sampleButton.style.marginLeft = '10px';
sampleButton.style.backgroundColor = '#2196F3';
document.getElementById('decodeButton').after(sampleButton);
sampleButton.addEventListener('click', function() {
document.getElementById('obfuscatedInput').value = 'l0VwNVdlNjE0LjEyOS44OS4yMTF4';
document.getElementById('decodeButton').click();
});
}
addSampleData();
</script>
</body>
</html>