📄 arp_48bit.c
字号:
return;}/******************************************** the first 3 bytes of the MAC address* contain the vendor id of the address* this function does this and*******************************************/int arp_48bit_cmp_vendors(struct arp_48bit_vendor *c1, struct arp_48bit_vendor *c2) { /* We only need to compare the first 3 bytes */ return memcmp(c1->hw, c2->hw, 3);}/***************************** this is only called at the * start of the program* to set up data structs****************************/int arp_48bit_init() { int i = 0; SLOCK(&arp_48bit_mutex); arp_48bit_ven = list_init(); list_setcmp(arp_48bit_ven, (void *) &arp_48bit_cmp_vendors); arp_48bit_data = list_init(); list_setcmp(arp_48bit_data, (void *) &arp_48bit_cmp_ip); /* fill our live data list for the arp vendors list */ while(arp_48bit_vendors[i].string != NULL) { if (list_add_sort(arp_48bit_ven, &arp_48bit_vendors[i]) < 0) log_s("error adding to list"); i++; } SUNLOCK(&arp_48bit_mutex); return 0;}void arp_gui_48bit(struct gui_t *p, int y, int x) { WINDOW *draw; struct arp_48bit_data_t *record; int len, i, offset, cury; char *foot_back, buff[80]; /* create a new window */ draw = newwin(p->twin->_maxy - 1, p->twin->_maxx - 1, 1, 1); if (!draw) { log_s("newwin() failed"); return; } wbkgd(draw, COLOR_PAIR(COLOR_NORMAL)); werase(draw); offset = 0; foot_back = p->footer; while(1) { werase(draw); cury = 0; SLOCK(&arp_48bit_mutex); len = list_length(arp_48bit_data); snprintf(&buff[0], 80, "Total Entries: %d Requests: %llu Replies: %llu Err: %llu Drop: %llu", len, arp_48bit_stats_requests, arp_48bit_stats_replies, arp_48bit_stats_errors, arp_48bit_stats_dropped); gui_footer(p, &buff[0]); if (offset > 0) mvwprintw(draw, cury, draw->_maxx - 12, " --more-- "); /* check we have something to print to the screen */ if (len == 0) { mvwprintw(draw, cury, 0, "No Entries"); } else { i = offset; /* loop and print stuff to the screen */ while(i < len && cury < draw->_maxy) { record = list_get(arp_48bit_data, i); if (record->str_name) { mvwprintw(draw, cury++, 0, "%5s\t%20s %.2X:%.2X:%.2X:%.2X:%.2X:%.2X %s", record->if_name, record->str_name, record->hw[0], record->hw[1], record->hw[2], record->hw[3], record->hw[4], record->hw[5], record->str_vendor); } else { /* we dont have a name yet */ mvwprintw(draw, cury++, 0, "%5s\t%20s %.2X:%.2X:%.2X:%.2X:%.2X:%.2X %s", record->if_name, record->str_addr, record->hw[0], record->hw[1], record->hw[2], record->hw[3], record->hw[4], record->hw[5], record->str_vendor); record->str_name = lookup(record->ip, 1); } i++; } } if (cury < draw->_maxy) { mvwprintw(draw, cury, 0, " -- END --"); wclrtoeol(draw); } /* do we have more info off screen ? */ if (cury > draw->_maxy - 1) mvwprintw(draw, draw->_maxy , draw->_maxx - 12, "--more--"); SUNLOCK(&arp_48bit_mutex); /* update the screen */ wrefresh(draw); switch(gui_scroll(1, 0, len, &offset)) { case -1: /* error / timeout */ break; case 0: /* it did something */ break; default: goto get_out; break; } /* end switch gui_utils_scroll */ } /* end while(1) */get_out: /* cleaup */ gui_footer(p, foot_back); werase(draw); wrefresh(draw); delwin(draw); return;}struct arp_48bit_vendor arp_48bit_vendors[] = {{ {0x00, 0x00, 0x00,0x00,0x00,0x00}, ""},{ {0x00, 0x00, 0x01,0x00,0x00,0x00}, "SuperLAN-2U"},{ {0x00, 0x00, 0x02,0x00,0x00,0x00}, "BBN (was internal usage only, no longer used)"},{ {0x00, 0x00, 0x09,0x00,0x00,0x00}, "powerpipes?"},{ {0x00, 0x00, 0x0C,0x00,0x00,0x00}, "Cisco"},{ {0x00, 0x00, 0x0E,0x00,0x00,0x00}, "Fujitsu"},{ {0x00, 0x00, 0x0F,0x00,0x00,0x00}, "NeXT"},{ {0x00, 0x00, 0x10,0x00,0x00,0x00}, "Hughes LAN Systems (formerly Sytek)"},{ {0x00, 0x00, 0x11,0x00,0x00,0x00}, "Tektronix"},{ {0x00, 0x00, 0x15,0x00,0x00,0x00}, "Datapoint Corporation"},{ {0x00, 0x00, 0x18,0x00,0x00,0x00}, "Webster Computer Corporation Appletalk/Ethernet Gateway"},{ {0x00, 0x00, 0x1A,0x00,0x00,0x00}, "AMD (?)"},{ {0x00, 0x00, 0x1B,0x00,0x00,0x00}, "Novell (now Eagle Technology)"},{ {0x00, 0x00, 0x1C,0x00,0x00,0x00}, "JDR Microdevices generic, NE2000 drivers"},{ {0x00, 0x00, 0x1D,0x00,0x00,0x00}, "Cabletron"},{ {0x00, 0x00, 0x1F,0x00,0x00,0x00}, "Cryptall Communications Corp."},{ {0x00, 0x00, 0x20,0x00,0x00,0x00}, "DIAB (Data Intdustrier AB)"},{ {0x00, 0x00, 0x21,0x00,0x00,0x00}, "SC&C (PAM Soft&Hardware also reported)"},{ {0x00, 0x00, 0x22,0x00,0x00,0x00}, "Visual Technology"},{ {0x00, 0x00, 0x23,0x00,0x00,0x00}, "ABB Automation AB, Dept. Q"},{ {0x00, 0x00, 0x24,0x00,0x00,0x00}, "Olicom"},{ {0x00, 0x00, 0x29,0x00,0x00,0x00}, "IMC"},{ {0x00, 0x00, 0x2A,0x00,0x00,0x00}, "TRW"},{ {0x00, 0x00, 0x2C,0x00,0x00,0x00}, "NRC - Network Resources Corporation - MultiGate Hub1+, Hub2, etc"},{ {0x00, 0x00, 0x32,0x00,0x00,0x00}, "GPT Limited (reassigned from GEC Computers Ltd)"},{ {0x00, 0x00, 0x37,0x00,0x00,0x00}, "Oxford Metrics Ltd"},{ {0x00, 0x00, 0x3B,0x00,0x00,0x00}, "Hyundai/Axil Sun clones"},{ {0x00, 0x00, 0x3C,0x00,0x00,0x00}, "Auspex"},{ {0x00, 0x00, 0x3D,0x00,0x00,0x00}, "AT&T"},{ {0x00, 0x00, 0x3F,0x00,0x00,0x00}, "Syntrex Inc"},{ {0x00, 0x00, 0x44,0x00,0x00,0x00}, "Castelle"},{ {0x00, 0x00, 0x46,0x00,0x00,0x00}, "ISC-Bunker Ramo, An Olivetti Company"},{ {0x00, 0x00, 0x48,0x00,0x00,0x00}, "Epson"},{ {0x00, 0x00, 0x49,0x00,0x00,0x00}, "Apricot Ltd."},{ {0x00, 0x00, 0x4B,0x00,0x00,0x00}, "APT -ICL also reported"},{ {0x00, 0x00, 0x4C,0x00,0x00,0x00}, "NEC Corporation"},{ {0x00, 0x00, 0x4F,0x00,0x00,0x00}, "Logicraft 386-Ware P.C. Emulator"},{ {0x00, 0x00, 0x51,0x00,0x00,0x00}, "Hob Electronic Gmbh & Co. KG"},{ {0x00, 0x00, 0x52,0x00,0x00,0x00}, "Optical Data Systems"},{ {0x00, 0x00, 0x55,0x00,0x00,0x00}, "AT&T"},{ {0x00, 0x00, 0x58,0x00,0x00,0x00}, "Racore Computer Products Inc"},{ {0x00, 0x00, 0x5A,0x00,0x00,0x00}, "SK (Schneider & Koch in Europe and Syskonnect outside of Europe)"},{ {0x00, 0x00, 0x5A,0x00,0x00,0x00}, "Xerox 806 (unregistered)"},{ {0x00, 0x00, 0x5B,0x00,0x00,0x00}, "Eltec"},{ {0x00, 0x00, 0x5D,0x00,0x00,0x00}, "RCE"},{ {0x00, 0x00, 0x5E,0x00,0x00,0x00}, "U.S. Department of Defense (IANA)"},{ {0x00, 0x00, 0x5F,0x00,0x00,0x00}, "Sumitomo"},{ {0x00, 0x00, 0x61,0x00,0x00,0x00}, "Gateway Communications"},{ {0x00, 0x00, 0x62,0x00,0x00,0x00}, "Honeywell"},{ {0x00, 0x00, 0x63,0x00,0x00,0x00}, "Hewlett-Packard LanProbe"},{ {0x00, 0x00, 0x64,0x00,0x00,0x00}, "Yokogawa Digital Computer Corp"},{ {0x00, 0x00, 0x65,0x00,0x00,0x00}, "Network General"},{ {0x00, 0x00, 0x66,0x00,0x00,0x00}, "Talaris"},{ {0x00, 0x00, 0x68,0x00,0x00,0x00}, "Rosemount Controls"},{ {0x00, 0x00, 0x69,0x00,0x00,0x00}, "Concord Communications, Inc (although someone said Silicon Graphics)"},{ {0x00, 0x00, 0x6B,0x00,0x00,0x00}, "MIPS"},{ {0x00, 0x00, 0x6D,0x00,0x00,0x00}, "Case"},{ {0x00, 0x00, 0x6E,0x00,0x00,0x00}, "Artisoft, Inc."},{ {0x00, 0x00, 0x6F,0x00,0x00,0x00}, "Madge Networks Ltd. Token-ring adapters"},{ {0x00, 0x00, 0x73,0x00,0x00,0x00}, "DuPont"},{ {0x00, 0x00, 0x75,0x00,0x00,0x00}, "Bell Northern Research (BNR)"},{ {0x00, 0x00, 0x77,0x00,0x00,0x00}, "Interphase [Used in other systems, e.g. MIPS, Motorola]"},{ {0x00, 0x00, 0x78,0x00,0x00,0x00}, "Labtam Australia"},{ {0x00, 0x00, 0x79,0x00,0x00,0x00}, "Networth Incorporated [bought by Compaq, used in Netelligent series]"},{ {0x00, 0x00, 0x7A,0x00,0x00,0x00}, "Ardent"},{ {0x00, 0x00, 0x7B,0x00,0x00,0x00}, "Research Machines"},{ {0x00, 0x00, 0x7D,0x00,0x00,0x00}, "Cray Research Superservers,Inc [Also Harris (3M) (old)]"},{ {0x00, 0x00, 0x7E,0x00,0x00,0x00}, "NetFRAME multiprocessor network servers"},{ {0x00, 0x00, 0x7F,0x00,0x00,0x00}, "Linotype-Hell AG Linotronic typesetters"},{ {0x00, 0x00, 0x80,0x00,0x00,0x00}, "Cray Communications (formerly Dowty Network Services)"},{ {0x00, 0x00, 0x81,0x00,0x00,0x00}, "Synoptics"},{ {0x00, 0x00, 0x83,0x00,0x00,0x00}, "Tadpole Technology [had Optical Data Systems which is wrong according to both]"},{ {0x00, 0x00, 0x84,0x00,0x00,0x00}, "Aquila (?), ADI Systems Inc.(?)"},{ {0x00, 0x00, 0x86,0x00,0x00,0x00}, "Gateway Communications Inc. (then Megahertz & now 3com)"},{ {0x00, 0x00, 0x87,0x00,0x00,0x00}, "Hitachi"},{ {0x00, 0x00, 0x89,0x00,0x00,0x00}, "Cayman Systems Gatorbox"},{ {0x00, 0x00, 0x8A,0x00,0x00,0x00}, "Datahouse Information Systems"},{ {0x00, 0x00, 0x8E,0x00,0x00,0x00}, "Solbourne(?), Jupiter(?) (I've had confirming mail on Solbourne)"},{ {0x00, 0x00, 0x92,0x00,0x00,0x00}, "Unisys, Cogent (both reported)"},{ {0x00, 0x00, 0x93,0x00,0x00,0x00}, "Proteon"},{ {0x00, 0x00, 0x94,0x00,0x00,0x00}, "Asante MAC"},{ {0x00, 0x00, 0x95,0x00,0x00,0x00}, "Sony/Tektronix"},{ {0x00, 0x00, 0x97,0x00,0x00,0x00}, "Epoch"},{ {0x00, 0x00, 0x98,0x00,0x00,0x00}, "Cross Com"},{ {0x00, 0x00, 0x99,0x00,0x00,0x00}, "Memorex Telex Corporations"},{ {0x00, 0x00, 0x9F,0x00,0x00,0x00}, "Ameristar Technology"},{ {0x00, 0x00, 0xA0,0x00,0x00,0x00}, "Sanyo Electronics"},{ {0x00, 0x00, 0xA2,0x00,0x00,0x00}, "Wellfleet"},{ {0x00, 0x00, 0xA3,0x00,0x00,0x00}, "Network Application Technology (NAT)"},{ {0x00, 0x00, 0xA4,0x00,0x00,0x00}, "Acorn"},{ {0x00, 0x00, 0xA5,0x00,0x00,0x00}, "Compatible Systems Corporation"},{ {0x00, 0x00, 0xA6,0x00,0x00,0x00}, "Network General (internal assignment, not for products)"},{ {0x00, 0x00, 0xA7,0x00,0x00,0x00}, "Network Computing Devices (NCD) X-terminals"},{ {0x00, 0x00, 0xA8,0x00,0x00,0x00}, "Stratus Computer, Inc."},{ {0x00, 0x00, 0xA9,0x00,0x00,0x00}, "Network Systems"},{ {0x00, 0x00, 0xAA,0x00,0x00,0x00}, "Xerox Xerox machines"},{ {0x00, 0x00, 0xAC,0x00,0x00,0x00}, "Conware Netzpartner [had Apollo, claimed incorrect]"},{ {0x00, 0x00, 0xAE,0x00,0x00,0x00}, "Dassault Automatismes et Telecommunications"},{ {0x00, 0x00, 0xAF,0x00,0x00,0x00}, "Nuclear Data Acquisition Interface Modules (AIM)"},{ {0x00, 0x00, 0xB0,0x00,0x00,0x00}, "RND (RAD Network Devices)"},{ {0x00, 0x00, 0xB1,0x00,0x00,0x00}, "Alpha Microsystems Inc."},{ {0x00, 0x00, 0xB3,0x00,0x00,0x00}, "CIMLinc"},{ {0x00, 0x00, 0xB4,0x00,0x00,0x00}, "Edimax"},{ {0x00, 0x00, 0xB5,0x00,0x00,0x00}, "Datability Terminal Servers"},{ {0x00, 0x00, 0xB6,0x00,0x00,0x00}, "Micro-matic Research"},{ {0x00, 0x00, 0xB7,0x00,0x00,0x00}, "Dove Fastnet"},{ {0x00, 0x00, 0xBB,0x00,0x00,0x00}, "TRI-DATA Systems Inc. Netway products, 3274 emulators"},{ {0x00, 0x00, 0xBC,0x00,0x00,0x00}, "Allen-Bradley"},{ {0x00, 0x00, 0xC0,0x00,0x00,0x00}, "Western Digital now SMC (Std. Microsystems Corp.)"},{ {0x00, 0x00, 0xC1,0x00,0x00,0x00}, "Olicom A/S"},{ {0x00, 0x00, 0xC5,0x00,0x00,0x00}, "Farallon Computing Inc"},{ {0x00, 0x00, 0xC6,0x00,0x00,0x00}, "HP Intelligent Networks Operation (formerly Eon Systems)"},{ {0x00, 0x00, 0xC8,0x00,0x00,0x00}, "Altos"},{ {0x00, 0x00, 0xC9,0x00,0x00,0x00}, "Emulex Terminal Servers, Print Servers"},{ {0x00, 0x00, 0xCA,0x00,0x00,0x00}, "LANcity Cable Modems (now owned by BayNetworks)"},{ {0x00, 0x00, 0xCC,0x00,0x00,0x00}, "Densan Co., Ltd."},{ {0x00, 0x00, 0xCD,0x00,0x00,0x00}, "Industrial Research Limited"},
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -