-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathip_generator.html
303 lines (265 loc) · 11.8 KB
/
ip_generator.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
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Generate Random IP Addresses.">
<meta name="author" content="L34ND3V">
<meta name="theme-color" content="#000000">
<title>Random IP Generator</title>
<link rel="icon" type="image/x-icon" href="https://img.icons8.com/?size=100&id=JitHof6tJOXi&format=png&color=000000">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Share+Tech+Mono">
<style>
/* General Styles */
body {
font-family: 'Share Tech Mono', monospace;
text-align: center;
color: #00ff00;
background-color: #000000;
display: flex;
flex-direction: column;
min-height: 100vh;
/* Ensure the body takes up at least the full viewport height */
cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%2300ff00" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"></rect><path d="M9 9H15V15H9V9Z"></path><path d="M3 12H6"></path><path d="M18 12H21"></path><path d="M12 3V6"></path><path d="M12 18V21"></path></svg>'), auto;
}
h1,
h4 {
text-shadow: 0 0 5px #00ff00;
}
.btn {
border: 1px solid #00ff00;
color: #00ff00;
background: transparent;
cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%2300ff00" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 4V10H10"></path><path d="M20 20V14H14"></path><path d="M10 4H20V14"></path><path d="M4 20H14V10"></path></svg>'), auto;
}
.btn:hover {
background-color: #00ff00;
color: black;
}
.form-control {
background-color: black;
color: #00ff00;
border: 1px solid #00ff00;
}
.alert-success {
background-color: black;
color: #00ff00;
border: 1px solid #00ff00;
}
/* Flexbox Container */
.container {
flex: 1;
/* Allow the container to grow and fill the available space */
}
/* Footer Styles */
.footer {
padding: 10px;
background-color: #000000;
color: #00ff00;
text-align: center;
border-top: 1px solid #00ff00;
margin-top: auto;
/* Push the footer to the bottom */
}
.github-link {
color: #00ff00;
text-decoration: none;
}
.github-link:hover {
text-decoration: underline;
cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%2300ff00" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 4H20V20H4V4Z"></path><path d="M4 4L12 12L20 4"></path></svg>'), auto;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Random IPv4 Generator</h1>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h4>Range</h4>
<div class="input-group">
<input id="rangeStart1" class="form-control" type="number" value="0" min="0" max="255">
<input id="rangeStart2" class="form-control" type="number" value="0" min="0" max="255">
<input id="rangeStart3" class="form-control" type="number" value="0" min="0" max="255">
<input id="rangeStart4" class="form-control" type="number" value="0" min="0" max="255">
</div>
</div>
</div><br>
<div class="row">
<div class="col-md-12">
<h4>Amount</h4>
<div class="input-group">
<input id="ipAmount" class="form-control" type="number" value="1" min="1" max="256">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<br>
<h4>Output</h4>
<div>
<button class="btn" onclick="ipGen()">Generate</button>
<button class="btn" onclick="autoCopy()">Copy</button>
<button class="btn" onclick="downloadText()">Download</button><br>
<br>
<div class="alert-success" id="log">Page loaded successfully</div>
<div class="row">
<div class="col-md-12">
<div class="input-group">
<textarea id="ipOut" class="form-control" rows="6"></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Footer -->
<footer class="footer">
<p class="developer-text">Developed by <a href="https://github.com/ExploitInject" class="github-link"
target="_blank">ExploitInject</a></p>
</footer>
<script>
var rangeStart1 = 0;
var rangeStart2 = 0;
var rangeStart3 = 0;
var rangeStart4 = 0;
var rangeEnd1 = 255;
var rangeEnd2 = 255;
var rangeEnd3 = 255;
var rangeEnd4 = 255;
var ipAmount = 1;
function alertBox(type, text) {
if (type === true) {
document.getElementById('log').innerHTML = text;
document.getElementById('log').className = "alert-success";
} else if (type === false) {
document.getElementById('log').innerHTML = text;
document.getElementById('log').className = "alert-danger";
}
}
function rangeSet() {
rangeStart1 = document.getElementById('rangeStart1').value;
rangeStart2 = document.getElementById('rangeStart2').value;
rangeStart3 = document.getElementById('rangeStart3').value;
rangeStart4 = document.getElementById('rangeStart4').value;
rangeEnd1 = document.getElementById('rangeEnd1').value;
rangeEnd2 = document.getElementById('rangeEnd2').value;
rangeEnd3 = document.getElementById('rangeEnd3').value;
rangeEnd4 = document.getElementById('rangeEnd4').value;
}
function amountSet() {
ipAmount = document.getElementById('ipAmount').value;
}
function ipGen() {
if (ipAmount > 256) return (alertBox(false, "You cannot generate more than 256 IP's at a time"));
document.getElementById('ipOut').innerHTML = '';
for (var i = 0; i < ipAmount; i++) {
var out1 = Math.floor(Math.random() * (parseFloat(rangeEnd1) - parseFloat(rangeStart1) + 1)) + parseFloat(rangeStart1);
var out2 = Math.floor(Math.random() * (parseFloat(rangeEnd2) - parseFloat(rangeStart2) + 1)) + parseFloat(rangeStart2);
var out3 = Math.floor(Math.random() * (parseFloat(rangeEnd3) - parseFloat(rangeStart3) + 1)) + parseFloat(rangeStart3);
var out4 = Math.floor(Math.random() * (parseFloat(rangeEnd4) - parseFloat(rangeStart4) + 1)) + parseFloat(rangeStart4);
document.getElementById('ipOut').innerHTML += out1 + "." + out2 + "." + out3 + "." + out4 + " ";
}
alertBox(true, ipAmount + " IP's generated successfully");
}
function autoCopy() {
var text = document.getElementById("ipOut");
text.select();
document.execCommand("copy");
alertBox(true, ipAmount + " IP's copied to clipboard")
}
function downloadText() {
var text = document.getElementById("ipOut").value;
if (!text) return (alertBox(false, "There are no generated IP's to download"));
text = text.replace(/\n/g, "\r\n");
var blob = new Blob([text], { type: "text/plain" });
var anchor = document.createElement("a");
anchor.download = `${ipAmount}-IP-list.txt`;
anchor.href = window.URL.createObjectURL(blob);
anchor.target = "_blank";
anchor.style.display = "none";
document.body.appendChild(anchor);
anchor.click();
document.body.removeChild(anchor);
alertBox(true, ipAmount + " IP's downloaded successfully")
}
var EventUtil = {
addHandler: function (element, type, handler) {
if (element.addEventListener) {
element.addEventListener(type, handler, false);
} else if (element.attachEvent) {
element.attachEvent("on" + type, handler);
} else {
element["on" + type] = handler;
}
},
removeHandler: function (element, type, handler) {
if (element.removeEventListener) {
element.removeEventListener(type, handler, false);
} else if (element.detachEvent) {
element.detachEvent("on" + type, handler);
} else {
element["on" + type] = null;
}
},
getEvent: function (event) {
return event ? event : window.event;
},
getTarget: function (event) {
return event.target || event.srcElement;
},
getWheelDelta: function (event) {
if (event.wheelDelta) {
return event.wheelDelta;
} else {
return -event.detail * 40;
}
},
preventDefault: function (event) {
if (event.preventDefault) {
event.preventDefault();
} else {
event.returnValue = false;
}
}
};
function onWheel(event) {
event = EventUtil.getEvent(event);
var curElem = EventUtil.getTarget(event);
var curVal = parseInt(curElem.value);
var delta = EventUtil.getWheelDelta(event);
if (delta > 0) {
curElem.value = curVal + 1;
rangeSet();
amountSet();
} else {
curElem.value = curVal - 1;
rangeSet();
amountSet();
}
if (curElem.value > 255) {
curElem.value = 255;
} else if (curElem.value < 0) {
curElem.value = 0;
}
EventUtil.preventDefault(event);
}
$(function () {
$(".wheelable").hover(function () {
EventUtil.addHandler(document, 'mousewheel', onWheel);
EventUtil.addHandler(document, 'DOMMouseScroll', onWheel);
},
function () {
EventUtil.removeHandler(document, 'mousewheel', onWheel);
EventUtil.removeHandler(document, 'DOMMouseScroll', onWheel);
});
});
</script>
</body>
</html>