unit arpmethod;

{$mode ObjFPC}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
  Grids;

type

  { TFormarpmethod }

  TFormarpmethod = class(TForm)
    ARPStatusMemo: TMemo;
    FixXPortButton: TButton;
    FixXPortGroupBox: TGroupBox;
    IPEdit: TEdit;
    FreeIPsLabel: TLabel;
    ChooseIPGroupBox: TGroupBox;
    InstructionsMemo: TMemo;
    InstructionsLabel: TLabel;
    StatusLabel: TLabel;
    IPsInUseGroupBox: TGroupBox;
    AssignedIPsLabel: TLabel;
    FindIPsButton: TButton;
    AssignedIPsStringGrid: TStringGrid;
    FreeIPsStringGrid: TStringGrid;
    RandomlyChooseIPButton: TButton;
    procedure FormShow(Sender: TObject);
    procedure FindIPsButtonClick(Sender: TObject);
  private

  public

  end;

var
  Formarpmethod: TFormarpmethod;

implementation
uses
  Unit1,Process,StrUtils, Types;

{ TFormarpmethod }

procedure TFormarpmethod.FindIPsButtonClick(Sender: TObject);
var
  s : ansistring;
  split: Types.TStringDynArray;

begin
  //Todo: See if Nmap command is available

   ARPStatusMemo.Lines.Add('Running nmap');
   Application.ProcessMessages;
   if RunCommand('nmap',['-sn','192.168.1.0/24'],s) then begin
     ARPStatusMemo.Clear;
     ARPStatusMemo.Lines.Add(s);
   end else
     ARPStatusMemo.Lines.Add('The nmap command cannot be accessed. Install it, or check the PATH.');

end;

procedure TFormarpmethod.FormShow(Sender: TObject);
begin
   ARPStatusMemo.Clear;
   ARPStatusMemo.Font.Name:=FixedFont;
end;

initialization
  {$I arpmethod.lrs}

end.

