本人想写个登录器,以前用的狂人的,现在也能用,不过还是想自己写。
加密这一步难住我了。我用的网上代码先base64再md5
代码如下:
function Base64(Src: string): string;
const
DataSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
var
i, ModLen: integer;
Current: string;
Buf: array[1..3] of Byte;
NewBuf: array[1..4] of Byte;
begin
result := '';
if Src = '' then
exit;
ModLen := Length(Src) mod 3;
while Length(Src) > 0 do
begin
FillChar(Buf, 3, #0);
Current := Copy(Src, 1, 3);
Src := Copy(Src, 4, Length(Src) - 3);
for i := 1 to 3 do
Buf[i] := Ord(Current[i]);
NewBuf[1] := Buf[1] shr 2;
NewBuf[2] := (Buf[1] shl 6 shr 2 or Buf[2] shr 4) and $3F;
NewBuf[3] := (Buf[2] shl 4 shr 2 or Buf[3] shr 6) and $3F;
NewBuf[4] := Buf[3] and $3F;
for i := 1 to 4 do
result := result + DataSet[NewBuf[i] + 1];
end;
if ModLen >= 1 then
result[Length(result)] := '=';
if ModLen = 1 then
result[Length(result) - 1] := '=';
end;function TForm3.getcmdline(QQpath, qqnum, pwd: string): string;
type
TempChar = array[0..15] of char;
var
md5: TIdHashMessageDigest5;
var
qqstate:Integer;
begin
if chk1.Checked then
qqstate:=41
else
qqstate:=40;
md5 := TIdHashMessageDigest5.Create;
result := QQPath + ' /START QQUIN:' + QQNum + ' PWDHASH:' + Base64(TempChar(md5.HashValue(pwd))) + ' /STAT:' + IntToStr(QQState);
md5.Free;
end;procedure TForm3.txt1KeyPress(Sender: TObject; var Key: Char);
begin
if not(Key in ['0'..'9',#8]) then
Key:=#0;
end;
procedure TForm3.btn1Click(Sender: TObject);
var
login_str:string;
begin
if stat1.Panels[0].Text='' then
begin
ShowMessage('plz choose the QQ''s Path Before Loginning! ');
btn2.Click;
end else
login_str:=getcmdline(stat1.Panels[0].Text,txt1.Text,txt2.Text);
WinExec(PChar(Login_str),SW_SHOWNORMAL);
end;procedure TForm3.btn2Click(Sender: TObject);
var
oldpath:string;
begin
oldpath:=stat1.Panels[0].Text;
stat1.Panels[0].Text:='';
dlgOpen1.FileName:='';
if dlgOpen1.Execute then
if dlgOpen1.FileName<>'' then
stat1.Panels[0].Text:=dlgOpen1.FileName
else
stat1.Panels[0].Text:=oldpath;end;
最后编译通过不过 最终还是密码错误,请人给我看看,谢谢
难道用迷你QQ的代码?
加密这一步难住我了。我用的网上代码先base64再md5
代码如下:
function Base64(Src: string): string;
const
DataSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
var
i, ModLen: integer;
Current: string;
Buf: array[1..3] of Byte;
NewBuf: array[1..4] of Byte;
begin
result := '';
if Src = '' then
exit;
ModLen := Length(Src) mod 3;
while Length(Src) > 0 do
begin
FillChar(Buf, 3, #0);
Current := Copy(Src, 1, 3);
Src := Copy(Src, 4, Length(Src) - 3);
for i := 1 to 3 do
Buf[i] := Ord(Current[i]);
NewBuf[1] := Buf[1] shr 2;
NewBuf[2] := (Buf[1] shl 6 shr 2 or Buf[2] shr 4) and $3F;
NewBuf[3] := (Buf[2] shl 4 shr 2 or Buf[3] shr 6) and $3F;
NewBuf[4] := Buf[3] and $3F;
for i := 1 to 4 do
result := result + DataSet[NewBuf[i] + 1];
end;
if ModLen >= 1 then
result[Length(result)] := '=';
if ModLen = 1 then
result[Length(result) - 1] := '=';
end;function TForm3.getcmdline(QQpath, qqnum, pwd: string): string;
type
TempChar = array[0..15] of char;
var
md5: TIdHashMessageDigest5;
var
qqstate:Integer;
begin
if chk1.Checked then
qqstate:=41
else
qqstate:=40;
md5 := TIdHashMessageDigest5.Create;
result := QQPath + ' /START QQUIN:' + QQNum + ' PWDHASH:' + Base64(TempChar(md5.HashValue(pwd))) + ' /STAT:' + IntToStr(QQState);
md5.Free;
end;procedure TForm3.txt1KeyPress(Sender: TObject; var Key: Char);
begin
if not(Key in ['0'..'9',#8]) then
Key:=#0;
end;
procedure TForm3.btn1Click(Sender: TObject);
var
login_str:string;
begin
if stat1.Panels[0].Text='' then
begin
ShowMessage('plz choose the QQ''s Path Before Loginning! ');
btn2.Click;
end else
login_str:=getcmdline(stat1.Panels[0].Text,txt1.Text,txt2.Text);
WinExec(PChar(Login_str),SW_SHOWNORMAL);
end;procedure TForm3.btn2Click(Sender: TObject);
var
oldpath:string;
begin
oldpath:=stat1.Panels[0].Text;
stat1.Panels[0].Text:='';
dlgOpen1.FileName:='';
if dlgOpen1.Execute then
if dlgOpen1.FileName<>'' then
stat1.Panels[0].Text:=dlgOpen1.FileName
else
stat1.Panels[0].Text:=oldpath;end;
最后编译通过不过 最终还是密码错误,请人给我看看,谢谢
难道用迷你QQ的代码?
解决方案 »
- 怎么把数据库中的数据显示在ListView上?
- 超难问题!!!!!!!! 如何判断 edit 控件 或 MEMO 控件 的 光标 在第几个字符上???????????????????? 急!!!!!!!!!!!!
- 保存记录的文件的问题
- 請教這樣的問題怎麼用 QrExpr 實現?
- 请问用extracticon读取程序的ico图标后如何将它保存为ico文件?
- 奇怪!我的DELPHI5怎么了???????
- DBgridEH多行选定
- 哪里有DELPHI 5下载
- 谁能提供个用Delphi发送S/MIME邮件的例子(数字加密、签名)?
- 用copyfile(Pchar(),Pchar(),false)出现"Invalid typecast"???
- 如何用Delphi进行图像编程实现投影图效果?
- ReadProcessMemory 获取内存值问题.
type
TempChar = array[0..15] of char;
var
md5: TIdHashMessageDigest5;
Src,cmdtmp:String;
i, ModLen: integer;
Current: string;
Buf: array[1..3] of Byte;
NewBuf: array[1..4] of Byte;
const
DataSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
begin
md5 := TIdHashMessageDigest5.Create;
Src := TempChar(md5.HashValue(QQPw));
cmdtmp := '';
if Src = '' then begin md5.Free;exit;end;
ModLen := Length(Src) mod 3;
while Length(Src) > 0 do
begin
FillChar(Buf, 3, #0);
Current := Copy(Src, 1, 3);
Src := Copy(Src, 4, Length(Src) - 3);
for i := 1 to 3 do
Buf[i] := Ord(Current[i]);
NewBuf[1] := Buf[1] shr 2;
NewBuf[2] := (Buf[1] shl 6 shr 2 or Buf[2] shr 4) and $3F;
NewBuf[3] := (Buf[2] shl 4 shr 2 or Buf[3] shr 6) and $3F;
NewBuf[4] := Buf[3] and $3F;
for i := 1 to 4 do
cmdtmp := cmdtmp + DataSet[NewBuf[i] + 1];
end;
if ModLen >= 1 then
cmdtmp[Length(cmdtmp)] := '=';
if ModLen = 1 then
cmdtmp[Length(cmdtmp) - 1] := '=';
result := QQPath + ' /START QQUIN:' + QQNum + ' PWDHASH:' + cmdtmp + ' /STAT:' + IntToStr(QQState);
md5.Free;
end;
用你给的登录器和miniqq1.6版 都不行,可是直接用QQ自己还是能登陆上去,本人qq2008
一直用的狂人的登录器,批登,一直没有问题
最先我想可能是QQ版本问题,我系统应该没有问题的,昨天重装了下
type
TempChar = array[0..15] of char;
var
md5: TIdHashMessageDigest5;
begin
md5 := TIdHashMessageDigest5.Create;
result := ' /START QQUIN:' + QQNum + ' PWDHASH:' + Base64(TempChar(md5.HashValue(QQPw))) + ' /STAT:' + IntToStr(QQState);
md5.Free;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
winexec(PChar(qqpath+' '+GetCommandLine(num.Text ,pass.Text ,41)),SW_normal);
end;