Thread: [Javanetsim-cvs] IceScan ieee-oui.txt, NONE, 1.1 iceparams.h, 1.7, 1.8 icedbs.h, 1.1, 1.2 icescan.c
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2006-12-14 19:45:47
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9431 Modified Files: iceparams.h icedbs.h icescan.cc ctarget.h csubtarget.h Added Files: ieee-oui.txt Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** icescan.cc 14 Dec 2006 19:23:32 -0000 1.19 --- icescan.cc 14 Dec 2006 19:45:40 -0000 1.20 *************** *** 229,238 **** int main(int argc, char *argv[]){ iceoutput out; ! iceparams par; ! struct timeb tp1, tp2; ! ! ice_service_name_database isnd("services"); char version_string[255]; --- 229,239 ---- int main(int argc, char *argv[]){ + ice_service_name_database isnd("services"); + ice_mac_name_database ismd("ieee-oui.txt"); + iceoutput out; ! iceparams par(&isnd, &ismd); ! struct timeb tp1, tp2; char version_string[255]; *************** *** 259,263 **** } ! ctargets ts(&par, &out, &isnd); ftime(&tp1); --- 260,264 ---- } ! ctargets ts(&par, &out); ftime(&tp1); *************** *** 273,276 **** --- 274,279 ---- ftime(&tp2); + out.line(""); + out << "IceScan finished: " << ts.subtargets_count() << " IP address(es) (" << ts.up_subtargets_count() << " host(s) up) processed in " << timeb_diff(tp1, tp2) << " seconds." << iceoutput::endl; --- NEW FILE: ieee-oui.txt --- # ieee-oui.txt -- Ethernet vendor OUI file for arp-scan # # This file contains the Ethernet vendor OUIs for arp-scan. These are used # to determine the vendor for a give Ethernet interface given the MAC address. # # Each line of this file contains an OUI-vendor mapping in the form: # # <OUI><TAB><Vendor> # # Where <OUI> is the first three bytes of the MAC address in hex, and <Vendor> # is the name of the vendor. # # Blank lines and lines beginning with "#" are ignored. # # This file was automatically generated by get-oui at 2006-06-25 17:54:10 # using data from http://standards.ieee.org/regauth/oui/oui.txt # # Do not edit this file. If you want to add additional MAC-Vendor mappings, # edit the file mac-vendor.txt instead. [...9318 lines suppressed...] 08008B PYRAMID TECHNOLOGY CORP. 08008C NETWORK RESEARCH CORPORATION 08008D XYVISION INC. 08008E TANDEM COMPUTERS 08008F CHIPCOM CORPORATION 080090 SONOMA SYSTEMS 081443 UNIBRAIN S.A. 08BBCC AK-NORD EDV VERTRIEBSGES. mbH 100000 PRIVATE 10005A IBM CORPORATION 1000E8 NATIONAL SEMICONDUCTOR 1100AA PRIVATE 800010 ATT BELL LABORATORIES A06A00 Verilink Corporation AA0000 DIGITAL EQUIPMENT CORPORATION AA0001 DIGITAL EQUIPMENT CORPORATION AA0002 DIGITAL EQUIPMENT CORPORATION AA0003 DIGITAL EQUIPMENT CORPORATION AA0004 DIGITAL EQUIPMENT CORPORATION ACDE48 PRIVATE Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** csubtarget.h 14 Dec 2006 19:23:32 -0000 1.20 --- csubtarget.h 14 Dec 2006 19:45:40 -0000 1.21 *************** *** 58,63 **** icestring reversed_hostname; - ice_service_name_database *isnd; - // *****scan parameters***** bool raw; --- 58,61 ---- *************** *** 75,79 **** std::vector<scanned_port> subtarget_ports; ! csubtarget(icestring hostname, icestring reverse_hostname, iceparams *par, iceoutput *out, ice_service_name_database *isnd){ struct scanned_port sp; --- 73,77 ---- std::vector<scanned_port> subtarget_ports; ! csubtarget(icestring hostname, icestring reverse_hostname, iceparams *par, iceoutput *out){ struct scanned_port sp; *************** *** 85,89 **** this->par = par; this->out = out; - this->isnd = isnd; discovered = false; init_scan_sockets(); --- 83,86 ---- *************** *** 119,123 **** if(mac != ""){ ! *out << "MAC Address: " << mac << "\n"; } #endif --- 116,131 ---- if(mac != ""){ ! char Mac[24], vmac[7]; ! ! strcpy(Mac, mac.c_str()); ! ! vmac[0] = Mac[0]; vmac[1] = Mac[1]; ! vmac[2] = Mac[3]; vmac[3] = Mac[4]; ! vmac[4] = Mac[6]; vmac[5] = Mac[7]; ! vmac[6] = '\0'; ! ! icestring Vmac(vmac); ! ! *out << "MAC Address: " << mac << " (" << par->ismd->get_vendor(vmac) << ")" << "\n"; } #endif *************** *** 721,739 **** bzero(output_buf, 255); if(subtarget_ports[j].status == PORT_OPEN){ ! sprintf(output_buf, "%5d/tcp open %s", subtarget_ports[j].port_number, isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); }else if(subtarget_ports[j].status == PORT_OPEN_FILTERED){ ! sprintf(output_buf, "%5d/tcp o|f %s", subtarget_ports[j].port_number, isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); }else if(subtarget_ports[j].status == PORT_UNFILTERED){ ! sprintf(output_buf, "%5d/tcp unfilt %s", subtarget_ports[j].port_number, isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); }else if(subtarget_ports[j].status == PORT_CLOSED && show_closed){ ! sprintf(output_buf, "%5d/tcp closed %s", subtarget_ports[j].port_number, isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); } } - out->line(""); } --- 729,746 ---- bzero(output_buf, 255); if(subtarget_ports[j].status == PORT_OPEN){ ! sprintf(output_buf, "%5d/tcp open %s", subtarget_ports[j].port_number, par->isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); }else if(subtarget_ports[j].status == PORT_OPEN_FILTERED){ ! sprintf(output_buf, "%5d/tcp o|f %s", subtarget_ports[j].port_number, par->isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); }else if(subtarget_ports[j].status == PORT_UNFILTERED){ ! sprintf(output_buf, "%5d/tcp unfilt %s", subtarget_ports[j].port_number, par->isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); }else if(subtarget_ports[j].status == PORT_CLOSED && show_closed){ ! sprintf(output_buf, "%5d/tcp closed %s", subtarget_ports[j].port_number, par->isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); } } } Index: icedbs.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icedbs.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** icedbs.h 14 Dec 2006 19:23:32 -0000 1.1 --- icedbs.h 14 Dec 2006 19:45:40 -0000 1.2 *************** *** 61,65 **** icestring get_tcp_service(int port){ ! if(tcp_services.find(port) != tcp_services.end()) return udp_services[port]; else return "unknown"; } --- 61,65 ---- icestring get_tcp_service(int port){ ! if(tcp_services.find(port) != tcp_services.end()) return tcp_services[port]; else return "unknown"; } *************** *** 71,73 **** --- 71,124 ---- }; + class ice_mac_name_database{ + + std::map <icestring, icestring> vendors; + + public: + + ice_mac_name_database(char *db_fname){ + std::ifstream in; + + in.open(db_fname); + + if(!in){ + std::cout << "Can't open service names database!" << std::endl; + } else { + while(!in.eof()){ + char tmpbuf[256]; + + in.getline(tmpbuf,256); + + //DBGOUTPUT("!!!!"); + + IceRegex re1("^(#.*|\\s*)$"); + + //DBGOUTPUT("&&&&&"); + + if(! re1.match(tmpbuf) ){ //FullMatch + IceRegex re("^([A-F0-9]+)\\s*\\W*([-a-z0-9A-Z.+]+)"); + + icestring prefix = "", company = ""; + + std::vector<icestring> v; + + re.match(tmpbuf, v); + + if(v.size()<3) continue; + + prefix = v[1]; company = v[2]; + + vendors[prefix] = company; + }//else DBGOUTPUT("#comment"); + } + } + } + + icestring get_vendor(icestring mac){ + if(vendors.find(mac) != vendors.end()) return vendors[mac]; + else return "Unknown vendor"; + } + + }; + #endif Index: iceparams.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/iceparams.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iceparams.h 13 Dec 2006 20:06:32 -0000 1.7 --- iceparams.h 14 Dec 2006 19:45:40 -0000 1.8 *************** *** 3,6 **** --- 3,7 ---- #include <vector> + #include "icedbs.h" #define NBT_PORT 137 *************** *** 61,64 **** --- 62,70 ---- std::vector <port_range> ports; + + // Databases + + ice_service_name_database *isnd; + ice_mac_name_database *ismd; private: *************** *** 88,92 **** public: ! iceparams(){ default_init(); } --- 94,101 ---- public: ! iceparams(ice_service_name_database *isnd, ice_mac_name_database *ismd){ ! this->isnd = isnd; ! this->ismd = ismd; ! default_init(); } Index: ctarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/ctarget.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ctarget.h 14 Dec 2006 19:23:32 -0000 1.9 --- ctarget.h 14 Dec 2006 19:45:40 -0000 1.10 *************** *** 10,15 **** iceparams *par; - ice_service_name_database *isnd; - std::vector <csubtarget *> subtargets; //subtargets (e.g. aliases for domain name, multiple ips per hostname, e.t.c.) std::vector <icestring> subtargets_addresses; //subtarget ips as string --- 10,13 ---- *************** *** 17,22 **** public: ! ctargets(iceparams *par, iceoutput *out, ice_service_name_database *isnd){ ! this->isnd = isnd; this->par = par; this->out = out; --- 15,19 ---- public: ! ctargets(iceparams *par, iceoutput *out){ this->par = par; this->out = out; *************** *** 49,53 **** for(int i=0; i<st; i++){ ! csubtarget *cst = new csubtarget(subtargets_addresses[i].c_str(), rev_hostname.c_str(), par, out, isnd); subtargets.push_back(cst); } --- 46,50 ---- for(int i=0; i<st; i++){ ! csubtarget *cst = new csubtarget(subtargets_addresses[i].c_str(), rev_hostname.c_str(), par, out); subtargets.push_back(cst); } |