一、gopher协议的使用方法(注意请求开头加个_或任意字符),例如/_,不然会丢失一个字节)
使用Gopher协议发送一个请求,环境为:nc起一个监听,curl发送gopher请求
nc启动监听,监听2333端口:
root@Ubuntu ~# nc -lp 2333
- 1
使用curl发送http请求,命令为
root@kali ~# curl gopher://192.168.17.129:2333/abcd
- 1
此时nc收到的消息为:
root@Ubuntu ~# nc -lp 2333
bcd
- 1
- 2
可以发现url中的a没有被nc接受到,如果命令变为
root@kali ~# curl gopher://192.168.17.129:2333/_abcd
- 1
此时nc收到的消息为:
root@Ubuntu ~# nc -lp 2333
abcd
- 1
- 2
二、gopher协议的GET和POST协议格式:
GET数据包只需要开头两行即可,例如:
GET /test.php?a=Hello world HTTP/1.1
Host: 127.0.0.1
- 1
- 2
POST数据包需要五行,例如:
POST /test.php HTTP/1.1
Host: 127.0.0.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 11
Connection: close //这个可以没有,但是没有的话连接结束会延迟一段时间
a=Hello world
- 1
- 2
- 3
- 4
- 5
- 6
- 7
关于多次url编码问题:
第一,利用ssrf时经常要进行多次url编码(传参或者多次跳转需要多次url编码,也就是说,有多少次请求就要编码多少次,直接curl后接gopher://就编码一次,利用?url=gopher://这样的形式进行ssrf利用就相当于请求了两次,需要编码两次,如果有302跳转,则还需要再编码),第一次url编码后,将所有%0a改成%0d%0a
gopher://默认发送到70端口,一般我们需要发送到80端口,记得改