资源简介
模糊测试作为发现漏洞的重要手段,为每个安全技术人员必须掌握。
本例子作为基础的应用层协议测试例子,代码简短精悍,注释完全,结构清晰,旨在揭示模糊测试原理,为初学者揭开其神秘面纱,对其不再感到困惑,当有抛砖引玉作用。

代码片段和文件信息
/*
* simple_http_fuzzer.c
*
*/
#include
#include
#include
#include
//maximum length to grow out url
#define MAX_NAME_LEN 2048
//max strlen of a valid IP address + null
#define MAX_IP_LEN 16
//static HTTP protocol content into which we insert fuzz string
char request[] = “GET %*s.html HTTP/1.1\r\nHost: %s\r\n\r\n“;
int main(int argc char **argv) {
//buffer to build out long request
char buf[MAX_NAME_LEN + sizeof(request) + MAX_IP_LEN];
//server address structure
struct sockaddr_in server;
int sock len req_len;
if (argc != 3) { //require IP address on the command line
fprintf(stderr “Missing server IP address\n“);
exit(1);
}
memset(&server 0 sizeof(server)); //clear the address info
server.sin_family = AF_INET; //building an IPV4 address
server.sin_port = htons(80); //connecting to port 80
//convert the dotted IP in argv[1] into network representation
if (inet_pton(AF_INET argv[1] &server.sin_addr) <= 0) {
fprintf(stderr “Invalid server IP address: %s\n“ argv[1]);
exit(1);
}
//This is the basic fuzzing loop. We loop growing the url by
//4 characters per pass until an error occurs or we reach MAX_NAME_LEN
for (len = 4; len < MAX_NAME_LEN; len += 4) {
//first we need to connect to the server create a socket...
sock = socket(AF_INET SOCK_STREAM 0);
if (sock == -1) {
fprintf(stderr “Could not create socket quitting\n“);
exit(1);
}
//and connect to port 80 on the web server
if (connect(sock (struct sockaddr*)&server sizeof(server))) {
fprintf(stderr “Failed connect to %s quitting\n“ argv[1]);
close(sock);
exit(1); //terminate if we can‘t connect
}
//build the request string. Request really only reserves space for
//the name field that we are fuzzing (using the * format specifier)
req_len = snprintf(buf sizeof(buf) request len “A“ argv[1]);
//this actually copies the growing number of A‘s into the request
memset(buf + 4 ‘A‘ len);
//now send the request to the server
send(sock buf req_len 0);
//try to read the server response for simplicity‘s sake let‘s assume
//that the remote side choked if no bytes are read or a recv error
//occurs
if (read(sock buf sizeof(buf) 0) <= 0) {
fprintf(stderr “Bad recv at len = %d\n“ len);
close(sock);
break; //a recv error occurred report it and stop looping
}
close(sock);
}
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2516 2013-08-19 14:41 simple_http_fuzzer.c
----------- --------- ---------- ----- ----
2516 1
- 上一篇:De Jong 测试函数及源代码
- 下一篇:GetAlibaba_Setup.rar
相关资源
- VirTest5.0.rar
- 一个测试报告的模板,有点用
- In vitro screening of lactobacilli with antago
- AresonMouseTestProgram可测鼠标回报率及
- Can EC-MPS reduce gastrointestinal side effect
- Spirent iTest用户手册详细介绍iTest的各
- line-test.rar
- 易语言123test源码易语言图形窗口的模
- 基于AHP-Fuzzy-VIKOR的装配式建筑混凝土
- 基于I-Fuzzy-Smith算法的融合控制策略仿
- 慧荣Test_SM32x_H0229汉化版
- Research on Forecasting Method of Urban Water
- 论文研究-基于fuzzyTOPSIS的资源服务优
- LabVIEW实现Fuzzy_PID的补充资源
- 小程序智能识别快递收货地址自动解
- pkavhttpfuzzer
- TDD(Test-Driven Development)的Demo
- Sequential probability ratio test - Wikipedia.
- W5500Test-20180314.7z
- 基于Fuzzy-AHP的风电场建设项目综合评
- 基于AHP-Fuzzy的电子商务风险探析
- UPnP测试程序
- ID_test.rar
- FERET人脸数据库转化为MAT文件
- TestDirector8.0 客户端
- 软件测试第二版Software Testing(Second
- TCS3200-TEST.rar
- ShortestRoute.rar
- websocket-rtsp-proxy-test.zip
- Analytical Methods in Fuzzy Modeling and Contr
评论
共有 条评论