javanetsim-cvs Mailing List for javaNetSim (Page 12)
Status: Beta
Brought to you by:
darkkey
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(120) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(1) |
Feb
(69) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(76) |
Oct
(28) |
Nov
(77) |
Dec
(186) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(36) |
Oct
(61) |
Nov
(23) |
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(17) |
Oct
(105) |
Nov
(5) |
Dec
(1) |
2009 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(8) |
Oct
(9) |
Nov
|
Dec
|
From: Alexander B. <da...@us...> - 2006-12-21 16:36:31
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6985 Modified Files: Makefile.am icescan.cc icediscover.h icedbs.h Makefile.in csubtarget.cc Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** icescan.cc 21 Dec 2006 16:29:36 -0000 1.39 --- icescan.cc 21 Dec 2006 16:36:28 -0000 1.40 *************** *** 28,32 **** #include "ctarget.h" #include "icesockets/csocket.h" ! #include "icesockets/ice_rand.h" void print_help(char *name){ --- 28,32 ---- #include "ctarget.h" #include "icesockets/csocket.h" ! #include "icesockets/sock_utils.h" void print_help(char *name){ Index: csubtarget.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** csubtarget.cc 21 Dec 2006 16:29:36 -0000 1.2 --- csubtarget.cc 21 Dec 2006 16:36:28 -0000 1.3 *************** *** 51,55 **** icestring mac = get_arp_from_cache(hostname); ! if(mac != ""){ char Mac[24], vmac[7]; --- 51,55 ---- icestring mac = get_arp_from_cache(hostname); ! if(mac != "" && mac != "00:00:00:00:00:00"){ char Mac[24], vmac[7]; Index: icedbs.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icedbs.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** icedbs.h 21 Dec 2006 15:37:23 -0000 1.10 --- icedbs.h 21 Dec 2006 16:36:28 -0000 1.11 *************** *** 2,6 **** #define ICEDBS_H ! #include "icesockets/sock_files.h" #include "icesockets/iceregex.h" --- 2,6 ---- #define ICEDBS_H ! #include "icesockets/sock_utils.h" #include "icesockets/iceregex.h" Index: icediscover.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icediscover.h,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** icediscover.h 21 Dec 2006 15:37:23 -0000 1.35 --- icediscover.h 21 Dec 2006 16:36:28 -0000 1.36 *************** *** 2,6 **** #define ICEDISCOVER_H ! #include "icesockets/ice_rand.h" #include "icesockets/csocket.h" #include "icesockets/crawsocket.h" --- 2,6 ---- #define ICEDISCOVER_H ! #include "icesockets/sock_utils.h" #include "icesockets/csocket.h" #include "icesockets/crawsocket.h" Index: Makefile.in =================================================================== RCS file: /cvsroot/javanetsim/IceScan/Makefile.in,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.in 21 Dec 2006 16:29:36 -0000 1.5 --- Makefile.in 21 Dec 2006 16:36:28 -0000 1.6 *************** *** 56,63 **** binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) ! am_icescan_OBJECTS = sock_time.$(OBJEXT) ice_rand.$(OBJEXT) \ ! sock_win.$(OBJEXT) sock_name.$(OBJEXT) sock_files.$(OBJEXT) \ ! csubtarget.$(OBJEXT) icediscover.$(OBJEXT) udpscan.$(OBJEXT) \ ! icescan.$(OBJEXT) icescan_OBJECTS = $(am_icescan_OBJECTS) icescan_LDADD = $(LDADD) --- 56,62 ---- binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) ! am_icescan_OBJECTS = sock_utils.$(OBJEXT) sock_win.$(OBJEXT) \ ! sock_name.$(OBJEXT) csubtarget.$(OBJEXT) icediscover.$(OBJEXT) \ ! udpscan.$(OBJEXT) icescan.$(OBJEXT) icescan_OBJECTS = $(am_icescan_OBJECTS) icescan_LDADD = $(LDADD) *************** *** 179,184 **** target_alias = @target_alias@ icescandir = $(datadir)/icescan ! icescan_SOURCES = icesockets/sock_time.cc icesockets/ice_rand.cc \ ! icesockets/sock_win.cc icesockets/sock_name.cc icesockets/sock_files.cc \ csubtarget.cc icediscover.cc udpscan.cc icescan.cc --- 178,182 ---- target_alias = @target_alias@ icescandir = $(datadir)/icescan ! icescan_SOURCES = icesockets/sock_utils.cc icesockets/sock_win.cc icesockets/sock_name.cc \ csubtarget.cc icediscover.cc udpscan.cc icescan.cc *************** *** 273,282 **** @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csubtarget.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ice_rand.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icediscover.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icescan.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_files.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_name.Po@am__quote@ ! @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_time.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_win.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udpscan.Po@am__quote@ --- 271,278 ---- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csubtarget.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icediscover.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icescan.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_name.Po@am__quote@ ! @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_win.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udpscan.Po@am__quote@ *************** *** 296,326 **** @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ! sock_time.o: icesockets/sock_time.cc ! @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sock_time.o -MD -MP -MF "$(DEPDIR)/sock_time.Tpo" -c -o sock_time.o `test -f 'icesockets/sock_time.cc' || echo '$(srcdir)/'`icesockets/sock_time.cc; \ ! @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/sock_time.Tpo" "$(DEPDIR)/sock_time.Po"; else rm -f "$(DEPDIR)/sock_time.Tpo"; exit 1; fi ! @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='icesockets/sock_time.cc' object='sock_time.o' libtool=no @AMDEPBACKSLASH@ ! @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ! @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sock_time.o `test -f 'icesockets/sock_time.cc' || echo '$(srcdir)/'`icesockets/sock_time.cc ! ! sock_time.obj: icesockets/sock_time.cc ! @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sock_time.obj -MD -MP -MF "$(DEPDIR)/sock_time.Tpo" -c -o sock_time.obj `if test -f 'icesockets/sock_time.cc'; then $(CYGPATH_W) 'icesockets/sock_time.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/sock_time.cc'; fi`; \ ! @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/sock_time.Tpo" "$(DEPDIR)/sock_time.Po"; else rm -f "$(DEPDIR)/sock_time.Tpo"; exit 1; fi ! @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='icesockets/sock_time.cc' object='sock_time.obj' libtool=no @AMDEPBACKSLASH@ ! @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ! @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sock_time.obj `if test -f 'icesockets/sock_time.cc'; then $(CYGPATH_W) 'icesockets/sock_time.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/sock_time.cc'; fi` ! ! ice_rand.o: icesockets/ice_rand.cc ! @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ice_rand.o -MD -MP -MF "$(DEPDIR)/ice_rand.Tpo" -c -o ice_rand.o `test -f 'icesockets/ice_rand.cc' || echo '$(srcdir)/'`icesockets/ice_rand.cc; \ ! @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/ice_rand.Tpo" "$(DEPDIR)/ice_rand.Po"; else rm -f "$(DEPDIR)/ice_rand.Tpo"; exit 1; fi ! @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='icesockets/ice_rand.cc' object='ice_rand.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ! @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ice_rand.o `test -f 'icesockets/ice_rand.cc' || echo '$(srcdir)/'`icesockets/ice_rand.cc ! ice_rand.obj: icesockets/ice_rand.cc ! @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ice_rand.obj -MD -MP -MF "$(DEPDIR)/ice_rand.Tpo" -c -o ice_rand.obj `if test -f 'icesockets/ice_rand.cc'; then $(CYGPATH_W) 'icesockets/ice_rand.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/ice_rand.cc'; fi`; \ ! @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/ice_rand.Tpo" "$(DEPDIR)/ice_rand.Po"; else rm -f "$(DEPDIR)/ice_rand.Tpo"; exit 1; fi ! @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='icesockets/ice_rand.cc' object='ice_rand.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ! @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ice_rand.obj `if test -f 'icesockets/ice_rand.cc'; then $(CYGPATH_W) 'icesockets/ice_rand.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/ice_rand.cc'; fi` sock_win.o: icesockets/sock_win.cc --- 292,308 ---- @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ! sock_utils.o: icesockets/sock_utils.cc ! @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sock_utils.o -MD -MP -MF "$(DEPDIR)/sock_utils.Tpo" -c -o sock_utils.o `test -f 'icesockets/sock_utils.cc' || echo '$(srcdir)/'`icesockets/sock_utils.cc; \ ! @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/sock_utils.Tpo" "$(DEPDIR)/sock_utils.Po"; else rm -f "$(DEPDIR)/sock_utils.Tpo"; exit 1; fi ! @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='icesockets/sock_utils.cc' object='sock_utils.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ! @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sock_utils.o `test -f 'icesockets/sock_utils.cc' || echo '$(srcdir)/'`icesockets/sock_utils.cc ! sock_utils.obj: icesockets/sock_utils.cc ! @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sock_utils.obj -MD -MP -MF "$(DEPDIR)/sock_utils.Tpo" -c -o sock_utils.obj `if test -f 'icesockets/sock_utils.cc'; then $(CYGPATH_W) 'icesockets/sock_utils.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/sock_utils.cc'; fi`; \ ! @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/sock_utils.Tpo" "$(DEPDIR)/sock_utils.Po"; else rm -f "$(DEPDIR)/sock_utils.Tpo"; exit 1; fi ! @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='icesockets/sock_utils.cc' object='sock_utils.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ! @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sock_utils.obj `if test -f 'icesockets/sock_utils.cc'; then $(CYGPATH_W) 'icesockets/sock_utils.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/sock_utils.cc'; fi` sock_win.o: icesockets/sock_win.cc *************** *** 351,368 **** @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sock_name.obj `if test -f 'icesockets/sock_name.cc'; then $(CYGPATH_W) 'icesockets/sock_name.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/sock_name.cc'; fi` - - sock_files.o: icesockets/sock_files.cc - @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sock_files.o -MD -MP -MF "$(DEPDIR)/sock_files.Tpo" -c -o sock_files.o `test -f 'icesockets/sock_files.cc' || echo '$(srcdir)/'`icesockets/sock_files.cc; \ - @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/sock_files.Tpo" "$(DEPDIR)/sock_files.Po"; else rm -f "$(DEPDIR)/sock_files.Tpo"; exit 1; fi - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='icesockets/sock_files.cc' object='sock_files.o' libtool=no @AMDEPBACKSLASH@ - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sock_files.o `test -f 'icesockets/sock_files.cc' || echo '$(srcdir)/'`icesockets/sock_files.cc - - sock_files.obj: icesockets/sock_files.cc - @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sock_files.obj -MD -MP -MF "$(DEPDIR)/sock_files.Tpo" -c -o sock_files.obj `if test -f 'icesockets/sock_files.cc'; then $(CYGPATH_W) 'icesockets/sock_files.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/sock_files.cc'; fi`; \ - @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/sock_files.Tpo" "$(DEPDIR)/sock_files.Po"; else rm -f "$(DEPDIR)/sock_files.Tpo"; exit 1; fi - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='icesockets/sock_files.cc' object='sock_files.obj' libtool=no @AMDEPBACKSLASH@ - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sock_files.obj `if test -f 'icesockets/sock_files.cc'; then $(CYGPATH_W) 'icesockets/sock_files.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/sock_files.cc'; fi` uninstall-info-am: install-icescanDATA: $(icescan_DATA) --- 333,336 ---- Index: Makefile.am =================================================================== RCS file: /cvsroot/javanetsim/IceScan/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.am 21 Dec 2006 16:29:36 -0000 1.5 --- Makefile.am 21 Dec 2006 16:36:28 -0000 1.6 *************** *** 1,6 **** bin_PROGRAMS = icescan icescandir = $(datadir)/icescan ! icescan_SOURCES = icesockets/sock_time.cc icesockets/ice_rand.cc \ ! icesockets/sock_win.cc icesockets/sock_name.cc icesockets/sock_files.cc \ csubtarget.cc icediscover.cc udpscan.cc icescan.cc icescan_DATA = services ieee-oui.txt README INSTALL COPYING AUTHORS ChangeLog INSTALL.conf --- 1,5 ---- bin_PROGRAMS = icescan icescandir = $(datadir)/icescan ! icescan_SOURCES = icesockets/sock_utils.cc icesockets/sock_win.cc icesockets/sock_name.cc \ csubtarget.cc icediscover.cc udpscan.cc icescan.cc icescan_DATA = services ieee-oui.txt README INSTALL COPYING AUTHORS ChangeLog INSTALL.conf |
From: Alexander B. <da...@us...> - 2006-12-21 16:36:31
|
Update of /cvsroot/javanetsim/IceScan/.deps In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6985/.deps Modified Files: .cvsignore Log Message: no message Index: .cvsignore =================================================================== RCS file: /cvsroot/javanetsim/IceScan/.deps/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** .cvsignore 21 Dec 2006 15:37:24 -0000 1.2 --- .cvsignore 21 Dec 2006 16:36:28 -0000 1.3 *************** *** 1,12 **** ! icescan.Po ! ice_rand.Po ! sock_files.Po ! sock_eth.Po sock_name.Po - sock_time.Po icediscover.Po - sock_win.Po sock_pcap.Po csubtarget.Po udpscan.Po sock_arp.Po --- 1,13 ---- ! sock_utils.Po sock_name.Po icediscover.Po sock_pcap.Po csubtarget.Po + icescan.Po + sock_eth.Po + sock_files.Po + ice_rand.Po + sock_time.Po + sock_win.Po udpscan.Po sock_arp.Po |
From: Alexander B. <da...@us...> - 2006-12-21 16:36:31
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6985/icesockets Modified Files: sock_utils.cc sock_name.h sock_utils.h csocket.h Added Files: cpcapreader.h Removed Files: sock_pcap.h Log Message: no message Index: sock_name.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_name.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** sock_name.h 21 Dec 2006 16:29:36 -0000 1.17 --- sock_name.h 21 Dec 2006 16:36:27 -0000 1.18 *************** *** 33,37 **** icestring get_source_ip(const icestring &destip, icestring &sourceint); ! icestring get_arp_from_cache(icestring &ip); #endif --- 33,37 ---- icestring get_source_ip(const icestring &destip, icestring &sourceint); ! icestring get_arp_from_cache(icestring &); #endif Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** csocket.h 21 Dec 2006 16:29:36 -0000 1.25 --- csocket.h 21 Dec 2006 16:36:27 -0000 1.26 *************** *** 6,10 **** #include "sock_err.h" #include "sock_name.h" ! #include "sock_time.h" #ifdef WIN32 --- 6,10 ---- #include "sock_err.h" #include "sock_name.h" ! #include "sock_utils.h" #ifdef WIN32 Index: sock_utils.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_utils.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sock_utils.h 21 Dec 2006 16:29:36 -0000 1.1 --- sock_utils.h 21 Dec 2006 16:36:27 -0000 1.2 *************** *** 1,4 **** ! #ifndef ICESOCK_SOCK_TIME_H ! #define ICESOCK_SOCK_TIME_H #include "sock_types.h" --- 1,4 ---- ! #ifndef ICESOCK_SOCK_UTILS_H ! #define ICESOCK_SOCK_UTILS_H #include "sock_types.h" Index: sock_utils.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_utils.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sock_utils.cc 21 Dec 2006 16:29:36 -0000 1.1 --- sock_utils.cc 21 Dec 2006 16:36:27 -0000 1.2 *************** *** 1,3 **** ! #include "sock_time.h" #ifdef WIN32 --- 1,3 ---- ! #include "sock_utils.h" #ifdef WIN32 --- NEW FILE: cpcapreader.h --- (This appears to be a binary file; contents omitted.) --- sock_pcap.h DELETED --- |
From: Alexander B. <da...@us...> - 2006-12-21 16:36:31
|
Update of /cvsroot/javanetsim/IceScan/nbproject In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6985/nbproject Modified Files: configurations.xml Makefile-Default.mk Log Message: no message Index: Makefile-Default.mk =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/Makefile-Default.mk,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile-Default.mk 21 Dec 2006 16:29:37 -0000 1.3 --- Makefile-Default.mk 21 Dec 2006 16:36:27 -0000 1.4 *************** *** 24,33 **** OBJECTFILES= \ build/Default/GNU-Linux-x86/icesockets/sock_win.o \ build/Default/GNU-Linux-x86/icescan.o \ - build/Default/GNU-Linux-x86/icesockets/ice_rand.o \ build/Default/GNU-Linux-x86/csubtarget.o \ build/Default/GNU-Linux-x86/icesockets/sock_name.o \ build/Default/GNU-Linux-x86/icediscover.o \ - build/Default/GNU-Linux-x86/icesockets/sock_files.o \ build/Default/GNU-Linux-x86/udpscan.o --- 24,32 ---- OBJECTFILES= \ build/Default/GNU-Linux-x86/icesockets/sock_win.o \ + build/Default/GNU-Linux-x86/icesockets/sock_utils.o \ build/Default/GNU-Linux-x86/icescan.o \ build/Default/GNU-Linux-x86/csubtarget.o \ build/Default/GNU-Linux-x86/icesockets/sock_name.o \ build/Default/GNU-Linux-x86/icediscover.o \ build/Default/GNU-Linux-x86/udpscan.o *************** *** 56,67 **** $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/sock_win.o icesockets/sock_win.cc build/Default/GNU-Linux-x86/icescan.o: icescan.cc @${MKDIR} -p build/Default/GNU-Linux-x86 $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icescan.o icescan.cc - build/Default/GNU-Linux-x86/icesockets/ice_rand.o: icesockets/ice_rand.cc - @${MKDIR} -p build/Default/GNU-Linux-x86/icesockets - $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/ice_rand.o icesockets/ice_rand.cc - build/Default/GNU-Linux-x86/csubtarget.o: csubtarget.cc @${MKDIR} -p build/Default/GNU-Linux-x86 --- 55,66 ---- $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/sock_win.o icesockets/sock_win.cc + build/Default/GNU-Linux-x86/icesockets/sock_utils.o: icesockets/sock_utils.cc + @${MKDIR} -p build/Default/GNU-Linux-x86/icesockets + $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/sock_utils.o icesockets/sock_utils.cc + build/Default/GNU-Linux-x86/icescan.o: icescan.cc @${MKDIR} -p build/Default/GNU-Linux-x86 $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icescan.o icescan.cc build/Default/GNU-Linux-x86/csubtarget.o: csubtarget.cc @${MKDIR} -p build/Default/GNU-Linux-x86 *************** *** 76,83 **** $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icediscover.o icediscover.cc - build/Default/GNU-Linux-x86/icesockets/sock_files.o: icesockets/sock_files.cc - @${MKDIR} -p build/Default/GNU-Linux-x86/icesockets - $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/sock_files.o icesockets/sock_files.cc - build/Default/GNU-Linux-x86/udpscan.o: udpscan.cc @${MKDIR} -p build/Default/GNU-Linux-x86 --- 75,78 ---- Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/configurations.xml,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** configurations.xml 21 Dec 2006 16:29:37 -0000 1.25 --- configurations.xml 21 Dec 2006 16:36:27 -0000 1.26 *************** *** 7,22 **** <itemPath>icesockets/csocket.h</itemPath> <itemPath>icesockets/getaddrinfo.h</itemPath> - <itemPath>icesockets/ice_rand.cc</itemPath> - <itemPath>icesockets/ice_rand.h</itemPath> <itemPath>icesockets/iceregex.h</itemPath> <itemPath>icesockets/queue.h</itemPath> <itemPath>icesockets/sock_err.h</itemPath> - <itemPath>icesockets/sock_files.cc</itemPath> - <itemPath>icesockets/sock_files.h</itemPath> <itemPath>icesockets/sock_name.cc</itemPath> <itemPath>icesockets/sock_name.h</itemPath> <itemPath>icesockets/sock_pcap.h</itemPath> - <itemPath>icesockets/sock_time.h</itemPath> <itemPath>icesockets/sock_types.h</itemPath> <itemPath>icesockets/sock_win.cc</itemPath> <itemPath>icesockets/sock_win.h</itemPath> --- 7,19 ---- <itemPath>icesockets/csocket.h</itemPath> <itemPath>icesockets/getaddrinfo.h</itemPath> <itemPath>icesockets/iceregex.h</itemPath> <itemPath>icesockets/queue.h</itemPath> <itemPath>icesockets/sock_err.h</itemPath> <itemPath>icesockets/sock_name.cc</itemPath> <itemPath>icesockets/sock_name.h</itemPath> <itemPath>icesockets/sock_pcap.h</itemPath> <itemPath>icesockets/sock_types.h</itemPath> + <itemPath>icesockets/sock_utils.cc</itemPath> + <itemPath>icesockets/sock_utils.h</itemPath> <itemPath>icesockets/sock_win.cc</itemPath> <itemPath>icesockets/sock_win.h</itemPath> *************** *** 99,105 **** <itemTool>3</itemTool> </item> - <item path="icesockets/sock_time.h"> - <itemTool>3</itemTool> - </item> <item path="icesockets/crawsocket.h"> <itemTool>3</itemTool> --- 96,99 ---- *************** *** 120,126 **** <itemTool>3</itemTool> </item> - <item path="icesockets/ice_rand.h"> - <itemTool>3</itemTool> - </item> <item path="icedbs.h"> <itemTool>3</itemTool> --- 114,117 ---- *************** *** 153,159 **** <itemTool>3</itemTool> </item> - <item path="icesockets/sock_files.h"> - <itemTool>3</itemTool> - </item> <item path="csubtarget.cc"> <itemTool>1</itemTool> --- 144,147 ---- *************** *** 161,174 **** </ccCompilerTool> </item> - <item path="icesockets/ice_rand.cc"> - <itemTool>1</itemTool> - <ccCompilerTool> - </ccCompilerTool> - </item> - <item path="icesockets/sock_files.cc"> - <itemTool>1</itemTool> - <ccCompilerTool> - </ccCompilerTool> - </item> <item path="icesockets/sock_name.cc"> <itemTool>1</itemTool> --- 149,152 ---- *************** *** 194,197 **** --- 172,183 ---- <itemTool>3</itemTool> </item> + <item path="icesockets/sock_utils.h"> + <itemTool>3</itemTool> + </item> + <item path="icesockets/sock_utils.cc"> + <itemTool>1</itemTool> + <ccCompilerTool> + </ccCompilerTool> + </item> </conf> </confs> |
From: Alexander B. <da...@us...> - 2006-12-21 16:29:41
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv4099 Modified Files: Makefile.am icescan.cc csubtarget.h Makefile.in csubtarget.cc udpscan.cc Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** icescan.cc 21 Dec 2006 15:37:23 -0000 1.38 --- icescan.cc 21 Dec 2006 16:29:36 -0000 1.39 *************** *** 155,159 **** par->forceuid = true; }else if(!strcmp(argv[i], "--list-interfaces")){ ! listdev_pcap(); std::cout << std::endl; exit(0); --- 155,159 ---- par->forceuid = true; }else if(!strcmp(argv[i], "--list-interfaces")){ ! cpcapreader::listdev_pcap(); std::cout << std::endl; exit(0); Index: csubtarget.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** csubtarget.cc 21 Dec 2006 15:37:23 -0000 1.1 --- csubtarget.cc 21 Dec 2006 16:29:36 -0000 1.2 *************** *** 298,310 **** } ! pcap_t* p; if(par->source_iface) ! p = init_pcap(par->source_iface); else ! p = init_pcap(getdev_pcap(source_iface)); ! ! if(p == NULL){ out->line("Can't open pcap: no raw tcp scan. Exitting."); return; --- 298,315 ---- } ! int iface; if(par->source_iface) ! iface = par->source_iface; else ! iface = cpcapreader::getdev_pcap(source_iface); ! char filter_exp[256]; ! ! sprintf(filter_exp, "port %d host %s tcp", MAGIC_PORT, hostname.c_str()); ! ! cpcapreader p(iface, false, filter_exp); ! ! if(!p.opened()){ out->line("Can't open pcap: no raw tcp scan. Exitting."); return; *************** *** 335,347 **** int l = scanning_ports.size()/MAX_PACKETS; if(scanning_ports.size() % MAX_PACKETS != 0) l++; ! ! char filter_exp[256]; ! ! sprintf(filter_exp, "port %d host %s tcp", MAGIC_PORT, hostname.c_str()); ! ! pcap_filter(p, filter_exp); ! ! pcap_block(p, false); ! int maxat; --- 340,344 ---- int l = scanning_ports.size()/MAX_PACKETS; if(scanning_ports.size() % MAX_PACKETS != 0) l++; ! int maxat; *************** *** 418,425 **** *out << "TCP " << scan_type << " scan finished.\n"; - close_pcap(p); } ! int csubtarget::recieve_tcp_raw(pcap_t* p, crawsocket &rawsend, icestring &source, struct sockaddr_in &saddress, std::map <int, scanning_port> &scanning_ports, int MAGIC_PORT, int timeout, int packets){ int bytes; char *response; --- 415,421 ---- *out << "TCP " << scan_type << " scan finished.\n"; } ! int csubtarget::recieve_tcp_raw(cpcapreader &p, crawsocket &rawsend, icestring &source, struct sockaddr_in &saddress, std::map <int, scanning_port> &scanning_ports, int MAGIC_PORT, int timeout, int packets){ int bytes; char *response; *************** *** 436,440 **** //while( bytes = rawrecv.recvfrom(response, 65535, 0, NULL) > 0){ while(!stop){ ! response = readip_pcap(p, &len, NULL); port = 0; //DBGOUTPUT("while"); --- 432,436 ---- //while( bytes = rawrecv.recvfrom(response, 65535, 0, NULL) > 0){ while(!stop){ ! response = p.read_packet(&len, NULL); port = 0; //DBGOUTPUT("while"); Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** csubtarget.h 21 Dec 2006 15:37:23 -0000 1.54 --- csubtarget.h 21 Dec 2006 16:29:36 -0000 1.55 *************** *** 60,63 **** --- 60,67 ---- bool discover(); + + icestring get_source_iface(){ + return source_iface; + } void scan(); *************** *** 101,105 **** void raw_tcp_scan(icestring scan_type); ! int recieve_tcp_raw(pcap_t* p, crawsocket &rawsend, icestring &source, struct sockaddr_in &saddress, std::map <int, scanning_port> &scanning_ports, int MAGIC_PORT, int timeout, int packets); void shutdown_scansocket(int j); --- 105,109 ---- void raw_tcp_scan(icestring scan_type); ! int recieve_tcp_raw(cpcapreader &p, crawsocket &rawsend, icestring &source, struct sockaddr_in &saddress, std::map <int, scanning_port> &scanning_ports, int MAGIC_PORT, int timeout, int packets); void shutdown_scansocket(int j); Index: Makefile.in =================================================================== RCS file: /cvsroot/javanetsim/IceScan/Makefile.in,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.in 21 Dec 2006 15:37:23 -0000 1.4 --- Makefile.in 21 Dec 2006 16:29:36 -0000 1.5 *************** *** 57,62 **** PROGRAMS = $(bin_PROGRAMS) am_icescan_OBJECTS = sock_time.$(OBJEXT) ice_rand.$(OBJEXT) \ ! sock_win.$(OBJEXT) sock_arp.$(OBJEXT) sock_eth.$(OBJEXT) \ ! sock_pcap.$(OBJEXT) sock_name.$(OBJEXT) sock_files.$(OBJEXT) \ csubtarget.$(OBJEXT) icediscover.$(OBJEXT) udpscan.$(OBJEXT) \ icescan.$(OBJEXT) --- 57,61 ---- PROGRAMS = $(bin_PROGRAMS) am_icescan_OBJECTS = sock_time.$(OBJEXT) ice_rand.$(OBJEXT) \ ! sock_win.$(OBJEXT) sock_name.$(OBJEXT) sock_files.$(OBJEXT) \ csubtarget.$(OBJEXT) icediscover.$(OBJEXT) udpscan.$(OBJEXT) \ icescan.$(OBJEXT) *************** *** 181,186 **** icescandir = $(datadir)/icescan icescan_SOURCES = icesockets/sock_time.cc icesockets/ice_rand.cc \ ! icesockets/sock_win.cc icesockets/sock_arp.cc icesockets/sock_eth.cc \ ! icesockets/sock_pcap.cc icesockets/sock_name.cc icesockets/sock_files.cc csubtarget.cc icediscover.cc udpscan.cc icescan.cc icescan_DATA = services ieee-oui.txt README INSTALL COPYING AUTHORS ChangeLog INSTALL.conf --- 180,185 ---- icescandir = $(datadir)/icescan icescan_SOURCES = icesockets/sock_time.cc icesockets/ice_rand.cc \ ! icesockets/sock_win.cc icesockets/sock_name.cc icesockets/sock_files.cc \ ! csubtarget.cc icediscover.cc udpscan.cc icescan.cc icescan_DATA = services ieee-oui.txt README INSTALL COPYING AUTHORS ChangeLog INSTALL.conf *************** *** 277,285 **** @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icediscover.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icescan.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_arp.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_eth.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_files.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_name.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_pcap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_time.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_win.Po@am__quote@ --- 276,281 ---- *************** *** 342,387 **** @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sock_win.obj `if test -f 'icesockets/sock_win.cc'; then $(CYGPATH_W) 'icesockets/sock_win.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/sock_win.cc'; fi` - sock_arp.o: icesockets/sock_arp.cc - @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sock_arp.o -MD -MP -MF "$(DEPDIR)/sock_arp.Tpo" -c -o sock_arp.o `test -f 'icesockets/sock_arp.cc' || echo '$(srcdir)/'`icesockets/sock_arp.cc; \ - @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/sock_arp.Tpo" "$(DEPDIR)/sock_arp.Po"; else rm -f "$(DEPDIR)/sock_arp.Tpo"; exit 1; fi - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='icesockets/sock_arp.cc' object='sock_arp.o' libtool=no @AMDEPBACKSLASH@ - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sock_arp.o `test -f 'icesockets/sock_arp.cc' || echo '$(srcdir)/'`icesockets/sock_arp.cc - - sock_arp.obj: icesockets/sock_arp.cc - @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sock_arp.obj -MD -MP -MF "$(DEPDIR)/sock_arp.Tpo" -c -o sock_arp.obj `if test -f 'icesockets/sock_arp.cc'; then $(CYGPATH_W) 'icesockets/sock_arp.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/sock_arp.cc'; fi`; \ - @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/sock_arp.Tpo" "$(DEPDIR)/sock_arp.Po"; else rm -f "$(DEPDIR)/sock_arp.Tpo"; exit 1; fi - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='icesockets/sock_arp.cc' object='sock_arp.obj' libtool=no @AMDEPBACKSLASH@ - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sock_arp.obj `if test -f 'icesockets/sock_arp.cc'; then $(CYGPATH_W) 'icesockets/sock_arp.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/sock_arp.cc'; fi` - - sock_eth.o: icesockets/sock_eth.cc - @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sock_eth.o -MD -MP -MF "$(DEPDIR)/sock_eth.Tpo" -c -o sock_eth.o `test -f 'icesockets/sock_eth.cc' || echo '$(srcdir)/'`icesockets/sock_eth.cc; \ - @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/sock_eth.Tpo" "$(DEPDIR)/sock_eth.Po"; else rm -f "$(DEPDIR)/sock_eth.Tpo"; exit 1; fi - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='icesockets/sock_eth.cc' object='sock_eth.o' libtool=no @AMDEPBACKSLASH@ - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sock_eth.o `test -f 'icesockets/sock_eth.cc' || echo '$(srcdir)/'`icesockets/sock_eth.cc - - sock_eth.obj: icesockets/sock_eth.cc - @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sock_eth.obj -MD -MP -MF "$(DEPDIR)/sock_eth.Tpo" -c -o sock_eth.obj `if test -f 'icesockets/sock_eth.cc'; then $(CYGPATH_W) 'icesockets/sock_eth.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/sock_eth.cc'; fi`; \ - @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/sock_eth.Tpo" "$(DEPDIR)/sock_eth.Po"; else rm -f "$(DEPDIR)/sock_eth.Tpo"; exit 1; fi - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='icesockets/sock_eth.cc' object='sock_eth.obj' libtool=no @AMDEPBACKSLASH@ - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sock_eth.obj `if test -f 'icesockets/sock_eth.cc'; then $(CYGPATH_W) 'icesockets/sock_eth.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/sock_eth.cc'; fi` - - sock_pcap.o: icesockets/sock_pcap.cc - @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sock_pcap.o -MD -MP -MF "$(DEPDIR)/sock_pcap.Tpo" -c -o sock_pcap.o `test -f 'icesockets/sock_pcap.cc' || echo '$(srcdir)/'`icesockets/sock_pcap.cc; \ - @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/sock_pcap.Tpo" "$(DEPDIR)/sock_pcap.Po"; else rm -f "$(DEPDIR)/sock_pcap.Tpo"; exit 1; fi - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='icesockets/sock_pcap.cc' object='sock_pcap.o' libtool=no @AMDEPBACKSLASH@ - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sock_pcap.o `test -f 'icesockets/sock_pcap.cc' || echo '$(srcdir)/'`icesockets/sock_pcap.cc - - sock_pcap.obj: icesockets/sock_pcap.cc - @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sock_pcap.obj -MD -MP -MF "$(DEPDIR)/sock_pcap.Tpo" -c -o sock_pcap.obj `if test -f 'icesockets/sock_pcap.cc'; then $(CYGPATH_W) 'icesockets/sock_pcap.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/sock_pcap.cc'; fi`; \ - @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/sock_pcap.Tpo" "$(DEPDIR)/sock_pcap.Po"; else rm -f "$(DEPDIR)/sock_pcap.Tpo"; exit 1; fi - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='icesockets/sock_pcap.cc' object='sock_pcap.obj' libtool=no @AMDEPBACKSLASH@ - @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sock_pcap.obj `if test -f 'icesockets/sock_pcap.cc'; then $(CYGPATH_W) 'icesockets/sock_pcap.cc'; else $(CYGPATH_W) '$(srcdir)/icesockets/sock_pcap.cc'; fi` - sock_name.o: icesockets/sock_name.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sock_name.o -MD -MP -MF "$(DEPDIR)/sock_name.Tpo" -c -o sock_name.o `test -f 'icesockets/sock_name.cc' || echo '$(srcdir)/'`icesockets/sock_name.cc; \ --- 338,341 ---- Index: udpscan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/udpscan.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** udpscan.cc 21 Dec 2006 15:37:23 -0000 1.1 --- udpscan.cc 21 Dec 2006 16:29:36 -0000 1.2 *************** *** 74,91 **** sudp.bind(hostname, MAGIC_PORT, 0); sudp.nonblock(true); - pcap_t* p = init_pcap(par->source_iface); //check for NULL - if(p == NULL){ - out->line("Can't open pcap: no raw tcp scan. Exitting."); - return false; - } ! pcap_block(p, false); char filter_exp[256]; ! sprintf(filter_exp, "host %s icmp", destname.c_str()); ! ! pcap_filter(p, filter_exp); ! for(repeats = 1; repeats <= UDP_SCAN_REPEATS && next; repeats++){ for(std::map <int, scanning_port>::iterator i = scanning_ports.begin(); i!= scanning_ports.end() && next; ++i){ --- 74,98 ---- sudp.bind(hostname, MAGIC_PORT, 0); sudp.nonblock(true); ! int iface = 0; ! ! if(par->source_iface) ! iface = par->source_iface; ! else{ ! icestring sif = subtarget->get_source_iface(); ! iface = cpcapreader::getdev_pcap(sif); ! } char filter_exp[256]; ! sprintf(filter_exp, "host %s icmp", destname.c_str()); ! ! cpcapreader p(iface, false, filter_exp); ! ! if(!p.opened()){ ! out->line("Can't open pcap: no raw tcp scan. Exitting."); ! return false; ! } ! for(repeats = 1; repeats <= UDP_SCAN_REPEATS && next; repeats++){ for(std::map <int, scanning_port>::iterator i = scanning_ports.begin(); i!= scanning_ports.end() && next; ++i){ *************** *** 114,118 **** else{ ! response = readip_pcap(p, &len, NULL); if(response){ recvbytes = len; --- 121,125 ---- else{ ! response = p.read_packet(&len, NULL); if(response){ recvbytes = len; *************** *** 149,154 **** sudp.close(); //sicmp.shutdown(); ! //sicmp.close(); ! close_pcap(p); delete[] zmsg; } --- 156,160 ---- sudp.close(); //sicmp.shutdown(); ! //sicmp.close(); delete[] zmsg; } Index: Makefile.am =================================================================== RCS file: /cvsroot/javanetsim/IceScan/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.am 21 Dec 2006 15:37:23 -0000 1.4 --- Makefile.am 21 Dec 2006 16:29:36 -0000 1.5 *************** *** 2,7 **** icescandir = $(datadir)/icescan icescan_SOURCES = icesockets/sock_time.cc icesockets/ice_rand.cc \ ! icesockets/sock_win.cc icesockets/sock_arp.cc icesockets/sock_eth.cc \ ! icesockets/sock_pcap.cc icesockets/sock_name.cc icesockets/sock_files.cc csubtarget.cc icediscover.cc udpscan.cc icescan.cc icescan_DATA = services ieee-oui.txt README INSTALL COPYING AUTHORS ChangeLog INSTALL.conf CXXFLAGS=-DICESCAN_DATADIR=\"$(icescandir)\" --- 2,7 ---- icescandir = $(datadir)/icescan icescan_SOURCES = icesockets/sock_time.cc icesockets/ice_rand.cc \ ! icesockets/sock_win.cc icesockets/sock_name.cc icesockets/sock_files.cc \ ! csubtarget.cc icediscover.cc udpscan.cc icescan.cc icescan_DATA = services ieee-oui.txt README INSTALL COPYING AUTHORS ChangeLog INSTALL.conf CXXFLAGS=-DICESCAN_DATADIR=\"$(icescandir)\" |
From: Alexander B. <da...@us...> - 2006-12-21 16:29:40
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv4099/icesockets Modified Files: crawsocket.h sock_pcap.h sock_name.h sock_name.cc csocket.h Added Files: sock_utils.cc sock_utils.h cethwrapper.h Removed Files: sock_pcap.cc sock_arp.h ice_rand.h sock_files.h sock_time.h sock_eth.cc sock_eth.h sock_time.cc sock_files.cc ice_rand.cc sock_arp.cc Log Message: no message --- ice_rand.cc DELETED --- --- sock_pcap.cc DELETED --- --- sock_arp.h DELETED --- --- sock_eth.h DELETED --- --- sock_eth.cc DELETED --- --- sock_time.cc DELETED --- Index: sock_name.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_name.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** sock_name.h 21 Dec 2006 15:37:23 -0000 1.16 --- sock_name.h 21 Dec 2006 16:29:36 -0000 1.17 *************** *** 12,16 **** #include "sock_types.h" ! #include "sock_eth.h" #include "iceregex.h" --- 12,16 ---- #include "sock_types.h" ! #include "cethwrapper.h" #include "iceregex.h" *************** *** 31,33 **** --- 31,37 ---- short int get_host_byip(icestring &nisname, icestring &retname); + icestring get_source_ip(const icestring &destip, icestring &sourceint); + + icestring get_arp_from_cache(icestring &ip); + #endif --- sock_time.h DELETED --- --- sock_files.h DELETED --- --- sock_arp.cc DELETED --- Index: crawsocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/crawsocket.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** crawsocket.h 17 Dec 2006 18:49:55 -0000 1.19 --- crawsocket.h 21 Dec 2006 16:29:36 -0000 1.20 *************** *** 3,7 **** #include "csocket.h" ! #include "sock_eth.h" #include "sock_types.h" --- 3,7 ---- #include "csocket.h" ! #include "cethwrapper.h" #include "sock_types.h" *************** *** 198,206 **** if(ethernet){ ! res = send_ip_packet(packet, ntohs(ip->tot_len)); }else if ((res = sendto(destination.c_str(), packet, ntohs(ip->tot_len), 0)) == -1) { ! perror("sendto in send_tcp_raw"); ! #ifdef WIN32 free(packet); #endif --- 198,209 ---- if(ethernet){ ! #ifdef HAVE_LIBDNET ! cethwrapper ew; ! res = ew.send_ip_packet(packet, ntohs(ip->tot_len)); ! #endif }else if ((res = sendto(destination.c_str(), packet, ntohs(ip->tot_len), 0)) == -1) { ! perror("sendto in send_tcp_raw"); ! #ifdef WIN32 free(packet); #endif *************** *** 208,212 **** } ! #ifdef WIN32 free(packet); #endif --- 211,215 ---- } ! #ifdef WIN32 free(packet); #endif *************** *** 240,294 **** return sendto(hostname, buftosend, len, 0); } - - // from Fyodor's "The Art of Port Scanning" - /*static int print_tcppacket(char *packet, int readdata) { - struct iphdr *ip = (struct iphdr *) packet; - struct tcphdr *tcp = (struct tcphdr *) (packet + sizeof(struct iphdr)); - char *data = packet + sizeof(struct iphdr) + sizeof(struct tcphdr); - int tot_len; - struct in_addr bullshit, bullshit2; - char sourcehost[16]; - int i; - - if (!packet) { - std::cerr << "readtcppacket: packet is NULL!\n"; - return -1; - } - - bullshit.s_addr = ip->saddr; bullshit2.s_addr = ip->daddr; - tot_len = ntohs(ip->tot_len); - strncpy(sourcehost, inet_ntoa(bullshit), 16); - i = 4 * (ntohs(ip->ihl) + ntohs(tcp->th_off)); - if (ip->protocol == IPPROTO_TCP){ - if (ip->frag_off){ - printf("Packet is fragmented, offset field: %u", ip->frag_off); - } else { - printf("TCP packet: %s:%d -> %s:%d (total: %d bytes)\n", sourcehost, - ntohs(tcp->th_sport), inet_ntoa(bullshit2), - ntohs(tcp->th_dport), tot_len); - printf("Flags: "); - if (!tcp->th_flags) printf("(none)"); - if (tcp->th_flags & TH_RST) printf("RST "); - if (tcp->th_flags & TH_SYN) printf("SYN "); - if (tcp->th_flags & TH_ACK) printf("ACK "); - if (tcp->th_flags & TH_PUSH) printf("PSH "); - if (tcp->th_flags & TH_FIN) printf("FIN "); - if (tcp->th_flags & TH_URG) printf("URG "); - printf("\n"); - printf("ttl: %hi ", ip->ttl); - if (tcp->th_flags & (TH_SYN | TH_ACK)) printf("Seq: %lu\tAck: %lu\n", - tcp->th_seq, tcp->th_ack); - else if (tcp->th_flags & TH_SYN) printf("Seq: %lu\n", ntohl(tcp->th_seq)); - else if (tcp->th_flags & TH_ACK) printf("Ack: %lu\n", ntohl(tcp->th_ack)); - } - } - if (readdata && i < tot_len) { - printf("Data portion:\n"); - while(i < tot_len) printf("%2X%c", data[i], (++i%16)? ' ' : '\n'); - printf("\n"); - } - - return 0; - } */ }; --- 243,246 ---- Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** csocket.h 17 Dec 2006 15:06:37 -0000 1.24 --- csocket.h 21 Dec 2006 16:29:36 -0000 1.25 *************** *** 7,11 **** #include "sock_name.h" #include "sock_time.h" - #include "sock_arp.h" #ifdef WIN32 --- 7,10 ---- *************** *** 200,204 **** if (remoteport) *remoteport = ntohs(sraddress.sin_port); return csocket(domain, type, resultid); ! }else return NULL; } --- 199,203 ---- if (remoteport) *remoteport = ntohs(sraddress.sin_port); return csocket(domain, type, resultid); ! }else csocket(domain, type, -1); } --- NEW FILE: sock_utils.h --- #ifndef ICESOCK_SOCK_TIME_H #define ICESOCK_SOCK_TIME_H #include "sock_types.h" #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #endif #define SUB_TIMEVALS(a,b) (((a).tv_sec - (b).tv_sec) * 1000000 + (a).tv_usec - (b).tv_usec) #ifdef WIN32 #define usleep(t) Sleep((t) / 1000) #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) || defined(__WATCOMC__) #define DELTA_EPOCH_IN_USEC 11644473600000000Ui64 #else #define DELTA_EPOCH_IN_USEC 11644473600000000ULL #endif static u_int64_t filetime_to_unix_epoch (const FILETIME *ft); int gettimeofday (struct timeval *tv, void *tz_U_); #endif void iceusleep(unsigned long); void icesleep(int, int); float timeb_diff(timeb &, timeb &); icestring make_uptime(long); bool file_exists(icestring &fname); icestring find_icefile_path(char *fname); // from Fyodor's "The Art of Port Scanning" int get_random_bytes(void *buf, int numbytes); void init_rand(); #endif Index: sock_name.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_name.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sock_name.cc 21 Dec 2006 15:37:23 -0000 1.1 --- sock_name.cc 21 Dec 2006 16:29:36 -0000 1.2 *************** *** 99,101 **** --- 99,227 ---- } + bool islocal(icestring &ip){ + + } + + icestring get_source_ip(const icestring &destip, icestring &sourceint){ + #ifndef HAVE_LIBDNET + char local_hostname[80]; + if(gethostname(local_hostname, 80)) exit(-1); + + sourceint.assign("null"); //unfortunately, no pcap in cygwin + + icestring ret(local_hostname); + + return ret; + #else + + cethwrapper ew; + + return ew.get_source_ip(destip, sourceint); + + #endif + } + + icestring get_arp_from_cache(icestring &ip) + { + char arp[24]; + + + #ifdef __CYGWIN__ + return ""; + #elif HAVE_LIBDNET + struct arp_entry ae; + + addr_pton(ip.c_str(), &ae.arp_pa); + + arp_t *p = arp_open(); + + arp_get(p, &ae); + + arp_close(p); + + struct sockaddr sa; + + addr_ntos(&(ae.arp_ha), &sa); + + sprintf(arp, "%02x:%02x:%02x:%02x:%02x:%02x", + sa.sa_data[0] & 0xFF, + sa.sa_data[1] & 0xFF, + sa.sa_data[2] & 0xFF, + sa.sa_data[3] & 0xFF, + sa.sa_data[4] & 0xFF, + sa.sa_data[5] & 0xFF); + + icestring ret(arp); + + return ret; + #elif WIN32 && !__WITH_DNET__ + PMIB_IPNETTABLE pIPNetTable = NULL; + PMIB_IPNETROW pIPNetRow = NULL; + ULONG ulSize = 0; + IN_ADDR ia; + + GetIpNetTable(pIPNetTable, &ulSize, TRUE); + pIPNetTable = new MIB_IPNETTABLE[ulSize]; + if (NULL != pIPNetTable) + { + GetIpNetTable(pIPNetTable, &ulSize, TRUE); + + for (int x = 0; x < pIPNetTable->dwNumEntries; x++) + { + pIPNetRow = &(pIPNetTable->table[x]); + ia.S_un.S_addr = pIPNetRow->dwAddr; + + if(!strcmp(inet_ntoa(ia), ip.c_str())){ + sprintf(arp, "%02x:%02x:%02x:%02x:%02x:%02x", + pIPNetRow->bPhysAddr[0] & 0xFF, + pIPNetRow->bPhysAddr[1] & 0xFF, + pIPNetRow->bPhysAddr[2] & 0xFF, + pIPNetRow->bPhysAddr[3] & 0xFF, + pIPNetRow->bPhysAddr[4] & 0xFF, + pIPNetRow->bPhysAddr[5] & 0xFF); + + icestring ret(arp); + + return ret; + } + } + + delete [] pIPNetTable; + + return ""; + } + #elif __linux__ && !__WITH_DNET__ + struct sockaddr_in sin = { 0 }; + struct arpreq myarp = { { 0 } }; + int sockfd; + + sin.sin_family = AF_INET; + inet_aton(ip.c_str(), &sin.sin_addr); + + memcpy(&myarp.arp_pa, &sin, sizeof myarp.arp_pa); + strcpy(myarp.arp_dev, "any"); //UGLY + + if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { + perror("socket"); + return ""; + } + + if (ioctl(sockfd, SIOCGARP, &myarp) == -1) { + return ""; + } + + sprintf(arp, "%02X:%02X:%02X:%02X:%02X:%02X", myarp.arp_ha.sa_data[0] & 0xFF, + myarp.arp_ha.sa_data[1] & 0xFF, + myarp.arp_ha.sa_data[2] & 0xFF, + myarp.arp_ha.sa_data[3] & 0xFF, + myarp.arp_ha.sa_data[4] & 0xFF, + myarp.arp_ha.sa_data[5] & 0xFF); + icestring ret(arp); + + return ret; + #else + return ""; + #endif + } + --- NEW FILE: sock_utils.cc --- #include "sock_time.h" #ifdef WIN32 static u_int64_t filetime_to_unix_epoch (const FILETIME *ft) { u_int64_t res = (u_int64_t) ft->dwHighDateTime << 32; res |= ft->dwLowDateTime; res /= 10; res -= DELTA_EPOCH_IN_USEC; return (res); } int gettimeofday (struct timeval *tv, void *tz_U_) { FILETIME ft; u_int64_t tim; if (!tv) { errno = EINVAL; return (-1); } GetSystemTimeAsFileTime (&ft); tim = filetime_to_unix_epoch (&ft); tv->tv_sec = (long) (tim / 1000000L); tv->tv_usec = (long) (tim % 1000000L); return (0); } #endif void iceusleep(unsigned long usec){ usleep(usec); } void icesleep(int secs, int nsecs = 0){ #ifndef WIN32 struct timespec ts; ts.tv_sec = secs; ts.tv_nsec = nsecs; nanosleep (&ts, NULL); #else usleep(secs + nsecs * 1000); #endif } float timeb_diff(timeb &tp1, timeb &tp2){ float dt; int secs = tp2.time - tp1.time; int msecs = tp2.millitm - tp1.millitm; if(msecs < 0){ secs--; msecs = 1000 + msecs; } dt = secs + 0.001*msecs; return dt; } icestring make_uptime(long t){ char buf[1024]; int msecs = t % (1000); int secs = t/1000 % (60); int mins = t/1000/60 % (60); int hours = t/1000/60/60; double fsecs = secs + (double) msecs/1000; sprintf(buf, "%d hours %d minutes %.3f seconds", hours, mins, fsecs); icestring ret(buf); return ret; } bool file_exists(icestring &fname){ std::ifstream in; in.open(fname.c_str()); bool result = in.is_open(); in.close(); return result; } icestring find_icefile_path(char *fname){ icestring ret; // current dir ret.assign(fname); if(file_exists(ret)) return ret; // datadir ret.assign(""); ret.append(ICESCAN_DATADIR); ret.push_back(TRAILING_SLASH); ret.append(fname); if(file_exists(ret)) return ret; // --data_dir // add some code here // default ret.assign(""); return ret; } // from Fyodor's "The Art of Port Scanning" int get_random_bytes(void *buf, int numbytes) { static char bytebuf[2048]; static char badrandomwarning = 0; static int bytesleft = 0; int tmp; int res; struct timeval tv; FILE *fp = NULL; unsigned int i; short *iptr; if (numbytes < 0 || numbytes > 0xFFFF) return -1; if (bytesleft == 0) { fp = fopen("/dev/arandom", "r"); if (!fp) fp = fopen("/dev/urandom", "r"); if (!fp) fp = fopen("/dev/random", "r"); if (fp) { res = (int) fread(bytebuf, 1, sizeof(bytebuf), fp); if (res != sizeof(bytebuf)) { printf("Failed to read from /dev/urandom or /dev/random\n"); fclose(fp); fp = NULL; } bytesleft = sizeof(bytebuf); } if (!fp) { if (badrandomwarning == 0) { badrandomwarning++; gettimeofday(&tv, NULL); srand((tv.tv_sec ^ tv.tv_usec) ^ getpid()); } for(i=0; i < sizeof(bytebuf) / sizeof(short); i++) { iptr = (short *) ((char *)bytebuf + i * sizeof(short)); *iptr = rand(); } bytesleft = (sizeof(bytebuf) / sizeof(short)) * sizeof(short); } else fclose(fp); } if (numbytes <= bytesleft) { /* we can cover it */ memcpy(buf, bytebuf + (sizeof(bytebuf) - bytesleft), numbytes); bytesleft -= numbytes; return 0; } memcpy(buf, bytebuf + (sizeof(bytebuf) - bytesleft), bytesleft); tmp = bytesleft; bytesleft = 0; return get_random_bytes((char *)buf + tmp, numbytes - tmp); } void init_rand(){ unsigned i; get_random_bytes(&i, sizeof(i)); srand(i); } --- ice_rand.h DELETED --- Index: sock_pcap.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_pcap.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** sock_pcap.h 21 Dec 2006 15:37:23 -0000 1.11 --- sock_pcap.h 21 Dec 2006 16:29:36 -0000 1.12 *************** *** 16,35 **** #endif ! pcap_t* init_pcap(int); ! pcap_t* start_pcap(int, bool, char); ! void listdev_pcap(); ! char* readip_pcap(pcap_t*, unsigned int *, struct timeval *); ! bool pcap_filter(pcap_t *, char *); ! int getdev_pcap(icestring &); ! int pcap_block(pcap_t *, bool); ! void close_pcap(pcap_t *); #endif /* _sock_pcap_H */ --- 16,301 ---- #endif ! class cpcapreader{ ! pcap_t* p; ! ! public: ! ! cpcapreader(int iface, bool block, char *filter_exp = NULL){ ! p = init_pcap(iface); ! pcap_block(p, block); ! if(filter_exp) pcap_filter(p, filter_exp); ! } ! ! void block(bool block){ ! pcap_block(p, block); ! } ! ! bool opened(){ ! return p ? true : false; ! } ! ! char* read_packet(unsigned int *len, struct timeval *rcvd_time){ ! return readip_pcap(p, len, rcvd_time); ! } ! ! static void listdev_pcap(){ ! #ifdef HAVE_LIBPCAP ! pcap_if_t *alldevs; ! pcap_if_t *d; ! int i=0; ! char errbuf[PCAP_ERRBUF_SIZE]; ! ! if(pcap_findalldevs(&alldevs, errbuf) == -1) ! { ! printf("Error in pcap_findalldevs: %s\n", errbuf); ! exit(1); ! } ! ! for(d=alldevs; d; d=d->next) ! { ! printf("%d. %s", ++i, d->name); ! if (d->description) ! printf(" (%s)\n", d->description); ! else ! printf(" (No description available)\n"); ! } ! ! pcap_freealldevs(alldevs); ! if(i==0) ! { ! printf("\nNo interfaces found! Make sure WinPcap is installed.\n"); ! return; ! } ! #endif ! } ! static int getdev_pcap(icestring &dev){ ! #ifdef HAVE_LIBPCAP ! pcap_if_t *alldevs; ! pcap_if_t *d; ! int i=1; ! char errbuf[PCAP_ERRBUF_SIZE]; ! if(pcap_findalldevs(&alldevs, errbuf) == -1) ! { ! printf("Error in pcap_findalldevs: %s\n", errbuf); ! exit(1); ! } ! for(d=alldevs; d; d=d->next, i++) ! { ! if(!strcmp(d->name, dev.c_str())) break; ! } ! if(!d) (i = 0); ! pcap_freealldevs(alldevs); ! ! if(i==0) ! printf("\nNo interfaces found! Make sure WinPcap is installed.\n"); ! ! return i; ! #else ! return 0; ! #endif ! } ! ! ~cpcapreader(){ ! close_pcap(p); ! } ! ! private: ! ! #ifndef HAVE_LIBPCAP ! ! pcap_t* init_pcap(int index = 0){ ! return NULL; ! } ! ! char* readip_pcap(pcap_t* pd, unsigned int *len, struct timeval *rcvd_time){ ! return NULL; ! } ! ! bool pcap_filter(pcap_t *p, char *filter_exp){ ! return true; ! } ! ! int pcap_block(pcap_t *p, bool block){ ! } ! ! void close_pcap(pcap_t *p){ ! } ! ! #else ! ! pcap_t* init_pcap(int index = 0){ ! char *dev; ! char errbuf[PCAP_ERRBUF_SIZE]; ! pcap_t* descr; ! pcap_if_t *alldevs; ! pcap_if_t *d; ! int i=0; ! ! if(index){ ! ! if(pcap_findalldevs(&alldevs, errbuf) == -1) ! { ! printf("Error in pcap_findalldevs: %s\n", errbuf); ! exit(1); ! } ! ! for(d=alldevs; d; d=d->next) ! i++; ! ! if(i==0) ! { ! printf("\nNo interfaces found! Make sure WinPcap/LibPcap is installed.\n"); ! pcap_freealldevs(alldevs); ! return NULL; ! } + for(d=alldevs, i=0; i< index-1 ;d=d->next, i++); + + pcap_t *dev = pcap_open_live(d->name,BUFSIZ,0,-1,errbuf); + + pcap_freealldevs(alldevs); + + return dev; + }else{ + dev = pcap_lookupdev(errbuf); + + if(dev == NULL) + { + return NULL; + } + + return pcap_open_live(dev,BUFSIZ,0,-1,errbuf); + } + + return NULL; + } + + + char* readip_pcap(pcap_t* pd, unsigned int *len, struct timeval *rcvd_time){ + unsigned int offset = 0; + struct pcap_pkthdr head; + char *p; + static char *alignedbuf = NULL; + static unsigned int alignedbufsz = 0; + int link; + + link = pcap_datalink(pd); + + switch(link){ + case DLT_EN10MB: offset = 14; break; + + case DLT_IEEE802: offset = 22; break; + + #ifdef DLT_LOOP + case DLT_LOOP: + #endif + case DLT_NULL: offset = 4; break; + + case DLT_SLIP: + #if (FREEBSD || OPENBSD || NETBSD || BSDI || MACOSX) + offset = 16; + #else + offset = 24; + #endif + break; + case DLT_PPP: + #ifdef DLT_PPP_BSDOS + case DLT_PPP_BSDOS: + #endif + #ifdef DLT_PPP_SERIAL + case DLT_PPP_SERIAL: + #endif + #ifdef DLT_PPP_ETHER + case DLT_PPP_ETHER: + #endif + #if (FREEBSD || OPENBSD || NETBSD || BSDI || MACOSX) + offset = 4; + #else + #ifdef SOLARIS + offset = 8; + #else + offset = 24; + #endif /* solaris */ + #endif /* freebsd || openbsd || netbsd || bsdi */ + break; + case DLT_RAW: offset = 0; break; + case DLT_FDDI: offset = 21; break; + #ifdef DLT_ENC + case DLT_ENC: offset = 12; break; + #endif /* DLT_ENC */ + #ifdef DLT_LINUX_SLL + case DLT_LINUX_SLL: offset = 16; break; + #endif + default: + err_die("FATAL: Unknown datalink type!", 0); + exit(1); + } + + p = (char *) pcap_next(pd, &head); + + if(p){ + if(head.caplen <= offset){ + *len = 0; + return NULL; + } + p += offset; + }else return NULL; + + *len = head.caplen - offset; + + if (*len > alignedbufsz) { + alignedbuf = (char *) realloc(alignedbuf, *len); + if (!alignedbuf) { + err_die("Unable to realloc mem!", 0); + } + alignedbufsz = *len; + } + memcpy(alignedbuf, p, *len); + + if (rcvd_time) { + #if defined(WIN32) + struct timeval tv_end; + + gettimeofday(&tv_end, NULL); + *rcvd_time = tv_end; + #else + rcvd_time->tv_sec = head.ts.tv_sec; + rcvd_time->tv_usec = head.ts.tv_usec; + #endif + } + + return alignedbuf; + } + + + bool pcap_filter(pcap_t *p, char *filter_exp){ + struct bpf_program fp; /* The compiled filter expression */ + + + if (pcap_compile(p, &fp, filter_exp, 0, 0) == -1) { + return false; + } + if (pcap_setfilter(p, &fp) == -1) { + return false; + } + return true; + } + + int pcap_block(pcap_t *p, bool block){ + return pcap_setnonblock(p, (int)(!block), NULL); + } + + void close_pcap(pcap_t *p){ + pcap_close(p); + } + #endif + }; #endif /* _sock_pcap_H */ --- NEW FILE: cethwrapper.h --- (This appears to be a binary file; contents omitted.) --- sock_files.cc DELETED --- |
From: Alexander B. <da...@us...> - 2006-12-21 16:29:40
|
Update of /cvsroot/javanetsim/IceScan/nbproject In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv4099/nbproject Modified Files: configurations.xml Makefile-Default.mk Log Message: no message Index: Makefile-Default.mk =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/Makefile-Default.mk,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile-Default.mk 21 Dec 2006 15:37:24 -0000 1.2 --- Makefile-Default.mk 21 Dec 2006 16:29:37 -0000 1.3 *************** *** 24,35 **** OBJECTFILES= \ build/Default/GNU-Linux-x86/icesockets/sock_win.o \ - build/Default/GNU-Linux-x86/icesockets/sock_eth.o \ build/Default/GNU-Linux-x86/icescan.o \ build/Default/GNU-Linux-x86/icesockets/ice_rand.o \ build/Default/GNU-Linux-x86/csubtarget.o \ build/Default/GNU-Linux-x86/icesockets/sock_name.o \ - build/Default/GNU-Linux-x86/icesockets/sock_pcap.o \ build/Default/GNU-Linux-x86/icediscover.o \ - build/Default/GNU-Linux-x86/icesockets/sock_arp.o \ build/Default/GNU-Linux-x86/icesockets/sock_files.o \ build/Default/GNU-Linux-x86/udpscan.o --- 24,32 ---- *************** *** 59,66 **** $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/sock_win.o icesockets/sock_win.cc - build/Default/GNU-Linux-x86/icesockets/sock_eth.o: icesockets/sock_eth.cc - @${MKDIR} -p build/Default/GNU-Linux-x86/icesockets - $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/sock_eth.o icesockets/sock_eth.cc - build/Default/GNU-Linux-x86/icescan.o: icescan.cc @${MKDIR} -p build/Default/GNU-Linux-x86 --- 56,59 ---- *************** *** 79,94 **** $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/sock_name.o icesockets/sock_name.cc - build/Default/GNU-Linux-x86/icesockets/sock_pcap.o: icesockets/sock_pcap.cc - @${MKDIR} -p build/Default/GNU-Linux-x86/icesockets - $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/sock_pcap.o icesockets/sock_pcap.cc - build/Default/GNU-Linux-x86/icediscover.o: icediscover.cc @${MKDIR} -p build/Default/GNU-Linux-x86 $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icediscover.o icediscover.cc - build/Default/GNU-Linux-x86/icesockets/sock_arp.o: icesockets/sock_arp.cc - @${MKDIR} -p build/Default/GNU-Linux-x86/icesockets - $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/sock_arp.o icesockets/sock_arp.cc - build/Default/GNU-Linux-x86/icesockets/sock_files.o: icesockets/sock_files.cc @${MKDIR} -p build/Default/GNU-Linux-x86/icesockets --- 72,79 ---- Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/configurations.xml,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** configurations.xml 21 Dec 2006 15:37:24 -0000 1.24 --- configurations.xml 21 Dec 2006 16:29:37 -0000 1.25 *************** *** 3,6 **** --- 3,7 ---- <logicalFolder name="root" displayName="root" projectFiles="true"> <logicalFolder name="icesockets" displayName="icesockets" projectFiles="true"> + <itemPath>icesockets/cethwrapper.h</itemPath> <itemPath>icesockets/crawsocket.h</itemPath> <itemPath>icesockets/csocket.h</itemPath> *************** *** 10,23 **** <itemPath>icesockets/iceregex.h</itemPath> <itemPath>icesockets/queue.h</itemPath> - <itemPath>icesockets/sock_arp.cc</itemPath> - <itemPath>icesockets/sock_arp.h</itemPath> <itemPath>icesockets/sock_err.h</itemPath> - <itemPath>icesockets/sock_eth.cc</itemPath> - <itemPath>icesockets/sock_eth.h</itemPath> <itemPath>icesockets/sock_files.cc</itemPath> <itemPath>icesockets/sock_files.h</itemPath> <itemPath>icesockets/sock_name.cc</itemPath> <itemPath>icesockets/sock_name.h</itemPath> - <itemPath>icesockets/sock_pcap.cc</itemPath> <itemPath>icesockets/sock_pcap.h</itemPath> <itemPath>icesockets/sock_time.h</itemPath> --- 11,19 ---- *************** *** 127,133 **** <itemTool>3</itemTool> </item> - <item path="icesockets/sock_arp.h"> - <itemTool>3</itemTool> - </item> <item path="icedbs.h"> <itemTool>3</itemTool> --- 123,126 ---- *************** *** 145,151 **** <itemTool>3</itemTool> </item> - <item path="icesockets/sock_eth.h"> - <itemTool>3</itemTool> - </item> <item path="icediscover.h"> <itemTool>3</itemTool> --- 138,141 ---- *************** *** 176,189 **** </ccCompilerTool> </item> - <item path="icesockets/sock_arp.cc"> - <itemTool>1</itemTool> - <ccCompilerTool> - </ccCompilerTool> - </item> - <item path="icesockets/sock_eth.cc"> - <itemTool>1</itemTool> - <ccCompilerTool> - </ccCompilerTool> - </item> <item path="icesockets/sock_files.cc"> <itemTool>1</itemTool> --- 166,169 ---- *************** *** 196,204 **** </ccCompilerTool> </item> - <item path="icesockets/sock_pcap.cc"> - <itemTool>1</itemTool> - <ccCompilerTool> - </ccCompilerTool> - </item> <item path="icesockets/sock_win.cc"> <itemTool>1</itemTool> --- 176,179 ---- *************** *** 216,219 **** --- 191,197 ---- </ccCompilerTool> </item> + <item path="icesockets/cethwrapper.h"> + <itemTool>3</itemTool> + </item> </conf> </confs> |
From: Alexander B. <da...@us...> - 2006-12-21 15:37:29
|
Update of /cvsroot/javanetsim/IceScan/nbproject In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15392/nbproject Modified Files: configurations.xml Makefile-Default.mk Log Message: no message Index: Makefile-Default.mk =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/Makefile-Default.mk,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile-Default.mk 28 Nov 2006 17:57:54 -0000 1.1 --- Makefile-Default.mk 21 Dec 2006 15:37:24 -0000 1.2 *************** *** 23,27 **** # Object Files OBJECTFILES= \ ! build/Default/GNU-Linux-x86/icescan.o # C Compiler Flags --- 23,37 ---- # Object Files OBJECTFILES= \ ! build/Default/GNU-Linux-x86/icesockets/sock_win.o \ ! build/Default/GNU-Linux-x86/icesockets/sock_eth.o \ ! build/Default/GNU-Linux-x86/icescan.o \ ! build/Default/GNU-Linux-x86/icesockets/ice_rand.o \ ! build/Default/GNU-Linux-x86/csubtarget.o \ ! build/Default/GNU-Linux-x86/icesockets/sock_name.o \ ! build/Default/GNU-Linux-x86/icesockets/sock_pcap.o \ ! build/Default/GNU-Linux-x86/icediscover.o \ ! build/Default/GNU-Linux-x86/icesockets/sock_arp.o \ ! build/Default/GNU-Linux-x86/icesockets/sock_files.o \ ! build/Default/GNU-Linux-x86/udpscan.o # C Compiler Flags *************** *** 45,52 **** --- 55,102 ---- ${LINK.cc} -o /home/key/IceScan/icescan ${OBJECTFILES} ${LDLIBSOPTIONS} + build/Default/GNU-Linux-x86/icesockets/sock_win.o: icesockets/sock_win.cc + @${MKDIR} -p build/Default/GNU-Linux-x86/icesockets + $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/sock_win.o icesockets/sock_win.cc + + build/Default/GNU-Linux-x86/icesockets/sock_eth.o: icesockets/sock_eth.cc + @${MKDIR} -p build/Default/GNU-Linux-x86/icesockets + $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/sock_eth.o icesockets/sock_eth.cc + build/Default/GNU-Linux-x86/icescan.o: icescan.cc @${MKDIR} -p build/Default/GNU-Linux-x86 $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icescan.o icescan.cc + build/Default/GNU-Linux-x86/icesockets/ice_rand.o: icesockets/ice_rand.cc + @${MKDIR} -p build/Default/GNU-Linux-x86/icesockets + $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/ice_rand.o icesockets/ice_rand.cc + + build/Default/GNU-Linux-x86/csubtarget.o: csubtarget.cc + @${MKDIR} -p build/Default/GNU-Linux-x86 + $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/csubtarget.o csubtarget.cc + + build/Default/GNU-Linux-x86/icesockets/sock_name.o: icesockets/sock_name.cc + @${MKDIR} -p build/Default/GNU-Linux-x86/icesockets + $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/sock_name.o icesockets/sock_name.cc + + build/Default/GNU-Linux-x86/icesockets/sock_pcap.o: icesockets/sock_pcap.cc + @${MKDIR} -p build/Default/GNU-Linux-x86/icesockets + $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/sock_pcap.o icesockets/sock_pcap.cc + + build/Default/GNU-Linux-x86/icediscover.o: icediscover.cc + @${MKDIR} -p build/Default/GNU-Linux-x86 + $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icediscover.o icediscover.cc + + build/Default/GNU-Linux-x86/icesockets/sock_arp.o: icesockets/sock_arp.cc + @${MKDIR} -p build/Default/GNU-Linux-x86/icesockets + $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/sock_arp.o icesockets/sock_arp.cc + + build/Default/GNU-Linux-x86/icesockets/sock_files.o: icesockets/sock_files.cc + @${MKDIR} -p build/Default/GNU-Linux-x86/icesockets + $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/icesockets/sock_files.o icesockets/sock_files.cc + + build/Default/GNU-Linux-x86/udpscan.o: udpscan.cc + @${MKDIR} -p build/Default/GNU-Linux-x86 + $(COMPILE.cc) -g -o build/Default/GNU-Linux-x86/udpscan.o udpscan.cc + # Subprojects .build-subprojects: Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/configurations.xml,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** configurations.xml 21 Dec 2006 13:59:50 -0000 1.23 --- configurations.xml 21 Dec 2006 15:37:24 -0000 1.24 *************** *** 6,20 **** --- 6,27 ---- <itemPath>icesockets/csocket.h</itemPath> <itemPath>icesockets/getaddrinfo.h</itemPath> + <itemPath>icesockets/ice_rand.cc</itemPath> <itemPath>icesockets/ice_rand.h</itemPath> <itemPath>icesockets/iceregex.h</itemPath> <itemPath>icesockets/queue.h</itemPath> + <itemPath>icesockets/sock_arp.cc</itemPath> <itemPath>icesockets/sock_arp.h</itemPath> <itemPath>icesockets/sock_err.h</itemPath> + <itemPath>icesockets/sock_eth.cc</itemPath> <itemPath>icesockets/sock_eth.h</itemPath> + <itemPath>icesockets/sock_files.cc</itemPath> <itemPath>icesockets/sock_files.h</itemPath> + <itemPath>icesockets/sock_name.cc</itemPath> <itemPath>icesockets/sock_name.h</itemPath> + <itemPath>icesockets/sock_pcap.cc</itemPath> <itemPath>icesockets/sock_pcap.h</itemPath> <itemPath>icesockets/sock_time.h</itemPath> <itemPath>icesockets/sock_types.h</itemPath> + <itemPath>icesockets/sock_win.cc</itemPath> <itemPath>icesockets/sock_win.h</itemPath> </logicalFolder> *************** *** 35,42 **** --- 42,51 ---- <itemPath>TODO</itemPath> </logicalFolder> + <itemPath>csubtarget.cc</itemPath> <itemPath>csubtarget.h</itemPath> <itemPath>ctarget.h</itemPath> <itemPath>defwin.h</itemPath> <itemPath>icedbs.h</itemPath> + <itemPath>icediscover.cc</itemPath> <itemPath>icediscover.h</itemPath> <itemPath>iceoutput.h</itemPath> *************** *** 47,50 **** --- 56,60 ---- <itemPath>nbt_wrapper.h</itemPath> <itemPath>portdef.h</itemPath> + <itemPath>udpscan.cc</itemPath> <itemPath>udpscan.h</itemPath> </logicalFolder> *************** *** 156,159 **** --- 166,219 ---- <itemTool>3</itemTool> </item> + <item path="csubtarget.cc"> + <itemTool>1</itemTool> + <ccCompilerTool> + </ccCompilerTool> + </item> + <item path="icesockets/ice_rand.cc"> + <itemTool>1</itemTool> + <ccCompilerTool> + </ccCompilerTool> + </item> + <item path="icesockets/sock_arp.cc"> + <itemTool>1</itemTool> + <ccCompilerTool> + </ccCompilerTool> + </item> + <item path="icesockets/sock_eth.cc"> + <itemTool>1</itemTool> + <ccCompilerTool> + </ccCompilerTool> + </item> + <item path="icesockets/sock_files.cc"> + <itemTool>1</itemTool> + <ccCompilerTool> + </ccCompilerTool> + </item> + <item path="icesockets/sock_name.cc"> + <itemTool>1</itemTool> + <ccCompilerTool> + </ccCompilerTool> + </item> + <item path="icesockets/sock_pcap.cc"> + <itemTool>1</itemTool> + <ccCompilerTool> + </ccCompilerTool> + </item> + <item path="icesockets/sock_win.cc"> + <itemTool>1</itemTool> + <ccCompilerTool> + </ccCompilerTool> + </item> + <item path="udpscan.cc"> + <itemTool>1</itemTool> + <ccCompilerTool> + </ccCompilerTool> + </item> + <item path="icediscover.cc"> + <itemTool>1</itemTool> + <ccCompilerTool> + </ccCompilerTool> + </item> </conf> </confs> |
From: Alexander B. <da...@us...> - 2006-12-21 15:37:28
|
Update of /cvsroot/javanetsim/IceScan/.deps In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15392/.deps Modified Files: .cvsignore Log Message: no message Index: .cvsignore =================================================================== RCS file: /cvsroot/javanetsim/IceScan/.deps/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 21 Dec 2006 13:16:26 -0000 1.1 --- .cvsignore 21 Dec 2006 15:37:24 -0000 1.2 *************** *** 1 **** --- 1,12 ---- icescan.Po + ice_rand.Po + sock_files.Po + sock_eth.Po + sock_name.Po + sock_time.Po + icediscover.Po + sock_win.Po + sock_pcap.Po + csubtarget.Po + udpscan.Po + sock_arp.Po |
From: Alexander B. <da...@us...> - 2006-12-21 15:37:28
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15392 Modified Files: .cvsignore Makefile.am icescan.cc udpscan.h icediscover.h csubtarget.h portdef.h iceoutput.h icedbs.h Makefile.in Added Files: icediscover.cc csubtarget.cc udpscan.cc Log Message: no message Index: .cvsignore =================================================================== RCS file: /cvsroot/javanetsim/IceScan/.cvsignore,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** .cvsignore 21 Dec 2006 13:16:26 -0000 1.7 --- .cvsignore 21 Dec 2006 15:37:23 -0000 1.8 *************** *** 3,5 **** icescan config.log ! icescan icescan.o Makefile icescan.exe IceScan.exe Makefile.in autom4te.cache --- 3,11 ---- icescan config.log ! icescan ! icescan.o ! Makefile ! icescan.exe ! IceScan.exe ! Makefile.in ! autom4te.cache Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** icescan.cc 18 Dec 2006 07:51:56 -0000 1.37 --- icescan.cc 21 Dec 2006 15:37:23 -0000 1.38 *************** *** 1,4 **** ! #include <string> ! #include "icesockets/csocket.h" #include "iceparams.h" #include "iceversion.h" --- 1,25 ---- ! /* ! * icescan.cc -- Contains the main() function of IceScan and functions ! * to parse command line args and print help; ! */ ! ! /* ! * Copyright (C) 2006 by Alexander Bolshev[Key] <key(at)timeold.ru> ! * ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License version 2 ! * as published by the Free Software Foundation, ! * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! * ! */ ! #include "iceparams.h" #include "iceversion.h" *************** *** 6,9 **** --- 27,31 ---- #include "icedbs.h" #include "ctarget.h" + #include "icesockets/csocket.h" #include "icesockets/ice_rand.h" Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** csubtarget.h 21 Dec 2006 10:13:53 -0000 1.53 --- csubtarget.h 21 Dec 2006 15:37:23 -0000 1.54 *************** *** 2,20 **** #define CSUBTARGET_H - #include <cstdio> - #include <cstdlib> - #include <map> - #include <vector> - #include <errno.h> - #include "portdef.h" #include "iceoutput.h" #include "iceparams.h" - - //#ifndef WIN32 #include "nbt_wrapper.h" - //#endif - #include "iceprotocol.h" #include "icesockets/sock_pcap.h" #define CONNECT_TIMEOUT 14 --- 2,12 ---- #define CSUBTARGET_H #include "iceoutput.h" #include "iceparams.h" #include "nbt_wrapper.h" #include "iceprotocol.h" #include "icesockets/sock_pcap.h" + #include "icediscover.h" + #include "portdef.h" #define CONNECT_TIMEOUT 14 *************** *** 31,40 **** #define MAX_CLOSED 7 - class csubtarget; - //#include "udpscan.h" - bool udpscan(icestring destname, std::map <int, scanning_port> scanning_ports, iceparams *par, iceoutput *out, csubtarget * subtarget, bool isscan); - - #include "icediscover.h" - struct scan_socket{ int sid; --- 23,26 ---- *************** *** 71,227 **** std::vector<scanned_port> subtarget_ports; ! csubtarget(icestring hostname, icestring reverse_hostname, iceparams *par, iceoutput *out){ ! ! struct scanned_port sp; ! ! subtarget_ports.push_back(sp); ! ! this->hostname.assign(hostname); ! this->reversed_hostname.assign(reverse_hostname); ! this->par = par; ! this->out = out; ! discovered = false; ! init_scan_sockets(); ! ! source_ip = get_source_ip(hostname, source_iface); ! } ! ! bool discover(){ ! struct timeb tp1, tp2; ! ! ftime(&tp1); ! discovered = host_discover(hostname.c_str(), par, out); ! ftime(&tp2); ! if(par->verbose) *out << "Discovery taken " << timeb_diff(tp1, tp2) << " seconds.\n"; ! ! return discovered; ! } ! void scan(){ ! if(par->scan_type == TCP_CONNECT_SCAN) connect_scan(); ! if(par->scan_type == NBT_SCAN) nbt_scan(); ! if(par->scan_type == PROT_SCAN) prot_scan(); ! if(par->scan_type == FIN_SCAN) raw_tcp_scan("FIN"); ! if(par->scan_type == NULL_SCAN) raw_tcp_scan("NULL"); ! if(par->scan_type == XMAS_SCAN) raw_tcp_scan("XMAS"); ! if(par->scan_type == WINDOW_SCAN) raw_tcp_scan("window"); ! if(par->scan_type == ACK_SCAN) raw_tcp_scan("ACK"); ! if(par->scan_type == SYN_SCAN) raw_tcp_scan("SYN"); ! if(par->scan_type == UDP_SCAN) udp_scan(); ! } ! void mac_discover(){ ! #ifndef __CYGWIN__ ! icestring mac = get_arp_from_cache(hostname); ! ! 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 ! } ! int prot_scan(){ ! // cprotocol_scan cps(par, out); ! // cps.test(hostname.c_str()); ! ! return 0; ! } ! ! int nbt_scan(){ ! // NetBIOS scan, -SB ! char output_buf[255]; ! ! if(par->verbose>0){ ! sprintf(output_buf, "Starting NetBIOS scan against %s...", hostname.c_str()); ! out->line(output_buf); ! } ! ! cnbtwrapper wrap(par); ! ! wrap.test(hostname.c_str(), 137); ! if(par->verbose>0){ ! Bzero(output_buf, 255); ! sprintf(output_buf, "NetBIOS scan finished.", hostname.c_str()); ! out->line(output_buf); ! } ! ! return 0; ! } ! int udp_scan(){ ! //udp scan, -SU ! ! char output_buf[255]; ! char local_hostname[80]; ! icestring local_hn; ! ! std::map <int, scanning_port> scanning_ports; ! init_scanning_ports(hostname, par, (int) SOCK_DGRAM, scanning_ports); ! ! if(par->verbose>0){ ! sprintf(output_buf, "Starting UDP scan against %s...", hostname.c_str()); ! out->line(output_buf); ! } ! ! udpscan(hostname, scanning_ports, par, out, this, true); ! ! show_ports(); ! ! if(par->verbose>0) ! out->line("UDP scan finished."); ! ! scanning_ports.clear(); ! ! return 0; ! } ! ! int connect_scan(){ ! // connect scan, -ST ! ! char output_buf[255]; ! ! domain = (int) SOCK_STREAM; ! ! std::map <int, scanning_port> scanning_ports; ! init_scanning_ports(hostname, par, (int) SOCK_STREAM, scanning_ports); ! ! if(par->verbose>0){ ! sprintf(output_buf, "Starting tcp connect() scan against %s...", hostname.c_str()); ! out->line(output_buf); ! } ! int j = initiate_connect(scanning_ports); ! ! while( ! do_select_round_connect(scanning_ports, subtarget_ports) ) iceusleep(1000); ! show_ports(); ! ! if(par->verbose>0) ! out->line("Connect() scan finished."); ! ! scanning_ports.clear(); ! return 0; ! } ! void set_port_status(int port, enum port_status status, char* protocol){ ! struct scanned_port sp; ! sp.port_number = port; ! sp.status = status; ! subtarget_ports.push_back(sp); ! print_port_status(sp.port_number, status, protocol); ! } private: --- 57,79 ---- std::vector<scanned_port> subtarget_ports; ! csubtarget(icestring hostname, icestring reverse_hostname, iceparams *par, iceoutput *out); ! bool discover(); ! void scan(); ! void mac_discover(); ! int prot_scan(); ! int nbt_scan(); ! int udp_scan(); ! int connect_scan(); ! void set_port_status(int port, enum port_status status, char* protocol); ! ~csubtarget(); private: *************** *** 232,861 **** int sockets_size; ! void init_scan_sockets(){ ! sockets_size = ICE_FD_SETSIZE*2/3; ! ! scan_sockets = (struct scan_socket *) malloc(sizeof(scan_socket) * (sockets_size+1)); ! ! for(int i = 0; i < sockets_size; i++){ ! scan_sockets[i].busy = false; ! scan_sockets[i].sid = -1; ! } ! free_sockets = sockets_size; ! } ! ! enum port_status get_no_response_status(){ ! switch(par->scan_type){ ! case FIN_SCAN: ! case NULL_SCAN: ! case XMAS_SCAN: ! return PORT_OPEN_FILTERED; ! break; ! case WINDOW_SCAN: ! case ACK_SCAN: ! case SYN_SCAN: ! return PORT_FILTERED; ! break; ! } ! } ! ! int get_first_free_socket(){ ! int f; ! ! for(f = 0; f < sockets_size; f++) ! if(!scan_sockets[f].busy && scan_sockets[f].sid < 0) ! return f; ! ! return -1; ! } ! ! void init_scanning_ports(icestring hostname, iceparams *par, int domain, std::map <int, scanning_port> &scanning_ports){ ! for(int j = 0; j<par->ports.size(); j++){ ! port_range pr = par->ports[j]; ! ! for(int i = pr.lower_port; i <= pr.upper_port; i++){ ! if(scanning_ports.find(i) == scanning_ports.end()){ ! struct scanning_port sp; ! sp.port_number = i; ! scanning_ports[i] = sp; ! scanning_ports[i].attempt = 0; ! scanning_ports[i].done = false; ! } ! } ! } ! ! if(domain == SOCK_RAW) return; ! ! std::map <int, scanning_port>::iterator i; ! int j; ! ! for(i = scanning_ports.begin(), j = 0; i!= scanning_ports.end(); ++i, j++){ ! if(j < sockets_size){ ! csocket c(AF_INET, domain); ! scan_sockets[j].domain = domain; ! scan_sockets[j].sid = c.get_socketid(); ! maxfd = scan_sockets[j].sid; ! scan_sockets[j].busy = true; ! (*i).second.socket_ptr = j; ! free_sockets--; ! }else{ ! (*i).second.socket_ptr = -1; ! } ! } ! ! } ! ! int initiate_connect(std::map <int, scanning_port> &scanning_ports){ ! std::map <int, scanning_port>::iterator i; ! FD_ZERO(&fd_r); ! FD_ZERO(&fd_w); ! FD_ZERO(&fd_x); ! ! int j; ! ! ! for(i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ //check FD_SET ! //DBGOUTPUT((*i).first); ! if((*i).second.socket_ptr != -1){ ! //DBGOUTPUT("!!!!!"); ! ! j = (*i).second.socket_ptr; ! csocket c(AF_INET, scan_sockets[j].domain, scan_sockets[j].sid); ! ! c.nonblock(true); ! ! FD_SET(scan_sockets[j].sid, &fd_w); ! FD_SET(scan_sockets[j].sid, &fd_r); ! FD_SET(scan_sockets[j].sid, &fd_x); ! ! (*i).second.time = time(0); ! ! int rc = c.connect(hostname.c_str(), (*i).first, 0); ! ! } ! } ! ! return j; ! } ! ! int get_max_fd(){ ! int max = -1; ! ! for(int f = 0; f < sockets_size; f++) ! if(scan_sockets[f].sid > max) ! max = scan_sockets[f].sid; ! ! return max; ! } ! ! /* This function implements any type of raw tcp scan, ! * e.g. ACK, FIN and etc. ! */ ! void raw_tcp_scan(icestring scan_type){ ! std::map <int, scanning_port> scanning_ports; ! struct sockaddr_in saddress; ! int len; ! int MAGIC_PORT = csocket::getMagicPort(SOCK_DGRAM, 100); ! ! if(par->verbose > 0) ! *out << "Starting TCP " << scan_type << " scan against " << hostname.c_str() << "...\n"; ! ! #if (__CYGWIN__) ! if(!par->forceuid){ ! #else ! if(getuid() && (par->forceuid != true)){ ! #endif ! out->line("UID isn't 0, so can't create raw socket/load pcap => no RAW tcp scan..."); ! return; ! } ! ! pcap_t* p; ! ! if(par->source_iface) ! p = init_pcap(par->source_iface); ! else ! p = init_pcap(getdev_pcap(source_iface)); ! ! ! if(p == NULL){ ! out->line("Can't open pcap: no raw tcp scan. Exitting."); ! return; ! } ! ! ! len = make_sockname(saddress, hostname.c_str(), 0, domain); ! ! icestring source(source_ip); ! ! init_scanning_ports(hostname, par, (int) SOCK_RAW, scanning_ports); ! ! crawsocket rawsend(AF_INET, (int) SOCK_RAW, IPPROTO_RAW); ! int one = 1; ! ! #ifdef WIN32 ! const BOOL val = TRUE; ! #else ! const int val = 1; ! #endif ! ! if (setsockopt (rawsend.get_socketid(), IPPROTO_IP, IP_HDRINCL, (char *) &val, sizeof (one)) != 0) ! perror("Setsockopt HDRINCL:"); ! ! ! int l = scanning_ports.size()/MAX_PACKETS; ! if(scanning_ports.size() % MAX_PACKETS != 0) l++; ! ! char filter_exp[256]; ! ! sprintf(filter_exp, "port %d host %s tcp", MAGIC_PORT, hostname.c_str()); ! ! pcap_filter(p, filter_exp); ! ! pcap_block(p, false); ! ! int maxat; ! ! int covar = 10000; ! ! int attempts = 0; ! while(attempts++ < 5){ ! int j = 0; ! while(j < l){ ! std::map <int, scanning_port>::iterator i = scanning_ports.begin(); ! ! maxat = 0; ! ! for(int k=0; k < MAX_PACKETS*j; k++) i++; ! ! for(int k = j*MAX_PACKETS; (k < (j+1)*MAX_PACKETS) && i!= scanning_ports.end(); ++i, k++){ ! if(! (*i).second.done ){ ! switch(par->scan_type){ ! case FIN_SCAN: ! rawsend.send_tcp_raw(par->ethernet, source, hostname, MAGIC_PORT, (*i).first, 0, 0, TH_FIN | par->tcpflags, 0, 0, 0); ! break; ! ! case NULL_SCAN: ! rawsend.send_tcp_raw(par->ethernet, source, hostname, MAGIC_PORT, (*i).first, 0, 0, par->tcpflags, 0, 0, 0); ! break; ! ! case XMAS_SCAN: ! rawsend.send_tcp_raw(par->ethernet, source, hostname, MAGIC_PORT, (*i).first, 0, 0, TH_FIN | TH_URG | TH_PUSH | par->tcpflags, 0, 0, 0); ! break; ! ! case WINDOW_SCAN: ! case ACK_SCAN: ! rawsend.send_tcp_raw(par->ethernet, source, hostname, MAGIC_PORT, (*i).first, 0, 0, TH_ACK, 0, 0, 0); ! break; ! ! case SYN_SCAN: ! rawsend.send_tcp_raw(par->ethernet, source, hostname, MAGIC_PORT, (*i).first, 0, 0, TH_SYN, 0, 0, 0); ! break; ! } ! ! ! gettimeofday(&((*i).second.tv), 0); ! ! (*i).second.attempt++; ! ! maxat++; ! ! recieve_tcp_raw(p, rawsend, source, saddress, scanning_ports, MAGIC_PORT, 10, 0); ! } ! } ! ! j++; ! ! //iceusleep(1000); ! recieve_tcp_raw(p, rawsend, source, saddress, scanning_ports, MAGIC_PORT, (maxat) * covar + 10000, maxat); ! ! //DBGOUTPUT(covar); ! } ! } ! for(std::map <int, scanning_port>::iterator i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ ! if(! (*i).second.done){ ! (*i).second.done = true; ! set_port_status((*i).first, get_no_response_status(), "tcp"); ! } ! } ! ! scanning_ports.clear(); ! ! show_ports(); ! ! if(par->verbose>0) ! *out << "TCP " << scan_type << " scan finished.\n"; ! ! close_pcap(p); ! } ! int recieve_tcp_raw(pcap_t* p, crawsocket &rawsend, icestring &source, struct sockaddr_in &saddress, std::map <int, scanning_port> &scanning_ports, int MAGIC_PORT, int timeout, int packets){ ! int bytes; ! char *response; ! struct iphdr *ip; ! struct tcphdr *tcp; ! unsigned int len; ! int maxtimeval = 0; ! struct timeval tv1, tv2, tv3; ! gettimeofday(&tv1, 0); ! bool stop = false; ! int port; ! ! //DBGOUTPUT("!!!!!"); ! //while( bytes = rawrecv.recvfrom(response, 65535, 0, NULL) > 0){ ! while(!stop){ ! response = readip_pcap(p, &len, NULL); ! port = 0; ! //DBGOUTPUT("while"); ! if(response){ ! //DBGOUTPUT("response"); ! ip = (struct iphdr *) response; ! if(ip->saddr == saddress.sin_addr.s_addr && ip->protocol == IPPROTO_TCP){ ! tcp = (struct tcphdr *) (response + 4 * ip->ihl); ! ! if ((tcp->th_flags & TH_RST) && (par->scan_type == FIN_SCAN || par->scan_type == NULL_SCAN || par->scan_type == XMAS_SCAN)) { ! port = ntohs(tcp->th_sport); ! ! if(scanning_ports.find(port) != scanning_ports.end()){ ! if(!scanning_ports[port].done){ ! set_port_status(port, PORT_CLOSED, "tcp"); ! scanning_ports[port].done = true; ! } ! } ! }else if ((tcp->th_flags & TH_RST) && (par->scan_type == WINDOW_SCAN)) { ! int port = ntohs(tcp->th_sport); ! ! if(scanning_ports.find(port) != scanning_ports.end()){ ! if(!scanning_ports[port].done){ ! scanning_ports[port].done = true; ! if(tcp->th_win == 0){ ! set_port_status(port, PORT_CLOSED, "tcp"); ! }else{ ! set_port_status(port, PORT_OPEN, "tcp"); ! } ! } ! } ! }else if ((tcp->th_flags & TH_RST) && (par->scan_type == ACK_SCAN)) { ! int port = ntohs(tcp->th_sport); ! ! ! if(scanning_ports.find(port) != scanning_ports.end()){ ! if(!scanning_ports[port].done){ ! set_port_status(port, PORT_UNFILTERED, "tcp"); ! scanning_ports[port].done = true; ! } ! } ! }else if ((tcp->th_flags & TH_RST) && (par->scan_type == SYN_SCAN)) { ! int port = ntohs(tcp->th_sport); ! ! if(port != MAGIC_PORT){ ! ! if(scanning_ports.find(port) != scanning_ports.end()){ ! if(!scanning_ports[port].done){ ! scanning_ports[port].done = true; ! set_port_status(port, PORT_CLOSED, "tcp"); ! } ! } ! } ! }else if ((tcp->th_flags & (TH_ACK|TH_SYN)) && (par->scan_type == SYN_SCAN)) { ! int port = ntohs(tcp->th_sport); ! ! if(port != MAGIC_PORT){ ! if(scanning_ports.find(port) != scanning_ports.end()){ ! if(!scanning_ports[port].done){ ! set_port_status(port, PORT_OPEN, "tcp"); ! rawsend.send_tcp_raw(par->ethernet, source, hostname, MAGIC_PORT, port, 0, 0, TH_RST, 0, 0, 0); ! scanning_ports[port].done = true; ! } ! } ! } ! } ! //bzero(response, 65534); ! } ! } ! gettimeofday(&tv2, 0); ! ! if(port){ ! if(SUB_TIMEVALS(tv2,scanning_ports[port].tv) > maxtimeval) ! maxtimeval = SUB_TIMEVALS(tv2,scanning_ports[port].tv); ! } ! if(SUB_TIMEVALS(tv2,tv1) >= timeout || SUB_TIMEVALS(tv2,tv1) > MAX_RAW_WAIT + packets * 500) ! stop = true; ! } ! ! return maxtimeval; ! } ! void shutdown_scansocket(int j){ ! csocket c(AF_INET, scan_sockets[j].domain, scan_sockets[j].sid); ! ! FD_CLR(c.get_socketid(), &fd_w); ! FD_CLR(c.get_socketid(), &fd_r); ! FD_CLR(c.get_socketid(), &fd_x); ! ! c.shutdown(); ! c.close(); ! ! free_sockets++; ! scan_sockets[j].busy = false; ! scan_sockets[j].sid = -1; ! } ! ! int get_first_idle_scanning_port(std::map <int, scanning_port> &scanning_ports){ ! std::map <int, scanning_port>::iterator i; ! ! //DBGOUTPUT("GFISP"); ! ! for(i = --scanning_ports.end(); i!= scanning_ports.begin(); --i){ ! if((*i).second.socket_ptr == -1 && (! (*i).second.done)) ! return (*i).first; ! } ! ! return -1; ! } ! ! void idle_status_dispatcher(std::map <int, scanning_port> &scanning_ports, int prt){ ! if(prt>=0 && free_sockets > 1){ ! int f = get_first_free_socket(); ! if(f < 0) return; ! csocket c(AF_INET, (int) domain); ! scan_sockets[f].sid = c.get_socketid(); ! scan_sockets[f].busy = true; ! scanning_ports[prt].socket_ptr = f; ! free_sockets--; ! //DBGOUTPUT(prt); ! c.nonblock(true); ! //DBGOUTPUT("!!!"); ! FD_SET(c.get_socketid(), &fd_w); ! FD_SET(c.get_socketid(), &fd_r); ! FD_SET(c.get_socketid(), &fd_x); ! ! //DBGOUTPUT(scanning_ports[prt].hostname); ! //int rc = make_connect(&c, hostname, prt); ! c.connect(hostname.c_str(), prt, 0); ! ! scanning_ports[prt].time = time(0); ! //DBGOUTPUT("Connecting to " << prt << " using socket id " << scanning_ports[prt].c->get_socketid()); ! //DBGOUTPUT("!!!"); ! //iceusleep(10000); ! } ! } ! ! void print_port_status(int port, enum port_status ps, char* protocol){ ! char output_buf[255]; ! ! if(ps == PORT_OPEN && par->verbose >= 1){ ! sprintf(output_buf, "Discovered open port %d/%s on %s.", port, protocol, hostname.c_str()); ! out->line(output_buf); ! }else if(ps == PORT_CLOSED && par->verbose > 1){ ! sprintf(output_buf, "Discovered closed port %d/%s on %s.", port, protocol, hostname.c_str()); ! out->line(output_buf); ! }else if(ps == PORT_FILTERED && par->verbose > 2){ ! sprintf(output_buf, "Discovered filtered port %d/%s on %s.", port, protocol, hostname.c_str()); ! out->line(output_buf); ! }else if(ps == PORT_OPEN_FILTERED && par->verbose > 2){ ! sprintf(output_buf, "Discovered open|filtered port %d/%s on %s.", port, protocol, hostname.c_str()); ! out->line(output_buf); ! }else if(ps == PORT_UNFILTERED && par->verbose > 1){ ! sprintf(output_buf, "Discovered unfiltered port %d/%s on %s.", port, protocol, hostname.c_str()); ! out->line(output_buf); ! } ! } // return true if scanning_ports are empty bool do_select_round_connect(std::map <int, scanning_port> &scanning_ports, ! std::vector<scanned_port> &subtarget_ports){ ! fd_set fd_rtmp, fd_wtmp, fd_xtmp; ! struct timeval tv; ! int s, err; ! int res; ! int sopt; ! #if (WIN32 || __CYGWIN__ || __linux__) ! int soptlen = sizeof(int); ! #else ! int soptlen; ! #endif ! bool done = true; ! ! maxfd = get_max_fd(); ! ! fd_rtmp = fd_r; fd_wtmp = fd_w; fd_xtmp = fd_x; ! std::map <int, scanning_port>::iterator i,j; ! ! do{ ! tv.tv_sec = 0; tv.tv_usec = 10000; ! ! #ifndef WIN32 ! s = select(maxfd + 1, &fd_rtmp, &fd_wtmp, &fd_xtmp, &tv); ! #else ! s = select(0, &fd_rtmp, &fd_wtmp, &fd_xtmp, &tv); ! #endif ! err = errno; ! //perror("select"); DBGOUTPUT(s); ! ! }while(s = -1 && err == EINTR); ! ! int curtime = time(0); ! ! for(i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ ! ! if((*i).second.done) continue; ! if( (*i).second.socket_ptr == -1){ ! idle_status_dispatcher(scanning_ports, (*i).first); ! done = false; ! continue; ! } ! ! ! enum port_status status = PORT_UNKNOWN; ! if(s >= 0 && (FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_rtmp) || ! FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_wtmp) || ! FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_xtmp))){ ! ! csocket c(AF_INET, (int) domain, scan_sockets[(*i).second.socket_ptr].sid); ! ! c.getsockopt(SOL_SOCKET, SO_ERROR, (char *)&sopt, (socklen_t*) &soptlen); ! ! switch(sopt){ ! case 0: ! #ifdef __CYGWIN__ ! if(false){ ! #else ! if(FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_r)){ ! status = PORT_OPEN; ! #endif ! }else{ ! DBGOUTPUT("WRITE"); ! iceusleep(20000); ! res = c.write("", 0, 0); ! DBGOUTPUT("/WRITE" << res); ! if(res < 0){ ! status = PORT_CLOSED; ! }else{ ! status = PORT_OPEN; //UGLY, pls add additional checkup ! } ! } ! break; ! ! case ECONNREFUSED: ! status = PORT_CLOSED; ! break; ! ! case EHOSTUNREACH: ! case ETIMEDOUT: ! case EHOSTDOWN: ! case ENETUNREACH: ! status = PORT_FILTERED; ! break; ! ! default: //add here more errors, pls ! status = PORT_UNKNOWN; ! } ! ! ! ! set_port_status((*i).first, status, "tcp"); ! (*i).second.done = true; ! shutdown_scansocket((*i).second.socket_ptr); ! (*i).second.socket_ptr = -1; ! ! }else{ ! if( ( curtime - (*i).second.time) >= CONNECT_TIMEOUT ){ ! status = PORT_FILTERED; ! ! set_port_status((*i).first, status, "tcp"); ! (*i).second.done = true; ! shutdown_scansocket((*i).second.socket_ptr); ! (*i).second.socket_ptr = -1; ! }else done &= false; ! } ! done &= true; ! } ! // DBGOUTPUT("done"); ! // DBGOUTPUT(done); ! return done; ! } ! ! void show_ports(){ ! int filtered = 0, closed = 0, open = 0, total = 0; ! bool show_closed = false; ! char output_buf[255]; ! std::vector <scanned_port>::iterator i; ! ! for(i = subtarget_ports.begin(); i!= subtarget_ports.end(); ++i){ ! total++; ! if((*i).status == PORT_OPEN || (*i).status == PORT_OPEN_FILTERED){ ! open++; ! }else if((*i).status == PORT_CLOSED){ ! //if(closed++ > MAX_CLOSED) subtarget_ports.erase(i++); ! closed++; ! }else if((*i).status == PORT_FILTERED){ ! filtered++; ! //subtarget_ports.erase(i++); ! } ! } ! ! if(open!= 0 && closed/open == 0) show_closed = true; ! else if(open == 0 && closed <= MAX_CLOSED) show_closed = true; ! ! if(strcmp(hostname.c_str(), reversed_hostname.c_str())) ! *out << "Interesting ports on " << reversed_hostname << " (" << hostname << "):" << iceoutput::endl; ! else ! *out << "Interesting ports on " << hostname << ":" << iceoutput::endl; ! ! ! Bzero(output_buf, 255); ! if(filtered > 0){ ! if(show_closed){ ! sprintf(output_buf, "Not shown: %d filtered ports.", filtered); ! }else{ ! sprintf(output_buf, "Not shown: %d filtered && %d closed ports.", filtered, closed); ! } ! out->line(output_buf); ! }else{ ! if(!show_closed){ ! sprintf(output_buf, "Not shown: %d closed ports.", closed); ! out->line(output_buf); ! } ! } ! ! out->line("PORT STATE SERVICE"); ! #ifndef __CYGWIN__ ! std::sort(subtarget_ports.begin(), subtarget_ports.end(), sort_sp); ! #endif ! int j = 0; ! ! for(j = 0; j < subtarget_ports.size(); j++){ ! 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); ! } ! } ! } - public: - ~csubtarget(){ - //DBGOUTPUT("Entering destructor..."); - free(scan_sockets); - subtarget_ports.clear(); - //DBGOUTPUT("Leaving destructor..."); - } }; --- 84,120 ---- int sockets_size; ! void init_scan_sockets(); + enum port_status get_no_response_status(); ! int get_first_free_socket(); ! void init_scanning_ports(icestring hostname, iceparams *par, int domain, std::map <int, scanning_port> &scanning_ports); ! int initiate_connect(std::map <int, scanning_port> &scanning_ports); ! int get_max_fd(); ! /* This function implements any type of raw tcp scan, ! * e.g. ACK, FIN and etc. ! */ ! void raw_tcp_scan(icestring scan_type); ! int recieve_tcp_raw(pcap_t* p, crawsocket &rawsend, icestring &source, struct sockaddr_in &saddress, std::map <int, scanning_port> &scanning_ports, int MAGIC_PORT, int timeout, int packets); ! void shutdown_scansocket(int j); ! ! int get_first_idle_scanning_port(std::map <int, scanning_port> &scanning_ports); ! void idle_status_dispatcher(std::map <int, scanning_port> &scanning_ports, int prt); // return true if scanning_ports are empty bool do_select_round_connect(std::map <int, scanning_port> &scanning_ports, ! std::vector<scanned_port> &subtarget_ports); ! void show_ports(); ! void csubtarget::print_port_status(int port, enum port_status ps, char* protocol); }; --- NEW FILE: csubtarget.cc --- #include "csubtarget.h" //#include "udpscan.h" bool sort_sp(const scanned_port &p1, const scanned_port &p2){ return p1.port_number < p2.port_number; } csubtarget::csubtarget(icestring hostname, icestring reverse_hostname, iceparams *par, iceoutput *out){ struct scanned_port sp; subtarget_ports.push_back(sp); this->hostname.assign(hostname); this->reversed_hostname.assign(reverse_hostname); this->par = par; this->out = out; discovered = false; init_scan_sockets(); source_ip = get_source_ip(hostname, source_iface); } bool csubtarget::discover(){ struct timeb tp1, tp2; ftime(&tp1); discovered = host_discover(hostname.c_str(), par, out); ftime(&tp2); if(par->verbose) *out << "Discovery taken " << timeb_diff(tp1, tp2) << " seconds.\n"; return discovered; } void csubtarget::scan(){ if(par->scan_type == TCP_CONNECT_SCAN) connect_scan(); if(par->scan_type == NBT_SCAN) nbt_scan(); if(par->scan_type == PROT_SCAN) prot_scan(); if(par->scan_type == FIN_SCAN) raw_tcp_scan("FIN"); if(par->scan_type == NULL_SCAN) raw_tcp_scan("NULL"); if(par->scan_type == XMAS_SCAN) raw_tcp_scan("XMAS"); if(par->scan_type == WINDOW_SCAN) raw_tcp_scan("window"); if(par->scan_type == ACK_SCAN) raw_tcp_scan("ACK"); if(par->scan_type == SYN_SCAN) raw_tcp_scan("SYN"); if(par->scan_type == UDP_SCAN) udp_scan(); } void csubtarget::mac_discover(){ #ifndef __CYGWIN__ icestring mac = get_arp_from_cache(hostname); 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 } int csubtarget::prot_scan(){ // cprotocol_scan cps(par, out); // cps.test(hostname.c_str()); return 0; } int csubtarget::nbt_scan(){ // NetBIOS scan, -SB char output_buf[255]; if(par->verbose>0){ sprintf(output_buf, "Starting NetBIOS scan against %s...", hostname.c_str()); out->line(output_buf); } cnbtwrapper wrap(par); wrap.test(hostname.c_str(), 137); if(par->verbose>0){ Bzero(output_buf, 255); sprintf(output_buf, "NetBIOS scan finished.", hostname.c_str()); out->line(output_buf); } return 0; } int csubtarget::udp_scan(){ //udp scan, -SU char output_buf[255]; char local_hostname[80]; icestring local_hn; std::map <int, scanning_port> scanning_ports; init_scanning_ports(hostname, par, (int) SOCK_DGRAM, scanning_ports); if(par->verbose>0){ sprintf(output_buf, "Starting UDP scan against %s...", hostname.c_str()); out->line(output_buf); } udpscan(hostname, scanning_ports, par, out, this, true); show_ports(); if(par->verbose>0) out->line("UDP scan finished."); scanning_ports.clear(); return 0; } int csubtarget::connect_scan(){ // connect scan, -ST char output_buf[255]; domain = (int) SOCK_STREAM; std::map <int, scanning_port> scanning_ports; init_scanning_ports(hostname, par, (int) SOCK_STREAM, scanning_ports); if(par->verbose>0){ sprintf(output_buf, "Starting tcp connect() scan against %s...", hostname.c_str()); out->line(output_buf); } int j = initiate_connect(scanning_ports); while( ! do_select_round_connect(scanning_ports, subtarget_ports) ) iceusleep(1000); show_ports(); if(par->verbose>0) out->line("Connect() scan finished."); scanning_ports.clear(); return 0; } void csubtarget::set_port_status(int port, enum port_status status, char* protocol){ struct scanned_port sp; sp.port_number = port; sp.status = status; subtarget_ports.push_back(sp); print_port_status(sp.port_number, status, protocol); } void csubtarget::init_scan_sockets(){ sockets_size = ICE_FD_SETSIZE*2/3; scan_sockets = (struct scan_socket *) malloc(sizeof(scan_socket) * (sockets_size+1)); for(int i = 0; i < sockets_size; i++){ scan_sockets[i].busy = false; scan_sockets[i].sid = -1; } free_sockets = sockets_size; } enum port_status csubtarget::get_no_response_status(){ switch(par->scan_type){ case FIN_SCAN: case NULL_SCAN: case XMAS_SCAN: return PORT_OPEN_FILTERED; break; case WINDOW_SCAN: case ACK_SCAN: case SYN_SCAN: return PORT_FILTERED; break; } } int csubtarget::get_first_free_socket(){ int f; for(f = 0; f < sockets_size; f++) if(!scan_sockets[f].busy && scan_sockets[f].sid < 0) return f; return -1; } void csubtarget::init_scanning_ports(icestring hostname, iceparams *par, int domain, std::map <int, scanning_port> &scanning_ports){ for(int j = 0; j<par->ports.size(); j++){ port_range pr = par->ports[j]; for(int i = pr.lower_port; i <= pr.upper_port; i++){ if(scanning_ports.find(i) == scanning_ports.end()){ struct scanning_port sp; sp.port_number = i; scanning_ports[i] = sp; scanning_ports[i].attempt = 0; scanning_ports[i].done = false; } } } if(domain == SOCK_RAW) return; std::map <int, scanning_port>::iterator i; int j; for(i = scanning_ports.begin(), j = 0; i!= scanning_ports.end(); ++i, j++){ if(j < sockets_size){ csocket c(AF_INET, domain); scan_sockets[j].domain = domain; scan_sockets[j].sid = c.get_socketid(); maxfd = scan_sockets[j].sid; scan_sockets[j].busy = true; (*i).second.socket_ptr = j; free_sockets--; }else{ (*i).second.socket_ptr = -1; } } } int csubtarget::initiate_connect(std::map <int, scanning_port> &scanning_ports){ std::map <int, scanning_port>::iterator i; FD_ZERO(&fd_r); FD_ZERO(&fd_w); FD_ZERO(&fd_x); int j; for(i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ //check FD_SET //DBGOUTPUT((*i).first); if((*i).second.socket_ptr != -1){ //DBGOUTPUT("!!!!!"); j = (*i).second.socket_ptr; csocket c(AF_INET, scan_sockets[j].domain, scan_sockets[j].sid); c.nonblock(true); FD_SET(scan_sockets[j].sid, &fd_w); FD_SET(scan_sockets[j].sid, &fd_r); FD_SET(scan_sockets[j].sid, &fd_x); (*i).second.time = time(0); int rc = c.connect(hostname.c_str(), (*i).first, 0); } } return j; } int csubtarget::get_max_fd(){ int max = -1; for(int f = 0; f < sockets_size; f++) if(scan_sockets[f].sid > max) max = scan_sockets[f].sid; return max; } /* This function implements any type of raw tcp scan, * e.g. ACK, FIN and etc. */ void csubtarget::raw_tcp_scan(icestring scan_type){ std::map <int, scanning_port> scanning_ports; struct sockaddr_in saddress; int len; int MAGIC_PORT = csocket::getMagicPort(SOCK_DGRAM, 100); if(par->verbose > 0) *out << "Starting TCP " << scan_type << " scan against " << hostname.c_str() << "...\n"; #if (__CYGWIN__) if(!par->forceuid){ #else if(getuid() && (par->forceuid != true)){ #endif out->line("UID isn't 0, so can't create raw socket/load pcap => no RAW tcp scan..."); return; } pcap_t* p; if(par->source_iface) p = init_pcap(par->source_iface); else p = init_pcap(getdev_pcap(source_iface)); if(p == NULL){ out->line("Can't open pcap: no raw tcp scan. Exitting."); return; } len = make_sockname(saddress, hostname.c_str(), 0, domain); icestring source(source_ip); init_scanning_ports(hostname, par, (int) SOCK_RAW, scanning_ports); crawsocket rawsend(AF_INET, (int) SOCK_RAW, IPPROTO_RAW); int one = 1; #ifdef WIN32 const BOOL val = TRUE; #else const int val = 1; #endif if (setsockopt (rawsend.get_socketid(), IPPROTO_IP, IP_HDRINCL, (char *) &val, sizeof (one)) != 0) perror("Setsockopt HDRINCL:"); int l = scanning_ports.size()/MAX_PACKETS; if(scanning_ports.size() % MAX_PACKETS != 0) l++; char filter_exp[256]; sprintf(filter_exp, "port %d host %s tcp", MAGIC_PORT, hostname.c_str()); pcap_filter(p, filter_exp); pcap_block(p, false); int maxat; int covar = 10000; int attempts = 0; while(attempts++ < 5){ int j = 0; while(j < l){ std::map <int, scanning_port>::iterator i = scanning_ports.begin(); maxat = 0; for(int k=0; k < MAX_PACKETS*j; k++) i++; for(int k = j*MAX_PACKETS; (k < (j+1)*MAX_PACKETS) && i!= scanning_ports.end(); ++i, k++){ if(! (*i).second.done ){ switch(par->scan_type){ case FIN_SCAN: rawsend.send_tcp_raw(par->ethernet, source, hostname, MAGIC_PORT, (*i).first, 0, 0, TH_FIN | par->tcpflags, 0, 0, 0); break; case NULL_SCAN: rawsend.send_tcp_raw(par->ethernet, source, hostname, MAGIC_PORT, (*i).first, 0, 0, par->tcpflags, 0, 0, 0); break; case XMAS_SCAN: rawsend.send_tcp_raw(par->ethernet, source, hostname, MAGIC_PORT, (*i).first, 0, 0, TH_FIN | TH_URG | TH_PUSH | par->tcpflags, 0, 0, 0); break; case WINDOW_SCAN: case ACK_SCAN: rawsend.send_tcp_raw(par->ethernet, source, hostname, MAGIC_PORT, (*i).first, 0, 0, TH_ACK, 0, 0, 0); break; case SYN_SCAN: rawsend.send_tcp_raw(par->ethernet, source, hostname, MAGIC_PORT, (*i).first, 0, 0, TH_SYN, 0, 0, 0); break; } gettimeofday(&((*i).second.tv), 0); (*i).second.attempt++; maxat++; recieve_tcp_raw(p, rawsend, source, saddress, scanning_ports, MAGIC_PORT, 10, 0); } } j++; //iceusleep(1000); recieve_tcp_raw(p, rawsend, source, saddress, scanning_ports, MAGIC_PORT, (maxat) * covar + 10000, maxat); //DBGOUTPUT(covar); } } for(std::map <int, scanning_port>::iterator i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ if(! (*i).second.done){ (*i).second.done = true; set_port_status((*i).first, get_no_response_status(), "tcp"); } } scanning_ports.clear(); show_ports(); if(par->verbose>0) *out << "TCP " << scan_type << " scan finished.\n"; close_pcap(p); } int csubtarget::recieve_tcp_raw(pcap_t* p, crawsocket &rawsend, icestring &source, struct sockaddr_in &saddress, std::map <int, scanning_port> &scanning_ports, int MAGIC_PORT, int timeout, int packets){ int bytes; char *response; struct iphdr *ip; struct tcphdr *tcp; unsigned int len; int maxtimeval = 0; struct timeval tv1, tv2, tv3; gettimeofday(&tv1, 0); bool stop = false; int port; //DBGOUTPUT("!!!!!"); //while( bytes = rawrecv.recvfrom(response, 65535, 0, NULL) > 0){ while(!stop){ response = readip_pcap(p, &len, NULL); port = 0; //DBGOUTPUT("while"); if(response){ //DBGOUTPUT("response"); ip = (struct iphdr *) response; if(ip->saddr == saddress.sin_addr.s_addr && ip->protocol == IPPROTO_TCP){ tcp = (struct tcphdr *) (response + 4 * ip->ihl); if ((tcp->th_flags & TH_RST) && (par->scan_type == FIN_SCAN || par->scan_type == NULL_SCAN || par->scan_type == XMAS_SCAN)) { port = ntohs(tcp->th_sport); if(scanning_ports.find(port) != scanning_ports.end()){ if(!scanning_ports[port].done){ set_port_status(port, PORT_CLOSED, "tcp"); scanning_ports[port].done = true; } } }else if ((tcp->th_flags & TH_RST) && (par->scan_type == WINDOW_SCAN)) { int port = ntohs(tcp->th_sport); if(scanning_ports.find(port) != scanning_ports.end()){ if(!scanning_ports[port].done){ scanning_ports[port].done = true; if(tcp->th_win == 0){ set_port_status(port, PORT_CLOSED, "tcp"); }else{ set_port_status(port, PORT_OPEN, "tcp"); } } } }else if ((tcp->th_flags & TH_RST) && (par->scan_type == ACK_SCAN)) { int port = ntohs(tcp->th_sport); if(scanning_ports.find(port) != scanning_ports.end()){ if(!scanning_ports[port].done){ set_port_status(port, PORT_UNFILTERED, "tcp"); scanning_ports[port].done = true; } } }else if ((tcp->th_flags & TH_RST) && (par->scan_type == SYN_SCAN)) { int port = ntohs(tcp->th_sport); if(port != MAGIC_PORT){ if(scanning_ports.find(port) != scanning_ports.end()){ if(!scanning_ports[port].done){ scanning_ports[port].done = true; set_port_status(port, PORT_CLOSED, "tcp"); } } } }else if ((tcp->th_flags & (TH_ACK|TH_SYN)) && (par->scan_type == SYN_SCAN)) { int port = ntohs(tcp->th_sport); if(port != MAGIC_PORT){ if(scanning_ports.find(port) != scanning_ports.end()){ if(!scanning_ports[port].done){ set_port_status(port, PORT_OPEN, "tcp"); rawsend.send_tcp_raw(par->ethernet, source, hostname, MAGIC_PORT, port, 0, 0, TH_RST, 0, 0, 0); scanning_ports[port].done = true; } } } } //bzero(response, 65534); } } gettimeofday(&tv2, 0); if(port){ if(SUB_TIMEVALS(tv2,scanning_ports[port].tv) > maxtimeval) maxtimeval = SUB_TIMEVALS(tv2,scanning_ports[port].tv); } if(SUB_TIMEVALS(tv2,tv1) >= timeout || SUB_TIMEVALS(tv2,tv1) > MAX_RAW_WAIT + packets * 500) stop = true; } return maxtimeval; } void csubtarget::shutdown_scansocket(int j){ csocket c(AF_INET, scan_sockets[j].domain, scan_sockets[j].sid); FD_CLR(c.get_socketid(), &fd_w); FD_CLR(c.get_socketid(), &fd_r); FD_CLR(c.get_socketid(), &fd_x); c.shutdown(); c.close(); free_sockets++; scan_sockets[j].busy = false; scan_sockets[j].sid = -1; } int csubtarget::get_first_idle_scanning_port(std::map <int, scanning_port> &scanning_ports){ std::map <int, scanning_port>::iterator i; //DBGOUTPUT("GFISP"); for(i = --scanning_ports.end(); i!= scanning_ports.begin(); --i){ if((*i).second.socket_ptr == -1 && (! (*i).second.done)) return (*i).first; } return -1; } void csubtarget::idle_status_dispatcher(std::map <int, scanning_port> &scanning_ports, int prt){ if(prt>=0 && free_sockets > 1){ int f = get_first_free_socket(); if(f < 0) return; csocket c(AF_INET, (int) domain); scan_sockets[f].sid = c.get_socketid(); scan_sockets[f].busy = true; scanning_ports[prt].socket_ptr ... [truncated message content] |
From: Alexander B. <da...@us...> - 2006-12-21 15:37:27
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15392/icesockets Modified Files: sock_win.h sock_arp.h sock_pcap.h sock_name.h ice_rand.h sock_files.h sock_time.h sock_eth.h Added Files: sock_pcap.cc sock_win.cc sock_eth.cc sock_name.cc sock_time.cc sock_files.cc ice_rand.cc sock_arp.cc Log Message: no message --- NEW FILE: ice_rand.cc --- #include "ice_rand.h" // from Fyodor's "The Art of Port Scanning" int get_random_bytes(void *buf, int numbytes) { static char bytebuf[2048]; static char badrandomwarning = 0; static int bytesleft = 0; int tmp; int res; struct timeval tv; FILE *fp = NULL; unsigned int i; short *iptr; if (numbytes < 0 || numbytes > 0xFFFF) return -1; if (bytesleft == 0) { fp = fopen("/dev/arandom", "r"); if (!fp) fp = fopen("/dev/urandom", "r"); if (!fp) fp = fopen("/dev/random", "r"); if (fp) { res = (int) fread(bytebuf, 1, sizeof(bytebuf), fp); if (res != sizeof(bytebuf)) { fprintf(stderr, "Failed to read from /dev/urandom or /dev/random\n"); fclose(fp); fp = NULL; } bytesleft = sizeof(bytebuf); } if (!fp) { if (badrandomwarning == 0) { badrandomwarning++; gettimeofday(&tv, NULL); srand((tv.tv_sec ^ tv.tv_usec) ^ getpid()); } for(i=0; i < sizeof(bytebuf) / sizeof(short); i++) { iptr = (short *) ((char *)bytebuf + i * sizeof(short)); *iptr = rand(); } bytesleft = (sizeof(bytebuf) / sizeof(short)) * sizeof(short); } else fclose(fp); } if (numbytes <= bytesleft) { /* we can cover it */ memcpy(buf, bytebuf + (sizeof(bytebuf) - bytesleft), numbytes); bytesleft -= numbytes; return 0; } memcpy(buf, bytebuf + (sizeof(bytebuf) - bytesleft), bytesleft); tmp = bytesleft; bytesleft = 0; return get_random_bytes((char *)buf + tmp, numbytes - tmp); } void init_rand(){ unsigned i; get_random_bytes(&i, sizeof(i)); srand(i); } --- NEW FILE: sock_pcap.cc --- #include "sock_pcap.h" #ifndef HAVE_LIBPCAP pcap_t* init_pcap(int index = 0){ return NULL; } pcap_t* start_pcap(int iface, bool block, char *filter_exp){ return NULL; } void listdev_pcap(){ } char* readip_pcap(pcap_t* pd, unsigned int *len, struct timeval *rcvd_time){ return NULL; } bool pcap_filter(pcap_t *p, char *filter_exp){ return true; } int getdev_pcap(icestring &dev){ return 0; } int pcap_block(pcap_t *p, bool block){ } void close_pcap(pcap_t *p){ } #else pcap_t* init_pcap(int index = 0){ char *dev; char errbuf[PCAP_ERRBUF_SIZE]; pcap_t* descr; pcap_if_t *alldevs; pcap_if_t *d; int i=0; if(index){ if(pcap_findalldevs(&alldevs, errbuf) == -1) { printf("Error in pcap_findalldevs: %s\n", errbuf); exit(1); } for(d=alldevs; d; d=d->next) i++; if(i==0) { printf("\nNo interfaces found! Make sure WinPcap/LibPcap is installed.\n"); pcap_freealldevs(alldevs); return NULL; } for(d=alldevs, i=0; i< index-1 ;d=d->next, i++); pcap_t *dev = pcap_open_live(d->name,BUFSIZ,0,-1,errbuf); pcap_freealldevs(alldevs); return dev; }else{ dev = pcap_lookupdev(errbuf); if(dev == NULL) { return NULL; } return pcap_open_live(dev,BUFSIZ,0,-1,errbuf); } return NULL; } void listdev_pcap(){ pcap_if_t *alldevs; pcap_if_t *d; int i=0; char errbuf[PCAP_ERRBUF_SIZE]; if(pcap_findalldevs(&alldevs, errbuf) == -1) { printf("Error in pcap_findalldevs: %s\n", errbuf); exit(1); } for(d=alldevs; d; d=d->next) { printf("%d. %s", ++i, d->name); if (d->description) printf(" (%s)\n", d->description); else printf(" (No description available)\n"); } pcap_freealldevs(alldevs); if(i==0) { printf("\nNo interfaces found! Make sure WinPcap is installed.\n"); return; } } int getdev_pcap(icestring &dev){ pcap_if_t *alldevs; pcap_if_t *d; int i=1; char errbuf[PCAP_ERRBUF_SIZE]; if(pcap_findalldevs(&alldevs, errbuf) == -1) { printf("Error in pcap_findalldevs: %s\n", errbuf); exit(1); } for(d=alldevs; d; d=d->next, i++) { if(!strcmp(d->name, dev.c_str())) break; } if(!d) (i = 0); pcap_freealldevs(alldevs); if(i==0) printf("\nNo interfaces found! Make sure WinPcap is installed.\n"); return i; } char* readip_pcap(pcap_t* pd, unsigned int *len, struct timeval *rcvd_time){ unsigned int offset = 0; struct pcap_pkthdr head; char *p; static char *alignedbuf = NULL; static unsigned int alignedbufsz = 0; int link; link = pcap_datalink(pd); switch(link){ case DLT_EN10MB: offset = 14; break; case DLT_IEEE802: offset = 22; break; #ifdef DLT_LOOP case DLT_LOOP: #endif case DLT_NULL: offset = 4; break; case DLT_SLIP: #if (FREEBSD || OPENBSD || NETBSD || BSDI || MACOSX) offset = 16; #else offset = 24; #endif break; case DLT_PPP: #ifdef DLT_PPP_BSDOS case DLT_PPP_BSDOS: #endif #ifdef DLT_PPP_SERIAL case DLT_PPP_SERIAL: #endif #ifdef DLT_PPP_ETHER case DLT_PPP_ETHER: #endif #if (FREEBSD || OPENBSD || NETBSD || BSDI || MACOSX) offset = 4; #else #ifdef SOLARIS offset = 8; #else offset = 24; #endif /* solaris */ #endif /* freebsd || openbsd || netbsd || bsdi */ break; case DLT_RAW: offset = 0; break; case DLT_FDDI: offset = 21; break; #ifdef DLT_ENC case DLT_ENC: offset = 12; break; #endif /* DLT_ENC */ #ifdef DLT_LINUX_SLL case DLT_LINUX_SLL: offset = 16; break; #endif default: err_die("FATAL: Unknown datalink type!", 0); exit(1); } p = (char *) pcap_next(pd, &head); if(p){ if(head.caplen <= offset){ *len = 0; return NULL; } p += offset; }else return NULL; *len = head.caplen - offset; if (*len > alignedbufsz) { alignedbuf = (char *) realloc(alignedbuf, *len); if (!alignedbuf) { err_die("Unable to realloc mem!", 0); } alignedbufsz = *len; } memcpy(alignedbuf, p, *len); if (rcvd_time) { #if defined(WIN32) struct timeval tv_end; gettimeofday(&tv_end, NULL); *rcvd_time = tv_end; #else rcvd_time->tv_sec = head.ts.tv_sec; rcvd_time->tv_usec = head.ts.tv_usec; #endif } return alignedbuf; } bool pcap_filter(pcap_t *p, char *filter_exp){ struct bpf_program fp; /* The compiled filter expression */ if (pcap_compile(p, &fp, filter_exp, 0, 0) == -1) { return false; } if (pcap_setfilter(p, &fp) == -1) { return false; } return true; } int pcap_block(pcap_t *p, bool block){ return pcap_setnonblock(p, (int)(!block), NULL); } pcap_t* open_pcap(int iface, bool block, char *filter_exp){ pcap_t* p = init_pcap(iface); if(!p) return NULL; pcap_block(p, block); pcap_filter(p, filter_exp); return p; } void close_pcap(pcap_t *p){ pcap_close(p); } #endif Index: sock_arp.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_arp.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sock_arp.h 21 Dec 2006 10:13:53 -0000 1.7 --- sock_arp.h 21 Dec 2006 15:37:23 -0000 1.8 *************** *** 11,117 **** #include "sock_types.h" ! ! icestring get_arp_from_cache(icestring &ip) ! { ! char arp[24]; ! ! ! #ifdef __CYGWIN__ ! return ""; ! #elif __WITH_DNET__ ! struct arp_entry ae; ! ! addr_pton(ip.c_str(), &ae.arp_pa); ! ! arp_t *p = arp_open(); ! ! arp_get(p, &ae); ! ! arp_close(p); ! ! struct sockaddr sa; ! ! addr_ntos(&(ae.arp_ha), &sa); ! ! sprintf(arp, "%02x:%02x:%02x:%02x:%02x:%02x", ! sa.sa_data[0] & 0xFF, ! sa.sa_data[1] & 0xFF, ! sa.sa_data[2] & 0xFF, ! sa.sa_data[3] & 0xFF, ! sa.sa_data[4] & 0xFF, ! sa.sa_data[5] & 0xFF); ! ! icestring ret(arp); ! ! return ret; ! #elif WIN32 && !__WITH_DNET__ ! PMIB_IPNETTABLE pIPNetTable = NULL; ! PMIB_IPNETROW pIPNetRow = NULL; ! ULONG ulSize = 0; ! IN_ADDR ia; ! ! GetIpNetTable(pIPNetTable, &ulSize, TRUE); ! pIPNetTable = new MIB_IPNETTABLE[ulSize]; ! if (NULL != pIPNetTable) ! { ! GetIpNetTable(pIPNetTable, &ulSize, TRUE); ! ! for (int x = 0; x < pIPNetTable->dwNumEntries; x++) ! { ! pIPNetRow = &(pIPNetTable->table[x]); ! ia.S_un.S_addr = pIPNetRow->dwAddr; ! ! if(!strcmp(inet_ntoa(ia), ip.c_str())){ ! sprintf(arp, "%02x:%02x:%02x:%02x:%02x:%02x", ! pIPNetRow->bPhysAddr[0] & 0xFF, ! pIPNetRow->bPhysAddr[1] & 0xFF, ! pIPNetRow->bPhysAddr[2] & 0xFF, ! pIPNetRow->bPhysAddr[3] & 0xFF, ! pIPNetRow->bPhysAddr[4] & 0xFF, ! pIPNetRow->bPhysAddr[5] & 0xFF); ! ! icestring ret(arp); ! ! return ret; ! } ! } ! ! delete [] pIPNetTable; ! ! return ""; ! } ! #elif __linux__ && !__WITH_DNET__ ! struct sockaddr_in sin = { 0 }; ! struct arpreq myarp = { { 0 } }; ! int sockfd; ! ! sin.sin_family = AF_INET; ! inet_aton(ip.c_str(), &sin.sin_addr); ! ! memcpy(&myarp.arp_pa, &sin, sizeof myarp.arp_pa); ! strcpy(myarp.arp_dev, "any"); //UGLY ! ! if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { ! perror("socket"); ! return ""; ! } ! ! if (ioctl(sockfd, SIOCGARP, &myarp) == -1) { ! return ""; ! } ! ! sprintf(arp, "%02X:%02X:%02X:%02X:%02X:%02X", myarp.arp_ha.sa_data[0] & 0xFF, ! myarp.arp_ha.sa_data[1] & 0xFF, ! myarp.arp_ha.sa_data[2] & 0xFF, ! myarp.arp_ha.sa_data[3] & 0xFF, ! myarp.arp_ha.sa_data[4] & 0xFF, ! myarp.arp_ha.sa_data[5] & 0xFF); ! icestring ret(arp); ! ! return ret; ! #else ! return ""; ! #endif ! } #endif /* _icearp_H */ --- 11,15 ---- #include "sock_types.h" ! icestring get_arp_from_cache(icestring &ip); #endif /* _icearp_H */ Index: sock_eth.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_eth.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sock_eth.h 21 Dec 2006 13:11:46 -0000 1.7 --- sock_eth.h 21 Dec 2006 15:37:23 -0000 1.8 *************** *** 2,12 **** #define _iceeth_H ! #ifndef HAVE_LIBDNET ! int send_ip_packet(const void *buf, size_t len){ ! return 1; ! } ! #else /* Portions of code below are from libdnet package: --- 2,12 ---- #define _iceeth_H ! #include "sock_types.h" ! int send_ip_packet(const void *buf, size_t len); ! icestring get_source_ip(const icestring &destip, icestring &sourceint); ! ! #ifdef HAVE_LIBDNET /* Portions of code below are from libdnet package: *************** *** 43,46 **** --- 43,48 ---- #include "queue.h" + #define SOCK_ETH + struct ip_intf { eth_t *eth; *************** *** 62,290 **** }; - static int - i_add_ip_intf(const struct intf_entry *entry, void *arg) - { - ip_t *ip = (ip_t *)arg; - struct ip_intf *ipi; - - if (entry->intf_type == INTF_TYPE_ETH && - (entry->intf_flags & INTF_FLAG_UP) != 0 && - entry->intf_mtu >= ETH_LEN_MIN && - entry->intf_addr.addr_type == ADDR_TYPE_IP && - entry->intf_link_addr.addr_type == ADDR_TYPE_ETH) { - - if ((ipi = (ip_intf*) calloc(1, sizeof(*ipi))) == NULL) - return (-1); - - strncpy(ipi->name, entry->intf_name, sizeof(ipi->name)); - memcpy(&ipi->ha, &entry->intf_link_addr, sizeof(ipi->ha)); - memcpy(&ipi->pa, &entry->intf_addr, sizeof(ipi->pa)); - ipi->mtu = entry->intf_mtu; - - LIST_INSERT_HEAD(&ip->ip_intf_list, ipi, next); - } - return (0); - } - - ip_t * - i_ip_open(void) - { - ip_t *ip; - - if ((ip = (ip_t*) calloc(1, sizeof(*ip))) != NULL) { - ip->fd = -1; - - if ((ip->arp = arp_open()) == NULL || - (ip->intf = intf_open()) == NULL || - (ip->route = route_open()) == NULL) - return (ip_close(ip)); - - if ((ip->fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - return (ip_close(ip)); - - memset(&ip->sin, 0, sizeof(ip->sin)); - ip->sin.sin_family = AF_INET; - ip->sin.sin_port = htons(666); - - LIST_INIT(&ip->ip_intf_list); - - if (intf_loop(ip->intf, i_add_ip_intf, ip) != 0) - return (ip_close(ip)); - } - return (ip); - } - - static struct ip_intf * - i_lookup_ip_intf(ip_t *ip, ip_addr_t dst) - { - struct ip_intf *ipi; - int n; - - ip->sin.sin_addr.s_addr = dst; - n = sizeof(ip->sin); - - if (connect(ip->fd, (struct sockaddr *)&ip->sin, n) < 0) - return (NULL); - - if (getsockname(ip->fd, (struct sockaddr *)&ip->sin, (socklen_t *) &n) < 0) - return (NULL); - - LIST_FOREACH(ipi, &ip->ip_intf_list, next) { - if (ipi->pa.addr_ip == ip->sin.sin_addr.s_addr) { - if (ipi->eth == NULL) { - if ((ipi->eth = eth_open(ipi->name)) == NULL) - return (NULL); - } - if (ipi != LIST_FIRST(&ip->ip_intf_list)) { - LIST_REMOVE(ipi, next); - LIST_INSERT_HEAD(&ip->ip_intf_list, ipi, next); - } - return (ipi); - } - } - return (NULL); - } - - static void - i_request_arp(struct ip_intf *ipi, struct addr *dst) - { - u_char frame[ETH_HDR_LEN + ARP_HDR_LEN + ARP_ETHIP_LEN]; - - eth_pack_hdr(frame, ETH_ADDR_BROADCAST, ipi->ha.addr_eth, - ETH_TYPE_ARP); - arp_pack_hdr_ethip(frame + ETH_HDR_LEN, ARP_OP_REQUEST, - ipi->ha.addr_eth, ipi->pa.addr_ip, ETH_ADDR_BROADCAST, - dst->addr_ip); - - eth_send(ipi->eth, frame, sizeof(frame)); - } - - ssize_t - i_ip_send(ip_t *ip, const void *buf, size_t len) - { - struct ip_hdr *iph; - struct ip_intf *ipi; - struct arp_entry arpent; - struct route_entry rtent; - u_char frame[ETH_LEN_MAX]; - int i, usec; - - iph = (struct ip_hdr *)buf; - - if ((ipi = i_lookup_ip_intf(ip, iph->ip_dst)) == NULL) { - errno = EHOSTUNREACH; - return (-1); - } - arpent.arp_pa.addr_type = ADDR_TYPE_IP; - arpent.arp_pa.addr_bits = IP_ADDR_BITS; - arpent.arp_pa.addr_ip = iph->ip_dst; - memcpy(&rtent.route_dst, &arpent.arp_pa, sizeof(rtent.route_dst)); - - for (i = 0, usec = 10; i < 3; i++, usec *= 100) { - if (arp_get(ip->arp, &arpent) == 0) - break; - - if (route_get(ip->route, &rtent) == 0 && - rtent.route_gw.addr_ip != ipi->pa.addr_ip) { - memcpy(&arpent.arp_pa, &rtent.route_gw, - sizeof(arpent.arp_pa)); - if (arp_get(ip->arp, &arpent) == 0) - break; - } - i_request_arp(ipi, &arpent.arp_pa); - - usleep(usec); - } - if (i == 3) - memset(&arpent.arp_ha.addr_eth, 0xff, ETH_ADDR_LEN); - - eth_pack_hdr(frame, arpent.arp_ha.addr_eth, - ipi->ha.addr_eth, ETH_TYPE_IP); - - if (len > ipi->mtu) { - u_char *p, *start, *end, *ip_data; - #undef ip_hl - int ip_hl, fraglen; - ip_hl = iph->ip_hl << 2; - fraglen = ipi->mtu - ip_hl; ! iph = (struct ip_hdr *)(frame + ETH_HDR_LEN); ! memcpy(iph, buf, ip_hl); ! ip_data = (u_char *)iph + ip_hl; ! start = (u_char *)buf + ip_hl; ! end = (u_char *)buf + len; ! ! for (p = start; p < end; ) { ! memcpy(ip_data, p, fraglen); ! ! iph->ip_len = htons(ip_hl + fraglen); ! iph->ip_off = htons(((p + fraglen < end) ? IP_MF : 0) | ! ((p - start) >> 3)); ! ip_checksum(iph, ip_hl + fraglen); ! i = ETH_HDR_LEN + ip_hl + fraglen; ! if (eth_send(ipi->eth, frame, i) != i) ! return (-1); ! p += fraglen; ! if (end - p < fraglen) ! fraglen = end - p; ! } ! return (len); ! #define ip_hl ip_hv&0x0f ! } ! memcpy(frame + ETH_HDR_LEN, buf, len); ! i = ETH_HDR_LEN + len; ! if (eth_send(ipi->eth, frame, i) != i) ! return (-1); ! ! return (len); ! } ip_t * ! i_ip_close(ip_t *ip) ! { ! struct ip_intf *ipi, *nxt; ! ! if (ip != NULL) { ! for (ipi = LIST_FIRST(&ip->ip_intf_list); ! ipi != LIST_END(&ip->ip_intf_list); ipi = nxt) { ! nxt = LIST_NEXT(ipi, next); ! if (ipi->eth != NULL) ! eth_close(ipi->eth); ! free(ipi); ! } ! if (ip->fd >= 0) ! #ifdef WIN32 ! closesocket(ip->fd); ! #else ! close(ip->fd); ! #endif ! if (ip->route != NULL) ! route_close(ip->route); ! if (ip->intf != NULL) ! intf_close(ip->intf); ! if (ip->arp != NULL) ! arp_close(ip->arp); ! free(ip); ! } ! return (NULL); ! } /* end of modified code from libdnet */ - int send_ip_packet(const void *buf, size_t len){ - ip_t *i = i_ip_open(); - - i_ip_send(i, buf, len); - - i_ip_close(i); - - return 0; - } - #endif --- 64,84 ---- }; ! static int i_add_ip_intf(const struct intf_entry *entry, void *arg); ! ip_t* i_ip_open(void); ! static struct ip_intf* i_lookup_ip_intf(ip_t*, ip_addr_t); ! static void i_request_arp(struct ip_intf *ipi, struct addr *dst); ! ssize_t i_ip_send(ip_t *ip, const void *buf, size_t len); ip_t * ! i_ip_close(ip_t *ip); /* end of modified code from libdnet */ #endif --- NEW FILE: sock_eth.cc --- #include "sock_eth.h" #ifndef HAVE_LIBDNET int send_ip_packet(const void *buf, size_t len){ return 1; } #else /* Portions of code below are from libdnet package: * Copyright (c) 2000-2004 Dug Song <du...@mo...> * All rights reserved, all wrongs reversed. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The names of the authors and copyright holders may not be used to * endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* start of modified code from libdnet */ static int i_add_ip_intf(const struct intf_entry *entry, void *arg) { ip_t *ip = (ip_t *)arg; struct ip_intf *ipi; if (entry->intf_type == INTF_TYPE_ETH && (entry->intf_flags & INTF_FLAG_UP) != 0 && entry->intf_mtu >= ETH_LEN_MIN && entry->intf_addr.addr_type == ADDR_TYPE_IP && entry->intf_link_addr.addr_type == ADDR_TYPE_ETH) { if ((ipi = (ip_intf*) calloc(1, sizeof(*ipi))) == NULL) return (-1); strncpy(ipi->name, entry->intf_name, sizeof(ipi->name)); memcpy(&ipi->ha, &entry->intf_link_addr, sizeof(ipi->ha)); memcpy(&ipi->pa, &entry->intf_addr, sizeof(ipi->pa)); ipi->mtu = entry->intf_mtu; LIST_INSERT_HEAD(&ip->ip_intf_list, ipi, next); } return (0); } ip_t * i_ip_open(void) { ip_t *ip; if ((ip = (ip_t*) calloc(1, sizeof(*ip))) != NULL) { ip->fd = -1; if ((ip->arp = arp_open()) == NULL || (ip->intf = intf_open()) == NULL || (ip->route = route_open()) == NULL) return (ip_close(ip)); if ((ip->fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) return (ip_close(ip)); memset(&ip->sin, 0, sizeof(ip->sin)); ip->sin.sin_family = AF_INET; ip->sin.sin_port = htons(666); LIST_INIT(&ip->ip_intf_list); if (intf_loop(ip->intf, i_add_ip_intf, ip) != 0) return (ip_close(ip)); } return (ip); } static struct ip_intf * i_lookup_ip_intf(ip_t *ip, ip_addr_t dst) { struct ip_intf *ipi; int n; ip->sin.sin_addr.s_addr = dst; n = sizeof(ip->sin); if (connect(ip->fd, (struct sockaddr *)&ip->sin, n) < 0) return (NULL); if (getsockname(ip->fd, (struct sockaddr *)&ip->sin, (socklen_t *) &n) < 0) return (NULL); LIST_FOREACH(ipi, &ip->ip_intf_list, next) { if (ipi->pa.addr_ip == ip->sin.sin_addr.s_addr) { if (ipi->eth == NULL) { if ((ipi->eth = eth_open(ipi->name)) == NULL) return (NULL); } if (ipi != LIST_FIRST(&ip->ip_intf_list)) { LIST_REMOVE(ipi, next); LIST_INSERT_HEAD(&ip->ip_intf_list, ipi, next); } return (ipi); } } return (NULL); } static void i_request_arp(struct ip_intf *ipi, struct addr *dst) { u_char frame[ETH_HDR_LEN + ARP_HDR_LEN + ARP_ETHIP_LEN]; eth_pack_hdr(frame, ETH_ADDR_BROADCAST, ipi->ha.addr_eth, ETH_TYPE_ARP); arp_pack_hdr_ethip(frame + ETH_HDR_LEN, ARP_OP_REQUEST, ipi->ha.addr_eth, ipi->pa.addr_ip, ETH_ADDR_BROADCAST, dst->addr_ip); eth_send(ipi->eth, frame, sizeof(frame)); } ssize_t i_ip_send(ip_t *ip, const void *buf, size_t len) { struct ip_hdr *iph; struct ip_intf *ipi; struct arp_entry arpent; struct route_entry rtent; u_char frame[ETH_LEN_MAX]; int i, usec; iph = (struct ip_hdr *)buf; if ((ipi = i_lookup_ip_intf(ip, iph->ip_dst)) == NULL) { errno = EHOSTUNREACH; return (-1); } arpent.arp_pa.addr_type = ADDR_TYPE_IP; arpent.arp_pa.addr_bits = IP_ADDR_BITS; arpent.arp_pa.addr_ip = iph->ip_dst; memcpy(&rtent.route_dst, &arpent.arp_pa, sizeof(rtent.route_dst)); for (i = 0, usec = 10; i < 3; i++, usec *= 100) { if (arp_get(ip->arp, &arpent) == 0) break; if (route_get(ip->route, &rtent) == 0 && rtent.route_gw.addr_ip != ipi->pa.addr_ip) { memcpy(&arpent.arp_pa, &rtent.route_gw, sizeof(arpent.arp_pa)); if (arp_get(ip->arp, &arpent) == 0) break; } i_request_arp(ipi, &arpent.arp_pa); usleep(usec); } if (i == 3) memset(&arpent.arp_ha.addr_eth, 0xff, ETH_ADDR_LEN); eth_pack_hdr(frame, arpent.arp_ha.addr_eth, ipi->ha.addr_eth, ETH_TYPE_IP); if (len > ipi->mtu) { u_char *p, *start, *end, *ip_data; #undef ip_hl int ip_hl, fraglen; ip_hl = iph->ip_hl << 2; fraglen = ipi->mtu - ip_hl; iph = (struct ip_hdr *)(frame + ETH_HDR_LEN); memcpy(iph, buf, ip_hl); ip_data = (u_char *)iph + ip_hl; start = (u_char *)buf + ip_hl; end = (u_char *)buf + len; for (p = start; p < end; ) { memcpy(ip_data, p, fraglen); iph->ip_len = htons(ip_hl + fraglen); iph->ip_off = htons(((p + fraglen < end) ? IP_MF : 0) | ((p - start) >> 3)); ip_checksum(iph, ip_hl + fraglen); i = ETH_HDR_LEN + ip_hl + fraglen; if (eth_send(ipi->eth, frame, i) != i) return (-1); p += fraglen; if (end - p < fraglen) fraglen = end - p; } return (len); #define ip_hl ip_hv&0x0f } memcpy(frame + ETH_HDR_LEN, buf, len); i = ETH_HDR_LEN + len; if (eth_send(ipi->eth, frame, i) != i) return (-1); return (len); } ip_t * i_ip_close(ip_t *ip) { struct ip_intf *ipi, *nxt; if (ip != NULL) { for (ipi = LIST_FIRST(&ip->ip_intf_list); ipi != LIST_END(&ip->ip_intf_list); ipi = nxt) { nxt = LIST_NEXT(ipi, next); if (ipi->eth != NULL) eth_close(ipi->eth); free(ipi); } if (ip->fd >= 0) #ifdef WIN32 closesocket(ip->fd); #else close(ip->fd); #endif if (ip->route != NULL) route_close(ip->route); if (ip->intf != NULL) intf_close(ip->intf); if (ip->arp != NULL) arp_close(ip->arp); free(ip); } return (NULL); } /* end of modified code from libdnet */ int send_ip_packet(const void *buf, size_t len){ ip_t *i = i_ip_open(); i_ip_send(i, buf, len); i_ip_close(i); return 0; } #endif icestring get_source_ip(const icestring &destip, icestring &sourceint){ #ifndef HAVE_LIBDNET char local_hostname[80]; if(gethostname(local_hostname, 80)) exit(-1); sourceint.assign("null"); //unfortunately, no pcap in cygwin icestring ret(local_hostname); return ret; #else #ifdef __linux__ if(!strcmp(destip.c_str(), "127.0.0.1")){ sourceint.assign("lo"); return "127.0.0.1"; } #elif //Need to add some code here... #endif struct ip_intf *ipi; ip_t *ip = i_ip_open(); if ((ipi = i_lookup_ip_intf(ip, inet_addr(destip.c_str()))) == NULL) { errno = EHOSTUNREACH; return ""; } struct sockaddr sa; addr_ntos(&(ipi->pa), &sa); struct sockaddr_in *sai = (sockaddr_in *) &sa; sourceint.assign(ipi->name); icestring addr(inet_ntoa(sai->sin_addr)); #ifdef __linux__ //add more platforms here if(! strcmp(addr.c_str(), destip.c_str())) sourceint.assign("lo"); #endif return addr; #endif } --- NEW FILE: sock_time.cc --- #include "sock_time.h" #ifdef WIN32 static u_int64_t filetime_to_unix_epoch (const FILETIME *ft) { u_int64_t res = (u_int64_t) ft->dwHighDateTime << 32; res |= ft->dwLowDateTime; res /= 10; res -= DELTA_EPOCH_IN_USEC; return (res); } int gettimeofday (struct timeval *tv, void *tz_U_) { FILETIME ft; u_int64_t tim; if (!tv) { errno = EINVAL; return (-1); } GetSystemTimeAsFileTime (&ft); tim = filetime_to_unix_epoch (&ft); tv->tv_sec = (long) (tim / 1000000L); tv->tv_usec = (long) (tim % 1000000L); return (0); } #endif void iceusleep(unsigned long usec){ usleep(usec); } void icesleep(int secs, int nsecs = 0){ #ifndef WIN32 struct timespec ts; ts.tv_sec = secs; ts.tv_nsec = nsecs; nanosleep (&ts, NULL); #else usleep(secs + nsecs * 1000); #endif } float timeb_diff(timeb &tp1, timeb &tp2){ float dt; int secs = tp2.time - tp1.time; int msecs = tp2.millitm - tp1.millitm; if(msecs < 0){ secs--; msecs = 1000 + msecs; } dt = secs + 0.001*msecs; return dt; } icestring make_uptime(long t){ char buf[1024]; int msecs = t % (1000); int secs = t/1000 % (60); int mins = t/1000/60 % (60); int hours = t/1000/60/60; double fsecs = secs + (double) msecs/1000; sprintf(buf, "%d hours %d minutes %.3f seconds", hours, mins, fsecs); icestring ret(buf); return ret; } --- NEW FILE: sock_win.cc --- #include "sock_win.h" #ifdef WIN32 WSADATA start_sockets(){ WSADATA wsa; if(WSAStartup(MAKEWORD(2,0), &wsa) != 0x0){ printf("WSAStartup() error!\n"); exit(-1); } return wsa; } void stop_sockets(){ WSACleanup(); } int getpid(){ return _getpid(); } int getuid(){ return (int)!(IsCurrentUserLocalAdministrator()); //UGLY, FIXIT! } //from MS Q118626: BOOL IsCurrentUserLocalAdministrator(void) { BOOL fReturn = FALSE; DWORD dwStatus; DWORD dwAccessMask; DWORD dwAccessDesired; DWORD dwACLSize; DWORD dwStructureSize = sizeof(PRIVILEGE_SET); PACL pACL = NULL; PSID psidAdmin = NULL; HANDLE hToken = NULL; HANDLE hImpersonationToken = NULL; PRIVILEGE_SET ps; GENERIC_MAPPING GenericMapping; PSECURITY_DESCRIPTOR psdAdmin = NULL; SID_IDENTIFIER_AUTHORITY SystemSidAuthority = SECURITY_NT_AUTHORITY; const DWORD ACCESS_READ = 1; const DWORD ACCESS_WRITE = 2; __try { if (!OpenThreadToken(GetCurrentThread(), TOKEN_DUPLICATE|TOKEN_QUERY, TRUE, &hToken)) { if (GetLastError() != ERROR_NO_TOKEN) __leave; if (!OpenProcessToken(GetCurrentProcess(), TOKEN_DUPLICATE|TOKEN_QUERY, &hToken)) __leave; } if (!DuplicateToken (hToken, SecurityImpersonation, &hImpersonationToken)) __leave; if (!AllocateAndInitializeSid(&SystemSidAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &psidAdmin)) __leave; psdAdmin = LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH); if (psdAdmin == NULL) __leave; if (!InitializeSecurityDescriptor(psdAdmin, SECURITY_DESCRIPTOR_REVISION)) __leave; dwACLSize = sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(psidAdmin) - sizeof(DWORD); pACL = (PACL)LocalAlloc(LPTR, dwACLSize); if (pACL == NULL) __leave; if (!InitializeAcl(pACL, dwACLSize, ACL_REVISION2)) __leave; dwAccessMask= ACCESS_READ | ACCESS_WRITE; if (!AddAccessAllowedAce(pACL, ACL_REVISION2, dwAccessMask, psidAdmin)) __leave; if (!SetSecurityDescriptorDacl(psdAdmin, TRUE, pACL, FALSE)) __leave; SetSecurityDescriptorGroup(psdAdmin, psidAdmin, FALSE); SetSecurityDescriptorOwner(psdAdmin, psidAdmin, FALSE); if (!IsValidSecurityDescriptor(psdAdmin)) __leave; dwAccessDesired = ACCESS_READ; /* Initialize GenericMapping structure even though you do not use generic rights. */ GenericMapping.GenericRead = ACCESS_READ; GenericMapping.GenericWrite = ACCESS_WRITE; GenericMapping.GenericExecute = 0; GenericMapping.GenericAll = ACCESS_READ | ACCESS_WRITE; if (!AccessCheck(psdAdmin, hImpersonationToken, dwAccessDesired, &GenericMapping, &ps, &dwStructureSize, &dwStatus, &fReturn)) { fReturn = FALSE; __leave; } } __finally { // Clean up. if (pACL) LocalFree(pACL); if (psdAdmin) LocalFree(psdAdmin); if (psidAdmin) FreeSid(psidAdmin); if (hImpersonationToken) CloseHandle (hImpersonationToken); if (hToken) CloseHandle (hToken); } return fReturn; } #else int start_sockets(){} void stop_sockets(){} #endif Index: sock_name.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_name.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** sock_name.h 21 Dec 2006 13:59:51 -0000 1.15 --- sock_name.h 21 Dec 2006 15:37:23 -0000 1.16 *************** *** 19,166 **** #endif ! int make_sockname(struct sockaddr_in& saddr, const char *hostname, int port, int domain) { ! saddr.sin_family = domain; ! if (hostname){ ! struct hostent *hostpointer = gethostbyname(hostname); ! memcpy((char *) &saddr.sin_addr, (char *) hostpointer->h_addr, hostpointer->h_length); ! } else ! saddr.sin_addr.s_addr = INADDR_ANY; ! ! ! saddr.sin_port = htons(port); ! saddr.sin_family = domain; ! memset(&(saddr.sin_zero), '\0', 8); ! ! return sizeof(saddr); ! } ! ! ! bool is_domainname(char * nisname){ ! IceRegex re("\\d+\\.\\d+\\.\\d+\\.\\d+"); ! return ! (re.match(nisname)); ! } ! ! bool is_domainname(icestring &nisname){ ! IceRegex re("\\d+\\.\\d+\\.\\d+\\.\\d+"); ! return ! (re.match(nisname.c_str())); ! } ! ! ! short int get_ip_byhost(const char * nisname, char * retname, int retlen){ ! struct hostent *h; ! char hname[1024]; ! char *rname; ! ! int len = (strlen(nisname) < 1024) ? strlen(nisname) : 1024; ! ! strncpy(hname, nisname, len); ! ! if( ( h = gethostbyname(nisname) ) == NULL) { ! return -1; ! } ! ! rname = inet_ntoa(*((struct in_addr *)h->h_addr)); ! ! retlen = (retlen >= strlen(rname)) ? strlen(rname) : retlen; ! ! strncpy(retname, rname, retlen); ! ! if(h->h_addr_list != NULL) return 1; ! else return 0; ! } ! ! short int get_ips_byhost(const char * nisname, std::vector <icestring> &v){ ! struct addrinfo hints, *res; ! char hname[1024]; ! int cnt = 0; ! ! int len = (strlen(nisname) < 1024) ? strlen(nisname) : 1024; ! ! strncpy(hname, nisname, len); ! ! Bzero(&hints, sizeof(hints)); ! hints.ai_flags = AI_CANONNAME; hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; ! ! if( getaddrinfo(nisname, "domain", &hints, &res) ) { ! return -1; ! } ! ! while(res){ ! icestring is(inet_ntoa( *( &( ((sockaddr_in *)res->ai_addr)->sin_addr ) ) )); ! ! v.push_back(is); ! res = res->ai_next; ! cnt++; ! } ! ! freeaddrinfo(res); ! ! return cnt; ! } ! short int get_host_byip(icestring &nisname, icestring &retname){ ! int rc; ! char hbuf[ICEMAXHOSTNAME]; ! struct sockaddr_in saddr; ! ! int len = make_sockname(saddr, nisname.c_str(), 53, AF_INET); ! ! if( (rc = getnameinfo((sockaddr *) &saddr, len, hbuf, sizeof(hbuf), NULL, 0, NI_NAMEREQD)) != 0) { //CHECK IN LINUX/BSD!!! ! //perror("getnameinfo"); ! return -1; ! } ! retname.assign(hbuf); ! ! return 0; ! } ! icestring get_source_ip(const icestring &destip, icestring &sourceint){ ! #ifndef DNET_H ! char local_hostname[80]; ! if(gethostname(local_hostname, 80)) exit(-1); ! sourceint.assign("null"); //unfortunately, no pcap in cygwin ! ! icestring ret(local_hostname); ! ! return ret; ! #else ! #ifdef __linux__ ! if(!strcmp(destip.c_str(), "127.0.0.1")){ ! sourceint.assign("lo"); ! return "127.0.0.1"; ! } ! #elif ! //Need to add some code here... ! #endif ! ! struct ip_intf *ipi; ! ! ip_t *ip = i_ip_open(); ! ! if ((ipi = i_lookup_ip_intf(ip, inet_addr(destip.c_str()))) == NULL) { ! errno = EHOSTUNREACH; ! return ""; ! } ! ! ! struct sockaddr sa; ! ! addr_ntos(&(ipi->pa), &sa); ! ! struct sockaddr_in *sai = (sockaddr_in *) &sa; ! ! sourceint.assign(ipi->name); ! icestring addr(inet_ntoa(sai->sin_addr)); ! ! #ifdef __linux__ //add more platforms here ! if(! strcmp(addr.c_str(), destip.c_str())) sourceint.assign("lo"); ! #endif ! ! return addr; ! #endif ! } #endif --- 19,33 ---- #endif ! int make_sockname(struct sockaddr_in& saddr, const char *hostname, int port, int domain); ! bool is_domainname(char * nisname); ! bool is_domainname(icestring &nisname); ! short int get_ip_byhost(const char * nisname, char * retname, int retlen); ! short int get_ips_byhost(const char * nisname, std::vector <icestring> &v); ! short int get_host_byip(icestring &nisname, icestring &retname); #endif Index: sock_time.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_time.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** sock_time.h 21 Dec 2006 13:11:46 -0000 1.10 --- sock_time.h 21 Dec 2006 15:37:23 -0000 1.11 *************** *** 15,96 **** #endif ! static u_int64_t filetime_to_unix_epoch (const FILETIME *ft) ! { ! u_int64_t res = (u_int64_t) ft->dwHighDateTime << 32; ! ! res |= ft->dwLowDateTime; ! res /= 10; ! res -= DELTA_EPOCH_IN_USEC; ! return (res); ! } ! ! int gettimeofday (struct timeval *tv, void *tz_U_) ! { ! FILETIME ft; ! u_int64_t tim; ! if (!tv) { ! errno = EINVAL; ! return (-1); ! } ! GetSystemTimeAsFileTime (&ft); ! tim = filetime_to_unix_epoch (&ft); ! tv->tv_sec = (long) (tim / 1000000L); ! tv->tv_usec = (long) (tim % 1000000L); ! return (0); ! } #endif ! void iceusleep(unsigned long usec){ ! usleep(usec); ! } ! ! void icesleep(int secs, int nsecs = 0){ ! #ifndef WIN32 ! struct timespec ts; ! ! ts.tv_sec = secs; ! ts.tv_nsec = nsecs; ! nanosleep (&ts, NULL); ! #else ! usleep(secs + nsecs * 1000); ! #endif ! } ! float timeb_diff(timeb &tp1, timeb &tp2){ ! float dt; ! ! int secs = tp2.time - tp1.time; ! int msecs = tp2.millitm - tp1.millitm; ! if(msecs < 0){ ! secs--; ! msecs = 1000 + msecs; ! } ! ! dt = secs + 0.001*msecs; ! ! return dt; ! } ! icestring make_uptime(long t){ ! char buf[1024]; ! ! int msecs = t % (1000); ! ! int secs = t/1000 % (60); ! ! int mins = t/1000/60 % (60); ! ! int hours = t/1000/60/60; ! ! double fsecs = secs + (double) msecs/1000; ! ! sprintf(buf, "%d hours %d minutes %.3f seconds", hours, mins, fsecs); ! ! icestring ret(buf); ! ! return ret; ! } #endif --- 15,30 ---- #endif ! static u_int64_t filetime_to_unix_epoch (const FILETIME *ft); ! int gettimeofday (struct timeval *tv, void *tz_U_); #endif ! void iceusleep(unsigned long); ! void icesleep(int, int); ! float timeb_diff(timeb &, timeb &); ! icestring make_uptime(long); #endif Index: sock_files.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_files.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sock_files.h 21 Dec 2006 13:59:51 -0000 1.1 --- sock_files.h 21 Dec 2006 15:37:23 -0000 1.2 *************** *** 11,44 **** #include "sock_types.h" ! bool file_exists(icestring &fname){ ! std::ifstream in; ! ! in.open(fname.c_str()); ! ! bool result = in.is_open(); ! ! in.close(); ! ! return result; ! } ! icestring find_icefile_path(char *fname){ ! icestring ret; ! ! // current dir ! ret.assign(fname); ! if(file_exists(ret)) return ret; ! ! // datadir ! ret.assign(""); ! ret.append(ICESCAN_DATADIR); ret.push_back(TRAILING_SLASH); ret.append(fname); ! if(file_exists(ret)) return ret; ! // --data_dir ! // add some code here ! ! // default ! ret.assign(""); ! return ret; ! } #endif /* _sock_files_H */ --- 11,17 ---- #include "sock_types.h" ! bool file_exists(icestring &fname); ! icestring find_icefile_path(char *fname); #endif /* _sock_files_H */ --- NEW FILE: sock_arp.cc --- #include "sock_arp.h" icestring get_arp_from_cache(icestring &ip) { char arp[24]; #ifdef __CYGWIN__ return ""; #elif __WITH_DNET__ struct arp_entry ae; addr_pton(ip.c_str(), &ae.arp_pa); arp_t *p = arp_open(); arp_get(p, &ae); arp_close(p); struct sockaddr sa; addr_ntos(&(ae.arp_ha), &sa); sprintf(arp, "%02x:%02x:%02x:%02x:%02x:%02x", sa.sa_data[0] & 0xFF, sa.sa_data[1] & 0xFF, sa.sa_data[2] & 0xFF, sa.sa_data[3] & 0xFF, sa.sa_data[4] & 0xFF, sa.sa_data[5] & 0xFF); icestring ret(arp); return ret; #elif WIN32 && !__WITH_DNET__ PMIB_IPNETTABLE pIPNetTable = NULL; PMIB_IPNETROW pIPNetRow = NULL; ULONG ulSize = 0; IN_ADDR ia; GetIpNetTable(pIPNetTable, &ulSize, TRUE); pIPNetTable = new MIB_IPNETTABLE[ulSize]; if (NULL != pIPNetTable) { GetIpNetTable(pIPNetTable, &ulSize, TRUE); for (int x = 0; x < pIPNetTable->dwNumEntries; x++) { pIPNetRow = &(pIPNetTable->table[x]); ia.S_un.S_addr = pIPNetRow->dwAddr; if(!strcmp(inet_ntoa(ia), ip.c_str())){ sprintf(arp, "%02x:%02x:%02x:%02x:%02x:%02x", pIPNetRow->bPhysAddr[0] & 0xFF, pIPNetRow->bPhysAddr[1] & 0xFF, pIPNetRow->bPhysAddr[2] & 0xFF, pIPNetRow->bPhysAddr[3] & 0xFF, pIPNetRow->bPhysAddr[4] & 0xFF, pIPNetRow->bPhysAddr[5] & 0xFF); icestring ret(arp); return ret; } } delete [] pIPNetTable; return ""; } #elif __linux__ && !__WITH_DNET__ struct sockaddr_in sin = { 0 }; struct arpreq myarp = { { 0 } }; int sockfd; sin.sin_family = AF_INET; inet_aton(ip.c_str(), &sin.sin_addr); memcpy(&myarp.arp_pa, &sin, sizeof myarp.arp_pa); strcpy(myarp.arp_dev, "any"); //UGLY if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { perror("socket"); return ""; } if (ioctl(sockfd, SIOCGARP, &myarp) == -1) { return ""; } sprintf(arp, "%02X:%02X:%02X:%02X:%02X:%02X", myarp.arp_ha.sa_data[0] & 0xFF, myarp.arp_ha.sa_data[1] & 0xFF, myarp.arp_ha.sa_data[2] & 0xFF, myarp.arp_ha.sa_data[3] & 0xFF, myarp.arp_ha.sa_data[4] & 0xFF, myarp.arp_ha.sa_data[5] & 0xFF); icestring ret(arp); return ret; #else return ""; #endif } --- NEW FILE: sock_name.cc --- #include "sock_name.h" int make_sockname(struct sockaddr_in& saddr, const char *hostname, int port, int domain) { saddr.sin_family = domain; if (hostname){ struct hostent *hostpointer = gethostbyname(hostname); memcpy((char *) &saddr.sin_addr, (char *) hostpointer->h_addr, hostpointer->h_length); } else saddr.sin_addr.s_addr = INADDR_ANY; saddr.sin_port = htons(port); saddr.sin_family = domain; memset(&(saddr.sin_zero), '\0', 8); return sizeof(saddr); } bool is_domainname(char * nisname){ IceRegex re("\\d+\\.\\d+\\.\\d+\\.\\d+"); return ! (re.match(nisname)); } bool is_domainname(icestring &nisname){ IceRegex re("\\d+\\.\\d+\\.\\d+\\.\\d+"); return ! (re.match(nisname.c_str())); } short int get_ip_byhost(const char * nisname, char * retname, int retlen){ struct hostent *h; char hname[1024]; char *rname; int len = (strlen(nisname) < 1024) ? strlen(nisname) : 1024; strncpy(hname, nisname, len); if( ( h = gethostbyname(nisname) ) == NULL) { return -1; } rname = inet_ntoa(*((struct in_addr *)h->h_addr)); retlen = (retlen >= strlen(rname)) ? strlen(rname) : retlen; strncpy(retname, rname, retlen); if(h->h_addr_list != NULL) return 1; else return 0; } short int get_ips_byhost(const char * nisname, std::vector <icestring> &v){ struct addrinfo hints, *res; char hname[1024]; int cnt = 0; int len = (strlen(nisname) < 1024) ? strlen(nisname) : 1024; strncpy(hname, nisname, len); Bzero(&hints, sizeof(hints)); hints.ai_flags = AI_CANONNAME; hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; if( getaddrinfo(nisname, "domain", &hints, &res) ) { return -1; } while(res){ icestring is(inet_ntoa( *( &( ((sockaddr_in *)res->ai_addr)->sin_addr ) ) )); v.push_back(is); res = res->ai_next; cnt++; } freeaddrinfo(res); return cnt; } short int get_host_byip(icestring &nisname, icestring &retname){ int rc; char hbuf[ICEMAXHOSTNAME]; struct sockaddr_in saddr; int len = make_sockname(saddr, nisname.c_str(), 53, AF_INET); if( (rc = getnameinfo((sockaddr *) &saddr, len, hbuf, sizeof(hbuf), NULL, 0, NI_NAMEREQD)) != 0) { //CHECK IN LINUX/BSD!!! //perror("getnameinfo"); return -1; } retname.assign(hbuf); return 0; } Index: sock_win.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_win.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sock_win.h 17 Dec 2006 19:52:23 -0000 1.9 --- sock_win.h 21 Dec 2006 15:37:23 -0000 1.10 *************** *** 32,177 **** #include <lmcons.h> ! WSADATA start_sockets(){ ! WSADATA wsa; ! ! if(WSAStartup(MAKEWORD(2,0), &wsa) != 0x0){ ! printf("WSAStartup() error!\n"); ! exit(-1); ! } ! ! return wsa; ! } ! void stop_sockets(){ ! WSACleanup(); ! } ! ! int getpid(){ ! return _getpid(); ! } ! ! BOOL IsCurrentUserLocalAdministrator(void); ! ! int getuid(){ ! return (int)!(IsCurrentUserLocalAdministrator()); //UGLY, FIXIT! ! } ! ! //from MS Q118626: ! BOOL IsCurrentUserLocalAdministrator(void) ! { ! BOOL fReturn = FALSE; ! DWORD dwStatus; ! DWORD dwAccessMask; ! DWORD dwAccessDesired; ! DWORD dwACLSize; ! DWORD dwStructureSize = sizeof(PRIVILEGE_SET); ! PACL pACL = NULL; ! PSID psidAdmin = NULL; ! ! HANDLE hToken = NULL; ! HANDLE hImpersonationToken = NULL; ! ! PRIVILEGE_SET ps; ! GENERIC_MAPPING GenericMapping; ! ! PSECURITY_DESCRIPTOR psdAdmin = NULL; ! SID_IDENTIFIER_AUTHORITY SystemSidAuthority = SECURITY_NT_AUTHORITY; ! ! const DWORD ACCESS_READ = 1; ! const DWORD ACCESS_WRITE = 2; ! ! ! __try ! { ! ! if (!OpenThreadToken(GetCurrentThread(), TOKEN_DUPLICATE|TOKEN_QUERY, TRUE, &hToken)) ! { ! if (GetLastError() != ERROR_NO_TOKEN) ! __leave; ! ! if (!OpenProcessToken(GetCurrentProcess(), TOKEN_DUPLICATE|TOKEN_QUERY, &hToken)) ! __leave; ! } ! ! if (!DuplicateToken (hToken, SecurityImpersonation, &hImpersonationToken)) ! __leave; ! ! ! if (!AllocateAndInitializeSid(&SystemSidAuthority, 2, ! SECURITY_BUILTIN_DOMAIN_RID, ! DOMAIN_ALIAS_RID_ADMINS, ! 0, 0, 0, 0, 0, 0, &psidAdmin)) ! __leave; ! ! psdAdmin = LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH); ! if (psdAdmin == NULL) ! __leave; ! ! if (!InitializeSecurityDescriptor(psdAdmin, SECURITY_DESCRIPTOR_REVISION)) ! __leave; ! ! dwACLSize = sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) + ! GetLengthSid(psidAdmin) - sizeof(DWORD); ! ! pACL = (PACL)LocalAlloc(LPTR, dwACLSize); ! if (pACL == NULL) ! __leave; ! ! if (!InitializeAcl(pACL, dwACLSize, ACL_REVISION2)) ! __leave; ! ! dwAccessMask= ACCESS_READ | ACCESS_WRITE; ! ! if (!AddAccessAllowedAce(pACL, ACL_REVISION2, dwAccessMask, psidAdmin)) ! __leave; ! ! if (!SetSecurityDescriptorDacl(psdAdmin, TRUE, pACL, FALSE)) ! __leave; ! ! SetSecurityDescriptorGroup(psdAdmin, psidAdmin, FALSE); ! SetSecurityDescriptorOwner(psdAdmin, psidAdmin, FALSE); ! ! if (!IsValidSecurityDescriptor(psdAdmin)) ! __leave; ! ! dwAccessDesired = ACCESS_READ; ! /* ! Initialize GenericMapping structure even though you ! do not use generic rights. ! */ ! GenericMapping.GenericRead = ACCESS_READ; ! GenericMapping.GenericWrite = ACCESS_WRITE; ! GenericMapping.GenericExecute = 0; ! GenericMapping.GenericAll = ACCESS_READ | ACCESS_WRITE; ! if (!AccessCheck(psdAdmin, hImpersonationToken, dwAccessDesired, ! &GenericMapping, &ps, &dwStructureSize, &dwStatus, ! &fReturn)) ! { ! fReturn = FALSE; ! __leave; ! } ! } ! __finally ! { ! // Clean up. ! if (pACL) LocalFree(pACL); ! if (psdAdmin) LocalFree(psdAdmin); ! if (psidAdmin) FreeSid(psidAdmin); ! if (hImpersonationToken) CloseHandle (hImpersonationToken); ! if (hToken) CloseHandle (hToken); ! } ! return fReturn; ! } #else ! typedef int WSADATA; ! ! int start_sockets(){ } ! ! void stop_sockets(){ } #endif --- 32,51 ---- #include <lmcons.h> ! WSADATA start_sockets(); ! void stop_sockets(); ! int getpid(); ! BOOL IsCurrentUserLocalAdministrator(void); ! int getuid(); #else + typedef int WSADATA; + + int start_sockets(); ! void stop_sockets(); #endif Index: ice_rand.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/ice_rand.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ice_rand.h 16 Dec 2006 16:06:06 -0000 1.3 --- ice_rand.h 21 Dec 2006 15:37:23 -0000 1.4 *************** *** 9,78 **** #define _ice_rand_H ! #include <string.h> ! #include <stdio.h> ! #include <stdlib.h> ! #if HAVE_SYS_TIME_H ! #include <sys/time.h> #endif // from Fyodor's "The Art of Port Scanning" ! int get_random_bytes(void *buf, int numbytes) { ! static char bytebuf[2048]; ! static char badrandomwarning = 0; ! static int bytesleft = 0; ! int tmp; ! int res; ! struct timeval tv; ! FILE *fp = NULL; ! unsigned int i; ! short *iptr; ! ! if (numbytes < 0 || numbytes > 0xFFFF) return -1; ! ! if (bytesleft == 0) { ! fp = fopen("/dev/arandom", "r"); ! if (!fp) fp = fopen("/dev/urandom", "r"); ! if (!fp) fp = fopen("/dev/random", "r"); ! if (fp) { ! res = (int) fread(bytebuf, 1, sizeof(bytebuf), fp); ! if (res != sizeof(bytebuf)) { ! fprintf(stderr, "Failed to read from /dev/urandom or /dev/random\n"); ! fclose(fp); ! fp = NULL; ! } ! bytesleft = sizeof(bytebuf); ! } ! if (!fp) { ! if (badrandomwarning == 0) { ! badrandomwarning++; ! gettimeofday(&tv, NULL); ! srand((tv.tv_sec ^ tv.tv_usec) ^ getpid()); ! } ! ! for(i=0; i < sizeof(bytebuf) / sizeof(short); i++) { ! iptr = (short *) ((char *)bytebuf + i * sizeof(short)); ! *iptr = rand(); ! } ! bytesleft = (sizeof(bytebuf) / sizeof(short)) * sizeof(short); ! } else fclose(fp); ! } ! ! if (numbytes <= bytesleft) { /* we can cover it */ ! memcpy(buf, bytebuf + (sizeof(bytebuf) - bytesleft), numbytes); ! bytesleft -= numbytes; ! return 0; ! } ! ! memcpy(buf, bytebuf + (sizeof(bytebuf) - bytesleft), bytesleft); ! tmp = bytesleft; ! bytesleft = 0; ! return get_random_bytes((char *)buf + tmp, numbytes - tmp); ! } ! void init_rand(){ ! unsigned i; ! get_random_bytes(&i, sizeof(i)); ! srand(i); ! } #endif /* _ice_rand_H */ --- 9,22 ---- #define _ice_rand_H ! #include "sock_types.h" ! ! #ifdef HAVE_SYS_TIME_H ! #include <sys/time.h> #endif // from Fyodor's "The Art of Port Scanning" ! int get_random_bytes(void *buf, int numbytes); ! void init_rand(); #endif /* _ice_rand_H */ Index: sock_pcap.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_pcap.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** sock_pcap.h 21 Dec 2006 13:11:46 -0000 1.10 --- sock_pcap.h 21 Dec 2006 15:37:23 -0000 1.11 *************** *** 9,282 **** #define _sock_pcap_H #include "sock_types.h" #ifndef HAVE_LIBPCAP ! typedef int pcap_t; ! ! pcap_t* init_pcap(int index = 0){ ! return NULL; ! } ! ! pcap_t* start_pcap(int iface, bool block, char *filter_exp){ ! return NULL; ! } ! ! void listdev_pcap(){ ! } ! ! char* readip_pcap(pcap_t* pd, unsigned int *len, struct timeval *rcvd_time){ ! return NULL; ! } ! ! bool pcap_filter(pcap_t *p, char *filter_exp){ ! return true; ! } ! ! int getdev_pcap(icestring &dev){ ! return 0; ! } ! ! int pcap_block(pcap_t *p, bool block){ ! } ! ! void close_pcap(pcap_t *p){ ! } ! ! #else ! ! pcap_t* init_pcap(int index = 0){ ! char *dev; ! char errbuf[PCAP_ERRBUF_SIZE]; ! pcap_t* descr; ! pcap_if_t *alldevs; ! pcap_if_t *d; ! int i=0; ! ! if(index){ ! ! if(pcap_findalldevs(&alldevs, errbuf) == -1) ! { ! printf("Error in pcap_findalldevs: %s\n", errbuf); ! exit(1); ! } ! ! for(d=alldevs; d; d=d->next) ! i++; ! ! if(i==0) ! { ! printf("\nNo interfaces found! Make sure WinPcap/LibPcap is installed.\n"); ! pcap_freealldevs(alldevs); ! return NULL; ! } ! ! for(d=alldevs, i=0; i< index-1 ;d=d->next, i++); ! ! pcap_t *dev = pcap_open_live(d->name,BUFSIZ,0,-1,errbuf); ! ! pcap_freealldevs(alldevs); ! ! return dev; ! }else{ ! dev = pcap_lookupdev(errbuf); ! ! if(dev == NULL) ! { ! return NULL; ! } ! ! return pcap_open_live(dev,BUFSIZ,0,-1,errbuf); ! } ! ! return NULL; ! } ! ! void listdev_pcap(){ ! pcap_if_t *alldevs; ! pcap_if_t *d; ! int i=0; ! char errbuf[PCAP_ERRBUF_SIZE]; ! ! if(pcap_findalldevs(&alldevs, errbuf) == -1) ! { ! printf("Error in pcap_findalldevs: %s\n", errbuf); ! exit(1); ! } ! ! for(d=alldevs; d; d=d->next) ! { ! printf("%d. %s", ++i, d->name); ! if (d->description) ! printf(" (%s)\n", d->description); ! else ! printf(" (No description available)\n"); ! } ! ! pcap_freealldevs(alldevs); ! ! if(i==0) ! { ! printf("\nNo interfaces found! Make sure WinPcap is installed.\n"); ! return; ! } ! } ! ! int getdev_pcap(icestring &dev){ ! pcap_if_t *alldevs; ! pcap_if_t *d; ! int i=1; ! char errbuf[PCAP_ERRBUF_SIZE]; ! ! if(pcap_findalldevs(&alldevs, errbuf) == -1) ! { ! printf("Error in pcap_findalldevs: %s\n", errbuf); ! exit(1); ! } ! ! for(d=alldevs; d; d=d->next, i++) ! { ! if(!strcmp(d->name, dev.c_str())) break; ! } ! ! if(!d) (i = 0); ! ! pcap_freealldevs(alldevs); ! ! if(i==0) ! printf("\nNo interfaces found! Make sure WinPcap is installed.\n"); ! ! return i; ! } ! ! char* readip_pcap(pcap_t* pd, unsigned int *len, struct timeval *rcvd_time){ ! unsigned int offset = 0; ! struct pcap_pkthdr head; ! char *p; ! static char *alignedbuf = NULL; ! static unsigned int alignedbufsz = 0; ! int link; ! ! link = pcap_datalink(pd); ! ! switch(link){ ! case DLT_EN10MB: offset = 14; break; ! ! case DLT_IEEE802: offset = 22; break; ! ! #ifdef DLT_LOOP ! case DLT_LOOP: ! #endif ! case DLT_NULL: offset = 4; break; ! ! case DLT_SLIP: ! #if (FREEBSD || OPENBSD || NETBSD || BSDI || MACOSX) ! offset = 16; ! #else ! offset = 24; ! #endif ! break; ! case DLT_PPP: ! #ifdef DLT_PPP_BSDOS ! case DLT_PPP_BSDOS: ! #endif ! #ifdef DLT_PPP_SERIAL ! case DLT_PPP_SERIAL: ! #endif ! #ifdef DLT_PPP_ETHER ! case DLT_PPP_ETHER: ! #endif ! #if (FREEBSD || OPENBSD || NETBSD || BSDI || MACOSX) ! offset = 4; ! #else ! #ifdef SOLARIS ! offset = 8; ! #else ! offset = 24; ! #endif /* solaris */ ! #endif /* freebsd || openbsd || netbsd || bsdi */ ! break; ! case DLT_RAW: offset = 0; break; ! case DLT_FDDI: offset = 21; break; ! #ifdef DLT_ENC ! case DLT_ENC: offset = 12; break; ! #endif /* DLT_ENC */ ! #ifdef DLT_LINUX_SLL ! case DLT_LINUX_SLL: offset = 16; break; ! #endif ! default: ! err_die("FATAL: Unknown datalink type!", 0); ! exit(1); ! } ! ! p = (char *) pcap_next(pd, &head); ! ! if(p){ ! if(head.caplen <= offset){ ! *len = 0; ! return NULL; ! } ! p += offset; ! }else return NULL; ! ! *len = head.caplen - offset; ! ! if (*len > alignedbufsz) { ! alignedbuf = (char *) realloc(alignedbuf, *len); ! if (!alignedbuf) { ! err_die("Unable to realloc mem!", 0); ! } ! alignedbufsz = *len; ! } ! memcpy(alignedbuf, p, *len); ! ! if (rcvd_time) { ! #if defined(WIN32) ! struct timeval tv_end; ! ! gettimeofday(&tv_end, NULL); ! *rcvd_time = tv_end; ! #else ! rcvd_time->tv_sec = head.ts.tv_sec; ! rcvd_time->tv_usec = head.ts.tv_usec; #endif - } ! return alignedbuf; ! } ! bool pcap_filter(pcap_t *p, char *filter_exp){ ! struct bpf_program fp; /* The compiled filter expression */ ! if (pcap_compile(p, &fp, filter_exp, 0, 0) == -1) { ! return false; ! } ! if (pcap_setfilter(p, &fp) == -1) { ! return false; ! } ! return true; ! } ! int pcap_block(pcap_t *p, bool block){ ! return pcap_setnonblock(p, (int)(!block), NULL); ! } ! pcap_t* open_pcap(int iface, bool block, char *filter_exp){ ! pcap_t* p = init_pcap(iface); ! ! if(!p) return NULL; ! ! pcap_block(p, block); ! ! pcap_filter(p, filter_exp); ! ! return p; ! } - void close_pcap(pcap_t *p){ - pcap_close(p); - } - #endif #endif /* _sock_pcap_H */ --- 9,35 ---- #define _sock_pcap_H + #include "sock_err.h" #include "sock_types.h" #ifndef HAVE_LIBPCAP ! typedef int pcap_t; #endif ! pcap_t* init_pcap(int); + pcap_t* start_pcap(int, bool, char); ! void listdev_pcap(); + char* readip_pcap(pcap_t*, unsigned int *, struct timeval *); ! bool pcap_filter(pcap_t *, char *); ! int getdev_pcap(icestring &); ! int pcap_block(pcap_t *, bool); ! ! void close_pcap(pcap_t *); #endif /* _sock_pcap_H */ --- NEW FILE: sock_files.cc --- #include "sock_files.h" bool file_exists(icestring &fname){ std::ifstream in; in.open(fname.c_str()); bool result = in.is_open(); in.close(); return result; } icestring find_icefile_path(char *fname){ icestring ret; // current dir ret.assign(fname); if(file_exists(ret)) return ret; // datadir ret.assign(""); ret.append(ICESCAN_DATADIR); ret.push_back(TRAILING_SLASH); ret.append(fname); if(file_exists(ret)) return ret; // --data_dir // add some code here // default ret.assign(""); return ret; } |
From: Alexander B. <da...@us...> - 2006-12-21 13:59:58
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7653 Modified Files: Makefile.am TODO configure.ac configure icedbs.h Makefile.in config.status Log Message: no message Index: configure =================================================================== RCS file: /cvsroot/javanetsim/IceScan/configure,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** configure 21 Dec 2006 13:11:46 -0000 1.1 --- configure 21 Dec 2006 13:59:50 -0000 1.2 *************** *** 1338,1342 **** cat >>confdefs.h <<\_ACEOF ! #define ICESCAN_DATE "21 December 2006" _ACEOF --- 1338,1342 ---- cat >>confdefs.h <<\_ACEOF ! #define ICESCAN_DATE '21 December 2006" _ACEOF *************** *** 1347,1350 **** --- 1347,1351 ---- + am__api_version="1.9" ac_aux_dir= Index: icedbs.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icedbs.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** icedbs.h 19 Dec 2006 21:09:04 -0000 1.8 --- icedbs.h 21 Dec 2006 13:59:50 -0000 1.9 *************** *** 2,9 **** #define ICEDBS_H ! #include <iostream> ! #include <fstream> ! #include <map> ! #include <string> class ice_service_name_database{ --- 2,6 ---- #define ICEDBS_H ! #include "icesockets/sock_files.h" class ice_service_name_database{ *************** *** 17,21 **** std::ifstream in; ! in.open(db_fname); if(!in){ --- 14,18 ---- std::ifstream in; ! in.open(find_icefile_path(db_fname).c_str()); if(!in){ *************** *** 40,44 **** if(v.size()<4){ - //DBGOUTPUT(tmpbuf); continue; } --- 37,40 ---- *************** *** 77,81 **** std::ifstream in; ! in.open(db_fname); if(!in){ --- 73,77 ---- std::ifstream in; ! in.open(find_icefile_path(db_fname).c_str()); if(!in){ Index: config.status =================================================================== RCS file: /cvsroot/javanetsim/IceScan/config.status,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** config.status 21 Dec 2006 13:11:46 -0000 1.1 --- config.status 21 Dec 2006 13:59:50 -0000 1.2 *************** *** 854,858 **** ${ac_dA}ICESCAN_VERSION${ac_dB}ICESCAN_VERSION${ac_dC}"0.0.6"${ac_dD} ${ac_dA}ICESCAN_NAME${ac_dB}ICESCAN_NAME${ac_dC}icescan${ac_dD} ! ${ac_dA}ICESCAN_DATE${ac_dB}ICESCAN_DATE${ac_dC}"21 December 2006"${ac_dD} ${ac_dA}ICESCAN_WEBSITE${ac_dB}ICESCAN_WEBSITE${ac_dC}"http://javanetsim.cvs.sourceforge.net/javanetsim/IceScan/"${ac_dD} ${ac_dA}PACKAGE${ac_dB}PACKAGE${ac_dC}"icescan"${ac_dD} --- 854,858 ---- ${ac_dA}ICESCAN_VERSION${ac_dB}ICESCAN_VERSION${ac_dC}"0.0.6"${ac_dD} ${ac_dA}ICESCAN_NAME${ac_dB}ICESCAN_NAME${ac_dC}icescan${ac_dD} ! ${ac_dA}ICESCAN_DATE${ac_dB}ICESCAN_DATE${ac_dC}'21 December 2006"${ac_dD} ${ac_dA}ICESCAN_WEBSITE${ac_dB}ICESCAN_WEBSITE${ac_dC}"http://javanetsim.cvs.sourceforge.net/javanetsim/IceScan/"${ac_dD} ${ac_dA}PACKAGE${ac_dB}PACKAGE${ac_dC}"icescan"${ac_dD} *************** *** 940,944 **** ${ac_uA}ICESCAN_VERSION${ac_uB}ICESCAN_VERSION${ac_uC}"0.0.6"${ac_uD} ${ac_uA}ICESCAN_NAME${ac_uB}ICESCAN_NAME${ac_uC}icescan${ac_uD} ! ${ac_uA}ICESCAN_DATE${ac_uB}ICESCAN_DATE${ac_uC}"21 December 2006"${ac_uD} ${ac_uA}ICESCAN_WEBSITE${ac_uB}ICESCAN_WEBSITE${ac_uC}"http://javanetsim.cvs.sourceforge.net/javanetsim/IceScan/"${ac_uD} ${ac_uA}PACKAGE${ac_uB}PACKAGE${ac_uC}"icescan"${ac_uD} --- 940,944 ---- ${ac_uA}ICESCAN_VERSION${ac_uB}ICESCAN_VERSION${ac_uC}"0.0.6"${ac_uD} ${ac_uA}ICESCAN_NAME${ac_uB}ICESCAN_NAME${ac_uC}icescan${ac_uD} ! ${ac_uA}ICESCAN_DATE${ac_uB}ICESCAN_DATE${ac_uC}'21 December 2006"${ac_uD} ${ac_uA}ICESCAN_WEBSITE${ac_uB}ICESCAN_WEBSITE${ac_uC}"http://javanetsim.cvs.sourceforge.net/javanetsim/IceScan/"${ac_uD} ${ac_uA}PACKAGE${ac_uB}PACKAGE${ac_uC}"icescan"${ac_uD} Index: Makefile.in =================================================================== RCS file: /cvsroot/javanetsim/IceScan/Makefile.in,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.in 21 Dec 2006 13:17:57 -0000 1.2 --- Makefile.in 21 Dec 2006 13:59:50 -0000 1.3 *************** *** 105,109 **** CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ ! CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ --- 105,109 ---- CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ ! CXXFLAGS = -DICESCAN_DATADIR=\"$(icescandir)\" CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ *************** *** 178,182 **** icescan_SOURCES = icescan.cc icescan_DATA = services ieee-oui.txt README INSTALL COPYING AUTHORS ChangeLog INSTALL.conf - @DEFS@ = -DICESCAN_DATADIR=$(icescandir) @DEFS@ all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am --- 178,181 ---- Index: configure.ac =================================================================== RCS file: /cvsroot/javanetsim/IceScan/configure.ac,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** configure.ac 21 Dec 2006 13:11:46 -0000 1.1 --- configure.ac 21 Dec 2006 13:59:50 -0000 1.2 *************** *** 7,13 **** AC_DEFINE(ICESCAN_VERSION, AC_PACKAGE_VERSION, [version]) AC_DEFINE(ICESCAN_NAME, AC_PACKAGE_NAME, [name]) ! AC_DEFINE(ICESCAN_DATE, "21 December 2006", [releasedate]) AC_DEFINE(ICESCAN_WEBSITE, "http://javanetsim.cvs.sourceforge.net/javanetsim/IceScan/", [website]) AM_INIT_AUTOMAKE([1.9 foreign]) --- 7,14 ---- AC_DEFINE(ICESCAN_VERSION, AC_PACKAGE_VERSION, [version]) AC_DEFINE(ICESCAN_NAME, AC_PACKAGE_NAME, [name]) ! AC_DEFINE(ICESCAN_DATE, '21 December 2006", [releasedate]) AC_DEFINE(ICESCAN_WEBSITE, "http://javanetsim.cvs.sourceforge.net/javanetsim/IceScan/", [website]) + AM_INIT_AUTOMAKE([1.9 foreign]) Index: Makefile.am =================================================================== RCS file: /cvsroot/javanetsim/IceScan/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.am 21 Dec 2006 13:17:57 -0000 1.2 --- Makefile.am 21 Dec 2006 13:59:50 -0000 1.3 *************** *** 3,6 **** icescan_SOURCES = icescan.cc icescan_DATA = services ieee-oui.txt README INSTALL COPYING AUTHORS ChangeLog INSTALL.conf ! @DEFS@ = -DICESCAN_DATADIR=$(icescandir) @DEFS@ --- 3,6 ---- icescan_SOURCES = icescan.cc icescan_DATA = services ieee-oui.txt README INSTALL COPYING AUTHORS ChangeLog INSTALL.conf ! CXXFLAGS=-DICESCAN_DATADIR=\"$(icescandir)\" Index: TODO =================================================================== RCS file: /cvsroot/javanetsim/IceScan/TODO,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** TODO 19 Dec 2006 21:09:04 -0000 1.16 --- TODO 21 Dec 2006 13:59:50 -0000 1.17 *************** *** 6,9 **** --- 6,10 ---- + add multiple targets handling; + + --data-dir option for directory handling the databases -- Discovering -- |
From: Alexander B. <da...@us...> - 2006-12-21 13:59:55
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7653/icesockets Modified Files: sock_name.h iceregex.h sock_types.h Added Files: sock_files.h Log Message: no message Index: sock_types.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_types.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** sock_types.h 21 Dec 2006 13:11:46 -0000 1.26 --- sock_types.h 21 Dec 2006 13:59:51 -0000 1.27 *************** *** 4,7 **** --- 4,9 ---- #include "sock_win.h" + #define TRAILING_SLASH '/' + #ifdef WIN32 #include "../defwin.h" *************** *** 14,20 **** #endif #include <vector> #include <string> ! #include <iostream> //for std #include <algorithm> --- 16,25 ---- #endif + //STD:: #include <vector> + #include <map> #include <string> ! #include <fstream> ! #include <iostream> #include <algorithm> *************** *** 33,36 **** --- 38,43 ---- #ifdef WIN32 #define __WIN32__ + #undef TRAILING_SLASH + #define TRAILING_SLASH '\' #else Index: iceregex.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/iceregex.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** iceregex.h 21 Dec 2006 13:11:46 -0000 1.12 --- iceregex.h 21 Dec 2006 13:59:51 -0000 1.13 *************** *** 11,15 **** #include "sock_types.h" ! #ifdef HAVE_LIBPCRE class IceRegex { --- 11,15 ---- #include "sock_types.h" ! #ifndef HAVE_LIBPCRE class IceRegex { Index: sock_name.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_name.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** sock_name.h 21 Dec 2006 10:13:53 -0000 1.14 --- sock_name.h 21 Dec 2006 13:59:51 -0000 1.15 *************** *** 143,147 **** if ((ipi = i_lookup_ip_intf(ip, inet_addr(destip.c_str()))) == NULL) { errno = EHOSTUNREACH; - DBGOUTPUT("HOST UNREACH!!!"); return ""; } --- 143,146 ---- --- NEW FILE: sock_files.h --- /* * File: sock_files.h * Author: Key * * Created on 21 Dec 2006, 16:54 */ #ifndef _sock_files_H #define _sock_files_H #include "sock_types.h" bool file_exists(icestring &fname){ std::ifstream in; in.open(fname.c_str()); bool result = in.is_open(); in.close(); return result; } icestring find_icefile_path(char *fname){ icestring ret; // current dir ret.assign(fname); if(file_exists(ret)) return ret; // datadir ret.assign(""); ret.append(ICESCAN_DATADIR); ret.push_back(TRAILING_SLASH); ret.append(fname); if(file_exists(ret)) return ret; // --data_dir // add some code here // default ret.assign(""); return ret; } #endif /* _sock_files_H */ |
From: Alexander B. <da...@us...> - 2006-12-21 13:59:54
|
Update of /cvsroot/javanetsim/IceScan/nbproject In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7653/nbproject Modified Files: configurations.xml Log Message: no message Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/configurations.xml,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** configurations.xml 21 Dec 2006 13:17:57 -0000 1.22 --- configurations.xml 21 Dec 2006 13:59:50 -0000 1.23 *************** *** 12,15 **** --- 12,16 ---- <itemPath>icesockets/sock_err.h</itemPath> <itemPath>icesockets/sock_eth.h</itemPath> + <itemPath>icesockets/sock_files.h</itemPath> <itemPath>icesockets/sock_name.h</itemPath> <itemPath>icesockets/sock_pcap.h</itemPath> *************** *** 152,155 **** --- 153,159 ---- <itemTool>3</itemTool> </item> + <item path="icesockets/sock_files.h"> + <itemTool>3</itemTool> + </item> </conf> </confs> |
From: Alexander B. <da...@us...> - 2006-12-21 13:18:01
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22959 Modified Files: Makefile.am Makefile.in icediscover.h Log Message: no message Index: Makefile.in =================================================================== RCS file: /cvsroot/javanetsim/IceScan/Makefile.in,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile.in 21 Dec 2006 13:13:34 -0000 1.1 --- Makefile.in 21 Dec 2006 13:17:57 -0000 1.2 *************** *** 177,181 **** icescandir = $(datadir)/icescan icescan_SOURCES = icescan.cc ! icescan_DATA = services ieee-oui.txt README INSTALL COPYING AUTHORS ChangeLog INSTALL.configure @DEFS@ = -DICESCAN_DATADIR=$(icescandir) @DEFS@ all: config.h --- 177,181 ---- icescandir = $(datadir)/icescan icescan_SOURCES = icescan.cc ! icescan_DATA = services ieee-oui.txt README INSTALL COPYING AUTHORS ChangeLog INSTALL.conf @DEFS@ = -DICESCAN_DATADIR=$(icescandir) @DEFS@ all: config.h Index: Makefile.am =================================================================== RCS file: /cvsroot/javanetsim/IceScan/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile.am 21 Dec 2006 13:11:46 -0000 1.1 --- Makefile.am 21 Dec 2006 13:17:57 -0000 1.2 *************** *** 2,6 **** icescandir = $(datadir)/icescan icescan_SOURCES = icescan.cc ! icescan_DATA = services ieee-oui.txt README INSTALL COPYING AUTHORS ChangeLog INSTALL.configure @DEFS@ = -DICESCAN_DATADIR=$(icescandir) @DEFS@ --- 2,6 ---- icescandir = $(datadir)/icescan icescan_SOURCES = icescan.cc ! icescan_DATA = services ieee-oui.txt README INSTALL COPYING AUTHORS ChangeLog INSTALL.conf @DEFS@ = -DICESCAN_DATADIR=$(icescandir) @DEFS@ Index: icediscover.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icediscover.h,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** icediscover.h 21 Dec 2006 13:16:26 -0000 1.33 --- icediscover.h 21 Dec 2006 13:17:57 -0000 1.34 *************** *** 6,19 **** #include "icesockets/csocket.h" #include "icesockets/crawsocket.h" - #include "iceoutput.h" #include "iceparams.h" ! ! #ifndef WIN32 ! #define ACK_PING_STANDART_PORT 80 ! #else ! #define ACK_PING_STANDART_PORT 80 ! #endif ! #define ARP_PING_STANDART_PORT 138 #define ATTEMPTS 5 --- 6,13 ---- #include "icesockets/csocket.h" #include "icesockets/crawsocket.h" #include "iceparams.h" + #include "iceoutput.h" ! #define ACK_PING_STANDART_PORT 80 #define ARP_PING_STANDART_PORT 138 #define ATTEMPTS 5 |
From: Alexander B. <da...@us...> - 2006-12-21 13:18:01
|
Update of /cvsroot/javanetsim/IceScan/nbproject In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22959/nbproject Modified Files: configurations.xml Log Message: no message Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/configurations.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** configurations.xml 21 Dec 2006 13:11:46 -0000 1.21 --- configurations.xml 21 Dec 2006 13:17:57 -0000 1.22 *************** *** 26,32 **** <itemPath>COPYING</itemPath> <itemPath>ieee-oui.txt</itemPath> <itemPath>INSTALL</itemPath> - <itemPath>Makefile</itemPath> <itemPath>NEWS</itemPath> <itemPath>README</itemPath> <itemPath>services</itemPath> --- 26,33 ---- <itemPath>COPYING</itemPath> <itemPath>ieee-oui.txt</itemPath> + <itemPath>INSTALL.conf</itemPath> <itemPath>INSTALL</itemPath> <itemPath>NEWS</itemPath> + <itemPath>README.win32</itemPath> <itemPath>README</itemPath> <itemPath>services</itemPath> |
From: Alexander B. <da...@us...> - 2006-12-21 13:16:30
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22453 Modified Files: .cvsignore icediscover.h Log Message: no message Index: .cvsignore =================================================================== RCS file: /cvsroot/javanetsim/IceScan/.cvsignore,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** .cvsignore 21 Dec 2006 13:13:20 -0000 1.6 --- .cvsignore 21 Dec 2006 13:16:26 -0000 1.7 *************** *** 1 **** ! icescan icescan.o Makefile icescan.exe IceScan.exe Makefile.in autom4te.cache \ No newline at end of file --- 1,5 ---- ! config.h ! stamp-h1 ! icescan ! config.log ! icescan icescan.o Makefile icescan.exe IceScan.exe Makefile.in autom4te.cache Index: icediscover.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icediscover.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** icediscover.h 18 Dec 2006 08:57:02 -0000 1.32 --- icediscover.h 21 Dec 2006 13:16:26 -0000 1.33 *************** *** 2,11 **** #define ICEDISCOVER_H ! #include "icesockets/ice_rand.h" #include "icesockets/csocket.h" #include "icesockets/crawsocket.h" - #include "iceparams.h" #include "iceoutput.h" #ifndef WIN32 --- 2,12 ---- #define ICEDISCOVER_H ! #include "icesockets/ice_rand.h" #include "icesockets/csocket.h" #include "icesockets/crawsocket.h" #include "iceoutput.h" + #include "iceparams.h" + #ifndef WIN32 |
From: Alexander B. <da...@us...> - 2006-12-21 13:16:30
|
Update of /cvsroot/javanetsim/IceScan/autom4te.cache In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22453/autom4te.cache Added Files: .cvsignore Log Message: no message --- NEW FILE: .cvsignore --- traces.1 traces.0 requests output.1 output.0 |
From: Alexander B. <da...@us...> - 2006-12-21 13:16:29
|
Update of /cvsroot/javanetsim/IceScan/.deps In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22453/.deps Added Files: .cvsignore Log Message: no message --- NEW FILE: .cvsignore --- icescan.Po |
From: Alexander B. <da...@us...> - 2006-12-21 13:16:23
|
Update of /cvsroot/javanetsim/IceScan/.deps In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22430/.deps Log Message: Directory /cvsroot/javanetsim/IceScan/.deps added to the repository |
From: Alexander B. <da...@us...> - 2006-12-21 13:16:23
|
Update of /cvsroot/javanetsim/IceScan/autom4te.cache In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22430/autom4te.cache Log Message: Directory /cvsroot/javanetsim/IceScan/autom4te.cache added to the repository |
From: Alexander B. <da...@us...> - 2006-12-21 13:13:42
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21171 Added Files: INSTALL.conf README AUTHORS ChangeLog README.win32 Makefile.in INSTALL NEWS Log Message: no message --- NEW FILE: ChangeLog --- IceScan CHANGELOG (+ -- new feature, * -- bugfix) *** IceScan v. 0.0.6, 19 Dec 2006 *** * fixed blocking pcap calls. + automatically select source ip/interface in Linux/Windows. + added OS independent (libdnet) checking MAC address. *** IceScan v. 0.0.5, 18 Dec 2006 *** + TCP Raw scan. + ICMP Timestamp/Netmask discovery. + UDP Discovery/Scan. + Windows NT/2000/XP support. + added printing time at startup. * fixed icmp echo discovery (icmplen). * fixed selecting discovery type from command line. * fixed format string vulnerability when showing port table. + added scan time reporting at the end of the scan * fixed crash on empty target + added reverse dns lookup (and -r key to command line) *** IceScan v. 0.0.1, 18 Dec 2006 *** Initial release. --- NEW FILE: Makefile.in --- # Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = icescan$(EXEEXT) DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ TODO config.guess config.sub depcomp install-sh missing subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(icescandir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_icescan_OBJECTS = icescan.$(OBJEXT) icescan_OBJECTS = $(am_icescan_OBJECTS) icescan_LDADD = $(LDADD) DEFAULT_INCLUDES = -I. -I$(srcdir) -I. depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(icescan_SOURCES) DIST_SOURCES = $(icescan_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; icescanDATA_INSTALL = $(INSTALL_DATA) DATA = $(icescan_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ icescandir = $(datadir)/icescan icescan_SOURCES = icescan.cc icescan_DATA = services ieee-oui.txt README INSTALL COPYING AUTHORS ChangeLog INSTALL.configure @DEFS@ = -DICESCAN_DATADIR=$(icescandir) @DEFS@ all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .cc .o .obj am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ cd $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) icescan$(EXEEXT): $(icescan_OBJECTS) $(icescan_DEPENDENCIES) @rm -f icescan$(EXEEXT) $(CXXLINK) $(icescan_LDFLAGS) $(icescan_OBJECTS) $(icescan_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icescan.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` uninstall-info-am: install-icescanDATA: $(icescan_DATA) @$(NORMAL_INSTALL) test -z "$(icescandir)" || $(mkdir_p) "$(DESTDIR)$(icescandir)" @list='$(icescan_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(icescanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(icescandir)/$$f'"; \ $(icescanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(icescandir)/$$f"; \ done uninstall-icescanDATA: @$(NORMAL_UNINSTALL) @list='$(icescan_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(icescandir)/$$f'"; \ rm -f "$(DESTDIR)$(icescandir)/$$f"; \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(DATA) config.h installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(icescandir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-icescanDATA install-exec-am: install-binPROGRAMS install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-icescanDATA \ uninstall-info-am .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \ dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am install-exec \ install-exec-am install-icescanDATA install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-binPROGRAMS uninstall-icescanDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: --- NEW FILE: README.win32 --- --- NEW FILE: INSTALL.conf --- Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. --- NEW FILE: INSTALL --- NOTE: this document applies to the IceScan source releases. Installation ============ These are installation instructions for Unix and Unix-like systems that can run the "configure" script in this same directory. These are not the installation instructions for Windows systems; see README.win32 for those instructions. 0. This is beta software. Beware. 1. If you wish to build IceScan, make sure you have libpcap installed. The latest "official" version can be found at http://www.tcpdump.org . If you installed libpcap from a binary package, you may have to install a "development" package; for example, there's apparently a "libpcap0" Debian package, but it just includes a shared library, a copyright notice, changelog files, and a README file - you also need to install a "libpcap-dev" package to get header files, a non-shared library, and the man page. Similarly, Red Hat ES/Fedora users will need to install a "libpcap-devel" .rpm to go along with the "libpcap" .rpm. 4. Run './configure' in the Wireshark distribution directory. Running './configure --help' displays a list of options. The file 'INSTALL.configure' contains general instructions for using 'configure' and 'make'. Wireshark has some non-generic configure options: --sysconfdir=DIR Wireshark installs a support file (manuf) in ${PREFIX}/etc by default, where ${PREFIX} comes from --prefix=DIR. If you do not specify any --prefix option, ${PREFIX} is "/usr/local". You can change the location of the manuf file with the --sysconfdir option. --disable-usr-local By default 'configure' will look in /usr/local/{include,lib} for additional header files and libraries. Using this switch keeps 'configure' from looking there --disable-wireshark By default, if 'configure' finds the GTK+ libraries, the Makefile build Wireshark, the GUI packet analyzer. You can disable the build of the GUI version of Wireshark with this switch. --with-pcap=DIR Use this to tell Wireshark where you have libpcap installed, if it is installed in a non-standard location. 5. After running './configure', you will see a summary of some of the options you chose. Ensure that the summary reflects what you want. If it doesn't, re-run './configure' with new options. 6. Run 'make'. Hopefully, you won't run into any problems. 7. Run './icescan' and make sure things are working. You must have root privileges in order to capture live data. 8. Run 'make install'. If you have trouble with the build or installation process, you can find assistance on the icescan-users an icescan-dev mailing lists. See http:// for details. --- NEW FILE: AUTHORS --- Author ------ Alexander Bolshev[Key] <key(at)timeold.ru> Developers ---------- Konstantin Karpov[Q_] <q_(at)peterstar.ru> { IceRegex C++ wrapper to pcre. UDP Scanning and pinging. Fixing _many_ bugs. Help on porting to CygWin and Win32. } Contributors ------------ Also thanks ---- ------ Motoyuki Kasahara for his implementation of getaddrinfo() (see icesockets/getaddrinfo.h). Dug Song <dugsong(at)monkey.org> for his GREAT libdnet library (some modified code from it used in icesockets/sock_eth.h) Andrew Tridgell and other Samba (http://samba.org) developers for some code of NetBIOS over TCP/IP structures and functions; also to Alla Bezroutchko <alla(at)scanit.be) for nbtstat. Potions of code from samba and nbtstat used in nbtwrapper.h. And to Fyodor, the AUTHOR of the GREATEST internet security scanner NNAP; I've spent some good nights in analyzing his code to understand how to write some scanning features in IceScan ;). --- NEW FILE: README --- General Information ------- ----------- IceScan is a free open source network analyzing and security auditing tool for Unix-like and Windows operating systems. It uses libpcap, a packet capture and filtering library. Primarily, I've started this project to have an experience in raw sockets and network channel level programming, and also to learn how to port C/C++ apps to different platforms. The main GOAL of IceScan is "coding and educating while coding :). I understand, that the IceScan NEVER 'll be like NMap, and always 'll be "ugly program". So don't hit me too much! And sorry for my *BAD* English. Also see AUTHORS file for thanksgiving service. The official home of IceScan is The latest distribution can be found in the subdirectory Good luck! Alexander Bolshev[Key] <key(at)timeold.ru> Installation ------------ Wireshark is known to compile and run on the following systems: - Linux (2.4 and later kernels, various distributions) - CygWin - Win32 (2000, XP, 2003) Full installation instructions can be found in the INSTALL file. See also the appropriate README.<OS> files for OS-specific installation instructions. Usage ----- Please consult the man page for a description of each command-line option and interface feature. IPv6 ---- Unfortunaly, IceScan currently don't support IPv6. Sorry. How to Report a Bug ------------------- IceScan is still under constant development, so it is possible that you will encounter a bug while using it. Please report bugs to <(at)>. Be sure you tell us: 1) Operating System and version (the command 'uname -sr' may tell you this, although on Linux systems it will probably tell you only the version number of the Linux kernel, not of the distribution as a whole; on Linux systems, please tell us both the version number of the kernel, and which version of which distribution you're running). 2) Version of libpcap, libdnet and libcre. COmpressed config.log file. 3) Version of IceScan (the command 'icescan -V' will tell you, unless the bug is so severe as to prevent that from working, and should also tell you the versions of libraries with which it was built) 4) The command you used to invoke IceScan, and the sequence of operations you performed that caused the bug to appear If the bug is produced by a particular trace file, please be sure to send a trace file along with your bug description. Please don't send a trace file greater than 1 MB when compressed. If the trace file contains sensitive information (e.g., passwords), then please do not send it. If IceScan died on you with a 'segmentation violation', 'bus error', 'abort', or other error that produces a UNIX core dump file, you can help the developers a lot if you have a debugger installed. A stack trace can be obtained by using your debugger ('gdb' in this example), the wireshark binary, and the resulting core file. Here's an example of how to use the gdb command 'backtrace' to do so. $ gdb icescan core (gdb) backtrace ..... prints the stack trace (gdb) quit $ The core dump file may be named "icescan.core" rather than "core" on some platforms (e.g., BSD systems). Disclaimer ---------- There is no warranty, expressed or implied, associated with this product. Use at your own risk. --- NEW FILE: NEWS --- |
From: Alexander B. <da...@us...> - 2006-12-21 13:13:23
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21139 Modified Files: .cvsignore Log Message: no message Index: .cvsignore =================================================================== RCS file: /cvsroot/javanetsim/IceScan/.cvsignore,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** .cvsignore 21 Dec 2006 13:11:46 -0000 1.5 --- .cvsignore 21 Dec 2006 13:13:20 -0000 1.6 *************** *** 1 **** ! icescan icescan.o Makefile icescan.exe IceScan.exe Makefile.in \ No newline at end of file --- 1 ---- ! icescan icescan.o Makefile icescan.exe IceScan.exe Makefile.in autom4te.cache \ No newline at end of file |
From: Alexander B. <da...@us...> - 2006-12-21 13:11:52
|
Update of /cvsroot/javanetsim/IceScan/nbproject In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20283/nbproject Modified Files: configurations.xml Log Message: Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/configurations.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** configurations.xml 19 Dec 2006 09:04:49 -0000 1.20 --- configurations.xml 21 Dec 2006 13:11:46 -0000 1.21 *************** *** 8,11 **** --- 8,12 ---- <itemPath>icesockets/ice_rand.h</itemPath> <itemPath>icesockets/iceregex.h</itemPath> + <itemPath>icesockets/queue.h</itemPath> <itemPath>icesockets/sock_arp.h</itemPath> <itemPath>icesockets/sock_err.h</itemPath> *************** *** 21,28 **** projectFiles="false"> <itemPath>.cvsignore</itemPath> ! <itemPath>CHANGELOG</itemPath> <itemPath>COPYING</itemPath> <itemPath>ieee-oui.txt</itemPath> <itemPath>Makefile</itemPath> <itemPath>services</itemPath> <itemPath>TODO</itemPath> --- 22,33 ---- projectFiles="false"> <itemPath>.cvsignore</itemPath> ! <itemPath>AUTHORS</itemPath> ! <itemPath>ChangeLog</itemPath> <itemPath>COPYING</itemPath> <itemPath>ieee-oui.txt</itemPath> + <itemPath>INSTALL</itemPath> <itemPath>Makefile</itemPath> + <itemPath>NEWS</itemPath> + <itemPath>README</itemPath> <itemPath>services</itemPath> <itemPath>TODO</itemPath> *************** *** 30,33 **** --- 35,39 ---- <itemPath>csubtarget.h</itemPath> <itemPath>ctarget.h</itemPath> + <itemPath>defwin.h</itemPath> <itemPath>icedbs.h</itemPath> <itemPath>icediscover.h</itemPath> *************** *** 139,142 **** --- 145,154 ---- <itemTool>3</itemTool> </item> + <item path="icesockets/queue.h"> + <itemTool>3</itemTool> + </item> + <item path="defwin.h"> + <itemTool>3</itemTool> + </item> </conf> </confs> |
From: Alexander B. <da...@us...> - 2006-12-21 13:11:51
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20283/icesockets Modified Files: iceregex.h sock_eth.h sock_pcap.h sock_time.h sock_types.h Log Message: Index: sock_types.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_types.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** sock_types.h 21 Dec 2006 10:13:53 -0000 1.25 --- sock_types.h 21 Dec 2006 13:11:46 -0000 1.26 *************** *** 4,10 **** #include "sock_win.h" ! #ifndef __CYGWIN__ ! #include <dnet.h> ! #define __WITH_DNET__ 1 #endif --- 4,15 ---- #include "sock_win.h" ! #ifdef WIN32 ! #include "../defwin.h" ! #elif HAVE_CONFIG_H ! #include "../config.h" ! #endif ! ! #ifdef HAVE_LIBDNET ! #include <dnet.h> #endif *************** *** 66,71 **** #include <fcntl.h> - #ifndef WIN32 --- 71,81 ---- #include <fcntl.h> + + #ifdef HAVE_BZERO + #define Bzero(a,b) bzero(a, b) + #else + #define Bzero(a,b) memset(a,0,b); + #endif #ifndef WIN32 *************** *** 73,101 **** #define SOCKET_ERROR -1 typedef int SOCKET; - //#define SOCKET int ! typedef uint16_t my_uint16_t; ! typedef uint32_t my_uint32_t; ! typedef uint8_t my_uint8_t; - #define Bzero(a,b) bzero(a, b) #else - #define Bzero(a,b) memset(a,0,b); - - typedef UINT16 uint16_t; - typedef UINT32 uint32_t; - typedef UINT8 uint8_t; ! typedef UINT16 my_uint16_t; ! typedef UINT32 my_uint32_t; ! typedef UINT8 my_uint8_t; ! typedef UINT16 u_int16_t; //UGLY ! typedef UINT8 u_int8_t; ! typedef UINT16 n_short; ! typedef UINT32 n_long; ! typedef long n_time; //UGLY, need to check... #endif --- 83,108 ---- #define SOCKET_ERROR -1 typedef int SOCKET; ! typedef uint16_t my_uint16_t; ! typedef uint32_t my_uint32_t; ! typedef uint8_t my_uint8_t; #else ! typedef UINT16 uint16_t; ! typedef UINT32 uint32_t; ! typedef UINT8 uint8_t; ! typedef UINT16 my_uint16_t; ! typedef UINT32 my_uint32_t; ! typedef UINT8 my_uint8_t; ! typedef UINT16 u_int16_t; ! typedef UINT8 u_int8_t; ! typedef UINT16 n_short; ! typedef UINT32 n_long; ! ! typedef long n_time; //UGLY, need to check... #endif *************** *** 104,108 **** struct pseudo_header { ! uint32_t src_addr; uint32_t dst_addr; uint8_t zero; --- 111,115 ---- struct pseudo_header { ! uint32_t src_addr; uint32_t dst_addr; uint8_t zero; Index: sock_pcap.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_pcap.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sock_pcap.h 21 Dec 2006 10:13:53 -0000 1.9 --- sock_pcap.h 21 Dec 2006 13:11:46 -0000 1.10 *************** *** 11,15 **** #include "sock_types.h" ! #ifdef __CYGWIN__ //There's no pcap in Cygwin :( typedef int pcap_t; --- 11,15 ---- #include "sock_types.h" ! #ifndef HAVE_LIBPCAP typedef int pcap_t; *************** *** 42,46 **** void close_pcap(pcap_t *p){ } ! #else /* __CYGWIN__ */ pcap_t* init_pcap(int index = 0){ --- 42,47 ---- void close_pcap(pcap_t *p){ } ! ! #else pcap_t* init_pcap(int index = 0){ Index: sock_eth.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_eth.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sock_eth.h 21 Dec 2006 10:13:53 -0000 1.6 --- sock_eth.h 21 Dec 2006 13:11:46 -0000 1.7 *************** *** 2,6 **** #define _iceeth_H ! #ifdef __CYGWIN__ int send_ip_packet(const void *buf, size_t len){ --- 2,6 ---- #define _iceeth_H ! #ifndef HAVE_LIBDNET int send_ip_packet(const void *buf, size_t len){ *************** *** 10,16 **** #else ! #include "queue.h" ! //#include <dnet.h> struct ip_intf { eth_t *eth; --- 10,46 ---- #else ! /* Portions of code below are from libdnet package: ! * Copyright (c) 2000-2004 Dug Song <du...@mo...> ! * All rights reserved, all wrongs reversed. ! * ! * Redistribution and use in source and binary forms, with or without ! * modification, are permitted provided that the following conditions ! * are met: ! * ! * 1. Redistributions of source code must retain the above copyright ! * notice, this list of conditions and the following disclaimer. ! * 2. Redistributions in binary form must reproduce the above copyright ! * notice, this list of conditions and the following disclaimer in the ! * documentation and/or other materials provided with the distribution. ! * 3. The names of the authors and copyright holders may not be used to ! * endorse or promote products derived from this software without ! * specific prior written permission. ! * ! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, ! * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY ! * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ! * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ! * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ! * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; ! * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ! * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR ! * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ! * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ! */ ! ! /* start of modified code from libdnet */ + #include "queue.h" + struct ip_intf { eth_t *eth; *************** *** 245,248 **** --- 275,280 ---- } + /* end of modified code from libdnet */ + int send_ip_packet(const void *buf, size_t len){ ip_t *i = i_ip_open(); Index: sock_time.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_time.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sock_time.h 16 Dec 2006 20:44:19 -0000 1.9 --- sock_time.h 21 Dec 2006 13:11:46 -0000 1.10 *************** *** 48,52 **** void icesleep(int secs, int nsecs = 0){ #ifndef WIN32 ! struct timespec ts; ts.tv_sec = secs; --- 48,52 ---- void icesleep(int secs, int nsecs = 0){ #ifndef WIN32 ! struct timespec ts; ts.tv_sec = secs; *************** *** 54,58 **** nanosleep (&ts, NULL); #else ! usleep(secs + nsecs * 1000); #endif } --- 54,58 ---- nanosleep (&ts, NULL); #else ! usleep(secs + nsecs * 1000); #endif } Index: iceregex.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/iceregex.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** iceregex.h 17 Dec 2006 21:03:17 -0000 1.11 --- iceregex.h 21 Dec 2006 13:11:46 -0000 1.12 *************** *** 11,15 **** #include "sock_types.h" ! #ifdef __NO_LIBPCRE__ class IceRegex { --- 11,15 ---- #include "sock_types.h" ! #ifdef HAVE_LIBPCRE class IceRegex { |