用于FUZZ测试的程序及其详解
来源:互联网 发布:单片机原理及应用pdf 编辑:程序博客网 时间:2024/06/01 20:56
//代码摘抄自模糊测试[...] if (!(pid = fork ())) {/*child*/ ptrace(PTRACE_TRACEME,0,NULL,NULL) //long ptrace(enum_ptrace_request requese,pid_t_ pid, void *addr,void *data); //1).enum_ptrace_request 执行了ptrace要执行的命令 //2).pid_t 进程ID //3).void *addr 指示了要监控的内存地址 //4).void *data 存放读取出的或者要写入的数据 execve(argv[0],argv,envp);//内核级系统调用,成功不返回,失败返回-1 } else {/*parent*/ c_pid = pid; monitor: waitpid(pid,&status,0);//等待京城 if(WIFEXITED(status)) {/*程序退出信号*/ if(!quiet) printf("process %d exited with code %d\n",pid,WEXITSTATUS(status)); return(ERR_OK); } else if(WIFSIGNALED(status)) {/*program ended because of a signal*/ printf("process %d terminated by unhandled signal %d\n",pid,WIERMSIG(status)); return(ERR_OK); } else if(WIFSIGNALED(status)) //看官方介绍 //The status field that was filled in by the wait or waitpid function /*The WIFSIGNALED macro is always successful.If the child process for which status was returned by the wait or waitpid function exited because it raised a signal that caused it to exit, the WIFSIGNALED macro evaluates to TRUE and the WTERMSIG macro can be used to determine which signal was raised by the child process. Otherwise, the WIFSIGNALED macro evaluates to FALSE.*/ /*意思就是说这个函数用于响应waitpid函数,如果进行是正常的通过waitpid返回状态子进程的话,那么就为TRUE,并且wtermsig可以用于子进程引发的信号*/ { if(!quiet) fprintf(stderr,"process %d stopped due to signal %d (%s)",pid,WSTOPSIG(status),F_signum2ascii(WSTOPSIG(status))); switch(WSTOPSIG(status)) { case SIGILL: case SIGBUS: case SIGSEGV: case SIGSYS: printf("program got interesting signal...\n"); if((ptrace(PTRACE_CONT,pid,NULL,(WSTOPSIG(status)==SIGTRAP)?0:WSTOPSIG(status)))==-1) { perror("ptrace"); } ptrace(PTRACE_DETACH,pid,NULL,NULL); fclose(fp); return(ERR_CRASH);/*it crashed*/ }*/deliver the signal through and keep traction*/ if((ptrace(PTRACE_CONT,pid,NULL,(WSTOPSIG(status)==SIGTRAP)?0:WSTOPSIG(status)))==-1) { perror("ptrace"); } goto monitor; } return(ERR_OK); }
0 0
- 用于FUZZ测试的程序及其详解
- 使用afl-fuzz的QEMU模式测试chome
- 搭建简易的asp服务器 用于手机安装测试程序
- 一个发包小程序 一种用于自动化测试的脚本语言
- 漫谈软件测试中的Fuzz测试技术
- 漫谈软件测试中的Fuzz测试技术
- Android的fuzz测试技术之符号执行浅谈-android学习之旅(82)
- 提高AFL的fuzz速度
- 模糊测试流程----fuzz笔记(1)
- 软件安全测试(fuzz)之大家一起学1: fuzz platform架构
- 用于大型程序的工具
- Shell用于开发的详解
- 用于测试
- 漫谈Fuzz测试技术 ——软件安全专家王清谈Fuzz技术与软件安全性测试
- s3c2440- led驱动分析及其测试程序
- 用于测试双目视觉的软件框架
- 用于测试的五种浏览器
- 用于.NET环境的时间测试
- Android分组悬浮列表实现
- [LeetCode]283. Move Zeroes
- Spring:基于注解的Spring MVC(下)
- 多线程
- bzoj 2539: [Ctsc2000]丘比特的烦恼 (KM算法)
- 用于FUZZ测试的程序及其详解
- 栈的基本操作和实现C++模板类
- mysql
- Git Push 避免用户名和密码方法
- 终于知道cocos2dx的cocos studio是被谁做烂得
- Spring:基于注解的Spring MVC(上)
- 隐马尔科夫模型的应用实例:中文分词
- HDU4404 Worms(计算多边形和圆的重叠面积)
- Java 30道经典笔试题