扫描端口?(50分)

  • 主题发起人 主题发起人 41426277
  • 开始时间 开始时间
4

41426277

Unregistered / Unconfirmed
GUEST, unregistred user!
谁有最快的端口扫描一段函数?
 
program Project1;
{$APPTYPE CONSOLE}

uses winsock,sysutils,windows;

const
startport=1;
stopport=30;
var
s:tsocket;
i,j,error:integer;
server:tsockaddrin;
wsa:twsadata;
begin

writeln('===============================================================================');
writeln('== Very Slow Port Scanner==');
writeln('== Edit bywhaoye@21cn.com ==');
writeln('===============================================================================');
writeln(' ====');
writeln(' ====');
writeln('=====================================================================');
writeln(' ====');
wsastartup(makeword(1,1),wsa);
server.sin_family:=AF_INET;
server.sin_addr.S_addr:=inet_addr('127.0.0.1');
for i:=startport to stopport do
begin
s:=socket(AF_INET, SOCK_STREAM, 0);
server.sin_port:=htons(i);
error:=connect(s,server,sizeof(server));
if error=0 then
begin
write(' == Scan port: '+inttostr(i));
for j:=0 to 5-length(inttostr(i)) do
write(' ');
writeln(' [ok] ==');
closesocket(s);
end;
end;
writeln(' ====');
writeln('=====================================================================');
writeln(' ====');
writeln(' ====');
writeln('============================================================================');
writeln('== Thank you for your test! Good luck!==');
writeln('== Edit bywhaoye@21cn.com ==');
writeln('===========================================================================');
wsacleanup();
readln;
end.
这个你看看??
 
我用过这个太慢了,我看人家的扫描好快的
 
用app2001扫1-100的端口要100多秒,客户没法等
 
用多线程处理.
 
后退
顶部