Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用饼干打嗝到Powershell_Powershell_Burp - Fatal编程技术网

用饼干打嗝到Powershell

用饼干打嗝到Powershell,powershell,burp,Powershell,Burp,以下是从Burp截短的捕获: 使用Burp的中继器转发此捕获将生成预期的响应。 将其重建到Powershell的Invoke WebRequest中的正确方法是什么 我试过以下方法,但没有成功。没有得到与使用Burp转发原始请求相同的响应 $URL = "https://portals.aliexpress.com/adcenter/generateUrl.htm" $WebSession = New-Object Microsoft.PowerShell.Commands.WebReques

以下是从Burp截短的捕获:

使用Burp的中继器转发此捕获将生成预期的响应。 将其重建到Powershell的Invoke WebRequest中的正确方法是什么

我试过以下方法,但没有成功。没有得到与使用Burp转发原始请求相同的响应

$URL = "https://portals.aliexpress.com/adcenter/generateUrl.htm"
$WebSession = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$MyCookie = New-Object System.Net.Cookie 
$MyCookie.Name = "ALIEXPRESS_SESSION"

$MyCookie.Domain = ".aliexpress.com"

$CookieParams = @{
        ali_apache_id='10.182.xxxxxxxxxxxxx';
        cna='Y3OFExxxxxxxxxxxx';
        _ga='GA1.2.1xxxxxxxxxxxxx';
        ....
        ....
    }

$MyCookie.Value = $CookieParams
$WebSession.Cookies.Add($MyCookie)

$TokenParams = @{
        _csrf_token_='xxxxxxxxx';
        action='GenerateUrlAction';
        targetUrl='https%3A%2F%2Fwww.aliexpress.com%2Fitem%2FOriginal-SPALDING-NBA-Graffiti-Series-Rubber-Outdoor-Basketball-83-574Y%2F32972474387.html%3Fspm%3D2114.33020108.6.3.23a1y1fQy1fQWV%26scm%3D1007.17258.122813.0%26pvid%3D3d3c706f-950c-45e8-8b10-6efc729703a4';
        trackId='thexxxxxxxxxx';
        eventSubmitDoGenerateUrl='Get+Tracking+Link';

    }

$response = Invoke-WebRequest -Uri $URL -WebSession $WebSession -Method Post -Body $TokenParams

我认为cookies的创建不正确。如果要同时添加多个Cookie,则需要在
$WebSession.Cookies.Add中使用
System.Net.CookieCollection
对象。否则,您需要迭代
$CookieParams
哈希表,从每个哈希表创建一个cookie,然后将其添加到
CookieContainer
中。我很犹豫是否发布一个答案,因为我没有任何方法来测试我所知道的想法。这很有趣。我试试看。但是,我应该为每个cookie名称和域设置什么?或者甚至都没关系?cookies应该与burp显示的内容相匹配,我认为您要使用的重载定义是
System.Net.Cookie new(字符串名称、字符串值)
。我不确定在添加cookie时是否需要指定域,但如果确实使用重载
void Add(uri-uri,System.Net.cookie cookie)
,则使用
void Add(System.Net.cookie cookie)
进行
$WebSession.Cookies.Add()