另外一个关于发包的例子
来源:互联网 发布:图片编辑软件有哪些 编辑:程序博客网 时间:2024/06/05 19:01
using System;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
public string GetTicket(string ChallengeString)
...{
string getTicketCmd = "GET https://login.passport.com/login2.srf HTTP/1.1 " + "Authorization: Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in="+this._userName.Replace("@", "%40") + ",pwd=" + this._password + "," + ChallengeString + " " + "Host: login.passport.com ";
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, 1);
IPEndPoint ipepServer = new IPEndPoint(IPAddress.Parse("10.0.0.172"),80);
socket.Connect(ipepServer);
if (socket != null)
...{
Encoding ASCII = Encoding.ASCII;
Byte[] sendCmd = ASCII.GetBytes(getTicketCmd);
int sendState = socket.Send(sendCmd, sendCmd.Length, 0);
UTF8Encoding UTF8 = new UTF8Encoding();
Byte[] RecvBytes = new byte[1024];
string data = "";
int bytes = 0;
bytes = socket.Receive(RecvBytes, RecvBytes.Length, 0);
data = UTF8.GetString(RecvBytes, 0, bytes);
string[] tmpDataList = data.Split(new char[] ...{ ''' });
socket.Shutdown(SocketShutdown.Both);
socket.Close();
return tmpDataList[1];
}
else
...{
return "";
}
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
public string GetTicket(string ChallengeString)
...{
string getTicketCmd = "GET https://login.passport.com/login2.srf HTTP/1.1 " + "Authorization: Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in="+this._userName.Replace("@", "%40") + ",pwd=" + this._password + "," + ChallengeString + " " + "Host: login.passport.com ";
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, 1);
IPEndPoint ipepServer = new IPEndPoint(IPAddress.Parse("10.0.0.172"),80);
socket.Connect(ipepServer);
if (socket != null)
...{
Encoding ASCII = Encoding.ASCII;
Byte[] sendCmd = ASCII.GetBytes(getTicketCmd);
int sendState = socket.Send(sendCmd, sendCmd.Length, 0);
UTF8Encoding UTF8 = new UTF8Encoding();
Byte[] RecvBytes = new byte[1024];
string data = "";
int bytes = 0;
bytes = socket.Receive(RecvBytes, RecvBytes.Length, 0);
data = UTF8.GetString(RecvBytes, 0, bytes);
string[] tmpDataList = data.Split(new char[] ...{ ''' });
socket.Shutdown(SocketShutdown.Both);
socket.Close();
return tmpDataList[1];
}
else
...{
return "";
}
- 另外一个关于发包的例子
- 一个python发包的脚本
- (ZT)udp发包收包的例子
- 请教大家一个关于.NET 的另外一个问题
- 关于winpcap发包速度低的问题
- 关于tcpreplay发包的错误积累帖
- 一个关于Timer()的例子..
- 一个关于异常的例子
- 关于多线程的一个例子
- 关于TabHost的一个例子
- 关于list的一个例子
- 关于Berkeley的一个例子
- 关于allocator的一个例子
- 关于ListActivity的一个例子
- 关于CSS的一个例子
- 关于abstract的一个例子
- 关于数组的一个例子
- 一个关于this的例子
- 延时方法及其定时精度分析
- 步履蹒跚的学用LINUX,思维混乱了。
- 一个别人写的在WindowCE下发HTTP包的类
- log4cpp应用速成手册
- AJAX下Post表单(解决中文乱码问题)
- 另外一个关于发包的例子
- Array类对数组的操作
- 搬家喽!
- 关于接口的实现,只能低层实现高层
- apache服务器中进程和线程的使用
- MapPath使用方法
- 一种简单JDBC数据库连接池的实现
- 修復VS.NET 2005
- BDE动态连接Oracle数据库