lanet 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/Gemfile.lock +1 -1
- data/README.md +109 -0
- data/index.html +363 -107
- data/lib/lanet/cli.rb +145 -0
- data/lib/lanet/file_transfer.rb +8 -1
- data/lib/lanet/mesh.rb +493 -0
- data/lib/lanet/traceroute.rb +426 -0
- data/lib/lanet/version.rb +1 -1
- data/lib/lanet.rb +12 -0
- metadata +4 -2
data/index.html
CHANGED
@@ -7,122 +7,155 @@
|
|
7
7
|
<style>
|
8
8
|
body {
|
9
9
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
10
|
-
line-height: 1.
|
11
|
-
color: #
|
12
|
-
max-width:
|
13
|
-
margin:
|
10
|
+
line-height: 1.7; /* Increased line height for better readability */
|
11
|
+
color: #34495e; /* Darker, more professional text color */
|
12
|
+
max-width: 980px; /* Slightly wider max width for content */
|
13
|
+
margin: 20px auto; /* Added top and bottom margin for better spacing */
|
14
14
|
padding: 20px;
|
15
|
-
background-color: #
|
15
|
+
background-color: #f4f6f9; /* Lighter background color */
|
16
16
|
}
|
17
17
|
h1 {
|
18
|
-
color: #
|
19
|
-
border-bottom:
|
20
|
-
padding-bottom:
|
18
|
+
color: #34495e; /* Darker heading color */
|
19
|
+
border-bottom: 3px solid #3498db; /* Thicker border */
|
20
|
+
padding-bottom: 12px; /* Increased padding */
|
21
|
+
letter-spacing: -0.5px; /* Slightly tighter letter spacing for headings */
|
21
22
|
}
|
22
23
|
h2 {
|
23
|
-
color: #
|
24
|
-
margin-top:
|
24
|
+
color: #3498db; /* Primary blue color for subheadings */
|
25
|
+
margin-top: 35px; /* Increased top margin */
|
26
|
+
margin-bottom: 10px; /* Added bottom margin */
|
25
27
|
}
|
26
28
|
h3 {
|
27
|
-
color: #
|
28
|
-
margin-top:
|
29
|
+
color: #2ecc71; /* Vibrant green for section titles */
|
30
|
+
margin-top: 30px;
|
31
|
+
margin-bottom: 8px;
|
29
32
|
}
|
30
33
|
h4 {
|
31
|
-
color: #
|
32
|
-
margin-top:
|
34
|
+
color: #34495e; /* Darker color for sub-subheadings */
|
35
|
+
margin-top: 25px;
|
36
|
+
margin-bottom: 5px;
|
37
|
+
}
|
38
|
+
p {
|
39
|
+
margin-bottom: 15px; /* Increased paragraph spacing */
|
40
|
+
color: #555; /* Slightly softer paragraph text color */
|
41
|
+
}
|
42
|
+
ul, ol {
|
43
|
+
margin-bottom: 15px;
|
44
|
+
color: #555;
|
33
45
|
}
|
34
46
|
pre {
|
35
|
-
background-color: #
|
36
|
-
border: 1px solid #
|
37
|
-
border-left:
|
38
|
-
padding:
|
47
|
+
background-color: #f0f0f0; /* Slightly darker pre background */
|
48
|
+
border: 1px solid #ccc; /* Lighter border */
|
49
|
+
border-left: 5px solid #3498db; /* Thicker, more prominent left border */
|
50
|
+
padding: 16px; /* Increased padding */
|
39
51
|
overflow-x: auto;
|
40
|
-
border-radius:
|
52
|
+
border-radius: 6px; /* More rounded corners */
|
53
|
+
font-size: 0.95em; /* Slightly smaller font size in code blocks */
|
41
54
|
}
|
42
55
|
code {
|
43
56
|
font-family: 'Courier New', Courier, monospace;
|
57
|
+
color: #2c3e50; /* Darker code text color */
|
44
58
|
}
|
45
59
|
.container {
|
46
60
|
background-color: #fff;
|
47
|
-
border-radius:
|
48
|
-
box-shadow: 0
|
49
|
-
padding:
|
61
|
+
border-radius: 10px; /* More rounded container corners */
|
62
|
+
box-shadow: 0 3px 20px rgba(0, 0, 0, 0.08); /* Softer, more subtle shadow */
|
63
|
+
padding: 40px; /* Increased container padding */
|
50
64
|
}
|
51
65
|
.feature {
|
52
|
-
margin:
|
53
|
-
padding-left:
|
54
|
-
border-left:
|
66
|
+
margin: 25px 0; /* Increased feature margin */
|
67
|
+
padding-left: 25px; /* Increased padding */
|
68
|
+
border-left: 5px solid #2ecc71; /* Thicker feature border */
|
55
69
|
}
|
56
70
|
.security-feature {
|
57
71
|
background-color: #e8f4fc;
|
58
|
-
padding:
|
59
|
-
margin:
|
60
|
-
border-radius:
|
72
|
+
padding: 20px; /* Increased padding */
|
73
|
+
margin: 15px 0; /* Increased margin */
|
74
|
+
border-radius: 8px; /* More rounded corners */
|
75
|
+
}
|
76
|
+
.security-feature ul li {
|
77
|
+
margin-bottom: 8px; /* Spacing in security feature lists */
|
61
78
|
}
|
62
79
|
.cli-example {
|
63
80
|
background-color: #2c3e50;
|
64
81
|
color: #ecf0f1;
|
65
|
-
padding:
|
66
|
-
margin:
|
67
|
-
border-radius:
|
82
|
+
padding: 15px 20px; /* Increased padding */
|
83
|
+
margin: 15px 0; /* Increased margin */
|
84
|
+
border-radius: 8px; /* More rounded corners */
|
68
85
|
font-family: 'Courier New', Courier, monospace;
|
69
86
|
position: relative;
|
87
|
+
font-size: 0.95em; /* Slightly smaller font size in CLI examples */
|
70
88
|
}
|
71
89
|
.cli-example::before {
|
72
90
|
content: "$";
|
73
91
|
color: #3498db;
|
74
|
-
margin-right:
|
92
|
+
margin-right: 12px; /* Increased margin */
|
75
93
|
font-weight: bold;
|
94
|
+
display: inline-block; /* Ensure proper spacing */
|
95
|
+
width: 15px; /* Fixed width for the dollar sign to align commands */
|
96
|
+
text-align: right; /* Align dollar sign to the right */
|
76
97
|
}
|
77
98
|
.cli-section {
|
78
|
-
margin-bottom:
|
99
|
+
margin-bottom: 40px; /* Increased bottom margin */
|
79
100
|
background-color: #f8f9fa;
|
80
|
-
padding:
|
81
|
-
border-radius:
|
101
|
+
padding: 25px; /* Increased padding */
|
102
|
+
border-radius: 8px; /* More rounded corners */
|
82
103
|
}
|
83
104
|
.output-example {
|
84
105
|
background-color: #f0f0f0;
|
85
|
-
padding:
|
86
|
-
margin:
|
87
|
-
border-radius:
|
106
|
+
padding: 15px; /* Increased padding */
|
107
|
+
margin: 15px 0; /* Increased margin */
|
108
|
+
border-radius: 8px; /* More rounded corners */
|
88
109
|
font-family: 'Courier New', Courier, monospace;
|
89
110
|
font-size: 0.9em;
|
90
|
-
border-left:
|
111
|
+
border-left: 5px solid #9b59b6; /* Thicker border */
|
91
112
|
}
|
92
113
|
.tab-container {
|
93
114
|
border: 1px solid #ddd;
|
94
|
-
border-radius:
|
115
|
+
border-radius: 8px; /* More rounded corners */
|
95
116
|
overflow: hidden;
|
96
|
-
margin:
|
117
|
+
margin: 25px 0; /* Increased margin */
|
97
118
|
}
|
98
119
|
.tab-buttons {
|
99
120
|
display: flex;
|
100
121
|
background-color: #f5f5f5;
|
122
|
+
border-bottom: 1px solid #ddd; /* Added bottom border to tab buttons container */
|
101
123
|
}
|
102
124
|
.tab-button {
|
103
|
-
padding:
|
125
|
+
padding: 12px 25px; /* Increased padding */
|
104
126
|
background-color: transparent;
|
105
127
|
border: none;
|
106
128
|
cursor: pointer;
|
107
|
-
border-right:
|
129
|
+
border-right: none; /* Removed right border */
|
108
130
|
transition: background-color 0.3s;
|
131
|
+
font-weight: 500; /* Slightly bolder tab button text */
|
132
|
+
color: #777; /* Slightly muted tab button text color */
|
109
133
|
}
|
110
|
-
.tab-button:hover
|
111
|
-
background-color: #
|
134
|
+
.tab-button:hover {
|
135
|
+
background-color: #f0f0f0; /* Lighter hover background */
|
136
|
+
color: #555; /* Darker hover text color */
|
137
|
+
}
|
138
|
+
.tab-button.active {
|
139
|
+
background-color: #fff; /* White background for active tab */
|
140
|
+
border-bottom: 3px solid #3498db; /* Underline for active tab */
|
141
|
+
color: #34495e; /* Darker text for active tab */
|
142
|
+
font-weight: bold; /* Bold text for active tab */
|
112
143
|
}
|
113
144
|
.tab-content {
|
114
145
|
display: none;
|
115
|
-
padding:
|
146
|
+
padding: 20px; /* Increased padding */
|
147
|
+
background-color: #fff; /* White background for tab content */
|
116
148
|
}
|
117
149
|
.tab-content.active {
|
118
150
|
display: block;
|
119
151
|
}
|
120
152
|
.badge {
|
121
153
|
display: inline-block;
|
122
|
-
padding:
|
123
|
-
border-radius:
|
124
|
-
font-size:
|
125
|
-
font-weight:
|
154
|
+
padding: 4px 10px; /* Increased badge padding */
|
155
|
+
border-radius: 6px; /* More rounded corners */
|
156
|
+
font-size: 13px; /* Slightly larger font size */
|
157
|
+
font-weight: 600; /* Bolder badge text */
|
158
|
+
letter-spacing: 0.5px; /* Added letter spacing */
|
126
159
|
}
|
127
160
|
.badge-new {
|
128
161
|
background-color: #2ecc71;
|
@@ -130,10 +163,25 @@
|
|
130
163
|
}
|
131
164
|
.note {
|
132
165
|
background-color: #fff8e1;
|
133
|
-
padding:
|
134
|
-
border-left:
|
135
|
-
margin:
|
136
|
-
border-radius:
|
166
|
+
padding: 15px; /* Increased padding */
|
167
|
+
border-left: 5px solid #ffc107; /* Thicker border */
|
168
|
+
margin: 15px 0; /* Increased margin */
|
169
|
+
border-radius: 6px; /* More rounded corners */
|
170
|
+
}
|
171
|
+
.note strong {
|
172
|
+
font-weight: bold;
|
173
|
+
color: #333; /* Make "Note:" bold and slightly darker */
|
174
|
+
}
|
175
|
+
footer {
|
176
|
+
margin-top: 50px; /* Increased footer margin */
|
177
|
+
text-align: center;
|
178
|
+
color: #7f8c8d;
|
179
|
+
padding-top: 20px;
|
180
|
+
border-top: 1px solid #ddd; /* Added top border to footer */
|
181
|
+
}
|
182
|
+
footer p {
|
183
|
+
color: #95a5a6; /* Softer footer text color */
|
184
|
+
font-size: 0.9em; /* Smaller footer font size */
|
137
185
|
}
|
138
186
|
</style>
|
139
187
|
</head>
|
@@ -141,18 +189,18 @@
|
|
141
189
|
<div class="container">
|
142
190
|
<h1>Lanet</h1>
|
143
191
|
<p>A secure network communication library that enables reliable and protected message exchange between devices on the same network.</p>
|
144
|
-
|
192
|
+
|
145
193
|
<h2>Key Features</h2>
|
146
|
-
|
194
|
+
|
147
195
|
<div class="feature">
|
148
196
|
<h3>Encrypted Communication</h3>
|
149
197
|
<p>Protect your messages with AES-256-CBC encryption to ensure confidentiality during transmission.</p>
|
150
198
|
</div>
|
151
|
-
|
199
|
+
|
152
200
|
<div class="feature">
|
153
201
|
<h3>Digital Signatures <span class="badge badge-new">New in v0.2.1</span></h3>
|
154
202
|
<p>Verify message authenticity and integrity with RSA-based digital signatures.</p>
|
155
|
-
|
203
|
+
|
156
204
|
<div class="security-feature">
|
157
205
|
<h4>Benefits of Digital Signatures:</h4>
|
158
206
|
<ul>
|
@@ -163,12 +211,12 @@
|
|
163
211
|
</ul>
|
164
212
|
</div>
|
165
213
|
</div>
|
166
|
-
|
214
|
+
|
167
215
|
<div class="feature">
|
168
216
|
<h3>Network Discovery</h3>
|
169
217
|
<p>Automatically find active devices on your local network with advanced scanning capabilities.</p>
|
170
218
|
</div>
|
171
|
-
|
219
|
+
|
172
220
|
<div class="feature">
|
173
221
|
<h3>Broadcasting</h3>
|
174
222
|
<p>Send messages to all devices on your network simultaneously.</p>
|
@@ -179,26 +227,58 @@
|
|
179
227
|
<p>Securely transfer files between devices with encryption, digital signatures, and integrity verification.</p>
|
180
228
|
</div>
|
181
229
|
|
230
|
+
<div class="feature">
|
231
|
+
<h3>Mesh Networking <span class="badge badge-new">New in v0.4.0</span></h3>
|
232
|
+
<p>Create resilient, decentralized mesh networks that enable communication between devices even without direct connectivity.</p>
|
233
|
+
|
234
|
+
<div class="security-feature">
|
235
|
+
<h4>Benefits of Mesh Networking:</h4>
|
236
|
+
<ul>
|
237
|
+
<li><strong>Decentralization</strong>: No central server or infrastructure needed</li>
|
238
|
+
<li><strong>Resilience</strong>: Messages can route around failed nodes or connections</li>
|
239
|
+
<li><strong>Extended Range</strong>: Devices can communicate beyond direct connection range</li>
|
240
|
+
<li><strong>Scalability</strong>: Network grows stronger with more participating nodes</li>
|
241
|
+
<li><strong>Self-healing</strong>: Network automatically adapts to changing conditions</li>
|
242
|
+
</ul>
|
243
|
+
</div>
|
244
|
+
</div>
|
245
|
+
|
246
|
+
<div class="feature">
|
247
|
+
<h3>Advanced Traceroute <span class="badge badge-new">New in v0.5.0</span></h3>
|
248
|
+
<p>Analyze network paths with multi-protocol traceroute capabilities to understand connectivity and troubleshoot network issues.</p>
|
249
|
+
|
250
|
+
<div class="security-feature">
|
251
|
+
<h4>Features of Advanced Traceroute:</h4>
|
252
|
+
<ul>
|
253
|
+
<li><strong>Multi-protocol support</strong>: Use ICMP, UDP, or TCP protocols for different network environments</li>
|
254
|
+
<li><strong>Load balancing detection</strong>: Identify multi-path routing and load balancers in the network</li>
|
255
|
+
<li><strong>Response time analysis</strong>: Measure latency at each hop in the network path</li>
|
256
|
+
<li><strong>Customizable parameters</strong>: Adjust max hops, timeouts, and query count for different scenarios</li>
|
257
|
+
<li><strong>Hostname resolution</strong>: Automatically resolve IP addresses to hostnames for easier identification</li>
|
258
|
+
</ul>
|
259
|
+
</div>
|
260
|
+
</div>
|
261
|
+
|
182
262
|
<h2>Command Line Interface</h2>
|
183
263
|
|
184
264
|
<div class="note">
|
185
265
|
<strong>Note:</strong> All Lanet commands have detailed help available. Try <code>lanet [command] --help</code> for more options.
|
186
266
|
</div>
|
187
|
-
|
267
|
+
|
188
268
|
<div class="cli-section">
|
189
269
|
<h3>Digital Signature Commands <span class="badge badge-new">New in v0.2.1</span></h3>
|
190
|
-
|
270
|
+
|
191
271
|
<h4>Generate a Key Pair</h4>
|
192
272
|
<p>Create RSA keys for signing and verifying messages:</p>
|
193
273
|
<div class="cli-example">
|
194
274
|
lanet keygen
|
195
275
|
</div>
|
196
|
-
|
276
|
+
|
197
277
|
<p>Generate keys with custom options:</p>
|
198
278
|
<div class="cli-example">
|
199
279
|
lanet keygen --bits 4096 --output ~/.lanet_keys
|
200
280
|
</div>
|
201
|
-
|
281
|
+
|
202
282
|
<div class="output-example">
|
203
283
|
Key pair generated!
|
204
284
|
Private key saved to: /home/user/.lanet_keys/lanet_private.key
|
@@ -207,32 +287,32 @@ Public key saved to: /home/user/.lanet_keys/lanet_public.key
|
|
207
287
|
IMPORTANT: Keep your private key secure and never share it.
|
208
288
|
Share your public key with others who need to verify your messages.
|
209
289
|
</div>
|
210
|
-
|
290
|
+
|
211
291
|
<h4>Send a Signed Message</h4>
|
212
292
|
<div class="cli-example">
|
213
293
|
lanet send --target 192.168.1.5 --message "Signed message" --private-key-file lanet_private.key
|
214
294
|
</div>
|
215
|
-
|
295
|
+
|
216
296
|
<h4>Send a Signed & Encrypted Message</h4>
|
217
297
|
<div class="cli-example">
|
218
298
|
lanet send --target 192.168.1.5 --message "Secure signed message" --key "my_secret_key" --private-key-file lanet_private.key
|
219
299
|
</div>
|
220
|
-
|
300
|
+
|
221
301
|
<h4>Broadcast a Signed Message</h4>
|
222
302
|
<div class="cli-example">
|
223
303
|
lanet broadcast --message "Important announcement" --private-key-file lanet_private.key
|
224
304
|
</div>
|
225
|
-
|
305
|
+
|
226
306
|
<h4>Listen for and Verify Signed Messages</h4>
|
227
307
|
<div class="cli-example">
|
228
308
|
lanet listen --public-key-file lanet_public.key
|
229
309
|
</div>
|
230
|
-
|
310
|
+
|
231
311
|
<h4>Listen for Encrypted & Signed Messages</h4>
|
232
312
|
<div class="cli-example">
|
233
313
|
lanet listen --encryption-key "my_secret_key" --public-key-file lanet_public.key
|
234
314
|
</div>
|
235
|
-
|
315
|
+
|
236
316
|
<p>Example output when receiving a signed message:</p>
|
237
317
|
<div class="output-example">
|
238
318
|
Message from 192.168.1.5:
|
@@ -244,27 +324,27 @@ Signature: ✓ VERIFIED
|
|
244
324
|
|
245
325
|
<div class="cli-section">
|
246
326
|
<h3>Basic Message Commands</h3>
|
247
|
-
|
327
|
+
|
248
328
|
<h4>Send a Message</h4>
|
249
329
|
<div class="cli-example">
|
250
330
|
lanet send --target 192.168.1.5 --message "Hello there!"
|
251
331
|
</div>
|
252
|
-
|
332
|
+
|
253
333
|
<h4>Send an Encrypted Message</h4>
|
254
334
|
<div class="cli-example">
|
255
335
|
lanet send --target 192.168.1.5 --message "Secret message" --key "my_secret_key"
|
256
336
|
</div>
|
257
|
-
|
337
|
+
|
258
338
|
<h4>Broadcast a Message</h4>
|
259
339
|
<div class="cli-example">
|
260
340
|
lanet broadcast --message "Announcement for everyone!"
|
261
341
|
</div>
|
262
|
-
|
342
|
+
|
263
343
|
<h4>Listen for Messages</h4>
|
264
344
|
<div class="cli-example">
|
265
345
|
lanet listen
|
266
346
|
</div>
|
267
|
-
|
347
|
+
|
268
348
|
<h4>Listen for Encrypted Messages</h4>
|
269
349
|
<div class="cli-example">
|
270
350
|
lanet listen --encryption-key "my_secret_key"
|
@@ -273,27 +353,27 @@ Signature: ✓ VERIFIED
|
|
273
353
|
|
274
354
|
<div class="cli-section">
|
275
355
|
<h3>Network Discovery Commands</h3>
|
276
|
-
|
356
|
+
|
277
357
|
<h4>Scan Network</h4>
|
278
358
|
<div class="cli-example">
|
279
359
|
lanet scan --range 192.168.1.0/24
|
280
360
|
</div>
|
281
|
-
|
361
|
+
|
282
362
|
<h4>Detailed Network Scan</h4>
|
283
363
|
<div class="cli-example">
|
284
364
|
lanet scan --range 192.168.1.0/24 --verbose --threads 16 --timeout 2
|
285
365
|
</div>
|
286
|
-
|
366
|
+
|
287
367
|
<h4>Ping a Host</h4>
|
288
368
|
<div class="cli-example">
|
289
369
|
lanet ping 192.168.1.5
|
290
370
|
</div>
|
291
|
-
|
371
|
+
|
292
372
|
<h4>Continuous Ping</h4>
|
293
373
|
<div class="cli-example">
|
294
374
|
lanet ping 192.168.1.5 --continuous
|
295
375
|
</div>
|
296
|
-
|
376
|
+
|
297
377
|
<h4>Ping Multiple Hosts</h4>
|
298
378
|
<div class="cli-example">
|
299
379
|
lanet ping --hosts 192.168.1.5,192.168.1.6,192.168.1.7 --count 5
|
@@ -302,28 +382,28 @@ Signature: ✓ VERIFIED
|
|
302
382
|
|
303
383
|
<div class="cli-section">
|
304
384
|
<h3>File Transfer Commands <span class="badge badge-new">New in v0.3.0</span></h3>
|
305
|
-
|
385
|
+
|
306
386
|
<h4>Send a File</h4>
|
307
387
|
<p>Send a file with encryption:</p>
|
308
388
|
<div class="cli-example">
|
309
389
|
lanet send-file --target 192.168.1.5 --file document.pdf --key "my_secret_key"
|
310
390
|
</div>
|
311
|
-
|
391
|
+
|
312
392
|
<p>Send a file with encryption and digital signature:</p>
|
313
393
|
<div class="cli-example">
|
314
394
|
lanet send-file --target 192.168.1.5 --file document.pdf --key "my_secret_key" --private-key-file lanet_private.key
|
315
395
|
</div>
|
316
|
-
|
396
|
+
|
317
397
|
<h4>Receive Files</h4>
|
318
398
|
<div class="cli-example">
|
319
399
|
lanet receive-file --output ./downloads --encryption-key "my_secret_key"
|
320
400
|
</div>
|
321
|
-
|
401
|
+
|
322
402
|
<p>With signature verification:</p>
|
323
403
|
<div class="cli-example">
|
324
404
|
lanet receive-file --output ./downloads --encryption-key "my_secret_key" --public-key-file lanet_public.key
|
325
405
|
</div>
|
326
|
-
|
406
|
+
|
327
407
|
<p>Example output during file transfer:</p>
|
328
408
|
<div class="output-example">
|
329
409
|
Receiving file: document.pdf from 192.168.1.5
|
@@ -332,7 +412,89 @@ Transfer ID: 8a7b6c5d-4e3f-2g1h-0i9j-8k7l6m5n4o3p
|
|
332
412
|
Progress: 75% (786432/1048576 bytes)
|
333
413
|
</div>
|
334
414
|
</div>
|
335
|
-
|
415
|
+
|
416
|
+
<div class="cli-section">
|
417
|
+
<h3>Mesh Network Commands <span class="badge badge-new">New in v0.4.0</span></h3>
|
418
|
+
|
419
|
+
<h4>Start a Mesh Network Node</h4>
|
420
|
+
<div class="cli-example">
|
421
|
+
lanet mesh start
|
422
|
+
</div>
|
423
|
+
|
424
|
+
<h4>Start with Custom Settings</h4>
|
425
|
+
<div class="cli-example">
|
426
|
+
lanet mesh start --port 5050 --max-hops 15
|
427
|
+
</div>
|
428
|
+
|
429
|
+
<h4>Send a Message Through the Mesh</h4>
|
430
|
+
<div class="cli-example">
|
431
|
+
lanet mesh send --target a1b2c3d4-5678-90ef-ghij --message "Hello Mesh"
|
432
|
+
</div>
|
433
|
+
|
434
|
+
<h4>Send an Encrypted Mesh Message</h4>
|
435
|
+
<div class="cli-example">
|
436
|
+
lanet mesh send --target a1b2c3d4-5678-90ef-ghij --message "Secret mesh message" --key "secret-key"
|
437
|
+
</div>
|
438
|
+
|
439
|
+
<h4>View Mesh Network Information</h4>
|
440
|
+
<div class="cli-example">
|
441
|
+
lanet mesh info
|
442
|
+
</div>
|
443
|
+
|
444
|
+
<p>Example output when viewing mesh info:</p>
|
445
|
+
<div class="output-example">
|
446
|
+
Mesh Node ID: 4f9a8b7c-6d5e-4f3e-2d1c-0b9a8b7c6d5e
|
447
|
+
|
448
|
+
Connected nodes:
|
449
|
+
b1c2d3e4-f5g6-7h8i-9j0k-l1m2n3o4p5q6 (192.168.1.5, last seen 12s ago)
|
450
|
+
c5d4e3f2-g1h0-i9j8-k7l6-m5n4o3p2q1r0 (192.168.1.10, last seen 5s ago)
|
451
|
+
|
452
|
+
Message cache: 24 messages
|
453
|
+
</div>
|
454
|
+
</div>
|
455
|
+
|
456
|
+
<div class="cli-section">
|
457
|
+
<h3>Traceroute Commands <span class="badge badge-new">New in v0.5.0</span></h3>
|
458
|
+
|
459
|
+
<h4>Basic Traceroute (UDP protocol)</h4>
|
460
|
+
<div class="cli-example">
|
461
|
+
lanet traceroute --host google.com
|
462
|
+
</div>
|
463
|
+
|
464
|
+
<h4>Traceroute with ICMP Protocol</h4>
|
465
|
+
<div class="cli-example">
|
466
|
+
lanet traceroute --host google.com --protocol icmp
|
467
|
+
</div>
|
468
|
+
|
469
|
+
<h4>Traceroute with TCP Protocol</h4>
|
470
|
+
<div class="cli-example">
|
471
|
+
lanet traceroute --host github.com --protocol tcp
|
472
|
+
</div>
|
473
|
+
|
474
|
+
<h4>Customize Traceroute Parameters</h4>
|
475
|
+
<div class="cli-example">
|
476
|
+
lanet traceroute --host cloudflare.com --protocol tcp --max-hops 20 --timeout 2 --queries 4
|
477
|
+
</div>
|
478
|
+
|
479
|
+
<p>Example output of a traceroute:</p>
|
480
|
+
<div class="output-example">
|
481
|
+
Tracing route to github.com using UDP protocol
|
482
|
+
Maximum hops: 30, Timeout: 1s, Queries: 3
|
483
|
+
======================================================================
|
484
|
+
TTL IP Address Hostname Response Time
|
485
|
+
----------------------------------------------------------------------
|
486
|
+
1 192.168.1.1 router.home 2.34ms
|
487
|
+
2 172.16.42.1 isp-gateway.net 8.72ms
|
488
|
+
3 216.58.223.14 15.35ms
|
489
|
+
4 172.217.170.78 edge-router.google.com 22.89ms
|
490
|
+
5 * * Request timed out
|
491
|
+
6 140.82.121.4 github.com 45.23ms
|
492
|
+
Destination unreachable
|
493
|
+
======================================================================
|
494
|
+
Trace complete.
|
495
|
+
</div>
|
496
|
+
</div>
|
497
|
+
|
336
498
|
<h2>Ruby Code Examples</h2>
|
337
499
|
|
338
500
|
<div class="tab-container">
|
@@ -341,8 +503,10 @@ Progress: 75% (786432/1048576 bytes)
|
|
341
503
|
<button class="tab-button" onclick="openTab(event, 'tab-signatures')">Digital Signatures</button>
|
342
504
|
<button class="tab-button" onclick="openTab(event, 'tab-advanced')">Advanced Usage</button>
|
343
505
|
<button class="tab-button" onclick="openTab(event, 'tab-filetransfer')">File Transfer</button>
|
506
|
+
<button class="tab-button" onclick="openTab(event, 'tab-mesh')">Mesh Network</button>
|
507
|
+
<button class="tab-button" onclick="openTab(event, 'tab-traceroute')">Traceroute</button>
|
344
508
|
</div>
|
345
|
-
|
509
|
+
|
346
510
|
<div id="tab-basic" class="tab-content active">
|
347
511
|
<pre><code>require 'lanet'
|
348
512
|
|
@@ -361,7 +525,7 @@ encrypted = Lanet::Encryptor.prepare_message('Secret message', 'my_encryption_ke
|
|
361
525
|
# Send the encrypted message
|
362
526
|
sender.send_to('192.168.1.5', encrypted)</code></pre>
|
363
527
|
</div>
|
364
|
-
|
528
|
+
|
365
529
|
<div id="tab-signatures" class="tab-content">
|
366
530
|
<pre><code>require 'lanet'
|
367
531
|
|
@@ -377,8 +541,8 @@ encryption_key = "secret-key-123"
|
|
377
541
|
# Send a signed and encrypted message
|
378
542
|
message = "Hello, secure world!"
|
379
543
|
prepared_message = Lanet::Encryptor.prepare_message(
|
380
|
-
message,
|
381
|
-
encryption_key,
|
544
|
+
message,
|
545
|
+
encryption_key,
|
382
546
|
private_key
|
383
547
|
)
|
384
548
|
sender.send_to("192.168.1.5", prepared_message)
|
@@ -387,17 +551,17 @@ sender.send_to("192.168.1.5", prepared_message)
|
|
387
551
|
receiver = Lanet::Receiver.new(9000)
|
388
552
|
receiver.listen do |data, sender_ip|
|
389
553
|
result = Lanet::Encryptor.process_message(
|
390
|
-
data,
|
391
|
-
encryption_key,
|
554
|
+
data,
|
555
|
+
encryption_key,
|
392
556
|
public_key
|
393
557
|
)
|
394
|
-
|
558
|
+
|
395
559
|
puts "Message: #{result[:content]}"
|
396
560
|
puts "Verified: #{result[:verified]}"
|
397
561
|
puts "Verification status: #{result[:verification_status]}"
|
398
562
|
end</code></pre>
|
399
563
|
</div>
|
400
|
-
|
564
|
+
|
401
565
|
<div id="tab-advanced" class="tab-content">
|
402
566
|
<pre><code>require 'lanet'
|
403
567
|
|
@@ -408,7 +572,7 @@ active_hosts = scanner.scan('192.168.1.0/24', 1, 32, true)
|
|
408
572
|
active_hosts.each do |host|
|
409
573
|
puts "Host: #{host[:ip]}, Hostname: #{host[:hostname]}"
|
410
574
|
puts "Response time: #{host[:response_time]}ms"
|
411
|
-
|
575
|
+
|
412
576
|
if host[:ports]
|
413
577
|
puts "Open ports:"
|
414
578
|
host[:ports].each do |port, service|
|
@@ -427,8 +591,8 @@ puts "Response time: #{result[:response_time]}ms"
|
|
427
591
|
encryption_key = "network-shared-key"
|
428
592
|
message = "Important system notification"
|
429
593
|
signed_message = Lanet::Encryptor.prepare_message(
|
430
|
-
message,
|
431
|
-
encryption_key,
|
594
|
+
message,
|
595
|
+
encryption_key,
|
432
596
|
private_key
|
433
597
|
)
|
434
598
|
sender.broadcast(signed_message)</code></pre>
|
@@ -472,43 +636,135 @@ file_transfer.receive_file('./downloads', 'encryption_key') do |event, data|
|
|
472
636
|
when :error
|
473
637
|
puts "Error: #{data[:error]}"
|
474
638
|
end
|
639
|
+
end</code></pre>
|
640
|
+
</div>
|
641
|
+
|
642
|
+
<div id="tab-mesh" class="tab-content">
|
643
|
+
<pre><code>require 'lanet'
|
644
|
+
|
645
|
+
# Create and start a mesh network node
|
646
|
+
mesh = Lanet.mesh_network
|
647
|
+
mesh.start
|
648
|
+
|
649
|
+
puts "Mesh node started with ID: #{mesh.node_id}"
|
650
|
+
|
651
|
+
# Send a plain message through the mesh
|
652
|
+
begin
|
653
|
+
message_id = mesh.send_message(
|
654
|
+
"target-node-id-here",
|
655
|
+
"Hello through the mesh network!"
|
656
|
+
)
|
657
|
+
puts "Message sent with ID: #{message_id}"
|
658
|
+
rescue Lanet::Mesh::Error => e
|
659
|
+
puts "Message sending failed: #{e.message}"
|
660
|
+
end
|
661
|
+
|
662
|
+
# Send an encrypted and signed message
|
663
|
+
encryption_key = "mesh-encryption-key"
|
664
|
+
key_pair = Lanet::Signer.generate_key_pair
|
665
|
+
private_key = key_pair[:private_key]
|
666
|
+
|
667
|
+
begin
|
668
|
+
message_id = mesh.send_message(
|
669
|
+
"target-node-id-here",
|
670
|
+
"Secure mesh message",
|
671
|
+
encryption_key,
|
672
|
+
private_key
|
673
|
+
)
|
674
|
+
puts "Secure message sent with ID: #{message_id}"
|
675
|
+
rescue Lanet::Mesh::Error => e
|
676
|
+
puts "Secure message sending failed: #{e.message}"
|
677
|
+
end
|
678
|
+
|
679
|
+
# Examine mesh connections
|
680
|
+
puts "Connected to #{mesh.connections.size} nodes:"
|
681
|
+
mesh.connections.each do |node_id, info|
|
682
|
+
puts " • #{node_id} (#{info[:ip]}, last seen #{Time.now.to_i - info[:last_seen]}s ago)"
|
683
|
+
end
|
684
|
+
|
685
|
+
# Always stop the mesh node when done
|
686
|
+
mesh.stop</code></pre>
|
687
|
+
</div>
|
688
|
+
|
689
|
+
<div id="tab-traceroute" class="tab-content">
|
690
|
+
<pre><code>require 'lanet'
|
691
|
+
|
692
|
+
# Create a traceroute instance with UDP protocol (default)
|
693
|
+
tracer = Lanet.traceroute
|
694
|
+
results = tracer.trace('github.com')
|
695
|
+
|
696
|
+
# Display the results
|
697
|
+
puts "Path to github.com:"
|
698
|
+
results.each do |hop|
|
699
|
+
if hop[:ip].nil?
|
700
|
+
puts "Hop #{hop[:ttl]}: * * * Request timed out"
|
701
|
+
else
|
702
|
+
hostname = hop[:hostname] ? hop[:hostname] : ""
|
703
|
+
time = hop[:avg_time] ? "#{hop[:avg_time]}ms" : "*"
|
704
|
+
puts "Hop #{hop[:ttl]}: #{hop[:ip]} (#{hostname}) #{time}"
|
705
|
+
|
706
|
+
# Check for load balancing (multiple IPs at the same hop)
|
707
|
+
if hop[:all_ips] && hop[:all_ips].size > 1
|
708
|
+
puts " Multiple IPs detected (load balancing):"
|
709
|
+
hop[:all_ips].each { |ip| puts " - #{ip}" }
|
710
|
+
end
|
711
|
+
end
|
712
|
+
end
|
713
|
+
|
714
|
+
# Use ICMP protocol (may require root/admin privileges)
|
715
|
+
begin
|
716
|
+
icmp_tracer = Lanet.traceroute(protocol: :icmp, max_hops: 10)
|
717
|
+
icmp_tracer.trace('google.com')
|
718
|
+
rescue StandardError => e
|
719
|
+
puts "Error with ICMP traceroute: #{e.message}"
|
720
|
+
end
|
721
|
+
|
722
|
+
# Use TCP protocol with custom parameters
|
723
|
+
tcp_tracer = Lanet.traceroute(protocol: :tcp, max_hops: 15,
|
724
|
+
timeout: 2, queries: 4)
|
725
|
+
tcp_results = tcp_tracer.trace('cloudflare.com')
|
726
|
+
|
727
|
+
# Analyze a specific hop
|
728
|
+
interesting_hop = tcp_results[5] # Sixth hop
|
729
|
+
if interesting_hop && interesting_hop[:unreachable]
|
730
|
+
puts "Destination unreachable at hop #{interesting_hop[:ttl]}"
|
475
731
|
end</code></pre>
|
476
732
|
</div>
|
477
733
|
</div>
|
478
|
-
|
734
|
+
|
479
735
|
<h2>Installation</h2>
|
480
|
-
|
736
|
+
|
481
737
|
<p>Add this to your Gemfile:</p>
|
482
738
|
<pre><code>gem 'lanet'</code></pre>
|
483
|
-
|
739
|
+
|
484
740
|
<p>Or install directly:</p>
|
485
741
|
<pre><code>gem install lanet</code></pre>
|
486
|
-
|
742
|
+
|
487
743
|
<h2>Documentation</h2>
|
488
744
|
<p>For complete documentation, please visit the <a href="https://github.com/davidesantangelo/lanet">GitHub repository</a>.</p>
|
489
|
-
|
745
|
+
|
490
746
|
<footer style="margin-top: 40px; text-align: center; color: #7f8c8d;">
|
491
|
-
<p>Lanet v0.
|
747
|
+
<p>Lanet v0.5.0 - Secure Network Communications Library</p>
|
492
748
|
</footer>
|
493
749
|
</div>
|
494
750
|
|
495
751
|
<script>
|
496
752
|
function openTab(evt, tabName) {
|
497
753
|
var i, tabContent, tabButtons;
|
498
|
-
|
754
|
+
|
499
755
|
tabContent = document.getElementsByClassName("tab-content");
|
500
756
|
for (i = 0; i < tabContent.length; i++) {
|
501
757
|
tabContent[i].className = tabContent[i].className.replace(" active", "");
|
502
758
|
}
|
503
|
-
|
759
|
+
|
504
760
|
tabButtons = document.getElementsByClassName("tab-button");
|
505
761
|
for (i = 0; i < tabButtons.length; i++) {
|
506
762
|
tabButtons[i].className = tabButtons[i].className.replace(" active", "");
|
507
763
|
}
|
508
|
-
|
764
|
+
|
509
765
|
document.getElementById(tabName).className += " active";
|
510
766
|
evt.currentTarget.className += " active";
|
511
767
|
}
|
512
768
|
</script>
|
513
769
|
</body>
|
514
|
-
</html>
|
770
|
+
</html>
|