[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stegotorus/master] Rename 'null' and 'null_rr' steg mods again, to 'nosteg' and 'nosteg_rr'.
commit 33fa70d8cfe4c708fad905092246ec473ef86c10
Author: Zack Weinberg <zackw@xxxxxxxxx>
Date: Wed Feb 1 20:09:41 2012 -0800
Rename 'null' and 'null_rr' steg mods again, to 'nosteg' and 'nosteg_rr'.
If you have a steg module with the same name as a protocol it confuses the
command line parser. Sorry for the churn.
---
Makefile.am | 4 +-
scripts/start-client.csh | 2 +-
scripts/start-server.csh | 2 +-
src/protocol/chop.cc | 22 +++++++---
src/steg/nosteg.cc | 95 ++++++++++++++++++++++++++++++++++++++
src/steg/nosteg_rr.cc | 113 ++++++++++++++++++++++++++++++++++++++++++++++
src/steg/null.cc | 95 --------------------------------------
src/steg/null_rr.cc | 113 ----------------------------------------------
src/test/test_tl.py | 46 +++++++++---------
9 files changed, 251 insertions(+), 241 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index b8e44b7..9affaed 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,8 +24,8 @@ STEGANOGRAPHERS = \
src/steg/embed.cc \
src/steg/http.cc \
src/steg/jsSteg.cc \
- src/steg/null.cc \
- src/steg/null_rr.cc \
+ src/steg/nosteg.cc \
+ src/steg/nosteg_rr.cc \
src/steg/payloads.cc \
src/steg/pdfSteg.cc \
src/steg/swfSteg.cc \
diff --git a/scripts/start-client.csh b/scripts/start-client.csh
index 3e3dece..149f035 100644
--- a/scripts/start-client.csh
+++ b/scripts/start-client.csh
@@ -5,5 +5,5 @@ setenv EVENT_NOKQUEUE yes
#./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 null # 127.0.0.1:3333 null
+./stegotorus --log-min-severity=error chop socks 127.0.0.1:1080 127.0.0.1:3333 nosteg # 127.0.0.1:3333 nosteg
diff --git a/scripts/start-server.csh b/scripts/start-server.csh
index 98f710a..d8580a9 100644
--- a/scripts/start-server.csh
+++ b/scripts/start-server.csh
@@ -3,5 +3,5 @@ setenv EVENT_NOKQUEUE yes
# ./stegotorus --log-min-severity=debug chop server 87.73.82.145:8080 127.0.0.1:8080 127.0.0.1:8081 http
# ./stegotorus --log-min-severity=warn chop server 87.73.82.145:8080 127.0.0.1:8080 127.0.0.1:8081 http
#./stegotorus --log-min-severity=error chop server 87.73.82.145:8080 127.0.0.1:8080 127.0.0.1:8081 http
-./stegotorus --log-min-severity=error chop server 87.73.82.145:8080 127.0.0.1:3333 null
+./stegotorus --log-min-severity=error chop server 87.73.82.145:8080 127.0.0.1:3333 nosteg
diff --git a/src/protocol/chop.cc b/src/protocol/chop.cc
index 338caa0..3aa0efd 100644
--- a/src/protocol/chop.cc
+++ b/src/protocol/chop.cc
@@ -848,8 +848,10 @@ chop_config_t::init(int n_options, const char *const *options)
int listen_up;
int i;
- if (n_options < 3)
+ if (n_options < 3) {
+ log_warn("chop: not enough parameters");
goto usage;
+ }
if (!strcmp(options[0], "client")) {
defport = "48988"; /* bf5c */
@@ -867,24 +869,32 @@ chop_config_t::init(int n_options, const char *const *options)
goto usage;
this->up_address = resolve_address_port(options[1], 1, listen_up, defport);
- if (!this->up_address)
+ if (!this->up_address) {
+ log_warn("chop: invalid up address: %s", options[1]);
goto usage;
+ }
/* From here on out, arguments alternate between downstream
addresses and steg targets. */
for (i = 2; i < n_options; i++) {
struct evutil_addrinfo *addr =
resolve_address_port(options[i], 1, !listen_up, NULL);
- if (!addr)
+ if (!addr) {
+ log_warn("chop: invalid down address: %s", options[i]);
goto usage;
+ }
this->down_addresses.push_back(addr);
i++;
- if (i == n_options)
+ if (i == n_options) {
+ log_warn("chop: missing steganographer for %s", options[i-1]);
goto usage;
+ }
- if (!steg_is_supported(options[i]))
+ if (!steg_is_supported(options[i])) {
+ log_warn("chop: steganographer '%s' not supported", options[i]);
goto usage;
+ }
this->steg_targets.push_back(options[i]);
}
return true;
@@ -894,7 +904,7 @@ chop_config_t::init(int n_options, const char *const *options)
"\tchop <mode> <up_address> (<down_address> [<steg>])...\n"
"\t\tmode ~ server|client|socks\n"
"\t\tup_address, down_address ~ host:port\n"
- "\t\tA steg target is required for each down_address.\n"
+ "\t\tA steganographer is required for each down_address.\n"
"\t\tThe down_address list is still required in socks mode.\n"
"Examples:\n"
"\tstegotorus chop client 127.0.0.1:5000 "
diff --git a/src/steg/nosteg.cc b/src/steg/nosteg.cc
new file mode 100644
index 0000000..43971bb
--- /dev/null
+++ b/src/steg/nosteg.cc
@@ -0,0 +1,95 @@
+/* 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>
+
+namespace {
+struct nosteg : steg_t
+{
+ STEG_DECLARE_METHODS(nosteg);
+};
+}
+
+STEG_DEFINE_MODULE(nosteg);
+
+nosteg::nosteg(bool is_clientside)
+ : steg_t(is_clientside)
+{
+}
+
+nosteg::~nosteg()
+{
+}
+
+size_t
+nosteg::transmit_room(conn_t *)
+{
+ return SIZE_MAX;
+}
+
+int
+nosteg::transmit(struct evbuffer *source, conn_t *conn)
+{
+ struct evbuffer *dest = conn_get_outbound(conn);
+
+ log_debug(conn, "transmitting %lu bytes",
+ (unsigned long)evbuffer_get_length(source));
+
+ if (evbuffer_add_buffer(dest, source)) {
+ log_warn(conn, "failed to transfer buffer");
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+nosteg::receive(conn_t *conn, struct evbuffer *dest)
+{
+ struct evbuffer *source = conn_get_inbound(conn);
+
+ log_debug(conn, "receiving %lu bytes",
+ (unsigned long)evbuffer_get_length(source));
+
+ if (evbuffer_add_buffer(dest, source)) {
+ log_warn(conn, "failed to transfer buffer");
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/src/steg/nosteg_rr.cc b/src/steg/nosteg_rr.cc
new file mode 100644
index 0000000..8fd70fe
--- /dev/null
+++ b/src/steg/nosteg_rr.cc
@@ -0,0 +1,113 @@
+/* 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>
+
+namespace {
+struct nosteg_rr : steg_t
+{
+ bool can_transmit : 1;
+ STEG_DECLARE_METHODS(nosteg_rr);
+};
+}
+
+STEG_DEFINE_MODULE(nosteg_rr);
+
+nosteg_rr::nosteg_rr(bool is_clientside)
+ : steg_t(is_clientside),
+ can_transmit(is_clientside)
+{
+}
+
+nosteg_rr::~nosteg_rr()
+{
+}
+
+size_t
+nosteg_rr::transmit_room(conn_t *)
+{
+ return can_transmit ? SIZE_MAX : 0;
+}
+
+int
+nosteg_rr::transmit(struct evbuffer *source, conn_t *conn)
+{
+ log_assert(can_transmit);
+
+ struct evbuffer *dest = conn_get_outbound(conn);
+
+ log_debug(conn, "transmitting %lu bytes",
+ (unsigned long)evbuffer_get_length(source));
+
+ if (evbuffer_add_buffer(dest, source)) {
+ log_warn(conn, "failed to transfer buffer");
+ return -1;
+ }
+
+ can_transmit = false;
+ if (is_clientside) {
+ conn_cease_transmission(conn);
+ } else {
+ conn_close_after_transmit(conn);
+ }
+
+ return 0;
+}
+
+int
+nosteg_rr::receive(conn_t *conn, struct evbuffer *dest)
+{
+ struct evbuffer *source = conn_get_inbound(conn);
+
+ log_debug(conn, "receiving %lu bytes",
+ (unsigned long)evbuffer_get_length(source));
+
+ if (evbuffer_add_buffer(dest, source)) {
+ log_warn(conn, "failed to transfer buffer");
+ return -1;
+ }
+
+ if (is_clientside) {
+ conn_expect_close(conn);
+ } else {
+ can_transmit = true;
+ conn_transmit_soon(conn, 100);
+ }
+
+ return 0;
+}
diff --git a/src/steg/null.cc b/src/steg/null.cc
deleted file mode 100644
index 59faed0..0000000
--- a/src/steg/null.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-/* 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>
-
-namespace {
-struct null : steg_t
-{
- STEG_DECLARE_METHODS(null);
-};
-}
-
-STEG_DEFINE_MODULE(null);
-
-null::null(bool is_clientside)
- : steg_t(is_clientside)
-{
-}
-
-null::~null()
-{
-}
-
-size_t
-null::transmit_room(conn_t *)
-{
- return SIZE_MAX;
-}
-
-int
-null::transmit(struct evbuffer *source, conn_t *conn)
-{
- struct evbuffer *dest = conn_get_outbound(conn);
-
- log_debug(conn, "transmitting %lu bytes",
- (unsigned long)evbuffer_get_length(source));
-
- if (evbuffer_add_buffer(dest, source)) {
- log_warn(conn, "failed to transfer buffer");
- return -1;
- }
-
- return 0;
-}
-
-int
-null::receive(conn_t *conn, struct evbuffer *dest)
-{
- struct evbuffer *source = conn_get_inbound(conn);
-
- log_debug(conn, "receiving %lu bytes",
- (unsigned long)evbuffer_get_length(source));
-
- if (evbuffer_add_buffer(dest, source)) {
- log_warn(conn, "failed to transfer buffer");
- return -1;
- }
-
- return 0;
-}
diff --git a/src/steg/null_rr.cc b/src/steg/null_rr.cc
deleted file mode 100644
index de062a8..0000000
--- a/src/steg/null_rr.cc
+++ /dev/null
@@ -1,113 +0,0 @@
-/* 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>
-
-namespace {
-struct null_rr : steg_t
-{
- bool can_transmit : 1;
- STEG_DECLARE_METHODS(null_rr);
-};
-}
-
-STEG_DEFINE_MODULE(null_rr);
-
-null_rr::null_rr(bool is_clientside)
- : steg_t(is_clientside),
- can_transmit(is_clientside)
-{
-}
-
-null_rr::~null_rr()
-{
-}
-
-size_t
-null_rr::transmit_room(conn_t *)
-{
- return can_transmit ? SIZE_MAX : 0;
-}
-
-int
-null_rr::transmit(struct evbuffer *source, conn_t *conn)
-{
- log_assert(can_transmit);
-
- struct evbuffer *dest = conn_get_outbound(conn);
-
- log_debug(conn, "transmitting %lu bytes",
- (unsigned long)evbuffer_get_length(source));
-
- if (evbuffer_add_buffer(dest, source)) {
- log_warn(conn, "failed to transfer buffer");
- return -1;
- }
-
- can_transmit = false;
- if (is_clientside) {
- conn_cease_transmission(conn);
- } else {
- conn_close_after_transmit(conn);
- }
-
- return 0;
-}
-
-int
-null_rr::receive(conn_t *conn, struct evbuffer *dest)
-{
- struct evbuffer *source = conn_get_inbound(conn);
-
- log_debug(conn, "receiving %lu bytes",
- (unsigned long)evbuffer_get_length(source));
-
- if (evbuffer_add_buffer(dest, source)) {
- log_warn(conn, "failed to transfer buffer");
- return -1;
- }
-
- if (is_clientside) {
- conn_expect_close(conn);
- } else {
- can_transmit = true;
- conn_transmit_soon(conn, 100);
- }
-
- return 0;
-}
diff --git a/src/test/test_tl.py b/src/test/test_tl.py
index 39fb728..a91beca 100644
--- a/src/test/test_tl.py
+++ b/src/test/test_tl.py
@@ -46,45 +46,45 @@ class TimelineTest(object):
("null", "server", "127.0.0.1:5000", "127.0.0.1:5001",
"null", "client", "127.0.0.1:4999", "127.0.0.1:5000"))
- def test_chop_null(self):
+ def test_chop_nosteg(self):
self.doTest("chop",
("chop", "server", "127.0.0.1:5001",
- "127.0.0.1:5010","null",
+ "127.0.0.1:5010","nosteg",
"chop", "client", "127.0.0.1:4999",
- "127.0.0.1:5010","null",
+ "127.0.0.1:5010","nosteg",
))
def test_chop_null2(self):
self.doTest("chop",
("chop", "server", "127.0.0.1:5001",
- "127.0.0.1:5010","null","127.0.0.1:5011","null",
+ "127.0.0.1:5010","nosteg","127.0.0.1:5011","nosteg",
"chop", "client", "127.0.0.1:4999",
- "127.0.0.1:5010","null","127.0.0.1:5011","null",
+ "127.0.0.1:5010","nosteg","127.0.0.1:5011","nosteg",
))
- def test_chop_null_rr(self):
+ def test_chop_nosteg_rr(self):
self.doTest("chop",
("chop", "server", "127.0.0.1:5001",
- "127.0.0.1:5010","null_rr",
+ "127.0.0.1:5010","nosteg_rr",
"chop", "client", "127.0.0.1:4999",
- "127.0.0.1:5010","null_rr",
+ "127.0.0.1:5010","nosteg_rr",
))
- def test_chop_null_rr2(self):
- self.doTest("chop",
- ("chop", "server", "127.0.0.1:5001",
- "127.0.0.1:5010","null_rr","127.0.0.1:5011","null_rr",
- "chop", "client", "127.0.0.1:4999",
- "127.0.0.1:5010","null_rr","127.0.0.1:5011","null_rr",
- ))
-
-# def test_chop_http(self):
-# self.doTest("chop",
-# ("chop", "server", "127.0.0.1:5001",
-# "127.0.0.1:5010","http","127.0.0.1:5011","http",
-# "chop", "client", "127.0.0.1:4999",
-# "127.0.0.1:5010","http","127.0.0.1:5011","http",
-# ))
+ # def test_chop_nosteg_rr2(self):
+ # self.doTest("chop",
+ # ("chop", "server", "127.0.0.1:5001",
+ # "127.0.0.1:5010","nosteg_rr","127.0.0.1:5011","nosteg_rr",
+ # "chop", "client", "127.0.0.1:4999",
+ # "127.0.0.1:5010","nosteg_rr","127.0.0.1:5011","nosteg_rr",
+ # ))
+
+ # def test_chop_http(self):
+ # self.doTest("chop",
+ # ("chop", "server", "127.0.0.1:5001",
+ # "127.0.0.1:5010","http","127.0.0.1:5011","http",
+ # "chop", "client", "127.0.0.1:4999",
+ # "127.0.0.1:5010","http","127.0.0.1:5011","http",
+ # ))
# Synthesize TimelineTest+TestCase subclasses for every 'tl_*' file in
# the test directory.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits