]> Zhao Yanbai Git Server - acecode.git/commitdiff
...
authoracevest <zhaoyanbai@126.com>
Thu, 9 Apr 2015 11:59:08 +0000 (19:59 +0800)
committeracevest <zhaoyanbai@126.com>
Thu, 9 Apr 2015 11:59:08 +0000 (19:59 +0800)
learn/test/overflow/of.1.c [new file with mode: 0644]
tools/hack/netpeeper/http.c
tools/hack/netpeeper/main.c
tools/hack/netpeeper/netpeeper [deleted file]

diff --git a/learn/test/overflow/of.1.c b/learn/test/overflow/of.1.c
new file mode 100644 (file)
index 0000000..7974a0c
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * ------------------------------------------------------------------------
+ *   File Name: of.1.c
+ *      Author: Zhao Yanbai
+ *              Thu Apr  9 18:50:29 2015
+ * Description: 
+ *              gcc of.1.c  -fno-stack-protector
+ * ------------------------------------------------------------------------
+ */
+#include<stdio.h>
+#include<string.h>
+
+const char *pwd = "1234";
+
+int of(const char *s)
+{
+    int r = 0xFEDCBA98;
+    char buf[8];
+    
+    r = strcmp(pwd, s) == 0 ? 1 : 0;
+
+    __builtin___strcpy_chk(buf, s, 1000);
+
+    return r;
+}
+
+int main(int argc, char *argv[]){
+
+    char buf[256];
+
+    scanf("%s", buf);
+
+    if(of(buf))
+    {
+        printf("SUCC:  %s\n", buf);
+    }
+    else
+    {
+        printf("FAIL:  %s\n", buf);
+    }
+
+       return 0;
+}
index 80226aaaf4f0ac946ed8872e6d51d6419dc11df4..282a9a807575c9550cf184b000f00dd56a0a26e2 100644 (file)
@@ -41,6 +41,8 @@ void http_callback(struct tcp_stream *ts) {
 
     int i;
 
+    printf("sssss\n");
+
     // data receive from client
     if(ts->server.count_new) {
         printf("HTTP FROM Client\n");
index 632effbe302146df293e9c5ac055be0340e5f1b8..2bf8438d25c725582903b72d1a1ea24c55866a7b 100644 (file)
@@ -95,11 +95,15 @@ int main(int argc, char *argv[]){
     nids_params.device = argv[1];
     nids_params.promisc = 1;
 
+    printf("init....\n");
     nids_init();
 
+    printf("register tcp....\n");
     nids_register_tcp(tcp_callback);
 
+    printf("nids run....\n");
     nids_run();
 
+    printf("exit....\n");
        return 0;
 }
diff --git a/tools/hack/netpeeper/netpeeper b/tools/hack/netpeeper/netpeeper
deleted file mode 100755 (executable)
index 834bed9..0000000
Binary files a/tools/hack/netpeeper/netpeeper and /dev/null differ