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中利用中断获得系统启动以来的时间

Delphi 字符串加密解密单元

Delphi 中format的字符串格式化使用说明

Delphi xe8中的正则表达式提取日语(平假名,片假名,汉字)

Delphi firedac 如何按整型(byte)读取 mysql tinyint(1) 类型字段?

Delphi开发获取文件md5值

Delphi 之 对话框组件

Delphi中如何用一个按钮控制开与关两个状态

Delphi 设计一个有渐变色的标签

Delphi中用socket解析域名获得ip地址

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



打赏

取消

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

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

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

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

评论

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