webInject 手册
一 系统框架
WebInject为perl语言编写,其系统框架如下:
webInject包含webInject Engine,可以用命令行调用,或者使用GUI调用webInject Engine. webInject Engine对应代码文件为webinject.pl.
二 webInject使用
webInject可以使用GUI运行以及命令行运行.下面步骤为gui运行,command运行具体参看: http://www.webinject.org/manual.html
步骤一:下载webInject: http://www.webinject.org/download.html
步骤二:解压,例如C:/ webinject
步骤三:双击webinjectgui.exe运行webinject自带的gui.
步骤四:点击run,运行默认配置config.xml
三 配置
3.1 config.xml
Config.xml用于配置测试项目,config.xml指定webInject运行哪几个test case并配置一些运行中使用的常量.config.xml是GUI运行时默认的配置文件名称.在命令行运行webInject时候,用户可以指定自己的配置文件.
下面讲述config,xml中使用的各类参数.
3.1.1 Proxy(代理)
在config.xml中,配置http request代理.代码如下:
<proxy>http://127.0.0.1:8080</proxy>
如果配置需要验证的代理服务器,代码中加入用户名+密码.代码如下:
<proxy>http://username:[email protected]:8080</proxy>
3.1.2 useragent(User-agent翻译为用户代理)
User-agent 字段指的是每个request的自身的标志符,相当于request的身份证号码.默认的user-agent为webInject
<useragent>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)</useragent>
3.1.3 httpauth(http验证)
对于需要http验证,配置如下:
<httpauth>www.fakedomain.com:80:my_realm:foo:welcome</httpauth>
3.1.4 baseurl(常量baseurl)
<baseurl>http://myserver</baseurl>