[tor-commits] [stegotorus/master] added dummy steg module that listens on a special port (3333)

zwol at torproject.org zwol at torproject.org
Fri Jul 20 23:17:06 UTC 2012


commit aefd52e3d07dbbee3af4a2d689fa62ca988dca6f
Author: Vinod Yegneswaran <vinod at csl.sri.com>
Date:   Mon Jan 9 18:45:51 2012 +0000

    added dummy steg module that listens on a special port (3333)
    
    git-svn-id: svn+ssh://spartan.csl.sri.com/svn/private/DEFIANCE@209 a58ff0ac-194c-e011-a152-003048836090
---
 Makefile.am              |    3 +-
 scripts/start-client.csh |   10 ++-
 scripts/start-server.csh |    7 +-
 src/steg/dummy.cc        |  137 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 149 insertions(+), 8 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index f3ed040..04df59d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,7 +27,8 @@ STEGANOGRAPHERS = \
 	src/steg/payloads.cc \
 	src/steg/pdfSteg.cc \
 	src/steg/swfSteg.cc \
-	src/steg/zpack.cc
+	src/steg/zpack.cc \
+	src/steg/dummy.cc
 
 libstegotorus_a_SOURCES = \
 	src/connections.cc \
diff --git a/scripts/start-client.csh b/scripts/start-client.csh
index 6eda343..c5062e1 100644
--- a/scripts/start-client.csh
+++ b/scripts/start-client.csh
@@ -1,8 +1,10 @@
 #!/bin/csh
-# ./obfsproxy --log-min-severity=debug x_dsteg socks 127.0.0.1:1080 x_http
+# ./stegotorus --log-min-severity=debug x_dsteg socks 127.0.0.1:1080 x_http
 
 setenv EVENT_NOKQUEUE yes 
-#./obfsproxy --log-min-severity=debug chop socks 127.0.0.1:1080 127.0.0.1:8080 http 127.0.0.1:8081 http
-# ./obfsproxy --log-min-severity=warn chop socks 127.0.0.1:1080 127.0.0.1:8080 http 127.0.0.1:8081 http
-./obfsproxy --log-min-severity=error chop socks 127.0.0.1:1080 127.0.0.1:8080 http 127.0.0.1:8081 http
+#./stegotorus --log-min-severity=debug chop socks 127.0.0.1:1080 127.0.0.1:8080 http 127.0.0.1:8081 http
+# ./stegotorus --log-min-severity=warn chop socks 127.0.0.1:1080 127.0.0.1:8080 http 127.0.0.1:8081 http
+#./stegotorus --log-min-severity=error chop socks 127.0.0.1:1080 127.0.0.1:8080 http 127.0.0.1:8081 http
+./stegotorus --log-min-severity=error chop socks 127.0.0.1:1080 127.0.0.1:3333 dummy 
+# 127.0.0.1:3333 dummy
 
diff --git a/scripts/start-server.csh b/scripts/start-server.csh
index b7d61e6..e5e7876 100644
--- a/scripts/start-server.csh
+++ b/scripts/start-server.csh
@@ -1,6 +1,7 @@
 #!/bin/csh
 setenv EVENT_NOKQUEUE yes 
-# ./obfsproxy --log-min-severity=debug chop server 87.73.82.145:8080 127.0.0.1:8080 127.0.0.1:8081
-# ./obfsproxy --log-min-severity=warn chop server 87.73.82.145:8080 127.0.0.1:8080 127.0.0.1:8081
-./obfsproxy --log-min-severity=error chop server 87.73.82.145:8080 127.0.0.1:8080 127.0.0.1:8081
+# ./stegotorus --log-min-severity=debug chop server 87.73.82.145:8080 127.0.0.1:8080 127.0.0.1:8081
+# ./stegotorus --log-min-severity=warn chop server 87.73.82.145:8080 127.0.0.1:8080 127.0.0.1:8081
+#./stegotorus --log-min-severity=error chop server 87.73.82.145:8080 127.0.0.1:8080 127.0.0.1:8081
+./stegotorus --log-min-severity=error chop server 87.73.82.145:8080 127.0.0.1:3333
 
diff --git a/src/steg/dummy.cc b/src/steg/dummy.cc
new file mode 100644
index 0000000..3ef8fc8
--- /dev/null
+++ b/src/steg/dummy.cc
@@ -0,0 +1,137 @@
+/*  Copyright (c) 2011, SRI International
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+    * 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.
+
+    * Neither the names of the copyright owners nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"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 COPYRIGHT
+OWNER OR CONTRIBUTORS 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.
+
+    Contributors: Zack Weinberg, Vinod Yegneswaran
+    See LICENSE for other credits and copying information
+*/
+
+#include "util.h"
+#include "connections.h"
+#include "protocol.h"
+#include "steg.h"
+#include <event2/buffer.h>
+#include <stdio.h>
+
+#define DUMMY_PORT 3333
+
+namespace {
+struct dummy : steg_t
+{
+  STEG_DECLARE_METHODS(dummy);
+};
+}
+
+STEG_DEFINE_MODULE(dummy,
+                   1024,  /* client-server max data rate - made up */
+                   10240, /* server-client max data rate - ditto */
+                   1,     /* max concurrent connections per IP */
+                   1);     /* max concurrent IPs */
+
+
+dummy::dummy(bool is_clientside)
+{
+  this->is_clientside = is_clientside;
+}
+
+dummy::~dummy()
+{
+}
+
+/** Determine whether a connection should be processed by this
+    steganographer. */
+bool
+dummy::detect(conn_t *conn)
+{
+  struct config_t* cfg = conn->cfg;
+  struct evutil_addrinfo *addrs = cfg->get_listen_addrs(0);
+
+  fprintf(stderr, "in detect\n");
+  
+  if (!addrs) {
+    log_warn("no listen addrs\n");
+    return 0;
+  }
+
+  struct sockaddr_in* sin = (struct sockaddr_in*) addrs->ai_addr;
+
+  if (sin->sin_port == htons(DUMMY_PORT)) {
+
+    return 1;
+  }
+
+  return 0;
+
+}
+
+size_t
+dummy::transmit_room(conn_t *)
+{
+  return 1024;
+}
+
+
+
+
+
+
+
+int
+dummy::transmit(struct evbuffer *source, conn_t *conn)
+{
+  struct evbuffer *dest = conn_get_outbound(conn);
+
+  fprintf(stderr, "transmitting %d\n", (int) evbuffer_get_length(source));
+
+  if (evbuffer_add_buffer(dest, source)) {
+    fprintf(stderr, "failed to transfer buffer\n");
+  }
+  
+  return 0;
+
+}
+
+
+
+
+
+
+int
+dummy::receive(conn_t *conn, struct evbuffer *dest)
+{
+  struct evbuffer *source = conn_get_inbound(conn);
+
+  fprintf(stderr, "receiving %d\n", (int) evbuffer_get_length(source));
+
+  if (evbuffer_add_buffer(dest, source)) {
+    fprintf(stderr, "failed to transfer buffer\n");
+  }
+
+  return 0;
+}





More information about the tor-commits mailing list