追捕是怎样得到检测结果的呢?下面是具体实现的程序段:
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;
本文地址:http://com.8s8s.com/it/it6332.htm