Rev 4781 | Rev 4845 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3545 | hidnplayr | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
4740 | hidnplayr | 3 | ;; Copyright (C) KolibriOS team 2010-2014. All rights reserved. ;; |
3545 | hidnplayr | 4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
||
6 | ;; netstat.asm - Network Status Tool for KolibriOS ;; |
||
7 | ;; ;; |
||
8 | ;; Written by hidnplayr@kolibrios.org ;; |
||
9 | ;; ;; |
||
10 | ;; GNU GENERAL PUBLIC LICENSE ;; |
||
11 | ;; Version 2, June 1991 ;; |
||
12 | ;; ;; |
||
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
14 | |||
15 | format binary as "" |
||
16 | |||
4798 | hidnplayr | 17 | BOX_WIDTH = 390 |
18 | BOX_HEIGHT = 185 |
||
19 | |||
3545 | hidnplayr | 20 | use32 |
21 | |||
22 | org 0x0 |
||
23 | |||
3601 | hidnplayr | 24 | db 'MENUET01' ; 8 byte id |
25 | dd 0x01 ; header version |
||
26 | dd START ; start of code |
||
27 | dd I_END ; size of image |
||
28 | dd (I_END+0x1000) ; memory for app |
||
29 | dd (I_END+0x1000) ; esp |
||
4781 | hidnplayr | 30 | dd 0, 0 ; I_Param, I_Path |
3545 | hidnplayr | 31 | |
3618 | hidnplayr | 32 | include '../../macros.inc' |
33 | include '../../network.inc' |
||
3545 | hidnplayr | 34 | |
35 | START: |
||
4742 | hidnplayr | 36 | mcall 40, EVM_REDRAW + EVM_BUTTON + EVM_STACK2 + EVM_KEY |
3545 | hidnplayr | 37 | |
4736 | leency | 38 | window_redraw: |
4781 | hidnplayr | 39 | ; Notify kernel of start of window draw |
3545 | hidnplayr | 40 | mcall 12, 1 |
41 | |||
4781 | hidnplayr | 42 | ; Draw the window |
43 | mcall 0, 100 shl 16 + 600, 100 shl 16 + 240, 0x34E1E1E1, , name |
||
44 | |||
45 | ; Define the buttons (for tabs) |
||
46 | mov ebx, 5 shl 16 + 54 |
||
47 | mov ecx, 4 shl 16 + 21 |
||
48 | mov edx, 0x60000000 + 101 |
||
49 | .buttonloop: |
||
50 | mcall 8 |
||
51 | add ebx, 60 shl 16 |
||
52 | inc edx |
||
53 | cmp dl, 106 |
||
54 | jle .buttonloop |
||
55 | |||
56 | ; draw sides and upper lines of the tab buttons |
||
57 | mov eax, 13 |
||
58 | mov ebx, 5 shl 16 + 1 |
||
59 | mov ecx, 4 shl 16 + 21 |
||
60 | mov edx, 0x00777777 |
||
61 | .loop: |
||
62 | mcall |
||
63 | mov bx, 54 |
||
64 | mov cx, 1 |
||
65 | mcall |
||
66 | mov bx, 1 |
||
67 | mov cx, 21 |
||
68 | add ebx, 54 shl 16 |
||
69 | mcall |
||
70 | add ebx, 6 shl 16 |
||
71 | cmp ebx, 360 shl 16 |
||
72 | jb .loop |
||
73 | |||
74 | ; Draw sides and bottom lines of the rectangle |
||
4798 | hidnplayr | 75 | mcall , 0 shl 16 + 1, 25 shl 16 + BOX_HEIGHT;, 0x00777777 |
76 | mcall , (0+BOX_WIDTH) shl 16 +1, 25 shl 16 + (BOX_HEIGHT+1) |
||
77 | mcall , 0 shl 16 + BOX_WIDTH, (25+BOX_HEIGHT) shl 16 + 1 |
||
4781 | hidnplayr | 78 | |
4736 | leency | 79 | redraw: |
4781 | hidnplayr | 80 | |
81 | ; Draw interface buttons (on the right hand side) |
||
3545 | hidnplayr | 82 | call draw_interfaces |
83 | |||
4781 | hidnplayr | 84 | ; Draw upper line of rectangle |
4798 | hidnplayr | 85 | mcall 13, 0 shl 16 + BOX_WIDTH, 25 shl 16 + 1, 0x00777777 |
4781 | hidnplayr | 86 | |
87 | ; Fill rectangle |
||
4798 | hidnplayr | 88 | mcall 13, 1 shl 16 + BOX_WIDTH-1, 26 shl 16 + BOX_HEIGHT-1, 0x00F3F3F3 |
4781 | hidnplayr | 89 | |
90 | ; Fill tab buttons |
||
91 | mov eax, 13 |
||
92 | mov ebx, 6 shl 16 + 53 |
||
93 | mov si, 101 |
||
94 | .buttonloop: |
||
95 | mov ecx, 6 shl 16 + 19 |
||
96 | mov edx, 0x00BBBBBB |
||
97 | cmp si, [mode] |
||
98 | jne @f |
||
99 | mov edx, 0x00F3F3F3 ; Activated button has other colors |
||
100 | inc ecx |
||
101 | @@: |
||
102 | mcall |
||
103 | mov edx, 0x00E1E1E1 |
||
104 | cmp si, [mode] |
||
105 | jne @f |
||
106 | mov edx, 0x00FFFFFF ; Activated button has other colors |
||
107 | @@: |
||
108 | mov ecx, 5 shl 16 + 1 |
||
109 | mcall |
||
110 | add ebx, 60 shl 16 |
||
111 | inc si |
||
112 | cmp si, 106 |
||
113 | jle .buttonloop |
||
114 | ; Print button names on top of the buttons |
||
115 | mcall 4, 9 shl 16 + 12, 0x80000000, modes |
||
116 | |||
117 | ; Get information about the selected device |
||
3601 | hidnplayr | 118 | xor ebx, ebx |
119 | mov bh, [device] |
||
120 | mcall 74 |
||
121 | mov [device_type], eax |
||
122 | |||
3545 | hidnplayr | 123 | cmp [mode], 101 |
124 | jne .no_eth |
||
125 | |||
3601 | hidnplayr | 126 | mcall 4, 8 shl 16 + 35, 0x80000000, str_packets_tx |
3545 | hidnplayr | 127 | add ebx, 18 |
128 | mov edx, str_packets_rx |
||
129 | mcall |
||
130 | add ebx, 18 |
||
131 | mov edx, str_bytes_tx |
||
132 | mcall |
||
133 | add ebx, 18 |
||
134 | mov edx, str_bytes_rx |
||
135 | mcall |
||
136 | add ebx, 18 |
||
3601 | hidnplayr | 137 | mov edx, str_link |
3545 | hidnplayr | 138 | mcall |
3601 | hidnplayr | 139 | |
140 | cmp [device_type], 1 |
||
141 | jne end_of_draw |
||
142 | |||
3545 | hidnplayr | 143 | add ebx, 18 |
3601 | hidnplayr | 144 | mov edx, str_MAC |
3545 | hidnplayr | 145 | mcall |
146 | |||
3601 | hidnplayr | 147 | mov ebx, API_ETH |
3545 | hidnplayr | 148 | mov bh, [device] |
149 | mcall 76 |
||
150 | push eax |
||
151 | push bx |
||
152 | |||
4740 | hidnplayr | 153 | mov edx, 134 shl 16 + 35 + 5*18 |
3545 | hidnplayr | 154 | call draw_mac |
155 | jmp end_of_draw |
||
156 | |||
157 | .no_eth: |
||
158 | |||
159 | cmp [mode], 102 |
||
160 | jne .no_ip |
||
161 | |||
3601 | hidnplayr | 162 | mcall 4, 8 shl 16 + 35, 0x80000000, str_packets_tx |
3545 | hidnplayr | 163 | add ebx, 18 |
164 | mov edx, str_packets_rx |
||
165 | mcall |
||
166 | add ebx, 18 |
||
167 | mov edx, str_ip |
||
168 | mcall |
||
169 | add ebx, 18 |
||
170 | mov edx, str_dns |
||
171 | mcall |
||
172 | add ebx, 18 |
||
173 | mov edx, str_subnet |
||
174 | mcall |
||
175 | add ebx, 18 |
||
176 | mov edx, str_gateway |
||
177 | mcall |
||
178 | |||
179 | |||
180 | mov ebx, API_IPv4 + 8 |
||
181 | mov bh, [device] |
||
182 | mcall 76 |
||
183 | push eax |
||
184 | |||
185 | dec bl |
||
186 | dec bl |
||
187 | mcall 76 |
||
188 | push eax |
||
189 | |||
190 | dec bl |
||
191 | dec bl |
||
192 | mcall 76 |
||
193 | push eax |
||
194 | |||
195 | dec bl |
||
196 | dec bl |
||
197 | mcall 76 |
||
198 | push eax |
||
199 | |||
4740 | hidnplayr | 200 | mov edx, 134 shl 16 + 35 + 2*18 |
3545 | hidnplayr | 201 | call draw_ip |
202 | |||
203 | add edx, 18 |
||
204 | call draw_ip |
||
205 | |||
206 | add edx, 18 |
||
207 | call draw_ip |
||
208 | |||
209 | add edx, 18 |
||
210 | call draw_ip |
||
211 | |||
212 | jmp end_of_draw |
||
213 | |||
214 | .no_ip: |
||
215 | |||
216 | cmp [mode], 103 |
||
217 | jne .no_arp |
||
218 | |||
3601 | hidnplayr | 219 | mcall 4, 8 shl 16 + 35, 0x80000000, str_packets_tx |
3545 | hidnplayr | 220 | add ebx, 18 |
221 | mov edx, str_packets_rx |
||
222 | mcall |
||
223 | add ebx, 18 |
||
224 | mov edx, str_arp |
||
225 | mcall |
||
226 | add ebx, 18 |
||
227 | mov edx, str_conflicts |
||
228 | mcall |
||
229 | |||
3601 | hidnplayr | 230 | mcall 4, 8 shl 16 + 130, 0x80000000, str_ARP_legend |
231 | |||
3545 | hidnplayr | 232 | jmp end_of_draw |
233 | |||
234 | .no_arp: |
||
235 | |||
3601 | hidnplayr | 236 | mcall 4, 8 shl 16 + 35, 0x80000000, str_packets_tx |
3545 | hidnplayr | 237 | |
238 | add ebx, 18 |
||
239 | mov edx, str_packets_rx |
||
240 | mcall |
||
241 | |||
242 | cmp [mode], 106 |
||
243 | jne end_of_draw |
||
244 | |||
245 | add ebx, 18 |
||
246 | mov edx, str_missed |
||
247 | mcall |
||
248 | |||
249 | add ebx, 18 |
||
250 | mov edx, str_dumped |
||
251 | mcall |
||
252 | |||
4742 | hidnplayr | 253 | end_of_draw: |
3545 | hidnplayr | 254 | |
4742 | hidnplayr | 255 | mcall 12, 2 |
3545 | hidnplayr | 256 | |
257 | draw_stats: |
||
258 | |||
259 | cmp [mode], 101 |
||
260 | jne not_101 |
||
261 | |||
262 | mov ebx, API_ETH |
||
263 | mov bh, [device] |
||
3601 | hidnplayr | 264 | mov bl, 6 |
3545 | hidnplayr | 265 | @@: |
266 | push ebx |
||
3601 | hidnplayr | 267 | mcall 74 |
3545 | hidnplayr | 268 | pop ebx |
269 | push eax |
||
270 | inc bl |
||
3601 | hidnplayr | 271 | cmp bl, 10 |
3545 | hidnplayr | 272 | jbe @r |
273 | |||
274 | mov ebx, 0x000a0000 |
||
275 | pop ecx |
||
4740 | hidnplayr | 276 | mov edx, 134 shl 16 + 35 + 4*18 |
3545 | hidnplayr | 277 | mov esi, 0x40000000 |
4736 | leency | 278 | mov edi, 0x00F3F3F3 |
3545 | hidnplayr | 279 | mcall 47 |
280 | |||
3601 | hidnplayr | 281 | sub edx, 18 |
3545 | hidnplayr | 282 | pop ecx |
283 | mcall |
||
284 | |||
285 | sub edx, 18 |
||
286 | pop ecx |
||
287 | mcall |
||
288 | |||
289 | sub edx, 18 |
||
290 | pop ecx |
||
291 | mcall |
||
292 | |||
293 | sub edx, 18 |
||
294 | pop ecx |
||
295 | mcall |
||
296 | |||
297 | jmp mainloop |
||
298 | |||
299 | |||
300 | not_101: |
||
301 | |||
302 | cmp [mode], 102 |
||
303 | jne not_102 |
||
304 | |||
305 | mov ebx, API_IPv4 |
||
306 | mov bh, [device] |
||
307 | push ebx |
||
308 | mcall 76 |
||
309 | pop ebx |
||
310 | push eax |
||
311 | |||
312 | inc bl |
||
313 | push ebx |
||
314 | mcall 76 |
||
315 | pop ebx |
||
316 | push eax |
||
317 | |||
318 | |||
319 | mov ebx, 0x000a0000 |
||
320 | pop ecx |
||
4740 | hidnplayr | 321 | mov edx, 134 shl 16 + 35 + 18 |
3545 | hidnplayr | 322 | mov esi, 0x40000000 |
4736 | leency | 323 | mov edi, 0x00F3F3F3 |
3545 | hidnplayr | 324 | mcall 47 |
325 | |||
326 | sub edx, 18 |
||
327 | pop ecx |
||
328 | mcall |
||
329 | |||
330 | jmp mainloop |
||
331 | |||
332 | |||
333 | not_102: |
||
334 | |||
335 | cmp [mode], 103 |
||
336 | jne not_103 |
||
337 | |||
338 | mov ebx, API_ARP |
||
339 | mov bh, [device] |
||
340 | push ebx |
||
3641 | hidnplayr | 341 | mcall 76 ; tx |
3545 | hidnplayr | 342 | pop ebx |
343 | push eax |
||
344 | |||
345 | inc bl |
||
346 | push ebx |
||
3641 | hidnplayr | 347 | mcall 76 ; rx |
3545 | hidnplayr | 348 | pop ebx |
349 | push eax |
||
350 | |||
351 | inc bl |
||
352 | push ebx |
||
3641 | hidnplayr | 353 | mcall 76 ; entries |
3545 | hidnplayr | 354 | pop ebx |
355 | push eax |
||
356 | |||
357 | mov bl, 7 |
||
358 | push ebx |
||
359 | mcall 76 |
||
360 | pop ebx |
||
361 | push eax |
||
362 | |||
363 | mov ebx, 0x000a0000 |
||
364 | pop ecx |
||
4740 | hidnplayr | 365 | mov edx, 134 shl 16 + 35 + 3*18 |
3545 | hidnplayr | 366 | mov esi, 0x40000000 |
4736 | leency | 367 | mov edi, 0x00F3F3F3 |
3545 | hidnplayr | 368 | mcall 47 |
369 | |||
370 | sub edx, 18 |
||
371 | pop ecx |
||
372 | mcall |
||
373 | |||
374 | sub edx, 18 |
||
375 | pop ecx |
||
376 | mcall |
||
377 | |||
378 | sub edx, 18 |
||
379 | pop ecx |
||
380 | mcall |
||
381 | |||
3618 | hidnplayr | 382 | ; mov edx, 50 shl 16 + 150 |
3601 | hidnplayr | 383 | mov [last], 0 |
384 | |||
385 | .arp_loop: |
||
3641 | hidnplayr | 386 | mov ebx, API_ARP + 3 ; read ARP entry |
3601 | hidnplayr | 387 | mov bh, [device] |
3641 | hidnplayr | 388 | mcall 76, ,[last], , , arp_buf |
3601 | hidnplayr | 389 | cmp eax, -1 |
390 | je mainloop |
||
391 | |||
3641 | hidnplayr | 392 | mov ebx, [last] |
393 | imul ebx, 16 |
||
394 | add ebx, 8 shl 16 + 140 |
||
395 | mcall 4, , 0x80000000, str_ARP_entry |
||
3601 | hidnplayr | 396 | mov edx, ebx |
397 | |||
398 | mov eax, 47 |
||
399 | mov ebx, 0x00030000 |
||
400 | mov esi, 0x40000000 |
||
4736 | leency | 401 | mov edi, 0x00F3F3F3 |
3601 | hidnplayr | 402 | xor ecx, ecx |
403 | |||
404 | mov cl, byte[arp_buf.IP+0] |
||
405 | mcall |
||
406 | |||
407 | mov cl, byte[arp_buf.IP+1] |
||
408 | add edx, 24 shl 16 |
||
409 | mcall |
||
410 | |||
411 | mov cl, byte[arp_buf.IP+2] |
||
412 | add edx, 24 shl 16 |
||
413 | mcall |
||
414 | |||
415 | mov cl, byte[arp_buf.IP+3] |
||
416 | add edx, 24 shl 16 |
||
417 | mcall |
||
418 | |||
419 | |||
420 | mov ebx, 0x00020100 |
||
421 | mov cl, byte[arp_buf.MAC+0] |
||
422 | add edx, 36 shl 16 |
||
423 | mcall |
||
424 | |||
425 | mov cl, byte[arp_buf.MAC+1] |
||
426 | add edx, 18 shl 16 |
||
427 | mcall |
||
428 | |||
429 | mov cl, byte[arp_buf.MAC+2] |
||
430 | add edx, 18 shl 16 |
||
431 | mcall |
||
432 | |||
433 | mov cl, byte[arp_buf.MAC+3] |
||
434 | add edx, 18 shl 16 |
||
435 | mcall |
||
436 | |||
437 | mov cl, byte[arp_buf.MAC+4] |
||
438 | add edx, 18 shl 16 |
||
439 | mcall |
||
440 | |||
441 | mov cl, byte[arp_buf.MAC+5] |
||
442 | add edx, 18 shl 16 |
||
443 | mcall |
||
444 | |||
445 | mov ebx, 0x00040000 |
||
446 | mov cx, [arp_buf.status] |
||
447 | add edx, 30 shl 16 |
||
448 | mcall |
||
449 | |||
450 | mov cx, [arp_buf.TTL] |
||
451 | add edx, 60 shl 16 |
||
452 | mcall |
||
453 | |||
454 | add dx, 18 |
||
455 | rol edx, 16 |
||
456 | mov dx, 8 |
||
457 | rol edx, 16 |
||
458 | inc [last] |
||
459 | |||
460 | jmp .arp_loop |
||
461 | |||
3545 | hidnplayr | 462 | not_103: |
463 | |||
464 | cmp [mode], 104 |
||
465 | jne not_104 |
||
466 | |||
467 | mov ebx, API_ICMP |
||
468 | mov bh, [device] |
||
469 | push ebx |
||
470 | mcall 76 |
||
471 | pop ebx |
||
472 | push eax |
||
473 | |||
474 | inc bl |
||
475 | push ebx |
||
476 | mcall 76 |
||
477 | pop ebx |
||
478 | push eax |
||
479 | |||
480 | mov ebx, 0x000a0000 |
||
481 | pop ecx |
||
4740 | hidnplayr | 482 | mov edx, 134 shl 16 + 35 + 18 |
3545 | hidnplayr | 483 | mov esi, 0x40000000 |
4736 | leency | 484 | mov edi, 0x00F3F3F3 |
3545 | hidnplayr | 485 | mcall 47 |
486 | |||
487 | sub edx, 18 |
||
488 | pop ecx |
||
489 | mcall |
||
490 | |||
491 | jmp mainloop |
||
492 | |||
493 | not_104: |
||
494 | |||
495 | cmp [mode], 105 |
||
496 | jne not_105 |
||
497 | |||
498 | mov ebx, API_UDP |
||
499 | mov bh, [device] |
||
500 | push ebx |
||
501 | mcall 76 |
||
502 | pop ebx |
||
503 | push eax |
||
504 | |||
505 | inc bl |
||
506 | push ebx |
||
507 | mcall 76 |
||
508 | pop ebx |
||
509 | push eax |
||
510 | |||
511 | mov ebx, 0x000a0000 |
||
512 | pop ecx |
||
4740 | hidnplayr | 513 | mov edx, 134 shl 16 + 35 + 18 |
3545 | hidnplayr | 514 | mov esi, 0x40000000 |
4736 | leency | 515 | mov edi, 0x00F3F3F3 |
3545 | hidnplayr | 516 | mcall 47 |
517 | |||
518 | sub edx, 18 |
||
519 | pop ecx |
||
520 | mcall |
||
521 | |||
522 | jmp mainloop |
||
523 | |||
524 | not_105: |
||
525 | |||
526 | cmp [mode], 106 |
||
527 | jne not_106 |
||
528 | |||
529 | mov ebx, API_TCP |
||
530 | mov bh, [device] |
||
531 | push ebx |
||
532 | mcall 76 |
||
533 | pop ebx |
||
534 | push eax |
||
535 | |||
536 | inc bl |
||
537 | push ebx |
||
538 | mcall 76 |
||
539 | pop ebx |
||
540 | push eax |
||
541 | |||
542 | inc bl |
||
543 | push ebx |
||
544 | mcall 76 |
||
545 | pop ebx |
||
546 | push eax |
||
547 | |||
548 | inc bl |
||
549 | push ebx |
||
550 | mcall 76 |
||
551 | pop ebx |
||
552 | push eax |
||
553 | |||
554 | mov ebx, 0x000a0000 |
||
555 | pop ecx |
||
4740 | hidnplayr | 556 | mov edx, 134 shl 16 + 35 + 18*3 |
3545 | hidnplayr | 557 | mov esi, 0x40000000 |
4736 | leency | 558 | mov edi, 0x00F3F3F3 |
3545 | hidnplayr | 559 | mcall 47 |
560 | |||
561 | sub edx, 18 |
||
562 | pop ecx |
||
563 | mcall |
||
564 | |||
565 | sub edx, 18 |
||
566 | pop ecx |
||
567 | mcall |
||
568 | |||
569 | sub edx, 18 |
||
570 | pop ecx |
||
571 | mcall |
||
572 | |||
573 | jmp mainloop |
||
574 | |||
575 | not_106: |
||
576 | |||
577 | mainloop: |
||
578 | |||
579 | mcall 23, 50 ; wait for event with timeout (0,5 s) |
||
580 | |||
4742 | hidnplayr | 581 | cmp eax, EV_REDRAW |
4736 | leency | 582 | je window_redraw |
4742 | hidnplayr | 583 | cmp eax, EV_BUTTON |
3545 | hidnplayr | 584 | je button |
4742 | hidnplayr | 585 | cmp eax, EV_KEY |
586 | je key |
||
3545 | hidnplayr | 587 | cmp eax, 11 |
588 | je redraw |
||
589 | |||
590 | jmp draw_stats |
||
591 | |||
592 | button: ; button |
||
593 | mcall 17 ; get id |
||
594 | cmp ah, 1 |
||
595 | je exit |
||
596 | cmp ah, 0 |
||
597 | je .interface |
||
4781 | hidnplayr | 598 | shr ax, 8 |
599 | mov [mode], ax |
||
3545 | hidnplayr | 600 | jmp redraw |
601 | |||
602 | .interface: |
||
603 | shr eax, 16 |
||
604 | mov [device], al |
||
605 | jmp redraw |
||
606 | |||
4742 | hidnplayr | 607 | key: |
608 | mcall 2 |
||
609 | cmp ah, 9 |
||
610 | je .tab |
||
611 | cmp ah, 183 |
||
612 | je .pgdown |
||
613 | cmp ah, 184 |
||
614 | je .pgup |
||
615 | jmp mainloop |
||
616 | |||
617 | .tab: |
||
618 | inc [mode] |
||
619 | cmp [mode], 106 |
||
620 | jbe redraw |
||
621 | mov [mode], 101 |
||
622 | jmp redraw |
||
623 | |||
624 | .pgdown: |
||
625 | inc [device] |
||
626 | mov al, [device] |
||
627 | cmp al, [last_device] |
||
628 | jbe redraw |
||
629 | mov [device], 0 |
||
630 | jmp redraw |
||
631 | |||
632 | .pgup: |
||
633 | dec [device] |
||
634 | cmp [device], 0 |
||
635 | jge redraw |
||
636 | mov al, [last_device] |
||
637 | mov [device], al |
||
638 | jmp redraw |
||
639 | |||
3545 | hidnplayr | 640 | exit: |
641 | mcall -1 |
||
642 | |||
643 | |||
644 | |||
645 | draw_mac: |
||
646 | |||
647 | mov eax, 47 |
||
648 | mov ebx, 0x00020100 |
||
649 | mov esi, 0x40000000 |
||
4736 | leency | 650 | mov edi, 0x00F3F3F3 |
3545 | hidnplayr | 651 | |
652 | mov cl, [esp+4] |
||
653 | mcall |
||
654 | |||
655 | mov cl, [esp+4+1] |
||
4740 | hidnplayr | 656 | add edx, 18 shl 16 |
3545 | hidnplayr | 657 | mcall |
658 | |||
659 | mov cl, [esp+4+2] |
||
4740 | hidnplayr | 660 | add edx, 18 shl 16 |
3545 | hidnplayr | 661 | mcall |
662 | |||
663 | mov cl, [esp+4+3] |
||
4740 | hidnplayr | 664 | add edx, 18 shl 16 |
3545 | hidnplayr | 665 | mcall |
666 | |||
667 | mov cl, [esp+4+4] |
||
4740 | hidnplayr | 668 | add edx, 18 shl 16 |
3545 | hidnplayr | 669 | mcall |
670 | |||
671 | mov cl, [esp+4+5] |
||
4740 | hidnplayr | 672 | add edx, 18 shl 16 |
3545 | hidnplayr | 673 | mcall |
674 | |||
4740 | hidnplayr | 675 | sub edx, 5*18 shl 16 |
3545 | hidnplayr | 676 | |
677 | ret 6 |
||
678 | |||
679 | |||
680 | draw_ip: |
||
681 | |||
682 | mov eax, 47 |
||
683 | mov ebx, 0x00030000 |
||
684 | mov esi, 0x40000000 |
||
4736 | leency | 685 | mov edi, 0x00F3F3F3 |
3545 | hidnplayr | 686 | |
687 | xor ecx, ecx |
||
688 | |||
689 | mov cl, [esp+4] |
||
690 | mcall |
||
691 | |||
692 | mov cl, [esp+4+1] |
||
4740 | hidnplayr | 693 | add edx, 24 shl 16 |
3545 | hidnplayr | 694 | mcall |
695 | |||
696 | mov cl, [esp+4+2] |
||
4740 | hidnplayr | 697 | add edx, 24 shl 16 |
3545 | hidnplayr | 698 | mcall |
699 | |||
700 | mov cl, [esp+4+3] |
||
4740 | hidnplayr | 701 | add edx, 24 shl 16 |
3545 | hidnplayr | 702 | mcall |
703 | |||
4740 | hidnplayr | 704 | sub edx, 3*24 shl 16 |
3545 | hidnplayr | 705 | ret 4 |
706 | |||
707 | |||
708 | draw_interfaces: |
||
709 | |||
3601 | hidnplayr | 710 | mov [.btnpos], 5 shl 16 + 20 |
4798 | hidnplayr | 711 | mov [.txtpos], 405 shl 16 + 12 |
3545 | hidnplayr | 712 | |
713 | mcall 74, -1 ; get number of active network devices |
||
714 | mov ecx, eax |
||
4742 | hidnplayr | 715 | dec al |
716 | mov [last_device], al |
||
3545 | hidnplayr | 717 | |
718 | xor ebx, ebx ; get device type |
||
719 | .loop: |
||
720 | mcall 74 |
||
3601 | hidnplayr | 721 | cmp eax, 1 ; loopback or ethernet? |
722 | jbe .hit |
||
3545 | hidnplayr | 723 | inc bh |
724 | jb .loop ; tried all 256? |
||
725 | ret |
||
726 | |||
727 | |||
728 | .hit: |
||
729 | push ecx ebx |
||
730 | movzx edx, bh |
||
731 | shl edx, 8 |
||
4736 | leency | 732 | mov esi, 0x00BBBbbb |
3545 | hidnplayr | 733 | cmp bh, [device] |
4736 | leency | 734 | cmove esi, 0x0081BBFF |
4798 | hidnplayr | 735 | mcall 8, 400 shl 16 + 185, [.btnpos] |
3545 | hidnplayr | 736 | mov ebx, [esp] |
737 | inc bl |
||
738 | mov ecx, namebuf |
||
739 | mov edx, namebuf |
||
3601 | hidnplayr | 740 | mcall 74 ; get device name |
3545 | hidnplayr | 741 | cmp eax, -1 |
742 | jne @f |
||
743 | mov edx, str_unknown |
||
744 | @@: |
||
3601 | hidnplayr | 745 | mcall 4, [.txtpos], 0x80000000 ; print the name |
3545 | hidnplayr | 746 | pop ebx ecx |
747 | |||
748 | inc bh |
||
749 | |||
750 | add [.btnpos], 25 shl 16 |
||
751 | add [.txtpos], 25 |
||
752 | |||
753 | dec ecx |
||
754 | jnz .loop |
||
755 | |||
756 | ret |
||
757 | |||
758 | .btnpos dd ? |
||
759 | .txtpos dd ? |
||
760 | |||
761 | |||
762 | ; DATA AREA |
||
763 | |||
4742 | hidnplayr | 764 | name db 'Network status', 0 |
4781 | hidnplayr | 765 | mode dw 101 |
3545 | hidnplayr | 766 | device db 0 |
4742 | hidnplayr | 767 | last_device db 0 |
3601 | hidnplayr | 768 | device_type dd 0 |
769 | last dd 0 |
||
4798 | hidnplayr | 770 | modes db 'Physical IPv4 ARP ICMP UDP TCP', 0 |
3545 | hidnplayr | 771 | |
772 | str_packets_tx db 'Packets sent:', 0 |
||
773 | str_packets_rx db 'Packets received:', 0 |
||
774 | str_bytes_tx db 'Bytes sent:', 0 |
||
775 | str_bytes_rx db 'Bytes received:', 0 |
||
4740 | hidnplayr | 776 | str_MAC db 'MAC address: - - - - -', 0 |
777 | str_ip db 'IP address: . . .', 0 |
||
778 | str_dns db 'DNS address: . . .', 0 |
||
779 | str_subnet db 'Subnet mask: . . .', 0 |
||
780 | str_gateway db 'Standard gateway: . . .', 0 |
||
3545 | hidnplayr | 781 | str_arp db 'ARP entrys:', 0 |
782 | str_conflicts db 'ARP conflicts:', 0 |
||
783 | str_unknown db 'unknown', 0 |
||
784 | str_missed db 'Packets missed:',0 |
||
785 | str_dumped db 'Packets dumped:',0 |
||
786 | str_link db 'Link state:',0 |
||
787 | |||
3601 | hidnplayr | 788 | str_ARP_legend db 'IP-address MAC-address Status TTL', 0 |
4740 | hidnplayr | 789 | str_ARP_entry db ' . . . - - - - -', 0 |
3601 | hidnplayr | 790 | |
3545 | hidnplayr | 791 | namebuf rb 64 |
3601 | hidnplayr | 792 | arp_buf ARP_entry |
3545 | hidnplayr | 793 | |
4742 | hidnplayr | 794 | I_END: |