Quantcast
Channel: 碳基体
Viewing all articles
Browse latest Browse all 75

HTTP发包工具 -HTTPie

$
0
0
一般用curl发送http协议包,这里介绍一款更为友好的发包工具 HTTPie(python版本)
(其实也自制了一款perl版本的发包工具HTTP.pl
一、安装 

pip install --upgrade httpie

或者 

easy_install httpie

或者 直接从github

pip install --upgrade https://github.com/jakubroztocil/httpie/tarball/master

可选的,

pip install --upgrade pyopenssl pyasn1 ndg-httpsclient


安装成功会 /usr/local/bin/http 

二、配置
参考:https://github.com/jkbr/httpie#config

vim ~/.httpie/config.json

{
"__meta__": {
"about": "HTTPie configuration file",
"help": "https://github.com/jkbr/httpie#config",
"httpie": "0.8.0"
},
"default_options": ["--verbose"],
"implicit_content_type": "form"
}



default_options: 配置默认选项,例如显示完整请求过程
implicit_content_type:默认请求的content_type类型,可以选择form或者json类型,例如选择form表示默认指定请求体的Content-Type为application/x-www-form-urlencoded
HTTP发包工具 -HTTPie - 碳基体 - 碳基体
例如选择json表示默认指定请求体的Content-Type为application/json
HTTP发包工具 -HTTPie - 碳基体 - 碳基体
 
三、使用
1.简介
基本使用方法 

http [选项] [请求方法] URL [ITEM [ITEM]]

仔细查看帮助选项是快速入门的好办法

http --help

2.常见功能示例
(1)发送查询字符串 ==
HTTP发包工具 -HTTPie - 碳基体 - 碳基体
 (2)发送表单数据
Content-Type为application/x-www-form-urlencoded
HTTP发包工具 -HTTPie - 碳基体 - 碳基体
从文件读取数据发送表单 =@
HTTP发包工具 -HTTPie - 碳基体 - 碳基体
 
HTTP发包工具 -HTTPie - 碳基体 - 碳基体
 (3)发送JSON数据 :=
Content-Type为application/json
HTTP发包工具 -HTTPie - 碳基体 - 碳基体
从文件读取JSON数据 :=@
HTTP发包工具 -HTTPie - 碳基体 - 碳基体

HTTP发包工具 -HTTPie - 碳基体 - 碳基体
   
(4)发送文件表单 @
Content-Type为multipart/form-data
HTTP发包工具 -HTTPie - 碳基体 - 碳基体
 (5)是否自动重定向 --follow
不自动重定向的
HTTP发包工具 -HTTPie - 碳基体 - 碳基体
 自动重定向的
HTTP发包工具 -HTTPie - 碳基体 - 碳基体
 (6)指定请求头 :
HTTP发包工具 -HTTPie - 碳基体 - 碳基体
 (7) 基本认证 --auth:passwd
缺少基本认证的
HTTP发包工具 -HTTPie - 碳基体 - 碳基体
 指定基本认证的
HTTP发包工具 -HTTPie - 碳基体 - 碳基体

(8)像wget一样下载 --download
HTTP发包工具 -HTTPie - 碳基体 - 碳基体
 

更多使用方法请参照
https://github.com/jakubroztocil/httpie

后记: 
本来这个工具让我觉得沮丧,觉得把我的工具瞄成了渣渣,但今天发了ta有个编码问题,瞬间满血复活了,我写的工具就没有这个问题(吼吼吼....)

当使用httpie发送下面这个请求时

http http://127.0.0.1:12354 a='(select 1 from(select count(*),concat((select (select (SELECT CHAR(100, 56, 100, 57, 48, 9
7, 97, 57, 52, 51, 101, 52, 97, 100, 100, 50))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema
.tables group by x)a)'


编码为

a=%28select+1+from%28select+count%28%2A%29%2Cconcat%28%28select+%28select+%28SELECT+CHAR%28100%2C+56%2C+100%2C+57%2C+48%2C+9%0A7%2C+97%2C+57%2C+52%2C+51%2C+101%2C+52%2C+97%2C+100%2C+100%2C+50%29%29%29+from+information_schema.tables+limit+0%2C1%29%2Cfloor%28rand%280%29%2A2%29%29x+from+information_schema%0A.tables+group+by+x%29a%29


ta将不该编码的也编码了

而用HTTP.pl

./HTTP.pl -url http://127.0.0.1:12354 -method POST -d a='(select 1 from(select count(*),concat((select (select (SELECT CHAR(100, 56, 100, 57, 48, 9
7, 97, 57, 52, 51, 101, 52, 97, 100, 100, 50))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema
.tables group by x)a)'


编码为

a=(select+1+from(select+count(*)%2Cconcat((select+(select+(SELECT+CHAR(100%2C+56%2C+100%2C+57%2C+48%2C+9%0D%0A7%2C+97%2C+57%2C+52%2C+51%2C+101%2C+52%2C+97%2C+100%2C+100%2C+50)))+from+information_schema.tables+limit+0%2C1)%2Cfloor(rand(0)*2))x+from+information_schema%0D%0A.tables+group+by+x)a)






Viewing all articles
Browse latest Browse all 75

Trending Articles