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.mzph.cn/news/638750.shtml

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

相关文章

构建库函数雏形(以GPIO为例)

构建库函数雏形 进行外设结构体定义构建置位和复位函数进行库函数的自定义 step I&#xff1a; \textbf{step I&#xff1a;} step I&#xff1a; 对端口进行输出数据类型枚举 step II&#xff1a; \textbf{step II&#xff1a;} step II&#xff1a;对端口进行结构化描述 step…

线性代数的学习和整理23:用EXCEL和python 计算向量/矩阵的:内积/点积,外积/叉积

目录 1 乘法 1.1 标量乘法(中小学乘法) 1.1.1 乘法的定义 1.1.2 乘法符合的规律 1.2 向量乘法 1.2.1 向量&#xff1a;有方向和大小的对象 1.2.2 向量的标量乘法 1.2.3 常见的向量乘法及结果 1.2.4 向量的其他乘法及结果 1.2.5 向量的模长&#xff08;长度&#xff0…

第三篇【传奇开心果系列】Vant开发移动应用:财务管理应用

传奇开心果博文系列 系列博文目录Vant开发移动应用系列博文 博文目录一、项目目标二、编程思路三、初步实现示例代码四、扩展思路五、使用Firebase等后端服务来实现用户认证和数据存储示例代码六、用Vant组件库实现收入和支出分类管理的示例代码七、用Vant组件库实现收入和支出…

Redis经典五大类型源码及底层实现

Redis经典五大类型源码及底层实现分析 1、一些题目 redis的zset底层实现&#xff1f;redis的跳表和压缩列表说一下&#xff0c;解决了哪些问题&#xff0c;时间复杂度和空间复杂度如何&#xff1f;redis的zset使用的是什么数据结构&#xff1f; Redis数据类型的底层数据结构…

《WebKit 技术内幕》之五(1): HTML解释器和DOM 模型

第五章 HTML 解释器和 DOM 模型 1.DOM 模型 1.1 DOM标准 DOM &#xff08;Document Object Model&#xff09;的全称是文档对象模型&#xff0c;它可以以一种独立于平台和语言的方式访问和修改一个文档的内容和结构。这里的文档可以是 HTML 文档、XML 文档或者 XHTML 文档。D…

python基本数据类型 - 字典集合

引入 在内存中存储的数据可以是不同的数据类型。比如名字可以使用字符串存储&#xff0c;年龄可以使用数字存储&#xff0c;python有6种基本数据类型&#xff0c;用于各种数据的存储&#xff0c;分别是&#xff1a;numbers(数字类型)、string(字符串)、List(列表)、Tuple(元组…

【笔记】Blender4.0建模入门-3物体的基本操作

Blender入门 ——邵发 3.1 物体的移动 演示&#xff1a; 1、选中一个物体 2、选中移动工具 3、移动 - 沿坐标轴移动 - 在坐标平面内移动 - 自由移动&#xff08;不好控制&#xff09; 选中物体&#xff1a;右上的大纲窗口&#xff0c;点击物体名称&#xff0c;物体的轮…

文件操作(上)

目录 文件的必要性&#xff1a; 文件分类&#xff1a; 程序文件&#xff1a; 数据文件&#xff1a; 文件的打开与关闭&#xff1a; fopen函数分析: ​编辑 FILE*: char*filename: char*mode: fclose函数&#xff1a; 应用&#xff1a; 文件编译 Fgetc Fputc 应用…

HNU-数据挖掘-作业1

数据挖掘课程作业作业1 计科210X 甘晴void 202108010XXX 第一题 假设所分析的数据包括属性 age,它在数据元组中的值&#xff08;以递增序&#xff09;为13 ,15 ,16 ,16 ,19 ,20 ,20 ,21 ,22 ,22 ,25 ,25 ,25 ,25 ,30 ,33 ,33 ,35 ,35 ,35 ,35 ,36 ,40 ,45 ,46 ,52,70。 a.…

基于Unity平台开发Vision Pro应用

VisionOS是苹果最新空间计算设备Vision Pro的操作系统。Unity开发人员可以利用现有的3D场景 以及为 visionOS 构建游戏或应用程序的资产。有关 visionOS 的更多信息&#xff0c;请参阅 Apple 的 visionOS 概述。 visionOS提供了几种不同的显示应用程序的模式&#xff1a;Windo…

