From: acevest Date: Thu, 9 Apr 2015 11:59:08 +0000 (+0800) Subject: ... X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=d59888f45fdb591821e2f9a792a69cf097d7de03;p=acecode.git ... --- diff --git a/learn/test/overflow/of.1.c b/learn/test/overflow/of.1.c new file mode 100644 index 0000000..7974a0c --- /dev/null +++ b/learn/test/overflow/of.1.c @@ -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 +#include + +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; +} diff --git a/tools/hack/netpeeper/http.c b/tools/hack/netpeeper/http.c index 80226aa..282a9a8 100644 --- a/tools/hack/netpeeper/http.c +++ b/tools/hack/netpeeper/http.c @@ -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"); diff --git a/tools/hack/netpeeper/main.c b/tools/hack/netpeeper/main.c index 632effb..2bf8438 100644 --- a/tools/hack/netpeeper/main.c +++ b/tools/hack/netpeeper/main.c @@ -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 index 834bed9..0000000 Binary files a/tools/hack/netpeeper/netpeeper and /dev/null differ