QQ数据包解密

Windows版qq数据包格式:
在这里插入图片描述

android版qq数据包格式:

在这里插入图片描述

密钥:16个0

算法:tea_crypt算法

pc版qq 0825数据包解密源码:

#include "qq.h"
#include "qqcrypt.h"
#include <WinSock2.h>
#include "../public.h"
#include "../ProtocolParser.h"
#include "../ResultFile.h"
#include "../fileOper.h"
#include <windows.h>int QQ::isQQ(const char * data, int len, DATALISTHEADER hdr) {if (hdr.sock.protocol == 0x11 ){if ( hdr.sock.dstport == 8000){int firstsize = hdr.sizelist->size;if (hdr.datalist->data[0] == 0x02 && hdr.datalist->data[firstsize-1] == 0x03 ){return TRUE;}}}return FALSE;
}int QQ::processQQ(LPDATABLOCKLIST list, LPPACKSIZELIST sizelist, DATALISTHEADER hdr) {int ret = 0;char lpbuf [0x1000];int offset = 0;while (list && sizelist){int len = DataBlockList::getNextPacket(list, offset, sizelist, (char*)lpbuf);if (len > 0){QQHEADER * qqhdr = (QQHEADER*)(lpbuf + 1);if (qqhdr->cmd == 0x2508){int pad = sizeof(QQHEADER) ;if (memcmp(lpbuf + 1 + pad, "\x03\x00\x00\x00", 4) == 0)//010101{pad += 15;}else if (memcmp(lpbuf + 1 + pad,"\x00\x00\x00",3) == 0){pad += 15;}char * offset = lpbuf + 1 + pad;int size = len - 1 - pad - 1 ;unsigned char *key = (unsigned char*)offset;int decodelen = size + 1024;unsigned char *decodebuf = new unsigned char[size + 1024];int ret = qq_decrypt((unsigned char*)offset + 16, size - 16, key, decodebuf, &decodelen);if (ret > 0){Public::WriteDataFile("qq.dat", (const char*)decodebuf, decodelen);}delete decodebuf;char szqq[16];sprintf(szqq, "%u", ntohl(qqhdr->qq));ResultFile::writeRecord(hdr, "qq", "on", szqq);}
// 			else if (qqhdr->cmd == 0x3608)
// 			{
// 				char szqq[16];
// 				sprintf(szqq, "%u", ntohl(qqhdr->qq));
// 				ResultFile::writeRecord(hdr, "qq", "on", szqq);
// 			}}else {// 			string fn = ProtocolParser::formatfn(hdr, "qq_error");
// 			ret = ProtocolParser::writeBlocks(list, fn);break;}}return 0;
}/*
POST /qbrowser HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0) QQBrowser/9.0
Host: update.browser.qq.com
Content-Length: 345
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: uin_cookie=2210853762; euin_cookie=53DFE9A7024225C8649F40745723E578AC136F6862ECF843{
"COS": "10.0.17763",
"CSoftID": 22,
"CVer": "1.6.6699.999",
"Cmd": 1,
"ExeVer": "1.0.1118.400",
"GUID": "9308ec3d7b7602d10f39e90f88399236",
"InstallTimeStamp": 1557478990,
"QID": 16785570,
"QQVer": "9.1.3.25332",
"SupplyID": 0,
"TriggerMode": 1,
"UIN": 0,
"bPatch": 0,
"osDigit": 64
}
HTTP/1.1 200
Date: Sun, 11 Aug 2019 03:14:20 GMT
Content-Length: 450
Connection: keep-alive{ "CSoftID": 22, "CommandLine": "", "Desp": "\u0031\u002e\u0030\u002e\u0031\u0031\u0036\u0030\u002e\u0034\u0030", "DownloadUrl": "http://dl_dir.qq.com/invc/tt/minibrowser11.zip", "ErrCode": 0, "File": "minibrowser11.zip", "Flags": 1, "Hash": "b1309eb4312bd83d154a4b2b1b66547b", "InstallType": 0, "NewVer": "1.0.1160.400", "PatchFile": "QBDeltaUpdate.exe", "PatchHash": "b1309eb4312bd83d154a4b2b1b66547b", "Sign": "", "Size": 36003449, "VerType": "" }
*/

Android版qq解密代码:


#include "mobileQQ.h"
#include "winsock2.h"
#include "qqcrypt.h"
#include "../public.h"
#include "../ProtocolParser.h"
#include "../ResultFile.h"
#include "../fileOper.h"
#include "../SearchData.h"int parseHeartbeat(const char * data, int len) {const char * pos = SearchData::getstring("Heartbeat.Alive", lstrlenA("Heartbeat.Alive"), data, len);if (pos){pos = pos - lstrlenA("Heartbeat.Alive") - 2;int len = ntohl(*(short*)pos);pos += len;len = ntohs(*(short*)pos);pos += len;len = ntohs(*(short*)pos);string imei = string(pos + 2, len - 2);pos += len;len = ntohs(*(short*)pos);pos += len;len = ntohs(*(short*)(pos -2));if (*pos == '|'){string imsi = string(pos, len - 2);imsi = imsi.substr(1);int dot = imsi.find("|");if (dot > 0){imsi = imsi.substr(0, dot);}}		}return 0;
}int MobileQQ::parsePacket(const char * data, int &len,int dport,int sport,DATALISTHEADER hdr) {const char * qqdata = data;LPMOBILEQQ_PACK_HDR qqhdr = (LPMOBILEQQ_PACK_HDR)qqdata;int offset = ntohl(qqhdr->offset);if (offset >= 0x80 || offset < 0){offset = 4;}qqdata = qqdata + sizeof(MOBILEQQ_PACK_HDR) + offset;string qqno = "";char qqnolen = *qqdata - sizeof(int);if (qqnolen >= 5 && qqnolen <= 10){qqdata++;qqno = string(qqdata, qqnolen);}else {printf("error qq no len\r\n");return -1;}qqdata += qqnolen;if (qqhdr->cryption == 2){ResultFile::writeRecord(hdr, "mqq", "on", qqno);unsigned char key[16] = { 0 };int cryptlen = len - (qqdata - data);unsigned char *decodebuf = new unsigned char[cryptlen + 4096];int decodelen = cryptlen + 4096;int ret = qq_decrypt((unsigned char*)qqdata, cryptlen, key, decodebuf, &decodelen);if (/*ret && */decodelen > 0){*(decodebuf + decodelen) = 0;printf("succeed decrypted size:%u,encrypted size:%u\r\n", decodelen, cryptlen);Public::WriteDataFile("mobileqq.dat", (const char*)decodebuf, decodelen);//ResultFile::writeRecord(hdr, "mqq", "on", qqno);}else {printf("error:decrypted size:%u,encrypted size:%u\r\n", decodelen, cryptlen);//printf("decrypt mobile qq fix crypt packet error\r\n");}delete decodebuf;}else if(qqhdr->cryption == 0){printf("no cryption mobile qq packet\r\n");}else if (qqhdr->cryption == 1){}else {printf("error qq packet cryption\r\n");return -1;}return 0;
}int MobileQQ::isMobileQQPack(DATALISTHEADER hdr) {int dport = hdr.sock.dstport;char * data = hdr.datalist->data;int len = hdr.sizelist->size;if (hdr.sock.protocol == 6 &&(dport == 8080 || dport == 443 || dport == 80 || dport == 14000)){int packlen = ntohl(*(int*)data);if (len == packlen ){char crypt = *(data + 8);if (crypt == 1 || crypt == 2 || crypt == 0){int ver = *(int*)(data + sizeof(int));//3 = 2010 11 = 2016if (ver == 0x0a000000 || ver == 0x0b000000 || ver == 0x09000000){return TRUE;}}}}return FALSE;
}

tea_crypt算法解密源码:

/**
* The QQ2003C protocol plugin
*
* for gaim
*
* Copyright (C) 2004 Puzzlebird
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
*
* OICQ encryption algorithm
* Convert from ASM code provided by PerlOICQ
*
* Puzzlebird, Nov-Dec 2002
*//*****************************************************************************/
/*Notes: (OICQ uses 0x10 iterations, and modified something...)IN : 64  bits of data in v[0] - v[1].
OUT: 64  bits of data in w[0] - w[1].
KEY: 128 bits of key  in k[0] - k[3].delta is chosen to be the real part of
the golden ratio: Sqrt(5/4) - 1/2 ~ 0.618034 multiplied by 2^32.0x61C88647 is what we can track on the ASM codes.!!
*///#ifndef _WIN32
//#include <arpa/inet.h>
//#else
//#include "win32dep.h"
//#endif
#ifndef _QQ_QQ_CRYPT_C_
#define _QQ_QQ_CRYPT_C_#include <string.h>
#include "qqcrypt.h"
#include <winsock2.h>
#include <stdlib.h>void qq_encipher(unsigned long *const        v,const unsigned long *const  k,unsigned long *const        w);void qq_decipher(unsigned long *const        v,const unsigned long *const  k,unsigned long *const        w);void qq_encrypt(unsigned char*  instr,int             instrlen,unsigned char*  key,unsigned char*  outstr,int*            outstrlen_prt);int qq_decrypt(unsigned char*  instr,int             instrlen,unsigned char*  key,unsigned char*  outstr,int*            outstrlen_ptr);/*****************************************************************************/
void qq_encipher(unsigned long *const        v,const unsigned long *const  k,unsigned long *const        w)
{register unsigned longy = ntohl(v[0]),z = ntohl(v[1]),a = ntohl(k[0]),b = ntohl(k[1]),c = ntohl(k[2]),d = ntohl(k[3]),n = 0x10,sum = 0,delta = 0x9E3779B9; /*  0x9E3779B9 - 0x100000000 = -0x61C88647 */while (n-- > 0) {sum += delta;y += ((z << 4) + a) ^ (z + sum) ^ ((z >> 5) + b);z += ((y << 4) + c) ^ (y + sum) ^ ((y >> 5) + d);}w[0] = htonl(y); w[1] = htonl(z);
}/*****************************************************************************/
void qq_decipher(unsigned long *const        v,const unsigned long *const  k,unsigned long *const        w)
{register unsigned longy = ntohl(v[0]),z = ntohl(v[1]),a = ntohl(k[0]),b = ntohl(k[1]),c = ntohl(k[2]),d = ntohl(k[3]),n = 0x10,sum = 0xE3779B90,/* why this ? must be related with n value*/delta = 0x9E3779B9;/* sum = delta<<5, in general sum = delta * n */while (n-- > 0) {z -= ((y << 4) + c) ^ (y + sum) ^ ((y >> 5) + d);y -= ((z << 4) + a) ^ (z + sum) ^ ((z >> 5) + b);sum -= delta;}w[0] = htonl(y); w[1] = htonl(z);
}/********************************************************************
* encrypt part
*******************************************************************/void qq_encrypt(unsigned char*  instr,int             instrlen,unsigned char*  key,unsigned char*  outstr,int*            outstrlen_prt)
{unsigned charplain[8],         /* plain text buffer*/plain_pre_8[8],   /* plain text buffer, previous 8 bytes*/*crypted,        /* crypted text*/*crypted_pre_8,  /* crypted test, previous 8 bytes*/*inp;            /* current position in instr*/intpos_in_byte = 1,  /* loop in the byte */is_header = 1,      /* header is one byte*/count = 0,          /* number of bytes being crypted*/padding = 0;      /* number of padding stuff*///  int rand(void);//  void encrypt_every_8_byte (void);    //  int rand(void) {    /* it can be the real random seed function*///    return 0xdead; }  /* override with number, convenient for debug*//*** we encrypt every eight byte ***///  void encrypt_every_8_byte (void) {//    for(pos_in_byte=0; pos_in_byte<8; pos_in_byte++) {//      if(is_header) { plain[pos_in_byte] ^= plain_pre_8[pos_in_byte]; }//      else { plain[pos_in_byte] ^= crypted_pre_8[pos_in_byte]; }//    } /* prepare plain text*///    qq_encipher( (unsigned long *) plain,//       		       (unsigned long *) key, //         		     (unsigned long *) crypted);   /* encrypt it*///    //    for(pos_in_byte=0; pos_in_byte<8; pos_in_byte++) {//      crypted[pos_in_byte] ^= plain_pre_8[pos_in_byte]; //    } //    memcpy(plain_pre_8, plain, 8);     /* prepare next*///    //    crypted_pre_8   =   crypted;       /* store position of previous 8 byte*///    crypted         +=  8;             /* prepare next output*///    count           +=  8;             /* outstrlen increase by 8*///    pos_in_byte     =   0;             /* back to start*///    is_header       =   0;             /* and exit header*///  }/* encrypt_every_8_byte*/pos_in_byte = (instrlen + 0x0a) % 8; /* header padding decided by instrlen*/if (pos_in_byte) {pos_in_byte = 8 - pos_in_byte;}plain[0] = (rand() & 0xf8) | pos_in_byte;memset(plain + 1, rand() & 0xff, pos_in_byte++);memset(plain_pre_8, 0x00, sizeof(plain_pre_8));crypted = crypted_pre_8 = outstr;padding = 1; /* pad some stuff in header*/while (padding <= 2) { /* at most two byte */if (pos_in_byte < 8) { plain[pos_in_byte++] = rand() & 0xff; padding++; }if (pos_in_byte == 8) {//encrypt_every_8_byte(); } //void encrypt_every_8_byte (void) {for (pos_in_byte = 0; pos_in_byte<8; pos_in_byte++) {if (is_header) { plain[pos_in_byte] ^= plain_pre_8[pos_in_byte]; }else { plain[pos_in_byte] ^= crypted_pre_8[pos_in_byte]; }} /* prepare plain text*/qq_encipher((unsigned long *)plain,(unsigned long *)key,(unsigned long *)crypted);   /* encrypt it*/for (pos_in_byte = 0; pos_in_byte<8; pos_in_byte++) {crypted[pos_in_byte] ^= plain_pre_8[pos_in_byte];}memcpy(plain_pre_8, plain, 8);     /* prepare next*/crypted_pre_8 = crypted;       /* store position of previous 8 byte*/crypted += 8;             /* prepare next output*/count += 8;             /* outstrlen increase by 8*/pos_in_byte = 0;             /* back to start*/is_header = 0;             /* and exit header*/}/* encrypt_every_8_byte*/}}inp = instr;while (instrlen > 0) {if (pos_in_byte < 8) { plain[pos_in_byte++] = *(inp++); instrlen--; }if (pos_in_byte == 8) {//encrypt_every_8_byte(); }//void encrypt_every_8_byte (void){for (pos_in_byte = 0; pos_in_byte<8; pos_in_byte++) {if (is_header) { plain[pos_in_byte] ^= plain_pre_8[pos_in_byte]; }else { plain[pos_in_byte] ^= crypted_pre_8[pos_in_byte]; }} /* prepare plain text*/qq_encipher((unsigned long *)plain,(unsigned long *)key,(unsigned long *)crypted);   /* encrypt it*/for (pos_in_byte = 0; pos_in_byte<8; pos_in_byte++) {crypted[pos_in_byte] ^= plain_pre_8[pos_in_byte];}memcpy(plain_pre_8, plain, 8);     /* prepare next*/crypted_pre_8 = crypted;       /* store position of previous 8 byte*/crypted += 8;             /* prepare next output*/count += 8;             /* outstrlen increase by 8*/pos_in_byte = 0;             /* back to start*/is_header = 0;             /* and exit header*/}/* encrypt_every_8_byte*/}}padding = 1; /* pad some stuff in tailer*/while (padding <= 7) { /* at most sever byte*/if (pos_in_byte < 8) { plain[pos_in_byte++] = 0x00; padding++; }if (pos_in_byte == 8) {// encrypt_every_8_byte(); //void encrypt_every_8_byte (void){for (pos_in_byte = 0; pos_in_byte<8; pos_in_byte++) {if (is_header) { plain[pos_in_byte] ^= plain_pre_8[pos_in_byte]; }else { plain[pos_in_byte] ^= crypted_pre_8[pos_in_byte]; }} /* prepare plain text*/qq_encipher((unsigned long *)plain,(unsigned long *)key,(unsigned long *)crypted);   /* encrypt it*/for (pos_in_byte = 0; pos_in_byte<8; pos_in_byte++) {crypted[pos_in_byte] ^= plain_pre_8[pos_in_byte];}memcpy(plain_pre_8, plain, 8);     /* prepare next*/crypted_pre_8 = crypted;       /* store position of previous 8 byte*/crypted += 8;             /* prepare next output*/count += 8;             /* outstrlen increase by 8*/pos_in_byte = 0;             /* back to start*/is_header = 0;             /* and exit header*/}/* encrypt_every_8_byte*/}}*outstrlen_prt = count;
}/* qq_encrypt*//********************************************************************* [decrypt part]* return 0 if failed, otherwise return 1********************************************************************/int qq_decrypt(unsigned char*  instr,int             instrlen,unsigned char*  key,unsigned char*  outstr,int*            outstrlen_ptr)
{unsigned chardecrypted[8], m[8],*crypt_buff,*crypt_buff_pre_8,*outp;intcount,context_start,pos_in_byte,padding;//  int decrypt_every_8_byte (void);//  int decrypt_every_8_byte (void) {//    for (pos_in_byte = 0; pos_in_byte < 8; pos_in_byte ++ ) {//        if (context_start + pos_in_byte >= instrlen) return 1;//        decrypted[pos_in_byte] ^= crypt_buff[pos_in_byte];//    }//    qq_decipher( (unsigned long *) decrypted, //       	  	     (unsigned long *) key, //        	  	   (unsigned long *) decrypted);//    //    context_start +=  8;//    crypt_buff    +=  8;//    pos_in_byte   =   0;//    return 1;//  }/* decrypt_every_8_byte*//* at least 16 bytes and %8 == 0*/if ((instrlen % 8) || (instrlen < 16)) return 0;/* get information from header*/qq_decipher((unsigned long *)instr,(unsigned long *)key,(unsigned long *)decrypted);pos_in_byte = decrypted[0] & 0x7;count = instrlen - pos_in_byte - 10; /* this is the plaintext length*//* return if outstr buffer is not large enought or error plaintext length*/if (*outstrlen_ptr < count || count < 0) return 0;memset(m, 0, 8);crypt_buff_pre_8 = m;*outstrlen_ptr = count;   /* everything is ok! set return string length*/crypt_buff = instr + 8;   /* address of real data start */context_start = 8;        /* context is at the second 8 byte*/pos_in_byte++;           /* start of paddng stuffv*/padding = 1;              /* at least one in header*/while (padding <= 2) {    /* there are 2 byte padding stuff in header*/if (pos_in_byte < 8) {  /* bypass the padding stuff, none sense data*/pos_in_byte++; padding++;}if (pos_in_byte == 8) {crypt_buff_pre_8 = instr;//      if (!decrypt_every_8_byte())//		  return 0; //	  int decrypt_every_8_byte (void);//	  int decrypt_every_8_byte (void){for (pos_in_byte = 0; pos_in_byte < 8; pos_in_byte++) {if (context_start + pos_in_byte >= instrlen)return 0;decrypted[pos_in_byte] ^= crypt_buff[pos_in_byte];}qq_decipher((unsigned long *)decrypted,(unsigned long *)key,(unsigned long *)decrypted);context_start += 8;crypt_buff += 8;pos_in_byte = 0;//		  return 0;}/* decrypt_every_8_byte*/}}/* while*/outp = outstr;while (count != 0) {if (pos_in_byte < 8) {*outp = crypt_buff_pre_8[pos_in_byte] ^ decrypted[pos_in_byte];outp++;count--;pos_in_byte++;}if (pos_in_byte == 8) {crypt_buff_pre_8 = crypt_buff - 8;//      if (! decrypt_every_8_byte()) return 0;//	  int decrypt_every_8_byte (void);//	  int decrypt_every_8_byte (void){for (pos_in_byte = 0; pos_in_byte < 8; pos_in_byte++) {if (context_start + pos_in_byte >= instrlen)return 0;decrypted[pos_in_byte] ^= crypt_buff[pos_in_byte];}qq_decipher((unsigned long *)decrypted,(unsigned long *)key,(unsigned long *)decrypted);context_start += 8;crypt_buff += 8;pos_in_byte = 0;//		  return 0;}/* decrypt_every_8_byte*/}}/* while*/for (padding = 1; padding < 8; padding++) {if (pos_in_byte < 8) {if (crypt_buff_pre_8[pos_in_byte] ^ decrypted[pos_in_byte]) return 0;pos_in_byte++;}if (pos_in_byte == 8) {crypt_buff_pre_8 = crypt_buff;//      if (! decrypt_every_8_byte()) return 0;//	  int decrypt_every_8_byte (void);//	  int decrypt_every_8_byte (void){int haveData = 1;for (pos_in_byte = 0; pos_in_byte < 8; pos_in_byte++) {if (context_start + pos_in_byte >= instrlen){haveData = 0;break;}decrypted[pos_in_byte] ^= crypt_buff[pos_in_byte];}if (haveData == 1){qq_decipher((unsigned long *)decrypted,(unsigned long *)key,(unsigned long *)decrypted);context_start += 8;crypt_buff += 8;pos_in_byte = 0;}//		  return 0;}/* decrypt_every_8_byte*/}}/* for*/return 1;
}/* qq_decrypt*//*****************************************************************************//* This is the Public Function *//* return 1 is succeed, otherwise return 0*/
int qq_crypt(unsigned char   flag,unsigned char*  instr,int             instrlen,unsigned char*  key,unsigned char*  outstr,int*            outstrlen_ptr)
{if (flag == DECRYPT)return qq_decrypt(instr, instrlen, key, outstr, outstrlen_ptr);else if (flag == ENCRYPT)qq_encrypt(instr, instrlen, key, outstr, outstrlen_ptr);return 1; /* flag must be DECRYPT or ENCRYPT*/
}/* qq_crypt*//*****************************************************************************//* END OF FILE*/int qq_decrypt2(unsigned char*  instr,int             instrlen,unsigned char*  key,unsigned char*  outstr,int*            outstrlen_ptr)
{unsigned chardecrypted[8], m[8],*crypt_buff,*crypt_buff_pre_8,*outp;intcount,context_start,pos_in_byte,padding;//  int decrypt_every_8_byte (void);//  int decrypt_every_8_byte (void) {//    for (pos_in_byte = 0; pos_in_byte < 8; pos_in_byte ++ ) {//        if (context_start + pos_in_byte >= instrlen) return 1;//        decrypted[pos_in_byte] ^= crypt_buff[pos_in_byte];//    }//    qq_decipher( (unsigned long *) decrypted, //       	  	     (unsigned long *) key, //        	  	   (unsigned long *) decrypted);//    //    context_start +=  8;//    crypt_buff    +=  8;//    pos_in_byte   =   0;//    return 1;//  }/* decrypt_every_8_byte*//* at least 16 bytes and %8 == 0*/if ((instrlen % 8) || (instrlen < 16)) return 0;/* get information from header*/qq_decipher((unsigned long *)instr,(unsigned long *)key,(unsigned long *)decrypted);pos_in_byte = decrypted[0] & 0x7;count = instrlen - pos_in_byte - 10; /* this is the plaintext length*//* return if outstr buffer is not large enought or error plaintext length*/if (*outstrlen_ptr < count || count < 0) return 0;//   if(count!=285 && count!=143)// 	  return 0;memset(m, 0, 8);crypt_buff_pre_8 = m;*outstrlen_ptr = count;   /* everything is ok! set return string length*/crypt_buff = instr + 8;   /* address of real data start */context_start = 8;        /* context is at the second 8 byte*/pos_in_byte++;           /* start of paddng stuffv*/padding = 1;              /* at least one in header*/while (padding <= 2) {    /* there are 2 byte padding stuff in header*/if (pos_in_byte < 8) {  /* bypass the padding stuff, none sense data*/pos_in_byte++; padding++;}if (pos_in_byte == 8) {crypt_buff_pre_8 = instr;//      if (!decrypt_every_8_byte())//		  return 0; //	  int decrypt_every_8_byte (void);//	  int decrypt_every_8_byte (void){for (pos_in_byte = 0; pos_in_byte < 8; pos_in_byte++) {if (context_start + pos_in_byte >= instrlen)return 0;decrypted[pos_in_byte] ^= crypt_buff[pos_in_byte];}qq_decipher((unsigned long *)decrypted,(unsigned long *)key,(unsigned long *)decrypted);context_start += 8;crypt_buff += 8;pos_in_byte = 0;//		  return 0;}/* decrypt_every_8_byte*/}}/* while*/bool bcheck = false;outp = outstr;while (count != 0) {if ((outp - outstr)>4 && false == bcheck){int aat = outstr[0] * 256 + outstr[1];if (*outstrlen_ptr - aat != 4)return 0;if (outstr[2] == 0 && outstr[3] == 0){bcheck = true;}else if (outstr[2] == 1 &&(outstr[3] >= '0' && outstr[3] <= '9') ||(outstr[3] >= 'a' && outstr[3] <= 'z') ||(outstr[3] >= 'A' && outstr[3] <= 'Z')){bcheck = true;}elsereturn 0;// 		  if(memcmp(outstr+2,"\x00\x00",2)==0)// 		  {// 			 // return 1;// 		  }// 		  else// 		  {// 			  return 0;// 		  }}if (pos_in_byte < 8) {*outp = crypt_buff_pre_8[pos_in_byte] ^ decrypted[pos_in_byte];outp++;count--;pos_in_byte++;}if (pos_in_byte == 8) {crypt_buff_pre_8 = crypt_buff - 8;//      if (! decrypt_every_8_byte()) return 0;//	  int decrypt_every_8_byte (void);//	  int decrypt_every_8_byte (void){for (pos_in_byte = 0; pos_in_byte < 8; pos_in_byte++) {if (context_start + pos_in_byte >= instrlen)return 0;decrypted[pos_in_byte] ^= crypt_buff[pos_in_byte];}qq_decipher((unsigned long *)decrypted,(unsigned long *)key,(unsigned long *)decrypted);context_start += 8;crypt_buff += 8;pos_in_byte = 0;//		  return 0;}/* decrypt_every_8_byte*/}}/* while*/for (padding = 1; padding < 8; padding++) {if (pos_in_byte < 8) {if (crypt_buff_pre_8[pos_in_byte] ^ decrypted[pos_in_byte]) return 0;pos_in_byte++;}if (pos_in_byte == 8) {crypt_buff_pre_8 = crypt_buff;//      if (! decrypt_every_8_byte()) return 0;//	  int decrypt_every_8_byte (void);//	  int decrypt_every_8_byte (void){int haveData = 1;for (pos_in_byte = 0; pos_in_byte < 8; pos_in_byte++) {if (context_start + pos_in_byte >= instrlen){haveData = 0;break;}decrypted[pos_in_byte] ^= crypt_buff[pos_in_byte];}if (haveData == 1){qq_decipher((unsigned long *)decrypted,(unsigned long *)key,(unsigned long *)decrypted);context_start += 8;crypt_buff += 8;pos_in_byte = 0;}//		  return 0;}/* decrypt_every_8_byte*/}}/* for*/return 1;
}/* qq_decrypt*/int qq_crypt2(unsigned char   flag,unsigned char*  instr,int             instrlen,unsigned char*  key,unsigned char*  outstr,int*            outstrlen_ptr
)
{if (flag == DECRYPT)return qq_decrypt2(instr, instrlen, key, outstr, outstrlen_ptr);else if (flag == ENCRYPT)qq_encrypt(instr, instrlen, key, outstr, outstrlen_ptr);return 1; /* flag must be DECRYPT or ENCRYPT*/
}/* qq_crypt*/#endif

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/243175.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Win10下在Qt项目中配置SQlite3环境

资源下载 官网资源&#xff1a;SQLite Download Page 1、sqlite.h sqlite-amalgamation-3450000.zip (2.60 MiB) 2、sqlite3.def&#xff0c;sqlite3.dll sqlite-dll-win-x64-3450000.zip (1.25 MiB) 3、 win10下安装sqlite3所需要文件 sqlite-tools-win-x64-3450000.zipht…

node介绍

1.node是什么 Node是一个基于Chrome V8引擎的JS运行环境。 Node不是一个独立的语言、node不是JS框架。 Node是一个除了浏览器之外的、可以让JS运行的环境 Node.js是一个让JS运行在服务端的开发平台&#xff0c;是使用事件驱动&#xff0c;异步非阻塞I/O&#xff0c;单线程&…

fastJson和jackson的日期数据处理

目录 1.jackson 2.fastjson 3.总结 1.jackson jackson是spring mvc默认的JSON解析方法&#xff0c;前端的数据序列化处理之后&#xff0c;后端经过反序列化处理可以直接使用实体对象进行接收。后端接口返回实体对象&#xff0c;经过序列化处理后前端可以接收并进行处理。 …

回归预测 | Matlab基于ABC-SVR人工蜂群算法优化支持向量机的数据多输入单输出回归预测

回归预测 | Matlab基于ABC-SVR人工蜂群算法优化支持向量机的数据多输入单输出回归预测 目录 回归预测 | Matlab基于ABC-SVR人工蜂群算法优化支持向量机的数据多输入单输出回归预测预测效果基本描述程序设计参考资料 预测效果 基本描述 1.Matlab基于ABC-SVR人工蜂群算法优化支持…

C++提高编程---模板---类模板

目录 一、类模板 1.模板 2.类模板的作用 3.语法 4.声明 二、类模板和函数模板的区别 三、类模板中成员函数的创建时机 四、类模板对象做函数参数 五、类模板与继承 六、类模板成员函数类外实现 七、类模板分文件编写 八、类模板与友元 九、类模板案例 一、类模板 …

第14章_集合与数据结构拓展练习(前序、中序、后序遍历,线性结构,单向链表构建,单向链表及其反转,字符串压缩)

文章目录 第14章_集合与数据结构拓展练习选择填空题1、前序、中序、后序遍历2、线性结构3、其它 编程题4、单向链表构建5、单向链表及其反转6、字符串压缩 第14章_集合与数据结构拓展练习 选择填空题 1、前序、中序、后序遍历 分析&#xff1a; 完全二叉树&#xff1a; 叶结点…

ElasticSearch的常用增删改查DSL和代码

es增删改查常用语法 我们日常开发中&#xff0c;操作数据库写sql倒是不可能忘记&#xff0c;但是操作es的dsl语句有时候很容易忘记&#xff0c;特地记录一下方便查找。 DSL语句 1、创建索引 -- 创建索引 PUT /my_index {"mappings": {"properties": {&…

Python实现Lasso回归模型

• Tibshirani(1996)提出了Lasso(The Least Absolute Shrinkage and Selectionator operator)算法。 • 通过构造一个一阶惩罚函数获得一个精炼的模型&#xff1b;通过最终确定一些指标&#xff08;变量&#xff09;的系数为零&#xff08;岭回归估计系数等于0的机会微乎其微&a…

【HarmonyOS】体验鸿蒙电商平台的未来之旅!

从今天开始&#xff0c;博主将开设一门新的专栏用来讲解市面上比较热门的技术 “鸿蒙开发”&#xff0c;对于刚接触这项技术的小伙伴在学习鸿蒙开发之前&#xff0c;有必要先了解一下鸿蒙&#xff0c;从你的角度来讲&#xff0c;你认为什么是鸿蒙呢&#xff1f;它出现的意义又是…

【堂堂狼人杀(定制开发)】

堂堂狼人杀游戏♨️风险规避与优势。?零投资也可参与规避五大风险 政策风险(点对点场外交易)账户风险(无资金池&#xff09; 推广风险(免费注册&#xff0c;注册送大礼包&#xff09; 网络风险(大平台&#xff0c;全网场外交易) 人脉风险(预约角色&#xff0c;强制出售) …

力扣hot100 相交链表 超全注释 满级表达

Problem: 160. 相交链表 文章目录 思路复杂度&#x1f496; Ac Code 思路 &#x1f468;‍&#x1f3eb; 参考题解 &#x1f469;‍&#x1f3eb; 参考图解 复杂度 时间复杂度: O ( n m ) O(nm) O(nm) 空间复杂度: 添加空间复杂度, 示例&#xff1a; O ( 1 ) O(1) O(…

python 正则表达式学习(1)

正则表达式是一个特殊的字符序列&#xff0c;它能帮助你方便的检查一个字符串是否与某种模式匹配。 1. 特殊符号 1.1 符号含义 模式描述^匹配字符串的开头$匹配字符串的末尾.匹配任意字符&#xff0c;除了换行符&#xff0c;当re.DOTALL标记被指定时&#xff0c;则可以匹配包…

飞书+ChatGPT+cpolar搭建企业智能AI助手并实现无公网ip远程访问

文章目录 推荐 前言环境列表1.飞书设置2.克隆feishu-chatgpt项目3.配置config.yaml文件4.运行feishu-chatgpt项目5.安装cpolar内网穿透6.固定公网地址7.机器人权限配置8.创建版本9.创建测试企业10. 机器人测试 推荐 前些天发现了一个巨牛的人工智能学习网站&#xff0c;通俗易懂…

用pandas实现用前一行的excel的值填充后一行

今天接到一份数据需要分析&#xff0c;数据在一个excel文件里&#xff0c;内容大概形式如下&#xff1a; 后面空的格子里的值就是默认是前面的非空的值&#xff0c;由于数据分析的需要需要对重复的数据进行去重&#xff0c;去重就需要把控的cell的值补上&#xff0c;然后根据几…

数字IC后端设计实现 | PR工具中到底应该如何控制density和congestion?(ICC2Innovus)

吾爱IC社区星友提问&#xff1a;请教星主和各位大佬&#xff0c;对于一个模块如果不加干预工具会让inst挤成一团&#xff0c;后面eco修时序就没有空间了。如果全都加instPadding会导致面积不够overlap&#xff0c;大家一般怎么处理这种问题&#xff1f; 在数字IC后端设计实现中…

Python内置的20个高阶函数的功能和示例详解

更多资料获取 &#x1f4da; 个人网站&#xff1a;ipengtao.com Python是一门功能丰富的编程语言&#xff0c;提供了许多内置函数来处理各种数据操作。其中&#xff0c;高阶函数是一类特殊的函数&#xff0c;它们接受其他函数作为参数&#xff0c;或者返回函数作为结果。高阶函…

如何禁用WordPress站点的管理员电子邮件验证或修改检查频率?

今天boke112百科登录某个WordPress站点时&#xff0c;又出现“管理员邮件确认”的提示&#xff0c;要求确认此站点的管理员电子邮箱地址是否仍然正确。具体如下图所示&#xff1a; 如果点击“稍后提醒我”&#xff0c;那么管理员邮件验证页面就会在3天后重新显示。 说实话&…

Unity - 简单音频

“Test_04” AudioTest public class AudioTest : MonoBehaviour {// 声明音频// AudioClippublic AudioClip music;public AudioClip se;// 声明播放器组件private AudioSource player;void Start(){// 获取播放器组件player GetComponent<AudioSource>();// 赋值…

搭建开源数据库中间件MyCat2-配置mysql数据库双主双从

mycat2官网&#xff1a;MyCat2 前言&#xff1a;mycat2下载地址无法访问&#xff0c;不知道是不是被DNS污染了&#xff0c;还是需要搭梯子访问&#xff0c;所以我只能找到1.21的版本进行安装。搭建mycat2的前提是搭建数据库主从复制。 架构&#xff1a;双主双从 配置&#xf…

Verilog基础:强度建模与net型信号的多驱动问题(三)

相关阅读 Verilog基础https://blog.csdn.net/weixin_45791458/category_12263729.html?spm1001.2014.3001.5482 四、一般情况下的net型信号的线与组合&#xff08;线网多驱动&#xff09; 在Verilog基础&#xff1a;强度建模与net型信号的多驱动问题&#xff08;二&#xff0…