-
Notifications
You must be signed in to change notification settings - Fork 0
/
reseau.html
254 lines (215 loc) · 10.1 KB
/
reseau.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
<head>
<meta charset="utf-8">
<title>Outils réseau</title>
<meta name="description" content="">
<!-- Mobile Specific Metas
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Font
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="fonts/font.css" type="text/css" charset="utf-8" />
<style type="text/css">
body {
font-family: 'new_yorkregular';
}
</style>
<!-- CSS
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="css/synthwave.css">
<!-- Favicon
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="icon" type="image/png" href="images/favicon.png">
<!-- Scripts
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/jquery-ui.min.js" type="text/javascript"></script>
</head>
<body>
<!-- Navigation
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<nav>
<a href="index.html">Accueil</a>
<a href="generateur.html">Générateurs</a>
<a href="reseau.html">Réseau</a>
<a href="mha.html">Analyseur de courriels</a>
<a href="cyberchef.html">CyberChef</a>
<a href="conversion.html">Conversion</a>
<a href="raid-calc.html">Calculateur RAID</a>
<a href="base64.html">Conversion Base 64</a>
<a href="ias-logs.html">Analyseur IAS</a>
<a href="rps.html">Simulateur sauvegardes</a>
</nav>
<!-- Contenu
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="background"></div>
<div class="grid"></div>
<div class="container">
<div class="row">
<h1>Outils réseau</h1>
<h4>Mon adresse IP</h4>
<div id="myIP"></div>
<br>
<script>
$.ajax({
url: "http://ip-api.com/json/?fields=status,message,continent,continentCode,country,countryCode,region,regionName,city,district,zip,lat,lon,timezone,offset,currency,isp,org,as,asname,reverse,mobile,proxy,hosting,query&lang=fr",
dataType: "jsonp",
success: function (res) {
document.getElementById("myIP").innerHTML = "Adresse IP: " + res.query + "<br>" +
"Ville: " + res.city + "<br>" +
"Région: " + res.region + "<br>" +
"Pays: " + res.country + "<br>" +
"Organisation: " + res.org + "<br>" +
"Fuseau horaire: " + res.timezone + "<br>" +
"Statut: " + res.status + "<br>" +
"Continent: " + res.continent + "<br>" +
"Code continent: " + res.continentCode + "<br>" +
"Code pays: " + res.countryCode + "<br>" +
"Nom région: " + res.regionName + "<br>" +
"District: " + res.district + "<br>" +
"Code postal: " + res.zip + "<br>" +
"Latitude: " + res.lat + "<br>" +
"Longitude: " + res.lon + "<br>" +
"Décalage horaire: " + (res.offset / 3600) + " h" + "<br>" +
"Devise: " + res.currency + "<br>" +
"Fournisseur d'accès: " + res.isp + "<br>" +
"AS: " + res.as + "<br>" +
"Nom AS: " + res.asname + "<br>" +
"Reverse DNS: " + res.reverse + "<br>" +
"Mobile: " + res.mobile + "<br>" +
"Proxy: " + res.proxy + "<br>" +
"Hébergement: " + res.hosting;
}
});
</script>
<h4>Calculateur de sous-réseau</h4>
<form>
<label for="ipAddress">Adresse IP:</label>
<input type="text" id="ipAddress" name="ipAddress" placeholder="Ex: 192.168.0.1" required>
<br>
<br>
<label for="cidr">Masque:</label>
<select id="cidr">
<!-- Options pour le masque CIDR -->
<option value="0">0.0.0.0/0</option>
<option value="1">128.0.0.0/1</option>
<option value="2">192.0.0.0/2</option>
<option value="3">224.0.0.0/3</option>
<option value="4">240.0.0.0/4</option>
<option value="5">248.0.0.0/5</option>
<option value="6">252.0.0.0/6</option>
<option value="7">254.0.0.0/7</option>
<option value="8">255.0.0.0/8</option>
<option value="9">255.128.0.0/9</option>
<option value="10">255.192.0.0/10</option>
<option value="11">255.224.0.0/11</option>
<option value="12">255.240.0.0/12</option>
<option value="13">255.248.0.0/13</option>
<option value="14">255.252.0.0/14</option>
<option value="15">255.254.0.0/15</option>
<option value="16">255.255.0.0/16</option>
<option value="17">255.255.128.0/17</option>
<option value="18">255.255.192.0/18</option>
<option value="19">255.255.224.0/19</option>
<option value="20">255.255.240.0/20</option>
<option value="21">255.255.248.0/21</option>
<option value="22">255.255.252.0/22</option>
<option value="23">255.255.254.0/23</option>
<option value="24">255.255.255.0/24</option>
<option value="25">255.255.255.128/25</option>
<option value="26">255.255.255.192/26</option>
<option value="27">255.255.255.224/27</option>
<option value="28">255.255.255.240/28</option>
<option value="29">255.255.255.248/29</option>
<option value="30">255.255.255.252/30</option>
<option value="31">255.255.255.254/31</option>
<option value="32">255.255.255.255/32</option>
</select>
<br>
<br>
<button type="submit" onclick="calculateResults(event)">Calculer</button>
</form>
<div id="networkDetails" style="display: none;">
<h5>Résultats:</h5>
<p id="networkAddress">Adresse réseau:</p>
<p id="broadcastAddress">Adresse de diffusion:</p>
<p id="subnetMask">Masque de sous-réseau:</p>
<p id="usableHosts">Nombre d'hôtes utilisables:</p>
</div>
</div>
</div>
<script>
function calculateResults(event) {
event.preventDefault(); // Previent le rechargement de la page
// Variables
var ipAddress = document.getElementById("ipAddress").value;
var cidr = document.getElementById("cidr").value;
var subnetMask = calculateSubnetMask(cidr);
var broadcastAddress = calculateBroadcastAddress(ipAddress, cidr);
var networkAddress = calculateNetworkAddress(ipAddress, cidr);
var usableHosts = calculateUsableHosts(cidr);
// Fonction de calcul du masque de sous-réseau
function calculateSubnetMask(cidr) {
var networkBits = parseInt(cidr);
var subnetMask = "";
for (var i = 0; i < 4; i++) {
if (networkBits >= 8) {
subnetMask += "255";
networkBits -= 8;
} else if (networkBits > 0) {
var subnetBits = 8 - networkBits;
var subnetValue = 256 - Math.pow(2, subnetBits);
subnetMask += subnetValue.toString();
networkBits = 0;
} else {
subnetMask += "0";
}
if (i < 3) {
subnetMask += ".";
}
}
return subnetMask;
}
// Fonction de calcul de l'adresse de diffusion
function calculateBroadcastAddress(ipAddress, cidr) {
var n_ipParts = ipAddress.split('.').map(Number);
var n_maskParts = calculateSubnetMask(cidr).split('.').map(Number);
var invertedMaskParts = n_maskParts.map(function (n_maskPart) {
return 255 - n_maskPart;
});
var broadcastParts = n_ipParts.map(function (n_ipPart, i) {
return n_ipPart | invertedMaskParts[i];
});
broadcastAddress = broadcastParts.join('.');
return broadcastAddress;
}
// Fonction de calcul de l'adresse réseau
function calculateNetworkAddress(ipAddress, cidr) {
var n_ipParts = ipAddress.split('.').map(Number);
var n_maskParts = calculateSubnetMask(cidr).split('.').map(Number);
var networkParts = n_ipParts.map(function (n_ipPart, i) {
return n_ipPart & n_maskParts[i];
});
networkAddress = networkParts.join('.');
return networkAddress;
}
// Fonction de calcul du nombre d'hôtes utilisables
function calculateUsableHosts(cidr) {
// Calculate the number of host bits
var hostBits = 32 - parseInt(cidr);
// Calcul du nombre d'hôtes utilisables
usableHosts = Math.pow(2, hostBits) - 2;
return usableHosts;
}
// Mise à jour des résultats
document.getElementById("networkAddress").textContent = "Adresse réseau: " + networkAddress;
document.getElementById("broadcastAddress").textContent = "Adresse de diffusion: " + broadcastAddress;
document.getElementById("subnetMask").textContent = "Masque de sous-réseau: " + subnetMask;
document.getElementById("usableHosts").textContent = "Nombre d'hôtes utilisables: " + usableHosts;
// Afficher les résultats
document.getElementById("networkDetails").style.display = "block";
}
</script>
<!-- End Document
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
</body>
</html>