1.GET传参
$_GET 数组的说明:
$_GET 是一个预定义数组。
作用域是超全局,脚本的任何地方都可以使用。
接收从浏览器客户端用户GET方式(URL 中)传递到服务器的参数。
GET 传参的参数名username做$_GET数组的key,参数值AJEST作为数组的value。
GET 传参时,直接将参数拼接到URL中即可。
首先在服务器创建一个php文件,内容如下:
<?php
// get.php
var_dump($_GET); //输出$_GET数组
?>当服务器接受到参数后将参数进行输出。
传参前访问页面如下:

使用hackbar进行GET传参:

参数传到_GET数组并进行输出。
2.POST传参
$_POST 数组的说明:
POST 传参,参数在请求正文中。
GET 传参"可见",POST 传参"不可见"。
以HTTP 协议通信,都是明文的。
2.1 使用php表单进行POST 传参
php代码如下:
<?php
// post.php
?>
<html>
<head>
<meta charset = 'utf-8'/>
</head>
<body>
<?php
if(empty($_POST['submit'])){
?>
<h1>用户登录</h1>
<form
action = ""
method = "post"
enctype = "application/x-www-form-urlencoded"
>
账号:<input type = 'text' name = "username" /><br />
密码:<input type = 'password' name = "password" /><br />
<input type = 'submit' name = "submit" value = "登录"/><br />
</form>
<?php
}else{
echo "您输入的用户名是{$_POST['username']},<br />您输入的密码是{$_POST['password']}!";
}
?>
</body>
</html>登录界面:

提交效果:

服务器接受参数并进行输出。
2.2 使用hackbar进行POST 传参

2.3 使用Burp Suite 的Repeater 模块进行POST 传参
复制url地址

在 Burp Suite 的Repeater 模块中选择“Paste URL as request”:

右键点击“Change request mmethod”改变请求方法为POST:

点击“Send”发送:

2.4 使用Python进行POST 传参
Python脚本代码如下:
import requests
url = "http://192.168.8.101/post.php"
data = {'username':'future','password':'123789','submit':'submit'}
res = requests.post(url = url, data = data)
print(res.content.decode('utf-8'))运行结果:

将输出的html代码通过浏览器进行渲染:

3.COOKIE传参
COOKIE 技术
弥补HTTP 协议的无状态性,保持用户的会话状态。
Cookie 过程:
1. 用户提交账密;
2. 浏览器进行身份认证;
3. 下发身份证(下发Cookie);
4. 接下来浏览器客户端用户的所有的请求都会携带身份证信息。
整体流程体现为,保持了HTTP 会话的状态性。
3.1 向浏览器写入Cookie 信息
首先,编写一个PHP 脚本用来接收cookie 参数:
<meta charset = 'utf-8'>
<?php
// cookie.php
var_dump($_COOKIE);
?>传参前访问页面如下:

$_COOKIE数组为空。
向浏览器写入Cookie 信息:

3.2 使用Burp Suite发送cookie信息
访问服务器php时进行抓包并发送到Repeater模块,在请求头中添加Cookie字段:

3.3 使用hackbar 发送Cookie 信息

3.4 使用Python脚本发送Cookie信息
3.4.1 写在自定义头部中
代码如下:
import requests
url = "http://192.168.8.101/cookie.php"
cookies = {'username':'future','password':'123789'}
res = requests.get(url = url, cookies = cookies)
print(res.text)运行结果如下:

3.4.2 写在Cookies 参数中
代码如下:
import requests
url = "http://192.168.8.101/cookie.php"
cookies = {'username':'silence','password':'789123'}
res = requests.get(url = url, cookies = cookies)
print(res.text)运行结果如下:

















