QQ应用程序源代码Word文档格式.docx

上传人:b****1 文档编号:14075001 上传时间:2022-10-18 格式:DOCX 页数:14 大小:19.79KB
下载 相关 举报
QQ应用程序源代码Word文档格式.docx_第1页
第1页 / 共14页
QQ应用程序源代码Word文档格式.docx_第2页
第2页 / 共14页
QQ应用程序源代码Word文档格式.docx_第3页
第3页 / 共14页
QQ应用程序源代码Word文档格式.docx_第4页
第4页 / 共14页
QQ应用程序源代码Word文档格式.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

QQ应用程序源代码Word文档格式.docx

《QQ应用程序源代码Word文档格式.docx》由会员分享,可在线阅读,更多相关《QQ应用程序源代码Word文档格式.docx(14页珍藏版)》请在冰豆网上搜索。

QQ应用程序源代码Word文档格式.docx

#endif 

Construction/Destruction 

MyQQ:

:

MyQQ() 

NULL;

LoginToken 

LoginTokenLength 

0;

Status 

//下线 

IsLogin 

false;

LastID 

MessageText 

FriendListHead 

FriendListTail 

send_seq 

random() 

&

0x0000ffff;

LastOnline 

time(NULL);

UDPServerNum 

//服务器地址 

LoginServer 

(char 

*)malloc(16*sizeof(char));

//QQ号 

UserID 

//密码 

Password 

//得到初始化密钥,按2004版 

InitKey 

(unsigned 

char*)malloc(QQ_KEY_LENGTH);

int 

i;

for(i 

<

16;

i++) 

rand();

SessionKey 

~MyQQ() 

if(LoginServer 

!

NULL) 

free(LoginServer);

if(MyIP 

free(MyIP);

if(MessageText 

free(MessageText);

if(Password 

free(Password);

if(InitKey 

free(InitKey);

if(PwdKey 

free(PwdKey);

if(SessionKey 

free(SessionKey);

if(FriendListHead 

QQFriend 

*p 

FriendListHead->

next;

while(p 

free(FriendListHead);

p;

p->

if(FriendListTail 

free(FriendListTail);

void 

Login(int 

pMode) 

unsigned 

*buf, 

*cursor, 

*raw_data, 

*encrypted_data;

seq_ret;

encrypted_len, 

bytes;

//登录模式:

为正常登录,2为隐身登录 

3登录即离开 

LoginMode 

pMode;

if(LoginToken 

== 

//发送获取登录令牌的包 

qq_get_logintoken();

else 

//2004登录包 

buf 

char*)malloc(MAX_PACKAGE_LENGTH);

//包长65535 

raw_data 

char*)malloc(QQ_LOGIN_DATA_LENGTH);

//数据长 

encrypted_data 

char*)malloc(QQ_LOGIN_DATA_LENGTH 

16);

//加密数据长度多16 

产生密文 

000-015 

用PwdKey加密空串 

MCrypter.qq_crypt(ENCRYPT, 

char*)"

 

0, 

PwdKey, 

raw_data, 

encrypted_len);

//016-051 

36字节的固定内容 

memmove(raw_data 

16, 

login_16_51, 

36);

//052-052 

登录方式 

raw_data[52] 

char)LoginMode;

//053-068 

16字节固定内容 

53, 

login_53_68, 

//069 

登录令牌长度 

pos 

69;

raw_data[pos++] 

char)LoginTokenLength;

//070-?

登录令牌 

pos, 

LoginToken, 

LoginTokenLength);

+= 

LoginTokenLength;

//未知字节0x40 

0x40;

//固定字节 

LOGIN_SEGMENTS, 

100);

100;

//剩下的字节填零 

for(;

QQ_LOGIN_DATA_LENGTH;

pos++) 

raw_data[pos] 

0x00;

//加密 

QQ_LOGIN_DATA_LENGTH, 

InitKey, 

encrypted_data, 

cursor 

buf;

bytes 

create_packet_head_seq(buf, 

cursor, 

QQ_CMD_LOGIN, 

true, 

seq_ret);

create_packet_dw(buf, 

UserID);

create_packet_data(buf, 

QQ_KEY_LENGTH);

create_packet_b(buf, 

QQ_PACKET_TAIL);

if 

(bytes 

(cursor 

buf)) 

//包被无误创建 

qq_send_packet(buf, 

bytes, 

QQ_CMD_LOGIN);

free(buf);

free(raw_data);

free(encrypted_data);

//从包中读取一个字节 

read_packet_b(unsigned 

buf, 

** 

buflen, 

b) 

if(*cursor 

buflen 

sizeof(*b)) 

*b 

**(unsigned 

**) 

cursor;

*cursor 

sizeof(*b);

return 

-1;

}

//从包中读取一个字 

read_packet_w(unsigned 

short 

w) 

sizeof(*w)) 

*w 

ntohs(**(short 

cursor);

sizeof(*w);

//处理收到的消息 

qq_process_recv_im(unsigned 

char* 

buf_len, 

seq) 

len, 

*data, 

*cursor;

qq_recv_im_header 

*im_header;

len 

buf_len;

data 

*)malloc(len);

(MCrypter.qq_crypt(DECRYPT, 

SessionKey, 

data, 

len)) 

if(len 

16) 

return;

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 初中教育 > 科学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1