Skip to content

Commit

Permalink
http_apache steg with opp steg modules tested and works, retransmit q…
Browse files Browse the repository at this point in the history
…ueue gets full
  • Loading branch information
vmon committed Nov 4, 2016
1 parent cb890b8 commit 46d67a2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
9 changes: 9 additions & 0 deletions doc/TESTING
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@ git checkout tor-improve
autoreconf
./configure PKG_CONFIG_PATH=`pwd`
make


To test from command line using curl
- ssh -ND 5001 localhost
- run the server on ports 5000->5001
- run client on 4999->5000
- curl --socks4 localhost:4999 http://1112.net/lastpage
- curl -x socks4://127.0.0.1:4999 http://download.thinkbroadband.com/1MB.zip -o /dev/null
- curl -x socks4://127.0.0.1:4999 http://download.thinkbroadband.com/1GB.zip -o /dev/null
6 changes: 4 additions & 2 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@ main(int, const char *const *argv)
if (!*begin || !config_is_supported(*begin))
usage();

//crypto should be initialized before protocol so the protocols
//can use encryption
init_crypto();

do {
end = begin+1;
while (*end && !config_is_supported(*end))
Expand Down Expand Up @@ -401,8 +405,6 @@ main(int, const char *const *argv)
log_warn("failed to create pid-file '%s': %s", pf.pathname().c_str(),
pf.errmsg());

init_crypto();

/* Ugly method to fix a Windows problem:
http://archives.seul.org/libevent/users/Oct-2010/msg00049.html */
#ifdef _WIN32
Expand Down
16 changes: 8 additions & 8 deletions src/protocol/chop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ chop_config_t::chop_config_t()
ignore_socks_destination = true;
trace_packets = false;
trace_packet_data = true;
encryption = false;
encryption = true;
retransmit = true;
noise2signal = 0;
}
Expand Down Expand Up @@ -775,13 +775,11 @@ chop_circuit_t::send_all_steg_data()
return 0;
}

//It makes sense to check if there is any steg data to be sent
//otherwise we can just return.
//Now we check if the protocol_data has any data
size_t avail = evbuffer_get_length(target->steg->cfg()->protocol_data_out);
if (avail == 0)
return 0;

// you might think that it makes sense to check if there is any steg data to be sent
//otherwise we can just return. but we can't do that cause each connection has
//its own steg module and some of the steg module might have steg data and others might
//not

bool no_target_connection = true;

//TODO: Instead of re-implementing pick connection here I should
Expand All @@ -807,6 +805,8 @@ chop_circuit_t::send_all_steg_data()

size_t avail0;

//Now we check if the protocol_data has any data
size_t avail = evbuffer_get_length(target->steg->cfg()->protocol_data_out);
//we try to send all data
//we don't send random block or retransmit from the transmit
//queue because we are called by the this->send which will
Expand Down
6 changes: 6 additions & 0 deletions src/steg/apache_payload_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ ApachePayloadServer::ApachePayloadServer(MachineSide init_side, const string& da
while (payload_info_stream >> file_id) {
PayloadInfo cur_payload_info;

if (_payload_database.payloads.find(cur_payload_info.url_hash) != _payload_database.payloads.end()) {
log_warn("duplicate url in the url list: %s", cur_payload_info.url.c_str());
continue;
}

payload_info_stream >> cur_payload_info.type;
payload_info_stream >> cur_payload_info.url_hash;
payload_info_stream >> cur_payload_info.capacity;
Expand All @@ -76,6 +81,7 @@ ApachePayloadServer::ApachePayloadServer(MachineSide init_side, const string& da
payload_info_stream >> cur_payload_info.absolute_url_is_absolute;
payload_info_stream >> cur_payload_info.absolute_url;


_payload_database.payloads.insert(pair<string, PayloadInfo>(cur_payload_info.url_hash, cur_payload_info));
_payload_database.sorted_payloads.push_back(EfficiencyIndicator(cur_payload_info.url_hash, cur_payload_info.length));

Expand Down

0 comments on commit 46d67a2

Please sign in to comment.