论坛上的各位朋友,想请教一下,自己的QQ号码上面有多个QQ群,请问是否可以用DELPHI来获取QQ上所有群的群号码呢?如果可以的话,希望各位朋友能提供一下相关的资料或者关键字,又或者思路,衷心谢谢!!!

解决方案 »

  1.   

    汗,这个说的也太轻巧了吧……
    http://www.aspinfo.cn/article/net/qq/41800.html
    要知道QQ那个DB文件存储方式现在还不是非常清楚……
      

  2.   

    unit QQmsg_Decode;interface
    uses
      winsock,windows;
    function  blowfish_decrypt(pIn:pChar; key:pChar;pOut:pChar):integer;
    function QQMSGdecode(pIn:pchar;len:integer;key:pchar; pOut:pchar;total_len:pInteger):integer;
    procedure Decrypt(ebx,edi:pCardinal);
    procedure Encrypt(edx,ebx:pCardinal);
    implementation
    var
      Key1,Key2,Key3,Key4:Cardinal;
    const
      C_BLOWFISH=16;function F_FUNCTION(x, k1, k2, c:Cardinal):Cardinal;
    begin
      result:=((((x) shr 5) + (k1)) xor (((x) shl 4) + (k2)) xor ((c) +(x)))
    end;function  blowfish_decrypt(pIn:pChar; key:pChar;pOut:pChar):integer;
    var
       ebx:Cardinal;
       edi:Cardinal;
       temp_p:pChar;
    begin    Key4 := pinteger(key)^;
      temp_p:=key+4;
        Key3 := pinteger(temp_p)^;
      temp_p:=key+8;
        Key2 := pinteger(temp_p)^;
      temp_p:=key+12;
        Key1 := pinteger(temp_p)^;
        
        Key1 := ntohl(Key1);
        Key2 := ntohl(Key2);
        Key3 := ntohl(Key3);
        Key4 := ntohl(Key4);    ebx := PCardinal(pIn)^;
      temp_p:=pIn+4;
        edi := pCardinal(temp_p)^;
        
        ebx := ntohl(ebx);
        edi := ntohl(edi);    Decrypt(@ebx, @edi);    ebx := ntohl(ebx);
        edi := ntohl(edi);     CopyMemory(pOut, @ebx, 4);
       temp_p:= pOut+4;
         CopyMemory(temp_p, @edi, 4);
       result:= 0;
    end;function QQMSGdecode(pIn:pchar;len:integer;key:pchar; pOut:pchar;total_len:pInteger):integer;
    var
        n,BLOCK_LEN,i,retLen,offset,count:integer;
        pEdi,pLocal,pbuffer,p,temp_p:pChar;
        buffer,ebx_edi:array[0..7] of char;
        cl:char;begin
      BLOCK_LEN:=8;
      i:=0;
      offset:=0;
      count:=0;
      cl:=chr(0);
        if((len mod 8) <> 0) then
      begin
            result:= -1;
        exit;
      end;
        
        if(len < $10)  then
      begin
            result:= -1;
        exit;
      end;
        
        n := len;
        pLocal := pIn;
        blowfish_decrypt(pIn, key, @ebx_edi);
        cl := ebx_edi[0];
        cl :=Chr(ord(cl) and $7);
        n :=n - ord(cl);
        n :=n - $a;
        if(total_len^ < n)then
      begin
            result:= -1;
        exit;
      end;    if(n = 0)then
      begin
            result:= -1;
        exit;
      end;    total_len^ := n;
        retLen := n;    n:=0;
        offset := BLOCK_LEN;
        
        zeromemory(@buffer,8);
        pEdi := pIn;
        pLocal :=pLocal+ BLOCK_LEN;
        pbuffer := buffer;
        n := ord(cl)+1;
        count := 1;    while(count <= 2) do
        begin
            if(n < BLOCK_LEN) then
            begin
                inc(n);
                inc(count);
                continue;
            end;
            if(n <> BLOCK_LEN)  then
                continue;
            
            pbuffer := pEdi;    //pIn
            pIn := pLocal;
            for i:=0 to BLOCK_LEN -1 do
            begin
                if((offset+i) >= len)then
            begin
              result:= -1;
              exit;
            end;
                p := pLocal+i;
                cl := p^;
                p := ebx_edi+i;
                p^ :=Chr(ord(p^) xor ord(cl));
            end;        blowfish_decrypt(ebx_edi, key, ebx_edi);
            offset :=offset+ BLOCK_LEN;
            pEdi := pLocal;
            pLocal :=pLocal+ BLOCK_LEN;
            n := 0;
        end;
        
        //end of while    if(total_len^ <> 0) then    while(total_len^ <> 0)do
        begin
            if(n < BLOCK_LEN)then
         begin
                p := pOut;
          temp_p:=pbuffer+n;
                cl := pchar(temp_p)^;
          temp_p:=pbuffer+n;
                cl :=chr(ord(cl) xor ord(pchar(temp_p)^));
                inc(pOut);
                inc(n);
                dec(total_len^);
                p^ := cl;
                continue;
            end;
            if(n <> BLOCK_LEN) then
                continue;
            pbuffer := pEdi;
            pIn := pLocal;
            
            i := 0;
            repeat
                if((offset+i) >= len)then
            begin
              result:= -1;
              exit;
            end;
                p := pLocal+i;
                cl := p^;
          p := ebx_edi+i;
                p^ :=Chr(ord(p^) xor ord(cl));
                inc(i);
            until (i>=BLOCK_LEN);
            blowfish_decrypt(ebx_edi, key, ebx_edi);
            offset :=offset+ BLOCK_LEN;
            pEdi := pLocal;
            pLocal :=pLocal+ BLOCK_LEN;
            n := 0;
        end;//end of while    count := 1;
        repeat
            if(n < BLOCK_LEN)then
        begin
                p := pOut;
          temp_p:=pbuffer+n;
                cl := pchar(temp_p)^;
          temp_p:=pbuffer+n;
                cl :=chr(ord(cl) xor ord(pchar(temp_p)^));
                if(ord(cl) <> 0)then
            begin
              result:= -1;
              exit;
            end;
                inc(n);
                inc(count);
                continue;
            end;        if(n <> BLOCK_LEN) then
                continue;
            
            pbuffer := pEdi;
            pIn := pLocal;
            i := 0;
            repeat
                if((offset+i) >= len) then
            begin
              result:= -1;
              exit;
            end;
                p := pLocal+i;
                cl := p^;
          p := ebx_edi+i;
                p^ :=Chr(ord(p^) xor ord(cl));
                inc(i);
                
            until(i>=BLOCK_LEN);        blowfish_decrypt(ebx_edi, key, ebx_edi);
            offset := offset+BLOCK_LEN;
            pEdi := pLocal;
            pLocal :=pLocal+ BLOCK_LEN;
            n := 0;
        until(count >= 7);
        
        total_len^ := retLen;
        result:= 0;
        
    end;procedure Decrypt(ebx,edi:pCardinal);
    var
      C1: Cardinal;
        k :integer;
    begin
      C1 := $E3779B90;
        for k:= 0 to  C_BLOWFISH -1 do
        begin
            edi^ := edi^ - F_FUNCTION((ebx^), Key1, Key2, C1);
            ebx^ := ebx^ - F_FUNCTION((edi^), Key3, Key4, C1);
            C1   := C1 + $61C88647;
        end;
    end;//上面的函数的逆
    procedure Encrypt(edx,ebx:pCardinal);
    var
      C1: integer;
        k :integer;
    begin
      C1 := $0;
        for k:= 0 to  C_BLOWFISH -1 do
      begin
            C1   := C1 - $61C88647;
        edx^ := edx^ + F_FUNCTION((ebx^), Key3, Key4, C1);
            ebx^ := ebx^ + F_FUNCTION((edx^), Key1, Key2, C1);
        end;
    end;end.
    ………………………………………………
      

  3.   

    你把他编译成一个DLL,然后用EXE调用……
    现在遇到了一个问题,输入的时候没反应,我不知道是不是哪里有什么错误,有时间了看下
    另外这个是QQTool的DLL源码,EXE源码作者没公开,所以接口什么的可能会有点麻烦
      

  4.   

    unit QQmsg_Decode; interface 
    uses 
      winsock,windows; 
    function  blowfish_decrypt(pIn:pChar; key:pChar;pOut:pChar):integer; 
    function QQMSGdecode(pIn:pchar;len:integer;key:pchar; pOut:pchar;total_len:pInteger):integer; 
    procedure Decrypt(ebx,edi:pCardinal); 
    procedure Encrypt(edx,ebx:pCardinal); 
    implementation 
    var 
      Key1,Key2,Key3,Key4:Cardinal; 
    const 
      C_BLOWFISH=16; function F_FUNCTION(x, k1, k2, c:Cardinal):Cardinal; 
    begin 
      result:=((((x) shr 5) + (k1)) xor (((x) shl 4) + (k2)) xor ((c) +(x))) 
    end; function  blowfish_decrypt(pIn:pChar; key:pChar;pOut:pChar):integer; 
    var 
      ebx:Cardinal; 
      edi:Cardinal; 
      temp_p:pChar; 
    begin     Key4 := pinteger(key)^; 
      temp_p:=key+4; 
        Key3 := pinteger(temp_p)^; 
      temp_p:=key+8; 
        Key2 := pinteger(temp_p)^; 
      temp_p:=key+12; 
        Key1 := pinteger(temp_p)^; 
        
        Key1 := ntohl(Key1); 
        Key2 := ntohl(Key2); 
        Key3 := ntohl(Key3); 
        Key4 := ntohl(Key4);     ebx := PCardinal(pIn)^; 
      temp_p:=pIn+4; 
        edi := pCardinal(temp_p)^; 
        
        ebx := ntohl(ebx); 
        edi := ntohl(edi);     Decrypt(@ebx, @edi);     ebx := ntohl(ebx); 
        edi := ntohl(edi);     CopyMemory(pOut, @ebx, 4); 
      temp_p:= pOut+4; 
        CopyMemory(temp_p, @edi, 4); 
      result:= 0; 
    end; function QQMSGdecode(pIn:pchar;len:integer;key:pchar; pOut:pchar;total_len:pInteger):integer; 
    var 
        n,BLOCK_LEN,i,retLen,offset,count:integer; 
        pEdi,pLocal,pbuffer,p,temp_p:pChar; 
        buffer,ebx_edi:array[0..7] of char; 
        cl:char; begin 
      BLOCK_LEN:=8; 
      i:=0; 
      offset:=0; 
      count:=0; 
      cl:=chr(0); 
        if((len mod 8) <> 0) then 
      begin 
            result:= -1; 
        exit; 
      end; 
        
        if(len < $10)  then 
      begin 
            result:= -1; 
        exit; 
      end; 
        
        n := len; 
        pLocal := pIn; 
        blowfish_decrypt(pIn, key, @ebx_edi); 
        cl := ebx_edi[0]; 
        cl :=Chr(ord(cl) and $7); 
        n :=n - ord(cl); 
        n :=n - $a; 
        if(total_len^ < n)then 
      begin 
            result:= -1; 
        exit; 
      end;     if(n = 0)then 
      begin 
            result:= -1; 
        exit; 
      end;     total_len^ := n; 
        retLen := n;     n:=0; 
        offset := BLOCK_LEN; 
        
        zeromemory(@buffer,8); 
        pEdi := pIn; 
        pLocal :=pLocal+ BLOCK_LEN; 
        pbuffer := buffer; 
        n := ord(cl)+1; 
        count := 1;     while(count <= 2) do 
        begin 
            if(n < BLOCK_LEN) then 
            begin 
                inc(n); 
                inc(count); 
                continue; 
            end; 
            if(n <> BLOCK_LEN)  then 
                continue; 
            
            pbuffer := pEdi;    //pIn 
            pIn := pLocal; 
            for i:=0 to BLOCK_LEN -1 do 
            begin 
                if((offset+i) >= len)then 
            begin 
              result:= -1; 
              exit; 
            end; 
                p := pLocal+i; 
                cl := p^; 
                p := ebx_edi+i; 
                p^ :=Chr(ord(p^) xor ord(cl)); 
            end;         blowfish_decrypt(ebx_edi, key, ebx_edi); 
            offset :=offset+ BLOCK_LEN; 
            pEdi := pLocal; 
            pLocal :=pLocal+ BLOCK_LEN; 
            n := 0; 
        end; 
        
        //end of while     if(total_len^ <> 0) then     while(total_len^ <> 0)do 
        begin 
            if(n < BLOCK_LEN)then 
        begin 
                p := pOut; 
          temp_p:=pbuffer+n; 
                cl := pchar(temp_p)^; 
          temp_p:=pbuffer+n; 
                cl :=chr(ord(cl) xor ord(pchar(temp_p)^)); 
                inc(pOut); 
                inc(n); 
                dec(total_len^); 
                p^ := cl; 
                continue; 
            end; 
            if(n <> BLOCK_LEN) then 
                continue; 
            pbuffer := pEdi; 
            pIn := pLocal; 
            
            i := 0; 
            repeat 
                if((offset+i) >= len)then 
            begin 
              result:= -1; 
              exit; 
            end; 
                p := pLocal+i; 
                cl := p^; 
          p := ebx_edi+i; 
                p^ :=Chr(ord(p^) xor ord(cl)); 
                inc(i); 
            until (i>=BLOCK_LEN); 
            blowfish_decrypt(ebx_edi, key, ebx_edi); 
            offset :=offset+ BLOCK_LEN; 
            pEdi := pLocal; 
            pLocal :=pLocal+ BLOCK_LEN; 
            n := 0; 
        end;//end of while     count := 1; 
        repeat 
            if(n < BLOCK_LEN)then 
        begin 
                p := pOut; 
          temp_p:=pbuffer+n; 
                cl := pchar(temp_p)^; 
          temp_p:=pbuffer+n; 
                cl :=chr(ord(cl) xor ord(pchar(temp_p)^)); 
                if(ord(cl) <> 0)then 
            begin 
              result:= -1; 
              exit; 
            end; 
                inc(n); 
                inc(count); 
                continue; 
            end;         if(n <> BLOCK_LEN) then 
                continue; 
            
            pbuffer := pEdi; 
            pIn := pLocal; 
            i := 0; 
            repeat 
                if((offset+i) >= len) then 
            begin 
              result:= -1; 
              exit; 
            end; 
                p := pLocal+i; 
                cl := p^; 
          p := ebx_edi+i; 
                p^ :=Chr(ord(p^) xor ord(cl)); 
                inc(i); 
                
            until(i>=BLOCK_LEN);         blowfish_decrypt(ebx_edi, key, ebx_edi); 
            offset := offset+BLOCK_LEN; 
            pEdi := pLocal; 
            pLocal :=pLocal+ BLOCK_LEN; 
            n := 0; 
        until(count >= 7); 
        
        total_len^ := retLen; 
        result:= 0; 
        
    end; procedure Decrypt(ebx,edi:pCardinal); 
    var 
      C1: Cardinal; 
        k :integer; 
    begin 
      C1 := $E3779B90; 
        for k:= 0 to  C_BLOWFISH -1 do 
        begin 
            edi^ := edi^ - F_FUNCTION((ebx^), Key1, Key2, C1); 
            ebx^ := ebx^ - F_FUNCTION((edi^), Key3, Key4, C1); 
            C1  := C1 + $61C88647; 
        end; 
    end; //上面的函数的逆 
    procedure Encrypt(edx,ebx:pCardinal); 
    var 
      C1: integer; 
        k :integer; 
    begin 
      C1 := $0; 
        for k:= 0 to  C_BLOWFISH -1 do 
      begin 
            C1  := C1 - $61C88647; 
        edx^ := edx^ + F_FUNCTION((ebx^), Key3, Key4, C1); 
            ebx^ := ebx^ + F_FUNCTION((edx^), Key1, Key2, C1); 
        end; 
    end; end.