Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.04.25;
Скачать: CL | DM;

Вниз

Сканер сети   Найти похожие ветки 

 
Ron   (2004-02-23 12:09) [0]

народ, может кто знает как сделать сканер сети средствами WinSock через массив? А то у меня что-то не получается... :(


 
Verg ©   (2004-02-23 13:25) [1]

Не мучайся, не стОит... Возьми готовый http://www.oxid.it/


 
Verg ©   (2004-02-23 13:27) [2]

.... особенно если

> средствами WinSock через массив


:))


 
Anatoly Podgoretsky ©   (2004-02-23 13:32) [3]

Объявить массив и все рахличие по сравнению с переменной это использование идекса для обращения
Вместо V образаться так V[i]
Но может рано заниматься сканерами, а потратить усилия на изучения основ Паскаля, в том числе и массивы.


 
ALeX.B. ©   (2004-02-27 11:57) [4]

Тебе надо алгоритм перебора айпишников? Если да то смотри
unit Unit1;

interface

uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 Dialogs, StdCtrls, Ping, IdBaseComponent, IdComponent, IdRawBase,
 IdRawClient, IdIcmpClient;

type
 TForm1 = class(TForm)
   Memo1: TMemo;
   Button1: TButton;
   startip: TEdit;
   endip: TEdit;
   IdIcmpClient1: TIdIcmpClient;
   procedure Button1Click(Sender: TObject);
   procedure IdIcmpClient1Reply(ASender: TComponent;
     const AReplyStatus: TReplyStatus);
 private
   { Private declarations }
 public
   { Public declarations }
 end;

var
Form1: TForm1;
var x, y, t: array [1..4] of integer; i: byte;
implementation

{$R *.dfm}
procedure scannet(a, b: byte);

begin
for i := a to b do
begin
Form1.IdIcmpClient1.Host := InttoStr(x[1]) + "." + InttoStr(x[2]) + "." + InttoStr(x[3]) + "." + InttoStr(i);
Form1.IdIcmpClient1.Ping();
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
label noscan;  var ipos,stip1,stip2,stip3,stip4,eip1,eip2,eip3,eip4,i1,i2,i3,i4,j,k:integer;
 stip,eip:string;
begin
Memo1.Lines.Clear;
stip := startip.Text;
ipos := pos(".",stip);
stip1 := strtoint(copy(stip,1,ipos-1));
delete(stip,1,ipos);
ipos := pos(".",stip);
stip2:= strtoint(copy(stip,1,ipos-1));
delete(stip,1,ipos);
ipos:=pos(".",stip);
stip3:= strtoint(copy(stip,1,ipos-1));
delete(stip,1,ipos);
ipos:=pos(".",stip);
stip4:= strtoint(copy(stip,1,ipos+3));
eip:=endip.Text;
ipos:=pos(".",eip);
eip1 := strtoint(copy(eip,1,ipos-1));
delete(eip,1,ipos);
ipos:=pos(".",eip);
eip2:= strtoint(copy(eip,1,ipos-1));
delete(eip,1,ipos);
ipos:=pos(".",eip);
eip3:= strtoint(copy(eip,1,ipos-1));
delete(eip,1,ipos);
ipos:=pos(".",eip);
eip4:= strtoint(copy(eip,1,ipos+3));
x[1] := stip1;x[2] := stip2;x[3] := stip3;x[4] := stip4;
y[1] := eip1;y[2] := eip2;y[3] := eip3;y[4] := eip4;
if ((x[1] = y[1]) and (x[2] = y[2]) and (x[3] = y[3]))
   then
     begin
       scannet(x[4], y[4]);
       goto noscan;
     end
   else scannet(x[4], 255);
 inc(x[3]);
 t[2] := y[2];
 t[3] := y[3];
 t[4] := y[4];
 y[2] := 255;
 y[3] := 255;
 y[4] := 255;
 while (x[1] <= y[1]) do
   begin
    if (x[1] = y[1]) then y[2] := t[2];
     while (x[2] <= y[2]) do
       begin
         if ((x[1] = y[1]) and (x[2] = t[2])) then y[3] := t[3] - 1;
         while (x[3] <= y[3]) do
           begin
             scannet(0, 255);
             if (x[3] = y[3]) then break else inc(x[3]);
           end;
         x[3] := 0;
         if (x[2] = y[2]) then break else inc(x[2]);
       end;
     x[2] := 0;
     if (x[1] = y[1]) then break else inc(x[1]);
   end;
 x[2] := t[2];
 x[3] := t[3];
 scannet(0,t[4]);
noscan:
end;
procedure TForm1.IdIcmpClient1Reply(ASender: TComponent;
 const AReplyStatus: TReplyStatus);
begin
if(IdIcmpClient1.ReplyData <> "") then
begin
Form1.Memo1.Lines.Add(InttoStr(x[1]) + "." + InttoStr(x[2]) + "." + InttoStr(x[3]) + "." + InttoStr(i));asm nop end;
IdIcmpClient1.CleanupInstance;
end;
end;
end.

Разберайся. Я сам тоже с этой бадягой долго парился.


 
Verg ©   (2004-02-27 12:06) [5]


> ALeX.B. ©   (27.02.04 11:57) [4]


Шо это было?


> asm nop end;


Это что?


 
Polevi ©   (2004-02-27 12:29) [6]

>Verg ©   (27.02.04 12:06) [5]
зато через массив :)



Страницы: 1 вся ветка

Текущий архив: 2004.04.25;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.023 c
3-1080142744
softmasters
2004-03-24 18:39
2004.04.25
Строка коннекта


3-1079868025
HMT
2004-03-21 14:20
2004.04.25
суммирование данных из двух таблиц.


3-1080447814
Артем К.
2004-03-28 08:23
2004.04.25
Как сохранить в таблицу DB значение вычисляемого поля


1-1081703697
Женя е
2004-04-11 21:14
2004.04.25
Форма из dll.


6-1077967331
Morg
2004-02-28 14:22
2004.04.25
Срочно, как отослать Stream нескольким пользователям (SreverSocke