From c5c21813d0d3e12fb8b6abda5cef20090a3ee3a1 Mon Sep 17 00:00:00 2001 From: Piotr Duszynski Date: Sat, 3 May 2014 13:22:25 +0200 Subject: [PATCH] add. fixed. --- DOCS | 11 +++++++---- src/Configuration.cpp | 7 ++++--- src/connection.cpp | 4 +++- src/connection.h | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/DOCS b/DOCS index 4f5cc81..994c71d 100644 --- a/DOCS +++ b/DOCS @@ -4,9 +4,9 @@ Portspoof documentation notes 1. Compile the software: - $./configure + $ ./configure (use ) $ make - $ sudo make install + $ make install 2. Configure your firewall rules: @@ -16,14 +16,17 @@ Portspoof documentation notes Configure iptables: # iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 1:65535 -j REDIRECT --to-ports 4444 - # iptables-restore < iptables-config (system_files directory) # remember to change the interface name! + # iptables-restore < iptables-config (system_files directory) # Note: remember to change the interface name to yours! - Run Portspoof with service emulation: + Run Portspoof with service emulation in daemon mode: $ portspoof -c /etc/portspoof.conf -s /etc/portspoof_signatures -D + This mode will generate and feed port scanners with bogus service signatures. + Run Portspoof in daemon "open port" mode: $ portspoof -D + This mode will just return OPEN state for every connection attempt. 3. Add portspoof invocation to your system's startup scripts. diff --git a/src/Configuration.cpp b/src/Configuration.cpp index f1b676f..9997f32 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -297,7 +297,7 @@ bool Configuration::processSignatureFile() // set random mapping srand((unsigned)time(0)); - for(int i=0;imapPort2Buffer(original_port); - n = recv(threads[tid].clients[i], buffer,buffer_size, 0); + n = recv(threads[tid].clients[i],buffer,buffer_size, 0); } @@ -149,6 +149,7 @@ void* process_connection(void *arg) if(configuration->getConfigValue(OPT_DEBUG)) fprintf(stdout,"Thread nr. %d : client %d closed connection\n",tid, threads[tid].clients[i]); + //shutdown(threads[tid].clients[i],SHUT_WR); close(threads[tid].clients[i]); pthread_mutex_lock(&new_connection_mutex); @@ -266,6 +267,7 @@ void* process_connection(void *arg) if(send(threads[tid].clients[i], buffertosend, buffertosendsize,0)==-1) perror("Send to socket failed"); + close(threads[tid].clients[i]); free(buffertosend); diff --git a/src/connection.h b/src/connection.h index 860f7c1..3050465 100644 --- a/src/connection.h +++ b/src/connection.h @@ -67,7 +67,7 @@ #define SO_ORIGINAL_DST 80 #define TCPSTATES -#define MAX_BUFFER_SIZE 1000 +#define MAX_BUFFER_SIZE 65536 extern pthread_cond_t new_connection_cond; extern pthread_mutex_t new_connection_mutex;