【网站项目】基于SSM的274办公自动化管理系统

&#x1f64a;作者简介&#xff1a;多年一线开发工作经验&#xff0c;分享技术代码帮助学生学习&#xff0c;独立完成自己的项目或者毕业设计。 代码可以私聊博主获取。&#x1f339;赠送计算机毕业设计600个选题excel文件&#xff0c;帮助大学选题。赠送开题报告模板&#xff…

JVM系列-1.初识JVM

&#x1f44f;作者简介&#xff1a;大家好&#xff0c;我是爱吃芝士的土豆倪&#xff0c;24届校招生Java选手&#xff0c;很高兴认识大家&#x1f4d5;系列专栏&#xff1a;Spring原理、JUC原理、Kafka原理、分布式技术原理、数据库技术、JVM原理&#x1f525;如果感觉博主的文…

异或运算的骚操作,由浅入深拿捏一类型的题

文章目录 &#x1f680;前言&#x1f680;异或运算的基本用法&#x1f680;一组数中一种数出现了奇数次&#xff0c;其他种数出现了偶数次&#xff0c;找出这个数&#x1f680;一组数中有两种数出现了奇数次&#xff0c;其他种数出现了偶数次&#xff0c;求这两个数✈️得到一个…

Spring Boot3.2.2整合MyBatis Plus3.5.5

目录 1.前置条件 2.导坐标 3.配置数据源 4.配置mapper扫描路径 5.MyBatis Plus代码生成器整合 1.导坐标 2.编写代码生成逻辑 1.前置条件 已经初始化好一个spring boot项目且版本为3X&#xff0c;项目可正常启动 2.导坐标 <dependency><groupId>com.baomid…

弹性调度助力企业灵活应对业务变化,高效管理云上资源

作者&#xff1a;吴昆 什么是弹性调度 云计算时代&#xff0c;企业可以通过云平台获得大量计算资源&#xff0c;并根据业务发展和流量需求的实时变化&#xff0c;灵活调整使用的资源类型与资源量。阿里云提供了多种弹性资源&#xff0c;如云服务器 ECS 和弹性容器实例 ECI&am…

基于 Spring Boot+MySQL实现的在线考试系统源码+数据库,基于不同类型的客观题,进行自动组卷、批卷等功能的考试系统

1. 部署相关 1.1. 介绍 一个 JAVA 实现的在线考试系统,主要实现一套基于不同类型的客观题,进行自动组卷、批卷等功能的考试系统&#xff08;没有主观题&#xff09; 1.2. 系统架构 后端技术栈基于 Spring Boot数据库MySQLORMMyBatis & MyBatis-plus缓存Redis、guava的L…

【Java网络编程02】套接字编程

【Java网络编程02】套接字编程 1. Socket套接字 概念&#xff1a;Socket套接字&#xff0c;就是系统提供用于实现网络通信的技术&#xff0c;是基于TCP/IP协议的网络通信基本操作单元。基于Socket套接字的网络程序开发就是网络编程。 分类&#xff1a; 我们可以把Socket套接字…

docker 部署 sentinel

docker 部署 sentinel 环境安装 拉取镜像 目前稳定的版本是1.8.0 docker pull bladex/sentinel-dashboard:1.8.0启动服务 docker run --name sentinel -p 8858:8858 -td bladex/sentinel-dashboard:1.8.0登录 登录的时候账号和密码都是sentinel

算法训练营Day45

#Java #动态规划 Feeling and experiences&#xff1a; 最长公共子序列&#xff1a;力扣题目链接 给定两个字符串 text1 和 text2&#xff0c;返回这两个字符串的最长 公共子序列 的长度。如果不存在 公共子序列 &#xff0c;返回 0 。 一个字符串的 子序列 是指这样一个新…

泛型..

1.泛型 所谓泛型 其实就是一种类型参数(我们平常所见到的参数指的就是方法中的参数 他接收有外界传递来的值 然后在方法中进行使用) 并且还提高了代码的复用率 何以见得提高了代码的复用率 其实就是通过对比使用了泛型技术和没有使用泛型技术之间的区别&#xff1a; 以下是没有…