追捕oicq探測技術 (轉)

gugu99發表於2007-12-29
追捕oicq探測技術 (轉)[@more@]

追捕是怎樣得到檢測結果的呢?下面是具體實現的段:
MyStream := TMemoryStream.Create;
try
NMUDP1.ReadStream(MyStream);
SetLength(TmpStr,NumberBytes);
MyStream.Read(TmpStr[1],NumberBytes);
finally
MyStream.Free;
end;
j := Pos( #$02 +#$02 +#$00 +#$00 , TmpStr);
k := Pos( #$02 +#$03 +#$00 +#$00 , TmpStr);
m := Pos( #$02 +#$03 +#$0a +#$00 , TmpStr);
o := Pos( #$02 +#$03 +#$02 +#$00 , TmpStr);

if (j=1) or (k=1) or (m=1) or (o=1) then begin
j := Pos( #$02 +#$02 +#$00 +#$00 + 'y', TmpStr);
k := Pos( #$02 +#$03 +#$00 +#$00 + 'y', TmpStr);
m := Pos( #$02 +#$03 +#$0a +#$00 + 'y', TmpStr);
o := Pos( #$02 +#$03 +#$02 +#$00 + 'y', TmpStr);
OicqVer := '未知';
if j=1 then OicqVer := '425';
if k=1 then OicqVer := '725';
if m=1 then OicqVer := '820';
if o=1 then OicqVer := '810';
if (j=1) or (k=1) or (m=1) or (o=1) then begin
TmpS := '';
for j:=1 to length(TmpStr) do begin
if TmpStr[j] in ['0'..'9'] then tmpS := tmpS + TmpStr[j];
end;
if TmpS='0' then Label2.Caption := 'OICQ處於關閉狀態,版本:'+ OicqVer
else Label2.Caption :='OICQ號碼為'+ TmpS + ',版本:'+ OicqVer;
end;

j := Pos( #$02 +#$02 +#$00 +#$00 + 'x', TmpStr);
k := Pos( #$02 +#$03 +#$00 +#$00 + 'x', TmpStr);
m := Pos( #$02 +#$03 +#$0a +#$00 + 'x', TmpStr);
o := Pos( #$02 +#$03 +#$02 +#$00 + 'x', TmpStr);
if (j=1) or (k=1) or (m=1) or (o=1) then begin
J := 8;
TmpOicqNUm := '';
While TmpStr[J]<>#$1f do begin
TmpOicqNum :=TmpOicqNum + TmpStr[J];
Inc(J);
end;
J := J + 6;
While TmpStr[J]<>#$1f do begin
Inc(J);
end;
J := J + 1;
While TmpStr[J]<>#$1f do begin
Inc(J);
end;
J := J + 1;
TmpOicqMsg := '';
While TmpStr[J]<>#$03 do begin
TmpOicqMsg := TmpOicqMsg + TmpStr[J];
Inc(J);
end;
if TmpOicqMsg<>LastOicqMessage then begin
LastOicqMessage := TmpOicqMsg;
Messagebox(Form1.handle, PChar('OICQ' + TmpOicqNum + '對你的探測作出回應:' + #$0D + #$0A + TmpOicqMsg), '警告資訊', MB_ICONWARNING +mb_ok);
end;
end;
exit;
end;


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10748419/viewspace-996046/,如需轉載,請註明出處,否則將追究法律責任。

相關文章