unit test_client;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Spin, ScktComp;
type
TForm1 = class(TForm)
Button1: TButton;
ClientSocket1: TClientSocket;
SpinEdit5: TSpinEdit;
Memo1: TMemo;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
procedure Button1Click(Sender: TObject);
procedure ClientSocket1Connect(Sender: TObject;
Socket: TCustomWinSocket);
procedure ClientSocket1Error(Sender: TObject; Socket: TCustomWinSocket;
ErrorEvent: TErrorEvent; var ErrorCode: Integer);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
ip: string;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
const Point = '.';
var
ip_1a,ip_1b,ip_2a,ip_2b,ip_3a,ip_3b,ip_4a,ip_4b: integer;
begin
ClientSocket1.Port := SpinEdit5.Value;
ip_1b := StrToInt(Edit5.Text);
ip_2b := StrToInt(Edit6.Text);
ip_3b := StrToInt(Edit7.Text);
ip_4b := StrToInt(Edit8.Text);
for ip_1a := StrToInt(Edit1.Text) to ip_1b do begin
for ip_2a := StrToInt(Edit2.Text) to ip_2b do begin
for ip_3a := StrToInt(Edit3.Text) to ip_3b do begin
for ip_4a := StrToInt(Edit4.Text) to ip_4b do begin
ip := IntToStr(ip_1a)+point+IntToStr(ip_2a)+point+IntToStr(ip_3a)+point+IntToStr(ip_4a);
try
Memo1.Lines.Add('Trying: '+
ip);
ClientSocket1.Host :=
ip;
ClientSocket1.Open;
except
Memo1.Lines.Add(
ip+' failed');
ClientSocket1.Close;
end;
end;
end;
end;
end;
end;
procedure TForm1.ClientSocket1Connect(Sender: TObject;
Socket: TCustomWinSocket);
begin
break;
showMessage(
ip+'was successfull');
end;
procedure TForm1.ClientSocket1Error(Sender: TObject;
Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
var ErrorCode: Integer);
begin
Memo1.Lines.Add(
ip+' failed because: '+IntToStr(ErrorCode));
ErrorCode := 0;
end;
end.