-
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathip-address.html
More file actions
420 lines (392 loc) · 14 KB
/
Copy pathip-address.html
File metadata and controls
420 lines (392 loc) · 14 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IP Address Tools — DevDunia</title>
<meta name="description" content="Check your IP address and lookup information about any IP. Free online IP address tools for developers.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://devdunia.com/production/ip-address.html">
<meta property="og:title" content="IP Address Tools — DevDunia">
<meta property="og:description" content="Check your IP address and lookup information about any IP. Free online IP address tools for developers.">
<meta property="og:image" content="https://devdunia.com/images/logo.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Bangers&family=Comic+Neue:wght@400;700&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--ink: #1a1410;
--paper: #fdf3e3;
--paper2: #fbe9cc;
--red: #e63946;
--blue: #1d6fb8;
--yellow: #ffd23f;
--green: #3fa34d;
--pink: #ff6b9d;
--purple: #8a4fff;
--orange: #ff8c42;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Comic Neue', cursive;
font-weight: 400;
color: var(--ink);
background-color: var(--paper);
background-image: radial-gradient(var(--ink) 0.5px, transparent 0.6px);
background-size: 14px 14px;
background-attachment: fixed;
min-height: 100vh;
}
.paper-overlay {
position: fixed; inset: 0;
background: rgba(253,243,227,.78);
pointer-events: none; z-index: 0;
}
.page-wrap {
position: relative; z-index: 1;
max-width: 1240px; margin: 0 auto;
padding: 20px 32px 60px;
}
.panel {
background: var(--paper);
border: 4px solid var(--ink); border-radius: 6px;
box-shadow: 7px 7px 0 var(--ink);
overflow: hidden; margin-bottom: 22px;
}
.panel-header {
background: var(--ink); color: var(--yellow);
font-family: 'Bangers', cursive; font-size: 1.2rem;
letter-spacing: 2px; padding: 8px 16px;
display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.panel-header .panel-tag {
font-family: 'Space Mono', monospace; font-size: .65rem; font-weight: 700;
background: var(--yellow); color: var(--ink);
padding: 2px 7px; border-radius: 3px;
}
.panel-body { padding: 18px 20px; }
.section-label {
font-family: 'Bangers', cursive; font-size: .95rem;
letter-spacing: 1px; color: var(--ink);
margin-bottom: 6px; text-transform: uppercase;
}
/* My IP display */
.my-ip-box {
background: var(--paper2);
border: 3px solid var(--ink); border-radius: 6px;
box-shadow: 4px 4px 0 var(--ink); padding: 16px 20px;
display: flex; align-items: center; justify-content: space-between; gap: 12px;
margin-bottom: 18px;
}
.my-ip-label { font-size: .85rem; color: var(--ink); opacity: .7; margin-bottom: 4px; font-weight: 700; }
#my-ip {
font-family: 'Space Mono', monospace; font-size: 1.3rem;
font-weight: 700; color: var(--blue);
}
/* Input row */
.input-row {
display: flex; gap: 10px; margin-bottom: 14px;
}
.comic-input {
flex: 1;
background: #fff; border: 3px solid var(--ink);
border-radius: 6px; padding: 10px 14px;
font-family: 'Space Mono', monospace; font-size: .85rem;
color: var(--ink); box-shadow: 3px 3px 0 var(--ink);
outline: none;
}
.comic-input:focus { border-color: var(--blue); }
.comic-input::placeholder { color: #aaa; font-style: italic; }
/* Buttons */
.btn {
font-family: 'Bangers', cursive; font-size: 1.1rem;
letter-spacing: 1px; border: 3px solid var(--ink);
border-radius: 6px; padding: 8px 20px;
cursor: pointer; box-shadow: 4px 4px 0 var(--ink);
transition: transform .1s, box-shadow .1s;
text-transform: uppercase;
}
.btn:active { transform: translate(2px,2px); box-shadow: 2px 2px 0 var(--ink); }
.btn-primary { background: var(--red); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-neutral { background: var(--paper2); color: var(--ink); }
/* Error bubble */
.error-bubble {
display: none; position: relative;
background: #fff0f0; border: 3px solid var(--red);
border-radius: 14px; padding: 10px 14px;
margin-top: 12px; font-size: .9rem; font-weight: 700; color: var(--red);
}
.error-bubble.show { display: block; }
/* IP Info grid */
.ip-info-grid {
display: none;
grid-template-columns: 1fr 1fr; gap: 12px;
margin-top: 16px;
}
.ip-info-grid.show { display: grid; }
.info-chip {
background: var(--paper2);
border: 3px solid var(--ink); border-radius: 6px;
box-shadow: 3px 3px 0 var(--ink); padding: 10px 14px;
}
.info-chip h4 {
font-family: 'Bangers', cursive; font-size: .9rem;
letter-spacing: 1px; margin-bottom: 4px;
}
.info-chip p {
font-family: 'Space Mono', monospace; font-size: .78rem;
}
/* Tools grid */
.tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 4px; }
.tool-card {
background: var(--paper2);
border: 3px solid var(--ink); border-radius: 6px;
box-shadow: 4px 4px 0 var(--ink); padding: 14px 16px;
}
.tool-card h4 {
font-family: 'Bangers', cursive; font-size: 1rem;
letter-spacing: 1px; margin-bottom: 8px;
}
.tool-row { display: flex; gap: 8px; align-items: center; }
.tool-input {
flex: 1;
background: #fff; border: 2px solid var(--ink);
border-radius: 4px; padding: 6px 10px;
font-family: 'Space Mono', monospace; font-size: .75rem;
color: var(--ink); outline: none;
}
.tool-result {
display: none;
font-family: 'Space Mono', monospace; font-size: .78rem;
margin-top: 8px; padding: 6px 10px;
background: var(--ink); color: var(--yellow);
border-radius: 4px; word-break: break-all;
}
.tool-result.show { display: block; }
@media (max-width: 760px) {
.ip-info-grid { grid-template-columns: 1fr; }
.tools-grid { grid-template-columns: 1fr; }
.input-row { flex-direction: column; }
}
</style>
</head>
<body>
<div class="paper-overlay"></div>
<div data-masthead></div>
<div class="page-wrap">
<!-- MASTHEAD -->
<div data-tool-hero
data-title="IP Address Info"
data-chapter="06"
data-category="Security & VAPT"
data-icon="📍"
data-desc="Look up geolocation, ISP, ASN and reverse DNS for any IP address. Your own IP detected automatically."
data-color="purple"
data-badges="GEOLOCATION,ISP,ASN,FREE"
data-badge-colors="purple,blue,green,yellow">
</div>
<!-- MY IP -->
<div class="panel">
<div class="panel-header">
📡 YOUR PUBLIC IP ADDRESS
<span class="panel-tag">MY IP</span>
</div>
<div class="panel-body">
<div class="my-ip-box">
<div>
<div class="my-ip-label">Public IP</div>
<div id="my-ip">Loading...</div>
</div>
<button id="copy-my-ip" class="btn btn-neutral">📋 COPY</button>
</div>
</div>
</div>
<!-- IP LOOKUP -->
<div class="panel">
<div class="panel-header">
🔍 IP ADDRESS LOOKUP
<span class="panel-tag">LOOKUP</span>
</div>
<div class="panel-body">
<div class="section-label">Enter an IP to look up</div>
<div class="input-row">
<input type="text" id="ip-input" class="comic-input" placeholder="e.g. 8.8.8.8">
<button id="lookup-btn" class="btn btn-primary">🔍 LOOKUP</button>
</div>
<div id="error-bubble" class="error-bubble">
💥 <span id="error-message">Invalid IP address!</span>
</div>
<div id="ip-info" class="ip-info-grid">
<div class="info-chip">
<h4 style="color:var(--blue);">IP Address</h4>
<p id="ip-address">—</p>
</div>
<div class="info-chip">
<h4 style="color:var(--green);">Country</h4>
<p id="country">—</p>
</div>
<div class="info-chip">
<h4 style="color:var(--purple);">Region</h4>
<p id="region">—</p>
</div>
<div class="info-chip">
<h4 style="color:var(--orange);">City</h4>
<p id="city">—</p>
</div>
<div class="info-chip">
<h4 style="color:var(--blue);">ISP</h4>
<p id="isp">—</p>
</div>
<div class="info-chip">
<h4 style="color:var(--yellow);">Organization</h4>
<p id="org">—</p>
</div>
</div>
</div>
</div>
<!-- IP TOOLS -->
<div class="panel">
<div class="panel-header">
🔧 IP CONVERSION TOOLS
<span class="panel-tag">TOOLS</span>
</div>
<div class="panel-body">
<div class="tools-grid">
<div class="tool-card">
<h4 style="color:var(--blue);">IP to Binary</h4>
<div class="tool-row">
<input type="text" id="ip-to-binary-input" class="tool-input" placeholder="192.168.1.1">
<button id="ip-to-binary-btn" class="btn btn-blue" style="padding:6px 12px;font-size:.9rem;">GO</button>
</div>
<div id="ip-to-binary-result" class="tool-result"></div>
</div>
<div class="tool-card">
<h4 style="color:var(--green);">Binary to IP</h4>
<div class="tool-row">
<input type="text" id="binary-to-ip-input" class="tool-input" placeholder="11000000.10101000.00000001.00000001">
<button id="binary-to-ip-btn" class="btn btn-green" style="padding:6px 12px;font-size:.9rem;">GO</button>
</div>
<div id="binary-to-ip-result" class="tool-result"></div>
</div>
</div>
</div>
</div>
</div><!-- /page-wrap -->
<script src="masthead.js"></script>
<script src="hero-banner.js"></script>
<script src="author-card.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
var myIpEl = document.getElementById('my-ip');
var copyMyIpBtn = document.getElementById('copy-my-ip');
var ipInput = document.getElementById('ip-input');
var lookupBtn = document.getElementById('lookup-btn');
var errBubble = document.getElementById('error-bubble');
var errMsg = document.getElementById('error-message');
var ipInfo = document.getElementById('ip-info');
var ipToBinaryInput = document.getElementById('ip-to-binary-input');
var ipToBinaryBtn = document.getElementById('ip-to-binary-btn');
var ipToBinaryResult = document.getElementById('ip-to-binary-result');
var binaryToIpInput = document.getElementById('binary-to-ip-input');
var binaryToIpBtn = document.getElementById('binary-to-ip-btn');
var binaryToIpResult = document.getElementById('binary-to-ip-result');
// Get user's public IP
async function getMyIP() {
try {
var response = await fetch('https://api.ipify.org?format=json');
var data = await response.json();
myIpEl.textContent = data.ip;
} catch(e) {
myIpEl.textContent = 'Unable to fetch IP';
}
}
copyMyIpBtn.addEventListener('click', function() {
var ip = myIpEl.textContent;
if (ip && ip !== 'Loading...' && ip !== 'Unable to fetch IP') {
navigator.clipboard.writeText(ip).then(function() {
copyMyIpBtn.textContent = '✔ COPIED!';
copyMyIpBtn.style.background = 'var(--green)';
copyMyIpBtn.style.color = '#fff';
setTimeout(function() {
copyMyIpBtn.textContent = '📋 COPY';
copyMyIpBtn.style.background = '';
copyMyIpBtn.style.color = '';
}, 2000);
});
}
});
function showError(msg) {
errMsg.textContent = msg;
errBubble.classList.add('show');
ipInfo.classList.remove('show');
}
function hideError() { errBubble.classList.remove('show'); }
function displayIPInfo(data) {
document.getElementById('ip-address').textContent = data.ip || 'N/A';
document.getElementById('country').textContent = data.country_name || 'N/A';
document.getElementById('region').textContent = data.region || 'N/A';
document.getElementById('city').textContent = data.city || 'N/A';
document.getElementById('isp').textContent = data.org || 'N/A';
document.getElementById('org').textContent = data.org || 'N/A';
ipInfo.classList.add('show');
}
function isValidIP(ip) {
var re = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
return re.test(ip);
}
function ipToBinary(ip) {
return ip.split('.').map(function(o) {
return parseInt(o).toString(2).padStart(8,'0');
}).join('.');
}
function binaryToIP(binary) {
var octets = binary.split('.');
if (octets.length !== 4) throw new Error('Invalid binary format');
return octets.map(function(o) {
if (o.length !== 8 || !/^[01]+$/.test(o)) throw new Error('Invalid binary format');
return parseInt(o, 2);
}).join('.');
}
lookupBtn.addEventListener('click', async function() {
var ip = ipInput.value.trim();
if (!ip) { showError('Please enter an IP address'); return; }
if (!isValidIP(ip)) { showError('Please enter a valid IPv4 address'); return; }
try {
var response = await fetch('https://ipapi.co/' + ip + '/json/');
var data = await response.json();
if (data.error) { showError(data.reason || 'Unable to lookup IP information'); return; }
displayIPInfo(data);
hideError();
} catch(e) {
showError('Unable to lookup IP information');
}
});
ipInput.addEventListener('keydown', function(e) {
if (e.key === 'Enter') lookupBtn.click();
});
ipToBinaryBtn.addEventListener('click', function() {
var ip = ipToBinaryInput.value.trim();
if (!ip) return;
if (!isValidIP(ip)) {
ipToBinaryResult.textContent = 'Invalid IP address';
} else {
ipToBinaryResult.textContent = ipToBinary(ip);
}
ipToBinaryResult.classList.add('show');
});
binaryToIpBtn.addEventListener('click', function() {
var binary = binaryToIpInput.value.trim();
if (!binary) return;
try {
binaryToIpResult.textContent = binaryToIP(binary);
} catch(e) {
binaryToIpResult.textContent = 'Invalid binary format';
}
binaryToIpResult.classList.add('show');
});
getMyIP();
});
</script>
</body>
</html>