http://www.sufeinet.com/plugin.php?id=keke_group

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

查看: 4723|回复: 0

[求助] 求助一个设备的https登录

[复制链接]
发表于 2015-12-14 13:15:35 | 显示全部楼层 |阅读模式
一个网络设备的web页面采用https登录抓包分析如下:
[HTML] 纯文本查看 复制代码
General
Remote Address:10.196.2.88:443
Request URL:https://10.196.2.88/login.cgi
Request Method:POST
Status Code:302 Found

Response Headers
view source
Content-Type:text/html
Date:Thu, 03 Apr 2014 21:04:28 GMT
Location:/index.cgi
Server:lighttpd/1.4.31
Set-cookie:show_security_warning=true
Set-cookie:ui_language=en_US; expires=Tuesday, 19-Jan-38 03:14:07 GMT
Transfer-Encoding:chunked

Request Headers
view source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate
Accept-Language:zh-CN,zh;q=0.8,en;q=0.6,ja;q=0.4,zh-TW;q=0.2
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:332
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryr60VxcDvNBmAnJOB
Cookie:last_check=1450059028693; netCollapsed=%23headerIfaces%2C%23headerAliases%2C%23headerVlan%2C%23headerBridge%2C%23headerFirewall%2C%23headerRoutes%2C%23headerPortFwd%2C%23headerIgmp%2C%23headerTShaping; AIROS_SESSIONID=3a29cd933a8fbda0f7a44d00b7ff7a6d; show_security_warning=true; ui_language=en_US
Host:10.196.2.88
Origin:https://10.196.2.88
Referer:https://10.196.2.88/login.cgi
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36

Request Payload
------WebKitFormBoundaryr60VxcDvNBmAnJOB
Content-Disposition: form-data; name="uri"


------WebKitFormBoundaryr60VxcDvNBmAnJOB
Content-Disposition: form-data; name="username"

myusername
------WebKitFormBoundaryr60VxcDvNBmAnJOB
Content-Disposition: form-data; name="password"

mypassword
------WebKitFormBoundaryr60VxcDvNBmAnJOB--



我下载了证书,可以获取https页面内容,登录后有获取到cookie,但不知道这是不是登录成功了(因为密码写错,也能获取到cookie)。
帮忙看看,我的代码如下:
[C#] 纯文本查看 复制代码
            HttpHelper http = new HttpHelper();

            string p1 = null;

            p1 = addpost(p1, "uri", "");
            p1 = addpost(p1, "username", "myusername");
            p1 = addpost(p1, "password", "mypassword");

            HttpItem item = new HttpItem()
            {
                URL = "https://10.196.2.88/login.cgi",
                Encoding = System.Text.Encoding.UTF8,
                Method = "post",
                Postdata = p1,
                CerPath = "C:\\zhengshu.cer",
                ContentType = "multipart/form-data; boundary=----WebKitFormBoundaryZ9IStEDwVADgmWWH",
                Expect100Continue = false,
                Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
                KeepAlive = true,
            };
            HttpResult result = http.GetHtml(item);

            string html = result.Html;
            string cookie = string.Empty;
            foreach (CookieItem s in HttpCookieHelper.GetCookieList(result.Cookie))
            {
                if (s.Key.Contains("AIROS_SESSIONID"))
                {
                    cookie += HttpCookieHelper.CookieFormat(s.Key, s.Value);
                }
            }
            textBox1.Text = "cookie=" + cookie;

            item = new HttpItem()
            {
                URL = "https://10.196.2.88/network.cgi",
                Cookie = cookie,//==================这里直接写=result.cookie也不行
                Referer = "",
                Postdata = "",
                Timeout = 100000,
                ReadWriteTimeout = 30000,
                UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",
                ContentType = "application/x-www-form-urlencoded",
                Allowautoredirect = true,
                Expect100Continue = false,
            };
            result = http.GetHtml(item);
            html = result.Html;



1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-11-25 00:18

© 2014-2021

快速回复 返回顶部 返回列表