首页
社区
课程
招聘
求助网友给构建个POST
发表于: 2015-9-24 20:39 8876

求助网友给构建个POST

2015-9-24 20:39
8876
VB获取网页数据
网站地址:http://w23456.net
我用截取封包工具查尔斯(Charles)

登录页面 查看结果需要登录

登陆成功 这是可以看到时时彩页面

查尔斯截取的POST包




因charles意外关闭 以下封包与图片不是同一次截取
POST /Login/index HTTP/1.1
x-requested-with: XMLHttpRequest
Accept-Language: zh-cn
Referer: http://888.w23456.net:8088/Login/index
Accept: application/json, text/javascript, */*; q=0.01
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
Host: 888.w23456.net:8088
Content-Length: 47
Pragma: no-cache
Cookie: Lang=zh-cn; _c_aut=%5B%5D5%40%60Cn%5B4%40%2C%7EK%3DZ%7C%3AeY0_%2CjSP%3ATsZOeX%2CiaHQPMs%40Sc%2CYBBB9TZ7fp; _theme=272727; _themeColor=7E3D76; _themeHighlight=FFFF00; _themeHighlightColor=202020; _b_page=bet; setbac=0; say=hbnl175.166.68.137; _c_cookie=1; _c_cookie3=6H%3AF%3F; PHPSESSID=aio5o27bto28pujet3ituonha1

login=‘账号’&pass=‘密码’&authnum=08606

下图是我想要获得的数据

之前我构建的POST结构返回数据总是登陆页面的或者其他错误!不知是cookie问题还是结构错误!
Sub 提交()
    Dim Myurl As String, send_data As String, my_head As String '//变量
    
    Myurl = "http://888.w23456.net:8088/Login/index" '//提交的页面
    
    my_head = "Content-Type: application/x-www-form-urlencoded"
    
    my_head = my_head & vbCrLf & "Cookie: Lang=zh-cn; _c_aut=%5B%5D5%40%60Cn%5B4%40%2C%7EK%3DZ%7C%3AeY0_%2CjSP%3ATsZOeX%2CiaHQPMs%40Sc%2CYBBB9TZ7fp; _theme=272727; _themeColor=7E3D76; _themeHighlight=FFFF00; _themeHighlightColor=202020; _b_page=bet; setbac=0; say=hbnl175.166.68.137; _c_cookie=1; _c_cookie3=6H%3AF%3F; PHPSESSID=aio5o27bto28pujet3ituonha1"
    
    Inet1.Execute Myurl, "POST", send_data, my_head '// POST  或者GET
    
    RichTextBox1.Text = Myurl & "POST" & send_data & my_head
End Sub

求助高手用VB给构建的POST

[课程]Android-CTF解题方法汇总!

上传的附件:
收藏
免费 0
支持
分享
最新回复 (9)
雪    币: 269
活跃值: (65)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
大神们如何构建这个post
2015-9-27 22:17
0
雪    币: 18
活跃值: (1009)
能力值: ( LV7,RANK:110 )
在线值:
发帖
回帖
粉丝
3
这里有个VB-Post范例,可以参考下,如果你是想大家帮你构建好你需要的东西,那我告诉你:“伸手党,慢慢等!”.
Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Namespace Examples.System.Net
    Public Class WebRequestPostExample

        Public Shared Sub Main()
            ' Create a request using a URL that can receive a post. 
            Dim request As WebRequest = WebRequest.Create("http://www.contoso.com/PostAccepter.aspx ")
            ' Set the Method property of the request to POST.
            request.Method = "POST"
            ' Create POST data and convert it to a byte array.
            Dim postData As String = "This is a test that posts this string to a Web server."
            Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
            ' Set the ContentType property of the WebRequest.
            request.ContentType = "application/x-www-form-urlencoded"
            ' Set the ContentLength property of the WebRequest.
            request.ContentLength = byteArray.Length
            ' Get the request stream.
            Dim dataStream As Stream = request.GetRequestStream()
            ' Write the data to the request stream.
            dataStream.Write(byteArray, 0, byteArray.Length)
            ' Close the Stream object.
            dataStream.Close()
            ' Get the response.
            Dim response As WebResponse = request.GetResponse()
            ' Display the status.
            Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
            ' Get the stream containing content returned by the server.
            dataStream = response.GetResponseStream()
            ' Open the stream using a StreamReader for easy access.
            Dim reader As New StreamReader(dataStream)
            ' Read the content.
            Dim responseFromServer As String = reader.ReadToEnd()
            ' Display the content.
            Console.WriteLine(responseFromServer)
            ' Clean up the streams.
            reader.Close()
            dataStream.Close()
            response.Close()
        End Sub
    End Class
End Namespace
2015-9-27 22:51
0
雪    币: 15
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
我希望您看的明白这代码。
public static string HttpPost(string URI, string Parameters) 
{
   System.Net.WebRequest req = System.Net.WebRequest.Create(URI);
   req.Proxy = new System.Net.WebProxy(ProxyString, true);
   // 竟然我们是要发送 POST
   req.ContentType = "application/x-www-form-urlencoded";
   req.Method = "POST";
   // 我们必须知道我们要发送多少 bytes. 
   // Post'ed Faked Forms should be name=value&
   byte [] bytes = System.Text.Encoding.ASCII.GetBytes(Parameters);
   req.ContentLength = bytes.Length;
   System.IO.Stream os = req.GetRequestStream ();
   os.Write (bytes, 0, bytes.Length); //Push it out there
   os.Close ();
   System.Net.WebResponse resp = req.GetResponse();
   if (resp== null) return null;
   System.IO.StreamReader sr = 
         new System.IO.StreamReader(resp.GetResponseStream());
   return sr.ReadToEnd().Trim();
}
2015-9-28 00:34
0
雪    币: 30
活跃值: (62)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
my_head那里不对,你提交上去的Cookies可能已经失效了
建议先访问一次登录的主页面,读取出Cookies随着接下来的POST一起提交
VB不擅长,所以没办法贴出代码,只能给一个思路
2015-9-28 12:52
0
雪    币: 35
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
rfz
6
貌似 需要 cookie 的保持 没post一次可能要请求一次cookie  用新的cookie  去提交
2015-10-31 13:04
0
雪    币: 631
活跃值: (46)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
7
POST登陆不需要COOKIE。投递数据没加入。且,登陆验证码未处理。
2015-10-31 14:45
0
雪    币: 202
活跃值: (114)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
8
mark
2015-11-1 01:03
0
雪    币: 250
活跃值: (81)
能力值: ( LV6,RANK:90 )
在线值:
发帖
回帖
粉丝
9
获取cookie,然后用curl来构建.
2015-11-10 12:30
0
雪    币: 202
活跃值: (114)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
10
正好对这种问题感兴趣,研究并用vc写个小程序验证了一下
因为登录需要验证码,还带有cookie,所以只单独发个post 是不行的
总的来说,达到楼主的获取数据的目的,通过以下4个交互可以做到
1) http://w23456.net
2) http://888.w23456.net:8088/Login/authnum
3) login=username&pass=******&authnum=05661
4) http://888.w23456.net:8088/LottoOp/Get_Lotto/12
1, 2, 4是GET, 3是POST,注意整个过程保持在一个会话中
2是get 验证码图片数据,要显示出来,识别后填在3 的请求串中
关于cookie, 注意观察抓包到数据,服务器response的set-cookie,
有些是设置有些是删除,每次访问把有效的cookie都带上就行了
但是其实这是自己写socket处理http协议时 需要关心的,
完全可以用高层一些的api,比如wininet.lib, 就不用自己处理cookie
我用的wininet api(不过是mfc封装过的,对应到用VB调用原生api函数,大概5个左右),不用考虑cookie
VB调wininet,网上有不少例子,随手找到一个
http://www.newxing.com/Tech/Program/VisualBasic/Wininet_743.html
参考VC程序的话我可以发给你
2015-11-14 15:43
0
游客
登录 | 注册 方可回帖
返回
//