delphi 为idhttp伪造session


本文整理自网络,侵删。

 为idhttp伪造session 
很多网站使用了session来 记录用户登录状态,idhttp本身是不记录session的, 需要通过一些技术手段来伪造session。

以Get为例,idhttp伪造session
IdHttp1.Get(mURL1);
mStr := IdHttp1.Response.CustomHeaders.Values['Set-Cookie'];
if Pos(';',mStr)>0 then
Session_ID := LeftBStr(mStr,Pos(';',mStr)-1)
else
Session_ID := mStr;

IdHttp1.Request.CustomHeaders.Add('Cookie:' + Session_ID);
IdHttp1.Get(mURL2);
----------------------------------------------
目前很多网站如百度都禁止indy组 件访问。因此必须注意UserAgent和http1.1的 设置。

dHTTP1.Request.Connection:='Keep-Alive';
IdHTTP1.Request.UserAgent:='Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon)';
IdHTTP1.Request.ContentType:='application/x-www-form-urlencoded';
IdHTTP1.Request.Referer:='http://www.xxx.com';
IdHTTP1.Request.Accept:='image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/msword, */*';
IdHTTP1.Request.AcceptLanguage:='zh-cn';
IdHTTP1.Request.AcceptEncoding:='gzip, deflate';
IdHTTP1.Request.CacheControl:='no-cache';
IdHTTP1.ReadTimeout:=60000;
IdHTTP1.HTTPOptions:=IdHTTP1.HTTPOptions+[hoKeepOrigProtocol]; //关键这行
IdHTTP1.ProtocolVersion:=pv1_1;

相关阅读 >>

Delphi xe5 Delphi 解析 json

Delphi xe5做一个android网页框架

Delphi 一个拼图工具的制作思路

Delphi idhttp 获取链接连通状态

Delphi通过调用com对象实现更改桌面壁纸

Delphi webbrowser1使用进度条查看浏览器状态

Delphi 访问https图片

Delphi中break,exit,abort跳出循环的比较

Delphi 通用程序自动更新升级

Delphi 从网页里下载图片的程序

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...