HTTP发包工具 -HTTPie

原文:

http://tanjiti.lofter.com/post/1cc6c85b_10c57767

https://github.com/jakubroztocil/httpie

一般用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

例如选择json表示默认指定请求体的Content-Type为application/json

 

三、使用

1.简介

基本使用方法 

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

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

http --help

2.常见功能示例

(1)发送查询字符串 ==

 (2)发送表单数据  

Content-Type为application/x-www-form-urlencoded

从文件读取数据发送表单 =@

 

 (3)发送JSON数据  :=

Content-Type为application/json

从文件读取JSON数据  :=@

   

(4)发送文件表单 @

Content-Type为multipart/form-data

 (5)是否自动重定向  --follow

不自动重定向的

 自动重定向的

 (6)指定请求头  :

 (7) 基本认证  --auth:passwd

缺少基本认证的

 指定基本认证的

(8)像wget一样下载 --download

 

更多使用方法请参照

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=(select+1+from(select+count(*),concat((select+(select+(SELECT+CHAR(100,+56,+100,+57,+48,+97,+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)

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(*),concat((select+(select+(SELECT+CHAR(100,+56,+100,+57,+48,+97,+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)

猜你喜欢

转载自www.cnblogs.com/itfat/p/9103647.html
今日推荐