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