1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
REQUIRE_MODULE LUA
BLOCK:LUA readFile name : ret
assert(io.input(name))
local buf = io.read("*all")
return buf
END
BLOCK attack host port url name code expect
_MILESTONE $name
_CODER:URLENC VAR(code) urlenc
_REQ $host $port
__GET ${url}?param=${urlenc} HTTP/1.1
__Host: $host
__Accept: text/html
__User-Agent: httest/2.4.2
__
_EXPECT headers "$expect"
_WAIT
_REQ $host $port
__GET ${url}?${urlenc}=foo HTTP/1.1
__Host: $host
__Accept: text/html
__User-Agent: httest/2.4.2
__
_EXPECT headers "$expect"
_WAIT
_REQ $host $port
__POST $url HTTP/1.1
__Host: $host
__Content-Length: AUTO
__Content-Type: application/x-www-form-urlencoded
__Accept: text/html
__User-Agent: httest/2.4.2
__
_-param=$urlenc
_EXPECT headers "$expect"
_WAIT
_REQ $host $port
__POST $url HTTP/1.1
__Host: $host
__Content-Length: AUTO
__Content-Type: application/x-www-form-urlencoded
__Accept: text/html
__User-Agent: httest/2.4.2
__
_-${urlenc}=fooo
_EXPECT headers "$expect"
_WAIT
_END
END
BLOCK runAttacks type host port url attackerFile
_AUTO_CLOSE on
_REQ $host $port
__GET $url?foo=bar&bla=fasel HTTP/1.1
__Host: $host
__Accept: text/html
__User-Agent: httest/2.4.2
__
_EXPECT headers "HTTP/1.1 200"
_WAIT
_REQ $host $port
__POST $url HTTP/1.1
__Host: $host
__Content-Length: AUTO
__Content-Type: application/x-www-form-urlencoded
__Accept: text/html
__User-Agent: httest/2.4.2
__
_-foo=bar&bla=fasel
_EXPECT headers "HTTP/1.1 200"
_WAIT
readFile "$attackerFile" BUF
_XML:PARSE VAR(BUF)
_XML:XPATH count(/${type}/attack) count
_LOOP $count i=1
_XML:XPATH /${type}/attack[$i]/name name
_XML:XPATH /${type}/attack[$i]/code code
attack $host $port $url VAR(name) VAR(code) "HTTP/1.1 403"
_END
END
|