[tor-commits] [stegotorus/master] git-svn-id: svn+ssh://spartan.csl.sri.com/svn/private/DEFIANCE at 126 a58ff0ac-194c-e011-a152-003048836090

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


commit 5e617e61d1165df71237147dc60400c2b5f47ec5
Author: Vinod Yegneswaran <vinod at csl.sri.com>
Date:   Sun Nov 6 02:46:06 2011 +0000

    git-svn-id: svn+ssh://spartan.csl.sri.com/svn/private/DEFIANCE@126 a58ff0ac-194c-e011-a152-003048836090
---
 src/steg/payloads.c |   59 ++++++++++++++++++++++++++++++++++++++++----------
 start-server.csh    |    5 +---
 2 files changed, 48 insertions(+), 16 deletions(-)

diff --git a/src/steg/payloads.c b/src/steg/payloads.c
index 02be31b..c683f77 100644
--- a/src/steg/payloads.c
+++ b/src/steg/payloads.c
@@ -303,19 +303,7 @@ void gen_rfc_1123_date(char* buf, int buf_size) {
 
 
 
-/* sample response header */
-/*
-
-HTTP/1.1 200 OK
-Date: Fri, 21 Oct 2011 19:09:49 GMT
-Server: Apache
-Content-Length: 1441
-* Content-Encoding: gzip
-Content-Type: text/html;charset=UTF-8
-* Keep-Alive: timeout=15, max=93
-Connection: close
 
-*/
 
 
 int gen_response_header(char* content_type, int gzip, int length, char* buf, int buflen) {
@@ -501,6 +489,52 @@ unsigned int find_client_payload(char* buf, int len, int type) {
  * todo: 
  * Use a more efficient regular expression matching algo
  */
+
+
+
+int skipJSPattern(char *cp, int len) {
+  int i,j;
+
+  char keywords [21][10]= {"function", "return", "var", "int", "random", "Math", "while", 
+			   "else", "for", "document", "write", "writeln", "true", 
+			   "false", "True", "False", "window", "indexOf", "navigator", "case", "if"};
+
+  if (len < 1) return 0;
+
+  // change the limit to 21 to enable if as a keyword
+  for (i=0; i < 20; i++) {
+    char* word = keywords[i];
+    
+    if (len <= (int) strlen(word))
+      continue;
+
+    if (word[0] != cp[0])
+      continue;
+
+    for (j=1; j < (int) strlen(word); j++) {
+      if (isxdigit(word[j])) {
+	if (!isxdigit(cp[j]))
+	  goto next_word;
+	else
+	  continue;
+      }
+      
+      if (cp[j] != word[j])
+	goto next_word;
+    }
+    if (!isalnum(cp[j]))
+      return strlen(word)+1;
+      
+  next_word:
+    continue;
+  }
+
+  return 0;
+}
+
+
+/*
+
 int skipJSPattern (char *cp, int len) {
 
   // log_debug("Turning off skipJSPattern for debugging");
@@ -561,6 +595,7 @@ int skipJSPattern (char *cp, int len) {
 
   return 0;
 }
+*/
 
 
 int isalnum_ (char c) {
diff --git a/start-server.csh b/start-server.csh
index eb421c4..b7d61e6 100644
--- a/start-server.csh
+++ b/start-server.csh
@@ -2,8 +2,5 @@
 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
+./obfsproxy --log-min-severity=error chop server 87.73.82.145:8080 127.0.0.1:8080 127.0.0.1:8081
 
-# ./obfsproxy --log-min-severity=debug chop server 87.73.82.145:8080 128.18.9.71:8080 128.18.9.71:8081 
-# ./obfsproxy --log-min-severity=warn chop server 87.73.82.145:8080 128.18.9.71:8080 128.18.9.71:8081 
-./obfsproxy --log-min-severity=error chop server 87.73.82.145:8080 128.18.9.71:8080 128.18.9.71:8081 





More information about the tor-commits mailing list