Redir

This lousy hack adds XOR “shrouding” (can’t call it encryption now, can ye) to redir 2.2

--- redir.c.original    1999-12-15 12:51:37.000000000 +0100
+++ redir.c     2005-11-20 17:02:02.000000000 +0100
@@ -60,6 +60,8 @@
  
 #define  VERSION "2.2"
 
+#define PASSPHRASE "Mary had a little Lamb, its fleece whas white as ..."
+
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -76,6 +78,20 @@
 #include <netdb.h>
 #include <errno.h>
 
+void shroud(char *buf, int bytes)
+{
+       int i = 0;
+       int n, ch;
+
+       for (n = 0; n < bytes; n++) {
+               ch = buf[n];
+               ch = PASSPHRASE[i++] ^ (~(ch));
+               buf[n] = ch;
+               if (i >= strlen(PASSPHRASE))
+                       i = 0;
+       }
+}
+
 #ifdef USE_TCP_WRAPPERS
 #include <tcpd.h>
 #endif
@@ -514,14 +530,17 @@
                                   in the buffer, if yes change this and establish 
                                   a new redirector for the data */
                                ftp_clean(outsock, buf, &bytes,0); 
-                       else
+                       else {
+                               shroud(buf, bytes);
                                if(write(outsock, buf, bytes) != bytes)
                                        break;
+                       }
                        bytes_out += bytes;
                }
                if(FD_ISSET(outsock, &c_iofds)) {
                        if((bytes = read(outsock, buf, sizeof(buf))) <= 0)
                                break;
+                       shroud(buf, bytes);
                        /* if we're correcting for PASV on ftp redirections, then
                           fix buf and bytes to have the new address, among other
                           things */
 
snippets/redir.txt · Last modified: 2006-09-22 13:44
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki