Beispiel #1
0
void prot_user_get_key( struct qqclient* qq, uchar key )
{
	qqpacket* p = packetmgr_new_send( qq, QQ_CMD_GET_KEY );
	if( !p ) return;
	bytebuffer *buf = p->buf;
	put_byte( buf, key );
	post_packet( qq, p, SESSION_KEY );
}
Beispiel #2
0
void prot_login_logout( struct qqclient* qq )
{
    qqpacket* p = packetmgr_new_send( qq, QQ_CMD_LOGOUT );
    if( !p ) return;
    bytebuffer *buf = p->buf;
    buf->pos += 16;	//zeros
    p->need_ack = 0;
    post_packet( qq, p, SESSION_KEY );
}
Beispiel #3
0
void prot_login_send_info( struct qqclient* qq )
{
    static uchar unknown5[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,
                               0x00,0x00,0x00
                              };
    static uchar unknown6[] = {0xE9,0xC4,0xD6,0x5C,0x4D,0x9D,
                               0xA0,0x17,0xE5,0x24,0x6B,0x55,0x57,0xD3,0xAB,0xF1
                              };
    static uchar unknown7[] = {0xCB,0x8D,0xA4,0xE2,0x61,0xC2,
                               0xDD,0x27,0x39,0xEC,0x8A,0xCA,0xA6,0x98,0xF8,0x9B
                              };

    qqpacket* p = packetmgr_new_send( qq, QQ_CMD_LOGIN_SEND_INFO );
    if( !p ) return;
    bytebuffer *buf = p->buf;
    //prepare sth.
    randkey( unknown6 );
    randkey( unknown7 );

    put_word( buf, 0x0001 );
    put_data( buf, qq->data.version_spec, sizeof(qq->data.version_spec) );
    put_int( buf, qq->data.login_info_unknown2 );
    put_int( buf, qq->server_time );
    put_int( buf, qq->client_ip );
    put_int( buf, 00000000 );
    put_word( buf, qq->data.login_info_large.len );
    put_data( buf, qq->data.login_info_large.data, qq->data.login_info_large.len );
    buf->pos += 35;
    put_data( buf, qq->data.exe_hash, sizeof(qq->data.exe_hash) );
    put_byte( buf, rand2() );	//unknown important byte
    put_byte( buf, qq->mode );
    put_data( buf, unknown5, sizeof(unknown5) );
    put_data( buf, qq->data.server_data, sizeof(qq->data.server_data) );
    put_data( buf, qq->data.locale, sizeof(qq->data.locale) );
    buf->pos += 16; //16 zeros
    put_word( buf, qq->data.token_c.len );
    put_data( buf, qq->data.token_c.data, qq->data.token_c.len );
    put_int( buf, 0x00000007 );
    put_int( buf, 0x00000000 );
    put_int( buf, 0x08041801 );
    put_byte( buf, 0x40 );	//length of the following
    put_byte( buf, 0x01 );
    put_int( buf, rand2()  );
//	put_int( buf, 0x0741E9748  );
    put_word( buf, sizeof(unknown6) );
    put_data( buf, unknown6, sizeof(unknown6) );
    put_data( buf, unknown5, sizeof(unknown5) );
    put_data( buf, qq->data.server_data, sizeof(qq->data.server_data) );
    put_byte( buf, 0x02 );
    put_int( buf, rand2()  );
//	put_int( buf, 0x8BED382E  );
    put_word( buf, sizeof(unknown7) );
    put_data( buf, unknown7, sizeof(unknown7) );
    buf->pos += 249;	//all zeros
    memcpy( p->key, qq->data.login_info_key1, sizeof(qq->data.login_info_key1) );
    post_packet( qq, p, RANDOM_KEY );
}
Beispiel #4
0
void prot_qun_get_online( struct qqclient* qq, uint number )
{
	qqpacket* p = packetmgr_new_send( qq, QQ_CMD_QUN_CMD );
	if( !p ) return;
	bytebuffer *buf = p->buf;
	put_byte( buf, 0x0B );	//command?
	put_int( buf, number );	//
	post_packet( qq, p, SESSION_KEY );
}
Beispiel #5
0
void prot_user_keep_alive( struct qqclient* qq )
{
	qqpacket* p = packetmgr_new_send( qq, QQ_CMD_KEEP_ALIVE );
	if( !p ) return;
	bytebuffer *buf = p->buf;
	char num_str[16];
	sprintf( num_str, "%u", qq->number );
	put_data( buf, (void*)num_str, strlen(num_str) );
	post_packet( qq, p, SESSION_KEY );
}
Beispiel #6
0
void prot_user_get_level( struct qqclient* qq )
{
	qqpacket* p = packetmgr_new_send( qq, QQ_CMD_GET_LEVEL );
	if( !p ) return;
	bytebuffer *buf = p->buf;
	put_byte( buf, 0x88 );
	put_int( buf, qq->number );
	put_byte( buf, 0x00 );
	post_packet( qq, p, SESSION_KEY );
}
Beispiel #7
0
void prot_im_ack_recv( struct qqclient* qq, qqpacket* pre )
{
	qqpacket* p = packetmgr_new_send( qq, pre->command );
	if( !p ) return;
	bytebuffer *buf = p->buf;
	p->seqno = pre->seqno;
	put_data( buf, pre->buf->data, 16 );
	p->need_ack = 0;
	post_packet( qq, p, SESSION_KEY );
}
Beispiel #8
0
void prot_group_download_labels( struct qqclient* qq, uint pos )
{
	qqpacket* p = packetmgr_new_send( qq, QQ_CMD_GROUP_LABEL );
	if( !p ) return;
	bytebuffer *buf = p->buf;
	put_byte( buf, 0x1F );	//command?
	put_byte( buf, 0x01 );
	put_int( buf, pos );
	post_packet( qq, p, SESSION_KEY );
}
Beispiel #9
0
void prot_qun_get_membername( struct qqclient* qq, uint number )
{
	qqpacket* p = packetmgr_new_send( qq, QQ_CMD_QUN_CMD );
	if( !p ) return;
	bytebuffer *buf = p->buf;
	put_byte( buf, 0x0F );	//command?
	put_int( buf, number );	//
	put_int( buf, 0x0 );	//?? which is position??
	put_int( buf, 0x0 );	//??
	post_packet( qq, p, SESSION_KEY );
}
Beispiel #10
0
void prot_user_change_status( struct qqclient* qq )
{
	qqpacket* p = packetmgr_new_send( qq, QQ_CMD_CHANGE_STATUS );
	if( !p ) return;
	bytebuffer *buf = p->buf;
	put_byte( buf, qq->mode );
	put_int( buf, 0 );
	put_int( buf, 1 );	//camera??
	put_word( buf, 0 );
	post_packet( qq, p, SESSION_KEY );
}
Beispiel #11
0
void prot_user_check_ip( struct qqclient* qq )
{
	qqpacket* p = packetmgr_new_send( qq, QQ_CMD_CHECK_IP );
	if( !p ) return;
	bytebuffer *buf = p->buf;
	put_byte( buf, 2 );
	put_byte( buf, 2 );
	put_byte( buf, 0 );
	put_int( buf, 0xD4020202 );
	put_int( buf, qq->last_login_time );
	put_byte( buf, 8 );
	put_byte( buf, 3 );
	post_packet( qq, p, SESSION_KEY );
}
Beispiel #12
0
void prot_login_touch_with_info( struct qqclient* qq, uchar* server_data, uchar len )
{
    qqpacket* p = packetmgr_new_send( qq, QQ_CMD_TOUCH );
    if( !p ) return;
    bytebuffer *buf = p->buf;
    restore_version_data( qq );
    randkey( p->key );
    memcpy( qq->data.server_data, server_data, MIN(len,sizeof(qq->data.server_data)) );
    put_word( buf, 0x0001 );
    put_data( buf, qq->data.locale, sizeof(qq->data.locale) );
    put_data( buf, qq->data.version_spec, sizeof(qq->data.version_spec) );
    put_data( buf, server_data, sizeof(qq->data.server_data) );
    post_packet( qq, p, RANDOM_KEY );
}
Beispiel #13
0
void prot_qun_get_memberinfo( struct qqclient* qq, uint number, uint* numbers, int count )
{
	qqpacket* p = packetmgr_new_send( qq, QQ_CMD_QUN_CMD );
	if( !p ) return;
	bytebuffer *buf = p->buf;
	put_byte( buf, 0x0C );	//command?
	put_int( buf, number );	//
	int i;
	if( count > 30 ) count = 30;	//TXQQ一次获取30个。
	for( i=0; i<count; i++ ){
		put_int( buf, numbers[i] );	//
	}
	post_packet( qq, p, SESSION_KEY );
}
Beispiel #14
0
void prot_im_send_msg_ex( struct qqclient* qq, uint to, char* msg, int len,
	ushort msg_id, uchar slice_count, uchar which_piece )
{
//	DBG("str: %s  len: %d", msg, len );
	qqpacket* p;
	if( !len ) return;
	p = packetmgr_new_send( qq, QQ_CMD_SEND_IM );
	if( !p ) return;
	bytebuffer *buf = p->buf;
	put_int( buf, qq->number );
	put_int( buf, to );
	//00 00 00 08 00 01 00 04 00 00 00 00  09SP1 changes
	put_int( buf, 0x00000008 );
	put_int( buf, 0x00010004 );
	put_int( buf, 0x00000000 );
	put_word( buf, qq->version );
	put_int( buf, qq->number );
	put_int( buf, to );
	put_data( buf, qq->data.im_key, 16 );
	put_word( buf, QQ_NORMAL_IM_TEXT );	//message type
	put_word( buf, p->seqno );
	put_int( buf, p->time_create );
	put_word( buf, qq->self->face );	//my face
	put_int( buf, 1 );	//has font attribute
	put_byte( buf, slice_count );	//slice_count
	put_byte( buf, which_piece );	//slice_no
	put_word( buf, msg_id );	//msg_id??
	put_byte( buf, QQ_IM_TEXT );	//auto_reply
	put_int( buf, 0x4D534700 ); //"MSG"
	put_int( buf, 0x00000000 );
	put_int( buf, p->time_create );
	put_int( buf, (msg_id<<16)|msg_id );	//maybe a random interger
	put_int( buf, 0x00000000 );
	put_int( buf, 0x09008600 );
	char font_name[] = "宋体";	//must be UTF8
	put_word( buf, strlen(font_name) );
	put_data( buf, (void*)font_name, strlen( font_name) );
	put_word( buf, 0x0000 );
	put_byte( buf, 0x01 );
	put_word( buf, len+3 );
	put_byte( buf, 1 );
	put_word( buf, len );
	// remodify it
	//put_word( buf, p->seqno );
	put_data( buf, (uchar*)msg, len );
	post_packet( qq, p, SESSION_KEY );
}
Beispiel #15
0
void prot_login_a4( struct qqclient* qq )
{
    static uchar unknown[] = {0x10,0x03,0xC8,0xEC,0xC8,0x96,
                              0x8B,0xF2,0xB3,0x6B,0x4D,0x0C,0x5C,0xE0,0x6A,0x51,0xCE
                             };

    qqpacket* p = packetmgr_new_send( qq, QQ_CMD_LOGIN_A4 );
    if( !p ) return;
    bytebuffer *buf = p->buf;
    put_word( buf, 0x0101 );
    put_word( buf, 0x0000 );
    put_byte( buf, qq->data.login_info_token.len );
    put_data( buf, qq->data.login_info_token.data, qq->data.login_info_token.len );
    put_data( buf, unknown, sizeof(unknown) );
    memcpy( p->key, qq->data.login_info_key1, sizeof(qq->data.login_info_key1) );
    post_packet( qq, p, RANDOM_KEY );
}
Beispiel #16
0
void prot_qun_send_msg( struct qqclient* qq, uint number, char* msg_content )
{
	qqpacket* p = packetmgr_new_send( qq, QQ_CMD_QUN_CMD );
	if( !p ) return;
	ushort len = strlen( msg_content );
	bytebuffer *buf = p->buf;
	put_byte( buf, 0x2A );
	put_int( buf, number );
	bytebuffer* content_buf;
	NEW( content_buf, sizeof(bytebuffer) ,bytebuffer);
	if( !content_buf ) {
		packetmgr_del_packet( &qq->packetmgr, p );
		return;
	}
	content_buf->size = PACKET_SIZE;
	
	put_word( content_buf, 0x0001 );	//text type
	put_byte( content_buf, 0x01 );		//slice_count
	put_byte( content_buf, 0x00 );		//slice_no
	put_word( content_buf, 0 );		//id??
	put_int( content_buf, 0 );		//zeros

	put_int( content_buf, 0x4D534700 ); //"MSG"
	put_int( content_buf, 0x00000000 );
	put_int( content_buf, p->time_create );
	put_int( content_buf, rand() );
	put_int( content_buf, 0x00000000 );
	put_int( content_buf, 0x09008600 );
	char font_name[] = "宋体";	//must be in UTF8
	put_word( content_buf, strlen(font_name) );
	put_data( content_buf, (uchar*)font_name, strlen( font_name) );
	put_word( content_buf, 0x0000 );
	put_byte( content_buf, 0x01 );
	put_word( content_buf, len+3 );
	put_byte( content_buf, 1 );			//unknown, keep 1
	put_word( content_buf, len );
	put_data( content_buf, (uchar*)msg_content, len );
	
	put_word( buf, content_buf->pos );
	put_data( buf, content_buf->data, content_buf->pos );
	DEL( content_buf );
	post_packet( qq, p, SESSION_KEY );
}
Beispiel #17
0
void prot_user_get_notice( struct qqclient* qq, uchar type )
{
	qqpacket* p = packetmgr_new_send( qq, QQ_CMD_GET_KEY );
	if( !p ) return;
	bytebuffer *buf = p->buf;
	p->need_ack = 0;
	switch( type ){
	case 0:
		put_int( buf, qq->number );
		break;
	case 1:
		put_int( buf, qq->number );
		put_word( buf, 0x0007 );
		put_word( buf, 0x0008 );
		break;
	default:
		DBG("unknown type.");
	}
	post_packet( qq, p, SESSION_KEY );
}
Beispiel #18
0
void prot_user_request_token( struct qqclient* qq, uint number, uchar operation, ushort type, uint code )
{
	qqpacket* p = packetmgr_new_send( qq, QQ_CMD_REQUEST_TOKEN );
	if( !p ) return;
	bytebuffer *buf = p->buf;
	qq->data.operation = operation;
	if( code ){	//输入验证码
		put_byte( buf, 2 );	//sub cmd
		put_word( buf, type );	//
		put_int( buf, number );
		put_word( buf, 4 );
		put_int( buf, htonl(code) );
		put_word( buf, strlen(qq->data.qqsession));
		put_data( buf, (uchar*)qq->data.qqsession, strlen(qq->data.qqsession));
	}else{
		put_byte( buf, 1 );	//sub cmd
		put_word( buf, type );	//
		put_int( buf, number );
		qq->data.operating_number = number ;
	}
	post_packet( qq, p, SESSION_KEY );
}
Beispiel #19
0
void prot_login_get_info( struct qqclient* qq )
{
    qqpacket* p = packetmgr_new_send( qq, QQ_CMD_LOGIN_GET_INFO );
    if( !p ) return;
    bytebuffer *buf = p->buf;
    put_word( buf, 0x010D );	//length or sth..
    put_byte( buf, 0x00 );
    put_word( buf, 0x0101 );
    put_data( buf, qq->data.locale, sizeof(qq->data.locale) );
    put_data( buf, qq->data.version_spec, sizeof(qq->data.version_spec) );
    put_word( buf, qq->data.token_c.len );
    put_data( buf, qq->data.token_c.data, qq->data.token_c.len );
    put_word( buf, qq->data.login_info_token.len );
    put_data( buf, qq->data.login_info_token.data, qq->data.login_info_token.len );
    put_int( buf, qq->data.login_info_unknown1 );
    put_int( buf, qq->server_time );
    put_word( buf, qq->data.login_info_data.len );
    put_data( buf, qq->data.login_info_data.data, qq->data.login_info_data.len );
    put_word( buf, 0x0000 );
    put_int( buf, 0x00000000 );
    memcpy( p->key, qq->data.login_info_key1, sizeof(qq->data.login_info_key1) );
    post_packet( qq, p, RANDOM_KEY );
}
Beispiel #20
0
void prot_login_request( struct qqclient* qq, token* tok, const char* code, char png_data )
{

    qqpacket* p = packetmgr_new_send( qq, QQ_CMD_LOGIN_REQUEST );
    if( !p ) return;
    bytebuffer *buf = p->buf;
    put_word( buf, 0x0001 );
    put_data( buf, qq->data.locale, sizeof(qq->data.locale) );
    put_data( buf, qq->data.version_spec, sizeof(qq->data.version_spec) );
    //
    put_word( buf, qq->data.login_token.len );
    put_data( buf, qq->data.login_token.data, qq->data.login_token.len );
    if( code )
        put_byte( buf, 4 );
    else
        put_byte( buf, 3 );
    put_byte( buf, 0 );
    put_byte( buf, 5 );
    put_int( buf, 0 );
    put_byte( buf, png_data );
    if( code && tok ) {
        put_byte( buf, 4 );
        put_data(buf,(uchar*)code, 4);
        //answer token
        put_word( buf, tok->len );
        put_data( buf, tok->data, tok->len );
    } else if( png_data && tok ) {
        //png token
        put_word( buf, tok->len );
        put_data( buf, tok->data, tok->len );
    } else {
        put_byte( buf, 0 );
        put_byte( buf, 0 );
    }
    post_packet( qq, p, RANDOM_KEY );
}
Beispiel #21
0
void prot_login_get_list( struct qqclient* qq, ushort pos )
{
    qqpacket* p = packetmgr_new_send( qq, QQ_CMD_LOGIN_GET_LIST );
    if( !p ) return;
    bytebuffer *buf = p->buf;
    put_word( buf, 0x011A );
    put_word( buf, 0x0001 );
    put_data( buf, qq->data.locale, sizeof(qq->data.locale) );
    put_data( buf, qq->data.version_spec, sizeof(qq->data.version_spec) );
    put_word( buf, qq->data.token_c.len );
    put_data( buf, qq->data.token_c.data, qq->data.token_c.len );
    put_int( buf, qq->data.login_info_unknown2 );
    put_int( buf, qq->server_time );
    put_int( buf, qq->client_ip );
    put_int( buf, 00000000 );
    put_word( buf, qq->data.login_info_large.len );
    put_data( buf, qq->data.login_info_large.data, qq->data.login_info_large.len );
    put_word( buf, pos );
    put_word( buf, 0x0000 );
    put_word( buf, 0x0071 );
    buf->pos += 0x0071;	//0x0071 zeros
    memcpy( p->key, qq->data.login_info_key1, sizeof(qq->data.login_info_key1) );
    post_packet( qq, p, RANDOM_KEY );
}
Beispiel #22
0
void prot_login_verify( struct qqclient* qq )
{
    qqpacket* p = packetmgr_new_send( qq, QQ_CMD_LOGIN_VERIFY );
    if( !p ) return;
    bytebuffer *buf = p->buf;
    bytebuffer *verify_data;
    NEW( verify_data, sizeof(bytebuffer) );
    if( !verify_data ) {
        packetmgr_del_packet( &qq->packetmgr, p );
        return;
    }
    verify_data->size = PACKET_SIZE;
    put_int( verify_data, rand2() );	//random??
    put_word( verify_data, 0x0001 );
    put_int( verify_data, qq->number );
    put_data( verify_data, qq->data.version_spec, sizeof(qq->data.version_spec) );
    put_byte( verify_data, 00 );
    put_word( verify_data, 00 );	//0x0001 什么来的?
    put_data( verify_data, qq->md5_pass1, 16 );
    put_int( verify_data, qq->server_time );
    verify_data->pos += 13;
    put_int( verify_data, qq->server_ip );
    put_int( verify_data, 0 );
    put_int( verify_data, 0 );
    put_word( verify_data, 0x0010 );
    put_data( verify_data, qq->data.verify_key1, 0x10 );
    put_data( verify_data, qq->data.verify_key2, 0x10 );
    //
    put_word( buf, 0x00CA );	//sub cmd??
    put_word( buf, 0x0001 );
    put_data( buf, qq->data.locale, sizeof(qq->data.locale) );
    put_data( buf, qq->data.version_spec, sizeof(qq->data.version_spec) );
    put_word( buf, qq->data.token_c.len );
    put_data( buf, qq->data.token_c.data, qq->data.token_c.len );
    if( verify_data->pos != 104 ) {
        DBG("wrong pos!!!");
    }

    int out_len = 120;
    uchar encrypted[120+10];
    qqencrypt( verify_data->data, verify_data->pos, qq->md5_pass2, encrypted, &out_len );
    put_word( buf, out_len );
    put_data( buf, encrypted, out_len );

    put_word( buf, 0x0000 );
    put_word( buf, 0x018B );
    put_byte( buf, 0x2E );	//length of the following info
    static uchar unknown6[] = {0xE9,0xC4,0xD6,0x5C,0x4D,0x9D,
                               0xA0,0x17,0xE5,0x24,0x6B,0x55,0x57,0xD3,0xAB,0xF1
                              };
    static uchar unknown7[] = {0xCB,0x8D,0xA4,0xE2,0x61,0xC2,
                               0xDD,0x27,0x39,0xEC,0x8A,0xCA,0xA6,0x98,0xF8,0x9B
                              };
    randkey( unknown6 );
    randkey( unknown7 );
    put_byte( buf, 0x01 );
    put_int( buf, rand2()  );
//	put_int( buf, 0x0741E9748  );
    put_word( buf, sizeof(unknown6) );
    put_data( buf, unknown6, sizeof(unknown6) );
    put_byte( buf, 0x02 );
    put_int( buf, rand2()  );
//	put_int( buf, 0x8BED382E  );
    put_word( buf, sizeof(unknown7) );
    put_data( buf, unknown7, sizeof(unknown7) );
    buf->pos += 0x015C;	//395 zeros?  348

    DEL( verify_data );
    post_packet( qq, p, RANDOM_KEY );
}