unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  aoutlbar, ImgList, SpeedBar, ExtCtrls, Ping, Spin, ComCtrls, StdCtrls,
  Buttons, RXCtrls,ip_misc, Wait, WSocket, SmtpProt, HttpProt, Ftpcli,
  pop3old, Pop3Prot, ic, Grids, TnCnx, Mask, ToolEdit,rxverinf, NMUDP,
  Psock, NMTime, NMFngr,winsock, aurllabl, LblEffct,nb, lmdclass, lmdnonvS,
  RxGrdCpt, NMEcho, smtpold, fngnetstat, Menus,
  MSysInfo,toolwin, Ani95;


type
  TInfoMode = (imNode, imText);

  tdn=function:string;
  tdnw=procedure(sa:string);
  tcheckport=function(c:word):string;
  TForm1 = class(TForm)
    SpeedBar: TSpeedBar;
    SpeedbarSection1: TSpeedbarSection;
    AboutB: TSpeedItem;
    ImageList1: TImageList;
    AutoOutLookBarStore1: TAutoOutLookBarStore;
    ABarSIAboutOrder: TAutoOutLookStoredItem;
    AutoOutLookBarStore1Item11: TAutoOutLookStoredItem;
    AutoOutLookBarStore1Item14: TAutoOutLookStoredItem;
    AutoOutLookBarStore1Item19: TAutoOutLookStoredItem;
    AutoOutLookBarStore1Item15: TAutoOutLookStoredItem;
    AutoOutLookBarStore1Item26: TAutoOutLookStoredItem;
    AutoOutLookBarStore1Item29: TAutoOutLookStoredItem;
    AutoOutLookBarStore1Item10: TAutoOutLookStoredItem;
    AutoOutLookBarStore1Item17: TAutoOutLookStoredItem;
    AutoOutLookBarStore1Item21: TAutoOutLookStoredItem;
    AutoOutLookBarStore1Item32: TAutoOutLookStoredItem;
    AutoOutLookBar1: TAutoOutLookBar;
    Ping1: TPing;
    Ping3: TPing;
    CliSocket: TWSocket;
    Wait1: TWait;
    FtpClient1: TFtpClient;
    HttpCli1: THttpCli;
    TraceRoute: TTraceRoute;
    WSocket3: TWSocket;
    NMTime1: TNMTime;
    NMUDP1: TNMUDP;
    NMFinger1: TNMFinger;
    LMDSysInfo1: TLMDSysInfo;
    RxGradientCaption1: TRxGradientCaption;
    TnCnx: TTnCnx;
    AutoOutLookBarStore1Item12: TAutoOutLookStoredItem;
    NMEcho1: TNMEcho;
    Splitter1: TSplitter;
    Panel1: TPanel;
    Panelfileinfo: TPanel;
    RxLabel111: TRxLabel;
    Buttonfiles: TRxSpeedButton;
    FilenameEdit12: TFilenameEdit;
    GroupBox18: TGroupBox;
    RxLabel113: TRxLabel;
    RxLabel120: TRxLabel;
    RxLabel119: TRxLabel;
    RxLabel118: TRxLabel;
    RxLabel117: TRxLabel;
    RxLabel116: TRxLabel;
    RxLabel115: TRxLabel;
    RxLabel114: TRxLabel;
    RxLabel112: TRxLabel;
    RxLabel121: TRxLabel;
    RxLabel122: TRxLabel;
    RxLabel123: TRxLabel;
    Edit27: TEdit;
    Edit26: TEdit;
    Edit28: TEdit;
    Edit29: TEdit;
    Edit30: TEdit;
    Edit31: TEdit;
    Edit32: TEdit;
    Edit33: TEdit;
    Edit37: TEdit;
    Edit36: TEdit;
    Edit35: TEdit;
    Edit34: TEdit;
    Panelc2c: TPanel;
    RxLabel1: TRxLabel;
    RxLabel2: TRxLabel;
    Button3: TRxSpeedButton;
    Button4: TRxSpeedButton;
    FilenameEdit1: TFilenameEdit;
    FilenameEdit2: TFilenameEdit;
    ListView1: TListView;
    AutoOutLookBarStore1Item13: TAutoOutLookStoredItem;
    Panelbugreprot: TPanel;
    RxLabel4: TRxLabel;
    RxLabel5: TRxLabel;
    Edit3: TEdit;
    Memo4: TMemo;
    Edit2: TEdit;
    Memo5: TMemo;
    RxSpeedButton8: TRxSpeedButton;
    Smtpclient1: TSmtpold;
    SpeedItem1: TSpeedItem;
    TnCnx1: TTnCnx;
    TnCnxtelnet: TTnCnx;
    Smtpclient2: TSmtpold;
    Pop3client: TPop3old;
    TnCnxsocks: TTnCnx;
    TnCnxdns: TTnCnx;
    Panelping: TPanel;
    RxLabel14: TRxLabel;
    RxLabel3: TRxLabel;
    RxLabel12: TRxLabel;
    RxLabel27: TRxLabel;
    PingButton: TRxSpeedButton;
    CancelButton: TRxSpeedButton;
    ListView4: TListView;
    SpinEdit7: TSpinEdit;
    SpinEdit8: TSpinEdit;
    SpinEdit9: TSpinEdit;
    ComboBox2: TComboBox;
    PanelTrojian: TPanel;
    RxLabel69: TRxLabel;
    RxLabel70: TRxLabel;
    RxSpeedButton6: TRxSpeedButton;
    RxSpeedButton4: TRxSpeedButton;
    RxLabel68: TRxLabel;
    RxLabel67: TRxLabel;
    ProgressBar7: TProgressBar;
    ListView10: TListView;
    CheckBox9: TCheckBox;
    CheckBox10: TCheckBox;
    CheckBox8: TCheckBox;
    Edit38: TEdit;
    Edit39: TEdit;
    Paneltelnet: TPanel;
    RxLabel89: TRxLabel;
    RxLabel90: TRxLabel;
    Button24: TRxSpeedButton;
    Button25: TRxSpeedButton;
    Memo3: TMemo;
    SpinEdit11: TSpinEdit;
    ComboBox5: TComboBox;
    PanelNS: TPanel;
    RxLabel28: TRxLabel;
    iplabel: TLabel;
    LookupButton: TRxSpeedButton;
    BitBtn13: TRxSpeedButton;
    ListView7: TListView;
    ComboBox6: TComboBox;
    Panelfinger: TPanel;
    GroupBox10: TGroupBox;
    RxLabel8: TRxLabel;
    RxLabel15: TRxLabel;
    QueryButton: TRxSpeedButton;
    Memo1: TMemo;
    StatusBar1: TStatusBar;
    Edit4: TEdit;
    GroupBox11: TGroupBox;
    Label11: TLabel;
    Label18: TLabel;
    Label19: TLabel;
    RxLabel19: TRxLabel;
    RxLabel21: TRxLabel;
    Button2: TRxSpeedButton;
    RxSpeedButton1: TRxSpeedButton;
    RxSpeedButton2: TRxSpeedButton;
    RxSpeedButton3: TRxSpeedButton;
    Edit7: TEdit;
    Edit10: TEdit;
    StatusBar2: TStatusBar;
    Edit6: TEdit;
    ComboBox7: TComboBox;
    ComboBox8: TComboBox;
    Paneltime: TPanel;
    GroupBox16: TGroupBox;
    Label20: TLabel;
    Label21: TLabel;
    Label22: TLabel;
    Button181: TRxSpeedButton;
    cbHost: TComboBox;
    Edit15: TEdit;
    StatusBar3: TStatusBar;
    GroupBox17: TGroupBox;
    PageControl2: TPageControl;
    TabSheet3: TTabSheet;
    Label23: TLabel;
    Label24: TLabel;
    Label25: TLabel;
    Button182: TRxSpeedButton;
    Edit19: TEdit;
    Edit20: TEdit;
    Edit25: TEdit;
    TabSheet4: TTabSheet;
    Button183: TRxSpeedButton;
    Memo2: TMemo;
    StatusBar4: TStatusBar;
    IcmpStats1: TIcmpStats;
    AutoOutLookBarStore1Item16: TAutoOutLookStoredItem;
    Panelnetstat: TPanel;
    RxSpeedButton7: TRxSpeedButton;
    icmpPanel: TPanel;
    Memo: TMemo;
    TabControl: TTabControl;
    Panelpacket: TPanel;
    GroupBox2: TGroupBox;
    RxLabel106: TRxLabel;
    SpinEdit20: TSpinEdit;
    SpinEdit21: TSpinEdit;
    RxLabel107: TRxLabel;
    SpinEdit19: TSpinEdit;
    SpinEdit22: TSpinEdit;
    SpinEdit18: TSpinEdit;
    SpinEdit26: TSpinEdit;
    SpinEdit25: TSpinEdit;
    RxLabel105: TRxLabel;
    RxLabel104: TRxLabel;
    RxLabel102: TRxLabel;
    RxLabel108: TRxLabel;
    RxLabel103: TRxLabel;
    GroupBox14: TGroupBox;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox3: TCheckBox;
    CheckBox4: TCheckBox;
    CheckBox5: TCheckBox;
    CheckBox6: TCheckBox;
    GroupBox3: TGroupBox;
    RxLabel96: TRxLabel;
    RxLabel95: TRxLabel;
    RxLabel100: TRxLabel;
    RxLabel93: TRxLabel;
    RxLabel91: TRxLabel;
    ComboBox9: TComboBox;
    Edit21: TEdit;
    RxLabel94: TRxLabel;
    SpinEdit13: TSpinEdit;
    Edit23: TEdit;
    Edit24: TEdit;
    RxLabel98: TRxLabel;
    RxLabel101: TRxLabel;
    SpinEdit17: TSpinEdit;
    SpinEdit15: TSpinEdit;
    RxLabel97: TRxLabel;
    RxLabel99: TRxLabel;
    RxLabel92: TRxLabel;
    SpinEdit14: TSpinEdit;
    SpinEdit12: TSpinEdit;
    SpinEdit16: TSpinEdit;
    Edit22: TEdit;
    RxLabel44: TRxLabel;
    SpinEdit1: TSpinEdit;
    RxSpeedButton9: TRxSpeedButton;
    SI: TMSysInfo;
    PopupMenu: TPopupMenu;
    pmRefresh: TMenuItem;
    pmAbout: TMenuItem;
    N1: TMenuItem;
    pmExit: TMenuItem;
    Timer: TTimer;
    ImageList: TImageList;
    ImageList2: TImageList;
    Panelsysinfo: TPanel;
    infoPanel: TPanel;
    Splitter2: TSplitter;
    EmptyPanel: TPanel;
    lvSI: TListView;
    tvSI: TTreeView;
    SB: TStatusBar;
    SpeedBar1: TSpeedBar;
    cbTopic: TComboBox;
    SpeedbarSection2: TSpeedbarSection;
    SpeedItem2: TSpeedItem;
    AutoOutLookBarStore1Item18: TAutoOutLookStoredItem;
    Panelhelp: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label7: TLabel;
    Label6: TLabel;
    Label16: TLabel;
    Label17: TLabel;
    LabelEffect7: TLabelEffect;
    AutoURLLabel1: TAutoURLLabel;
    AutoURLLabel8: TAutoURLLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label14: TLabel;
    Label26: TLabel;
    ippanel: TPanel;
    hostpanel: TPanel;
    winsockpanel: TPanel;
    Macpanel: TPanel;
    ospanel: TPanel;
    compnamePanel: TPanel;
    procpanel: TPanel;
    regPanel: TPanel;
    GroupBox1: TGroupBox;
    RxSpeedButton5: TRxSpeedButton;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    Panelipscaner: TPanel;
    RxLabel10: TRxLabel;
    RxLabel11: TRxLabel;
    Label12: TLabel;
    Label13: TLabel;
    Button12: TRxSpeedButton;
    Button13: TRxSpeedButton;
    E3: TEdit;
    E7: TEdit;
    ListView6: TListView;
    ProgressBar4: TProgressBar;
    Animation1: TAnimation;
    Panelnetwork: TPanel;
    RxLabel62: TRxLabel;
    RxLabel63: TRxLabel;
    Label10: TLabel;
    Label15: TLabel;
    RxLabel64: TRxLabel;
    Button10: TRxSpeedButton;
    Button11: TRxSpeedButton;
    Edit13: TEdit;
    Edit14: TEdit;
    ListView16: TListView;
    SpinEdit5: TSpinEdit;
    ProgressBar2: TProgressBar;
    Animation2: TAnimation;
    Panelportscaner: TPanel;
    RxLabel13: TRxLabel;
    Label5: TLabel;
    RxLabel16: TRxLabel;
    RxLabel17: TRxLabel;
    RxLabel18: TRxLabel;
    Port: TRxSpeedButton;
    Disconnectbutton: TRxSpeedButton;
    ListView5: TListView;
    ProgressBar1: TProgressBar;
    SpinEdit2: TSpinEdit;
    SpinEdit3: TSpinEdit;
    ComboBox3: TComboBox;
    Animation3: TAnimation;
    Panelsiteinfo: TPanel;
    RxLabel26: TRxLabel;
    ftpl: TRxLabel;
    ftpn: TRxLabel;
    RxLabel29: TRxLabel;
    RxLabel30: TRxLabel;
    RxLabel31: TRxLabel;
    RxLabel32: TRxLabel;
    RxLabel33: TRxLabel;
    RxLabel34: TRxLabel;
    RxLabel35: TRxLabel;
    RxLabel36: TRxLabel;
    RxLabel37: TRxLabel;
    RxLabel38: TRxLabel;
    RxLabel39: TRxLabel;
    RxLabel40: TRxLabel;
    RxLabel41: TRxLabel;
    RxLabel42: TRxLabel;
    BitBtn16: TRxSpeedButton;
    RxLabel6: TRxLabel;
    RxLabel7: TRxLabel;
    RxLabel9: TRxLabel;
    RxLabel22: TRxLabel;
    RxLabel23: TRxLabel;
    RxLabel24: TRxLabel;
    RxLabel25: TRxLabel;
    RxLabel43: TRxLabel;
    ComboBox1: TComboBox;
    Animation4: TAnimation;
    Paneltracert: TPanel;
    RxLabel20: TRxLabel;
    btn_start: TRxSpeedButton;
    btn_break: TRxSpeedButton;
    grid: TStringGrid;
    ComboBox4: TComboBox;
    Animation5: TAnimation;
    procedure cmGetItemData(Sender: TObject; Node: TTreeNode);
    procedure TimerTimer(Sender: TObject);
    procedure cmExpCol(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure cbTopicChange(Sender: TObject);
    procedure cmWinList(Sender: TObject);


    procedure lab;
    procedure PingButtonClick(Sender: TObject);
    procedure Ping1Display(Sender: TObject; Msg: String);
    procedure Ping1DnsLookupDone(Sender: TObject; Error: Word);
    procedure Ping1EchoReply(Sender: TObject; Error: Integer);
    procedure ABarSIAboutOrderClick(Sender: TObject;
      Item: TAutoOutLookItem);
    procedure ports1(sa,s4:string);
    procedure Button12Click(Sender: TObject);
    procedure Ping3Display(Sender: TObject; Msg: String);
    procedure Ping3DnsLookupDone(Sender: TObject; Error: Word);
    procedure AutoOutLookBarStore1Item14Click(Sender: TObject;
      Item: TAutoOutLookItem);
    procedure ports2(sa,s4:string);
    procedure Button13Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure PortClick(Sender: TObject);
    procedure ports(sa,s4:string);
    procedure CliSocketSessionConnected(Sender: TObject; Error: Word);
    procedure AutoOutLookBarStore1Item11Click(Sender: TObject;
      Item: TAutoOutLookItem);
    procedure Button10Click(Sender: TObject);
    procedure Button11Click(Sender: TObject);
    procedure BitBtn16Click(Sender: TObject);
    procedure HttpCli;
    procedure FtpClient1RequestDone(Sender: TObject; RqType: TFtpRequest;
      Error: Word);
    procedure AutoOutLookBarStore1Item15Click(Sender: TObject;
      Item: TAutoOutLookItem);
    procedure AutoOutLookBarStore1Item26Click(Sender: TObject;
      Item: TAutoOutLookItem);
    procedure TraceRouteRoute(sender: TObject; hop: Byte; ip,
      roundtime: Integer);
    procedure btn_startClick(Sender: TObject);
    procedure msysinfo;
    procedure btn_breakClick(Sender: TObject);
    procedure AutoOutLookBarStore1Item19Click(Sender: TObject;
      Item: TAutoOutLookItem);
    procedure AutoOutLookBarStore1Item29Click(Sender: TObject;
      Item: TAutoOutLookItem);
    procedure LookupButtonClick(Sender: TObject);
    procedure BitBtn13Click(Sender: TObject);
    procedure WSocket3DnsLookupDone(Sender: TObject; Error: Word);
    procedure AutoOutLookBarStore1Item10Click(Sender: TObject;
      Item: TAutoOutLookItem);
    procedure Refresh1Click(Sender: TObject);
    procedure ButtonfilesClick(Sender: TObject);
    procedure AutoOutLookBarStore1Item32Click(Sender: TObject;
      Item: TAutoOutLookItem);
    procedure NMTime1Connect(Sender: TObject);
    procedure NMTime1ConnectionFailed(Sender: TObject);
    procedure NMTime1Disconnect(Sender: TObject);
    procedure NMTime1HostResolved(Sender: TComponent);
    procedure NMTime1InvalidHost(var Handled: Boolean);
    procedure NMTime1Status(Sender: TComponent; Status: String);
    procedure Button181Click(Sender: TObject);
    procedure Button182Click(Sender: TObject);
    procedure NMUDP1DataReceived(Sender: TComponent; NumberBytes: Integer;
      FromIP: String);
    procedure NMUDP1DataSend(Sender: TObject);
    procedure NMUDP1InvalidHost(var handled: Boolean);
    procedure NMUDP1Status(Sender: TComponent; status: String);
    procedure Button183Click(Sender: TObject);
    procedure AutoOutLookBarStore1Item21Click(Sender: TObject;
      Item: TAutoOutLookItem);
    procedure AutoOutLookBarStore1Item17Click(Sender: TObject;
      Item: TAutoOutLookItem);
    procedure QueryButtonClick(Sender: TObject);
    procedure NMFinger1Connect(Sender: TObject);
    procedure NMFinger1ConnectionFailed(Sender: TObject);
    procedure NMFinger1Disconnect(Sender: TObject);
    procedure NMFinger1HostResolved(Sender: TComponent);
    procedure NMFinger1InvalidHost(var Handled: Boolean);
    procedure NMFinger1Status(Sender: TComponent; Status: String);
    procedure AboutBClick(Sender: TObject);
    procedure TnCnxDataAvailable(Sender: TTnCnx; Buffer: PChar;
      Len: Integer);
    procedure TnCnxSessionClosed(Sender: TTnCnx; Error: Word);
    procedure TnCnxSessionConnected(Sender: TTnCnx; Error: Word);
    procedure Memo3KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Memo3KeyPress(Sender: TObject; var Key: Char);
    procedure Button24Click(Sender: TObject);
    procedure Button25Click(Sender: TObject);
    procedure AutoOutLookBarStore1Item12Click(Sender: TObject;
      Item: TAutoOutLookItem);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure RxSpeedButton1Click(Sender: TObject);
    procedure NMEcho1Connect(Sender: TObject);
    procedure NMEcho1ConnectionFailed(Sender: TObject);
    procedure NMEcho1ConnectionRequired(var Handled: Boolean);
    procedure NMEcho1Disconnect(Sender: TObject);
    procedure NMEcho1HostResolved(Sender: TComponent);
    procedure NMEcho1InvalidHost(var Handled: Boolean);
    procedure NMEcho1Status(Sender: TComponent; Status: String);
    procedure RxSpeedButton2Click(Sender: TObject);
    procedure RxSpeedButton3Click(Sender: TObject);
    procedure CancelButtonClick(Sender: TObject);
    procedure RxSpeedButton5Click(Sender: TObject);
    procedure DisconnectbuttonClick(Sender: TObject);
    procedure RxSpeedButton4Click(Sender: TObject);
    procedure RxSpeedButton6Click(Sender: TObject);
    procedure AutoOutLookBarStore1Item13Click(Sender: TObject;
      Item: TAutoOutLookItem);
    procedure RxSpeedButton8Click(Sender: TObject);
    procedure bugsend;    
    procedure Smtpclient1Display(Sender: TObject; Msg: String);
    procedure Smtpclient1GetData(Sender: TObject; LineNum: Integer;
      MsgLine: PChar; MaxLen: Integer; var More: Boolean);
    procedure Smtpclient1HeaderLine(Sender: TObject; Msg: PChar;
      Size: Integer);
    procedure SpeedItem1Click(Sender: TObject);
    procedure TnCnx1DataAvailable(Sender: TTnCnx; Buffer: PChar;
      Len: Integer);
    procedure TnCnxtelnetDataAvailable(Sender: TTnCnx; Buffer: PChar;
      Len: Integer);
    procedure Smtpold1Display(Sender: TObject; Msg: String);
    procedure Pop3old1Display(Sender: TObject; Msg: String);
    procedure TnCnxsocksDataAvailable(Sender: TTnCnx; Buffer: PChar;
      Len: Integer);
    procedure TnCnxdnsDataAvailable(Sender: TTnCnx; Buffer: PChar;
      Len: Integer);
    procedure TabControlChange(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure AutoOutLookBarStore1Item16Click(Sender: TObject;
      Item: TAutoOutLookItem);
    procedure RxSpeedButton7Click(Sender: TObject);
    procedure SpeedItem2Click(Sender: TObject);
    procedure AutoOutLookBarStore1Item18Click(Sender: TObject;
      Item: TAutoOutLookItem);
  private
      FConnList :TFnugryIpConnectionList;
    FIpStats  :TIpStats;
    FIcmpStats  :TIcmpStats;
    FTCPStats :TTCPStats;
    FUdpStats :TUdpStats;
    procedure ResetConnectionList;
    procedure ResetIpStats;
    procedure ResetIcmpStats;
    procedure ResetTcpStats;
    procedure ResetUdpStats;
    procedure ResetCountersPage( List :TCounterList );
    function GetComputerData(Parent :TTreenode; Mode :TInfoMode; var Node :TTreeNode) :Boolean;
    function GetCPUData(Parent :TTreenode; Mode :TInfoMode) :Boolean;
    function GetBIOSData(Parent :TTreenode; Mode :TInfoMode) :Boolean;
    function GetMemoryData(Parent :TTreenode; Mode :TInfoMode) :Boolean;
    function GetDisksData(Parent :TTreenode; Mode :TInfoMode; var Node :TTreeNode) :Boolean;
    function GetDiskData(Sign :char; Parent :TTreenode; Mode :TInfoMode) :Boolean;
    function GetDisplayData(Parent :TTreenode; Mode :TInfoMode; var Node :TTreeNode) :Boolean;
    function GetFontsData(Parent :TTreenode; Mode :TInfoMode) :Boolean;
    function GetSoundData(Parent :TTreenode; Mode :TInfoMode) :Boolean;
    function GetMonitorData(Parent :TTreenode; Mode :TInfoMode) :Boolean;
    function GetMouseData(Parent :TTreenode; Mode :TInfoMode) :Boolean;
    function GetPrinterData(Parent :TTreenode; Mode :TInfoMode) :Boolean;
    function GetOSData(Parent :TTreenode; Mode :TInfoMode) :Boolean;
    function GetDXData(Parent :TTreenode; Mode :TInfoMode) :Boolean;
    function GetNetData(Parent :TTreenode; Mode :TInfoMode) :Boolean;
  public
           ConnectError : Word;
           FHttpCliList  : TList;
    procedure FillSystemInfo;
  end;

var
  Form1: TForm1;
 a,a1,a2,a3,a4,a5,a6,a7,a8,a9,
 compflag,b,dnsf,vv,v5,v2,v,x3,x,x1,x2,nr,fl,qa:word;
 sss:string;
 RegProc: pointer;
 LibHandle: hmodule;
 checkport:tcheckport;
 dn:tdn;
 dnw:tdnw;
 g,s,s1,s2,s3,df:string;

 const
  txParameter = 'Property';
  txValue = 'Value';

  txSpace = '';
  txDescription = 'Description';

  txComputer = 'Computer';
    txName = 'Name';
    txOwner = 'Owner';
    txOrg = 'Organization';
    txUser = 'User';
    txIP = 'IP Address';
    txBootTime = 'Boot time';
    txLastBoot = 'Last boot';

    txCPU = 'CPU';
      txNumberOfProcessors = 'Number of Processors';
      txActiveProcessorMask = 'Active Processor Mask';
      txProcessorArchitecture = 'Architecture';
      txProcessorType = 'Type';
      txProcessorVendor = 'Vendor';
      txProcessorVendorID = 'Vendor Identifier';
      txProcessorLevel = 'Level';
      txProcessorRevision = 'Revision';
      txProcessorSpeed = 'Speed';

    txBIOS = 'BIOS';
      txBIOSName = 'BIOS Name';
      txBIOSCopyright = 'BIOS Copyright';
      txBIOSDate = 'BIOS Date';
      txBIOSExt = 'BIOS Extended Info';
      txBIOSVideoVer = 'BIOS Video Version';
      txBIOSVideoDate = 'BIOS Video Date';

    txMemory = 'Memory';
      txMemUsage = 'Usage';
      txTotalPhys = 'Total Physical';
      txAvailPhys = 'Available Physical';
      txTotalPage = 'Total Page File';
      txAvailPage = 'Available Page File';
      txTotalVirt = 'Total Virtual';
      txAvailVirt = 'Available Virtual';
      txPageSize  = 'Page Size';
      txAllocGran = 'Allocation Granularity';

    txDisk = 'Disks';
      txNumber = 'Number';
      txAvailSigns = 'Available Signs';

      txFileSystem = 'File System';
      txSerial = 'Serial Number';
      txCompress = 'Compressed';
      txFreeSpace = 'Free Space';
      txTotalSpace = 'Total Space';
      txTotalClusters = 'Total Clusters';
      txSPC = 'Sectors Per Cluster';
      txBPS = 'Bytes Per Sector';

    txDisplay = 'Display';
      txChip = 'Chip';
      txDAC = 'DAC';
      txVideoMem = 'Memory';
      txXRes = 'Screen Width';
      txYRes = 'Screen Height';
      txRes = 'Color Resolution';
      txFontCount = 'Font Count';
      txFonts = 'Installed Fonts';
        txFontname = 'Font Name';

    txSound = 'Sound Device';
      txWaveIn = 'Wave In';
      txWaveOut = 'Wave Out';
      txMIDIIn = 'MIDI In';
      txMIDIOut = 'MIDI Out';
      txAUX = 'AUX';
      txMixer = 'Mixer';

    txPrinter = 'Printer';
    txMouse = 'Mouse';
    txMonitor = 'Monitor';

  txDirectX = 'DirectX';
    txDXVer = 'Version';

  txNetwork = 'Network';
    txAdapter = 'Adapter';

  txOS = 'Operating System';
    txPlatform = 'Platform';
    txVersion = 'Version';
    txCSD = 'CSD Version';
    txMaxApp = 'Maximum Application Address';
    txMinApp = 'Minimum Application Address';
    txProductID = 'Product ID';

implementation

{$R *.DFM}
uses shellapi;
const
  StdCap = 'The Current Time is : ';
var
  tvWidth :integer;

function BoolToStr(x :boolean) :string;
begin
  if x then
    result:='Yes'
  else
    result:='No';
end;

{###################### Private routines #######################}

function Tform1.GetComputerData;
var
  item :tlistitem;
begin
  if mode=imnode then
    with tvsi.items do
      node:=add(parent,txComputer);
  if mode=imtext then
    with lvsi do begin
      items.BeginUpdate;
      try
        columns[0].caption:=txparameter;
        columns[1].caption:=txvalue;
        item:=items.add;
        item.caption:=txName;
        item.subitems.add(si.cmpname);

        item:=items.add;
        item.caption:=txOwner;
        item.subitems.add(si.osreguser);

        item:=items.add;
        item.caption:=txOrg;
        item.subitems.add(si.osregorg);

        item:=items.add;
        item.caption:=txIP;
        item.subitems.add(si.cmpIPAddress);

        item:=items.add;
        item.caption:=txSpace;

        item:=items.add;
        item.caption:=txBoottime;
        item.subitems.add(si.cmpboottime);

        item:=items.add;
        item.caption:=txlastboot;
        item.subitems.add(si.cmplastboot);

      finally
        items.endupdate;
      end;
    end;
  result:=true;
end;

function Tform1.GetCPUData;
var
  item :tlistitem;
begin
  if mode=imnode then
    with tvsi.items do
      addchild(parent,txCPU);
  if mode=imtext then
    with lvsi do begin
      items.BeginUpdate;
      try
        columns[0].caption:=txparameter;
        columns[1].caption:=txvalue;
        item:=items.add;
        item.caption:=txNumberOfProcessors;
        item.subitems.add(inttostr(si.cpuNumber));

        item:=items.add;
        item.caption:=txActiveProcessorMask;
        item.subitems.add(inttostr(si.cpuactivemask));

        item:=items.add;
        item.caption:=txProcessorArchitecture;
        item.subitems.add(si.getcpuarc(si.cpuarchitecture));

        item:=items.add;
        item.caption:=txProcessorType;
        item.subitems.add(si.getcputype(si.cputype));

        item:=items.add;
        item.caption:=txProcessorLevel;
        item.subitems.add(inttostr(si.cpulevel));

        item:=items.add;
        item.caption:=txProcessorRevision;
        item.subitems.add(inttostr(si.cpurevision));

        item:=items.add;
        item.caption:=txProcessorSpeed;
        item.subitems.add(inttostr(round(int(si.cpuspeed)))+' MHz');

        item:=items.add;
        item.caption:=txSpace;
        item.imageindex:=-1;
        item:=items.add;
        item.caption:=txProcessorVendor;
        item.subitems.add(si.cpuvendor);

        item:=items.add;
        item.caption:=txProcessorVendorID;
        item.subitems.add(si.cpuvendorid);

      finally
        items.endupdate;
      end;
    end;
  result:=true;
end;

function Tform1.GetBIOSData;
var
  item :tlistitem;
begin
  if mode=imnode then
    with tvsi.items do
      addchild(parent,txBIOS);
  if mode=imtext then
    with lvsi do begin
      items.BeginUpdate;
      try
        columns[0].caption:=txparameter;
        columns[1].caption:=txvalue;
        item:=items.add;
        item.caption:=txBIOSName;
        item.subitems.add(si.biosname);

        item:=items.add;
        item.caption:=txbioscopyright;
        item.subitems.add(si.bioscopyright);

        item:=items.add;
        item.caption:=txbiosdate;
        item.subitems.add(si.biosdate);

        item:=items.add;
        item.caption:=txbiosext;
        item.subitems.add(si.biosextendedinfo);

        item:=items.add;
        item.caption:=txbiosvideover;
        item.subitems.add(si.biosvideoversion);

        item:=items.add;
        item.caption:=txbiosvideodate;
        item.subitems.add(si.biosvideodate);
      finally
        items.endupdate;
      end;
    end;
  result:=true;
end;

function Tform1.GetDXData;
var
  item :tlistitem;
begin
  if mode=imnode then
    with tvsi.items do
      addchild(parent,txDirectX);
  if mode=imtext then
    with lvsi do begin
      items.BeginUpdate;
      try
        columns[0].caption:=txparameter;
        columns[1].caption:=txvalue;
        item:=items.add;
        item.caption:=txDXVer;
        item.subitems.add(si.drxVersion);

      finally
        items.endupdate;
      end;
    end;
  result:=true;
end;

function Tform1.GetNetData;
var
  item :tlistitem;
begin
  if mode=imnode then
    with tvsi.items do
      addchild(parent,txNetwork);
  if mode=imtext then
    with lvsi do begin
      items.BeginUpdate;
      try
        columns[0].caption:=txparameter;
        columns[1].caption:=txvalue;
        item:=items.add;
        item.caption:=txAdapter;
        item.subitems.add(si.netAdapter);

      finally
        items.endupdate;
      end;
    end;
  result:=true;
end;

function Tform1.GetMemoryData;
var
  item :tlistitem;
begin
  if mode=imnode then
    with tvsi.items do
      addchild(parent,txMemory);
  if mode=imtext then
    with lvsi do begin
      items.BeginUpdate;
      try
        columns[0].caption:=txparameter;
        columns[1].caption:=txvalue;
        item:=items.add;
        item.caption:=(txmemusage);
        item.subitems.add(formatfloat('#,##0 %',si.memMemUsage));

        item:=items.add;
        item.caption:=(txspace);
        item.imageindex:=-1;
        item:=items.add;
        item.caption:=(txtotalphys);
        item.subitems.add(formatfloat('#,##0 B',si.memtotalphys));

        item:=items.add;
        item.caption:=(txavailphys);
        item.subitems.add(formatfloat('#,##0 B',si.memfreephys));

        item:=items.add;
        item.caption:=(txspace);
        item.imageindex:=-1;
        item:=items.add;
        item.caption:=(txtotalpage);
        item.subitems.add(formatfloat('#,##0 B',si.memtotalpagefile));

        item:=items.add;
        item.caption:=(txavailpage);
        item.subitems.add(formatfloat('#,##0 B',si.memfreepagefile));
        
        item:=items.add;
        item.caption:=(txspace);
        item.imageindex:=-1;
        item:=items.add;
        item.caption:=(txtotalvirt);
        item.subitems.add(formatfloat('#,##0 B',si.memtotalvirtual));

        item:=items.add;
        item.caption:=(txavailvirt);
        item.subitems.add(formatfloat('#,##0 B',si.memfreevirtual));

        item:=items.add;
        item.caption:=(txspace);
        item.imageindex:=-1;
        item:=items.add;
        item.caption:=(txpagesize);
        item.subitems.add(formatfloat('#,##0 B',si.mempagesize));
        
        item:=items.add;
        item.caption:=(txallocgran);
        item.subitems.add(formatfloat('#,##0 B',si.memallocationgranularity));
        
      finally
        items.EndUpdate;
      end;
    end;
  result:=true;
end;

function Tform1.GetDisksData;
var
  item :tlistitem;
begin
try
  if mode=imnode then
    with tvsi.items do
      node:=addchild(parent,txDisk);
  if mode=imtext then
    with lvsi do begin
      items.BeginUpdate;
      try
        columns[0].caption:=txparameter;
        columns[1].caption:=txvalue;
        item:=items.add;
        item.caption:=(txnumber);
        item.subitems.add(formatfloat('#,##0 ',si.dskdiskcount));

        item:=items.add;
        item.caption:=(txavailsigns);
        item.subitems.add(si.dskavailabledisks);

      finally
        items.endupdate;
      end;
    end;
  result:=true;
finally
end;
end;

function Tform1.GetDiskData;
var
  item :tlistitem;
begin
  si.dsksign:=sign;
  result:=si.dsktotalspace<>-1;
  if mode=imnode then
    with tvsi.items do
      addchild(parent,si.dsksign+': ['+si.dskvolumelabel+']...'+si.getmediatype(si.dskmediatype));
  if mode=imtext then
    with lvsi do begin
      items.BeginUpdate;
      try
        columns[0].caption:=txparameter;
        columns[1].caption:=txvalue;
        item:=items.add;
        item.caption:=(txFileSystem);
        item.subitems.add(si.dskfilesystem);
        
        item:=items.add;
        item.caption:=(txserial);
        item.subitems.add('0x'+inttohex(si.dskserialnumber,16));
        
        item:=items.add;
        item.caption:=(txspace);
        item.imageindex:=-1;
        item:=items.add;
        item.caption:=(txcompress);
        item.subitems.add(booltostr(si.dskcompressed));
        
        item:=items.add;
        item.caption:=(txTotalspace);
        item.subitems.add(formatfloat('#,##0 B',si.dsktotalspace));
        
        item:=items.add;
        item.caption:=(txfreespace);
        item.subitems.add(formatfloat('#,##0 B',si.dskfreespace));

        item:=items.add;
        item.caption:=(txTotalclusters);
        item.subitems.add(formatfloat('#,##0 ',si.dsktotalclusters));

        item:=items.add;
        item.caption:=(txspc);
        item.subitems.add(formatfloat('#,##0 ',si.dsksectorspercluster));

        item:=items.add;
        item.caption:=(txbps);
        item.subitems.add(formatfloat('#,##0 ',si.dskbytespersector));

      finally
        items.endupdate;
      end;
    end;
end;

function Tform1.GetDisplayData;
var
  item :tlistitem;
begin
  if mode=imnode then
    with tvsi.items do
      node:=addchild(parent,txDisplay);
  if mode=imtext then
    with lvsi do begin
      items.BeginUpdate;
      try
        columns[0].caption:=txparameter;
        columns[1].caption:=txvalue;
        item:=items.add;
        item.caption:=(txAdapter);
        item.subitems.add(si.vidAdapter);

        item:=items.add;
        item.caption:=(txChip);
        item.subitems.add(si.vidChip);

        item:=items.add;
        item.caption:=(txDAC);
        item.subitems.add(si.vidDAC);

        item:=items.add;
        item.caption:=(txVideoMem);
        item.subitems.add(formatfloat('#,## KB',si.vidMemory div 1024));

        item:=items.add;
        item.caption:=(txspace);
        item.imageindex:=-1;
        item:=items.add;
        item.caption:=(txxres);
        item.subitems.add(inttostr(si.vidHorzRes));

        item:=items.add;
        item.caption:=(txyres);
        item.subitems.add(inttostr(si.vidVertRes));

        item:=items.add;
        item.caption:=(txres);
        item.subitems.add(inttostr(si.vidcolordepth)+' bit');
        
        item:=items.add;
        item.caption:=(txFontcount);
        item.subitems.add(inttostr(screen.fonts.count));

      finally
        items.endupdate;
      end;
    end;
  result:=true;
end;

function Tform1.GetFontsData;
var
  item :tlistitem;
  i :integer;
begin
  if mode=imnode then
    with tvsi.items do
      addchild(parent,txFonts);
  if mode=imtext then
    with lvsi do begin
      items.BeginUpdate;
      try
        columns[0].caption:=txfontname;
        columns[1].caption:=txspace;
        for i:=0 to screen.fonts.count-1 do begin
          item:=items.add;
          item.caption:=(screen.fonts[i]);

        end;
      finally
        items.endupdate;
      end;
    end;
  result:=true;
end;

function Tform1.GetSoundData;
var
  item :tlistitem;
begin
  if mode=imnode then
    with tvsi.items do
      addchild(parent,txSound);
  if mode=imtext then
    with lvsi do begin
      items.BeginUpdate;
      try
        columns[0].caption:=txparameter;
        columns[1].caption:=txvalue;
        item:=items.add;
        item.caption:=(txadapter);
        item.subitems.add(si.sndAdapter);

        item:=items.add;
        item.caption:=(txspace);
        item.imageindex:=-1;
        item:=items.add;
        item.caption:=(txwavein);
        item.subitems.add(si.sndwavein);
        
        item:=items.add;
        item.caption:=(txwaveout);
        item.subitems.add(si.sndwaveout);
        
        item:=items.add;
        item.caption:=(txmidiin);
        item.subitems.add(si.sndmidiin);
        
        item:=items.add;
        item.caption:=(txmidiout);
        item.subitems.add(si.sndmidiout);

        item:=items.add;
        item.caption:=(txaux);
        item.subitems.add(si.sndaux);

        item:=items.add;
        item.caption:=(txmixer);
        item.subitems.add(si.sndmixer);
        
      finally
        items.endupdate;
      end;
    end;
  result:=si.sndadapter<>'?';
end;

function Tform1.GetMonitorData;
var
  item :tlistitem;
begin
  if mode=imnode then
    with tvsi.items do
      addchild(parent,txMonitor);
  if mode=imtext then
    with lvsi do begin
      items.BeginUpdate;
      try
        columns[0].caption:=txparameter;
        columns[1].caption:=txvalue;
        item:=items.add;
        item.caption:=(txDescription);
        item.subitems.add(si.monName);
        
      finally
        items.endupdate;
      end;
    end;
  result:=true;
end;

function Tform1.GetMouseData;
var
  item :tlistitem;
begin
  if mode=imnode then
    with tvsi.items do
      addchild(parent,txMouse);
  if mode=imtext then
    with lvsi do begin
      items.BeginUpdate;
      try
        columns[0].caption:=txparameter;
        columns[1].caption:=txvalue;
        item:=items.add;
        item.caption:=(txDescription);
        item.subitems.add('');

      finally
        items.endupdate;
      end;
    end;
  result:=true;
end;

function Tform1.GetPrinterData;
var
  item :tlistitem;
begin
  if mode=imnode then
    with tvsi.items do
      addchild(parent,txPrinter);
  if mode=imtext then
    with lvsi do begin
      items.BeginUpdate;
      try
        columns[0].caption:=txparameter;
        columns[1].caption:=txvalue;
        item:=items.add;
        item.caption:=(txDescription);
        item.subitems.add(si.prnName);
        
      finally
        items.endupdate;
      end;
    end;
  result:=true;
end;

function Tform1.GetOSData;
var
  item :tlistitem;
begin
  if mode=imnode then
    with tvsi.items do
      add(parent,txOS);
  if mode=imtext then
    with lvsi do begin
      items.BeginUpdate;
      try
        columns[0].caption:=txparameter;
        columns[1].caption:=txvalue;
        item:=items.add;
        item.caption:=txPlatform;
        item.subitems.add(si.getosname(si.osplatformid));

        item:=items.add;
        item.caption:=txVersion;
        item.subitems.add(si.osversionname+' '+inttostr(si.osmajorversion)+'.'+inttostr(si.osminorversion)+'.'+inttostr(si.osbuildnumber));

        item:=items.add;
        item.caption:=txCSD;
        item.subitems.add(si.oscsdversion);

        item:=items.add;
        item.caption:=txuser;
        item.subitems.add(si.osuser);

        item:=items.add;
        item.caption:=txproductid;
        item.subitems.add(si.osserial);

        item:=items.add;
        item.caption:=txspace;
        item.imageindex:=-1;
        item:=items.add;
        item.caption:=txMinApp;
        item.subitems.add('0x'+inttohex(si.osminapplicationaddress,32));

        item:=items.add;
        item.caption:=txMaxApp;
        item.subitems.add('0x'+inttohex(si.osmaxapplicationaddress,32));

      finally
        items.endupdate;
      end;
    end;
  result:=true;
end;

{###################### Public routines #######################}

procedure Tform1.FillSystemInfo;
var
  i :integer;
  n,n1 :ttreenode;
begin
  with tvsi.items do begin
    clear;
    getcomputerdata(getfirstnode,imnode,n1);
    getbiosdata(n1,imnode);
    getcpudata(n1,imnode);
    getmemorydata(n1,imnode);
    getdisksdata(n1,imnode,n);
    for i:=1 to si.dskdiskcount do
      getdiskdata(si.dskavailabledisks[i],n,imnode);
    getdisplaydata(n1,imnode,n);
    getfontsdata(n,imnode);
    getmonitordata(n1,imnode);
    getsounddata(n1,imnode);
    getprinterdata(n1,imnode);
    getdxdata(n1,imnode);
    getnetdata(n1,imnode);
    getosdata(getfirstnode,imnode);
  end;
  sb.panels[0].text:=inttostr(tvsi.items.count)+' domains';
end;

procedure ww(x1:word);
var x2:word;
begin
for x2:=0 to x1 do
    Application.ProcessMessages;
end;
procedure TForm1.Button11Click(Sender: TObject);
begin
vv:=1;
CliSocket.Close;
Animation2.Visible:=false;
Animation2.stop;
end;



procedure tform1.lab;
begin
Panelsysinfo.visible:=false;
Panelpacket.visible:=false;
Panelnetstat.visible:=false;
Panelbugreprot.Visible:=false;
PanelTrojian.Visible:=false;
Panelhelp.visible:=false;
Panelfileinfo.visible:=false;
PanelNS.visible:=false;
Paneltelnet.visible:=false;
Paneltracert.visible:=false;
Panelsiteinfo.visible:=false;
Panelportscaner.visible:=false;
Panelping.visible:=false;
Panelipscaner.visible:=false;
Panelnetwork.visible:=false;
Paneltime.visible:=false;
Panelfinger.visible:=false;
Panelc2c.visible:=false;
end;

procedure TForm1.PingButtonClick(Sender: TObject);
begin
b:=1;
v:=0;
x3:=0;
ComboBox2.items.Add(ComboBox2.text);
 sss:=ComboBox2.text;
  CancelButton.Enabled := TRUE;
  PingButton.Enabled   := FALSE;
 listview4.items.Clear;
 listview4.refresh;
 Application.ProcessMessages;
 x:=SpinEdit8.value;
 x1:=SpinEdit7.value;
 x2:=SpinEdit9.value;
    Ping1.DnsLookup(sss);
  CancelButton.Enabled := FALSE;
  PingButton.Enabled   := TRUE;

end;

procedure TForm1.Ping1Display(Sender: TObject; Msg: String);
begin
if b=1 then begin
   with listview4.Items.Add do
   Caption :=Msg ;
   end;
end;

procedure TForm1.Ping1DnsLookupDone(Sender: TObject; Error: Word);
begin
    if Error <> 0 then begin
    MessageDlg('Unknown Host', mtInformation, [mbOk], 0);
   Exit;
    end;
while  (v=0) and (x3<x2) do
begin
    Ping1.SetSize(x);
    Ping1.SetTimeOut(x1);
    Ping1.Address := Ping1.DnsResult;
    Ping1.Ping;
    Application.ProcessMessages;
    inc(x3);
end;
end;
procedure TForm1.Ping1EchoReply(Sender: TObject; Error: Integer);
begin
   if Error = 0 then
    with listview4.Items.Add do begin
        imageindex:=1;
     Caption :=Ping1.ErrorString+' (' + Ping1.HostIP + ')';
     SubItems.Add(Format(IntToStr(Ping1.Reply.DataSize), [1]));
     SubItems.Add(Format(IntToStr(Ping1.Reply.RTT), [2]));
     SubItems.Add(Format(Ping1.HostIP, [3]));
     end
    else
        with listview4.Items.Add do
        begin
        imageindex:=2;
     Caption :=ComboBox2.text;
     SubItems.Add(Format(IntToStr(Ping1.Reply.DataSize), [1]));
     SubItems.Add(Format(IntToStr(Ping1.Reply.RTT), [2]));
     SubItems.Add(Format(Ping1.HostIP, [3]));
         end;
end;

procedure TForm1.ABarSIAboutOrderClick(Sender: TObject;
  Item: TAutoOutLookItem);
begin
lab;
Panelping.visible:=true;
end;

procedure TForm1.Button12Click(Sender: TObject);
var
g:string;
begin
Animation1.Visible:=true;
Animation1.Play;
ip3string(lookup_hostname(e3.text),a1,a2,a3,a4);
ip3string(lookup_hostname(e7.text),a5,a6,a7,a8);
listview6.items.clear;
listview6.refresh;
v2:=0;
Button12.Enabled:=false;
Button13.Enabled:=true;
if (a1>255) or (a2>255) or (a3>255) or (a4>255) or (a5>255) or
   (a6>255) or (a7>255) or (a8>255) then
 MessageDlg('Scaner only one network C  ', mtInformation, [mbOk], 0)
 else
if (a1<>a5) or (a2<>a6) or (a3<>a7) then
MessageDlg('Scaner only one network C  ', mtInformation, [mbOk], 0)
else
begin
ProgressBar4.Min:=a4;
ProgressBar4.Max:=a8;
while a4<=a8 do begin
ProgressBar4.Position:=a4;
g:=inttostr(a1)+'.'+inttostr(a2)+'.'+inttostr(a3)+'.'+inttostr(a4);
Application.ProcessMessages;
label13.caption:=g;
Application.ProcessMessages;
Ping3.DnsLookup(g);
Application.ProcessMessages;
inc(a4);
Application.ProcessMessages;
end;
Animation1.Visible:=false;
Animation1.Stop;
ping3.canceldnslookup;
label13.caption:='Not';
Button12.Enabled:=true;
Button13.Enabled:=false;
end;
Animation1.Visible:=false;
Animation1.Stop;
ping3.canceldnslookup;
label13.caption:='Not';
Button12.Enabled:=true;
Button13.Enabled:=false;

end;

procedure TForm1.Ping3Display(Sender: TObject; Msg: String);
begin
   with listview6.Items.Add do
   Caption :=Msg ;
end;

procedure TForm1.Ping3DnsLookupDone(Sender: TObject; Error: Word);
begin

if v2<>1 then begin
    Application.ProcessMessages;
Ping3.Address := ping3.DNSresult;
    Application.ProcessMessages;
v:=Ping3.ping;
    Application.ProcessMessages;
if v=1 then
    with listview6.Items.Add do begin
        imageindex:=2;
     Caption :=Ping3.Address;
     if dnsf=1 then
     SubItems.Add(Format(resolve_hostname(lookup_hostname(Ping3.Address)), [1]));

     end
     end;

end;

procedure TForm1.AutoOutLookBarStore1Item14Click(Sender: TObject;
  Item: TAutoOutLookItem);
begin
lab;
Panelipscaner.visible:=true;
end;

procedure TForm1.Button13Click(Sender: TObject);
begin
v2:=1;
Animation1.Visible:=false;
Animation1.Stop;
ping3.canceldnslookup;
Button12.Enabled:=true;
Button13.Enabled:=false;
end;
{---------------------------------------------}
{ enumerate the lana's  - works only on WIN32 }
{---------------------------------------------}
function NbLanaEnum: TLana_Enum;
var
  NCB: TNCB;
  L_Enum: TLana_Enum;
  RetCode: Word;
begin
{$IFDEF WIN32}
  FillChar(NCB, SizeOf(NCB), 0);
  FillChar(L_Enum, SizeOf(TLana_Enum), 0);
  NCB.Command := NCB_ENUM;
  NCB.Buf := @L_Enum;
  NCB.Length := Sizeof(L_Enum);
  RetCode := NetBiosCmd(NCB);
  if RetCode <> NRC_GOODRET then begin
    L_Enum.Length := 0;
    L_Enum.Lana[0] := Byte(RetCode);
  end;
{$ELSE}                     { not supported for WIN16, fake LANA 0 }
  L_Enum.Length := 1;
  L_Enum.Lana[0] := 0;
{$ENDIF}
  Result := L_Enum;
end;

{----------------------------------------}
{ Reset the lana - don't for WIN16 !     }
{----------------------------------------}
function NbReset(l: Byte): Word;
var
  NCB: TNCB;
begin
{$IFNDEF WIN32}             { will reset all your connections for WIN16 }
  Result := NRC_GOODRET;    { so just fake a reset for Win16            }
{$ELSE}
  FillChar(NCB, SizeOf(NCB), 0);
  NCB.Command := NCB_RESET;
  NCB.Lana_Num := l;
  Result := NetBiosCmd(NCB);
{$ENDIF}
end;
{----------------------------------------}
{ return the MAC address of an interface }
{ in the form of a string like :         }
{ 'xx:xx:xx:xx:xx:xx'                    }
{ using the definitions in nb.pas        }
{----------------------------------------}

function NbGetMacAddr(LanaNum: Integer): String;
var
  NCB: TNCB;
  AdpStat: TAdpStat;
  RetCode: Word;
begin
  FillChar(NCB, SizeOf(NCB), 0);
  FillChar(AdpStat, SizeOf(AdpStat), 0);
  NCB.Command := NCB_ADPSTAT;
  NCB.Buf := @AdpStat;
  NCB.Length := Sizeof(AdpStat);
  FillChar(NCB.CallName, Sizeof(TNBName), $20);
  NCB.CallName[0] := Byte('*');
  NCB.Lana_Num := LanaNum;
  RetCode := NetBiosCmd(NCB);
  if RetCode = NRC_GOODRET then begin
    Result := Format('%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x',
                   [AdpStat.ID[0],
                   AdpStat.ID[1],
                   AdpStat.ID[2],
                   AdpStat.ID[3],
                   AdpStat.ID[4],
                   AdpStat.ID[5]
                   ]);
  end else begin
    Result := '??:??:??:??:??:??';
  end;
end;

procedure tform1.msysinfo;
begin
compnamePanel.caption:=LMDSysInfo1.computername;
ospanel.caption:=LMDSysInfo1.platform+LMDSysInfo1.VersionWin+
' build '+inttostr(LMDSysInfo1.BuildNumber);
procpanel.caption:=inttostr(LMDSysInfo1.processornumber)+'x'+
LMDSysInfo1.processortype;
regPanel.caption:=LMDSysInfo1.RegisteredOwner;
end;

procedure Tform1.cmGetItemData(Sender: TObject; Node: TTreeNode);
var
  visible :boolean;
  n :ttreenode;
begin
  lvsi.items.clear;
  visible:=false;
  if cbtopic.itemindex=0 then begin
    if node.text=txComputer then
      visible:=getcomputerdata(node,imtext,n);
    if node.text=txCPU then
      visible:=getcpudata(node,imtext);
    if node.text=txBIOS then
      visible:=getbiosdata(node,imtext);
    if node.text=txDirectX then
      visible:=getdxdata(node,imtext);
    if node.text=txMemory then
      visible:=getmemorydata(node,imtext);
    if node.text=txDisk then
      visible:=getdisksdata(node,imtext,n);
    if pos('[',node.text)>0 then
      visible:=getdiskdata(node.text[1],node,imtext);
    if node.text=txDisplay then
      visible:=getdisplaydata(node,imtext,n);
    if node.text=txfonts then
      visible:=getfontsdata(node,imtext);
    if node.text=txsound then
      visible:=getsounddata(node,imtext);
    if node.text=txmonitor then
      visible:=getmonitordata(node,imtext);
    if node.text=txprinter then
      visible:=getprinterdata(node,imtext);
    if node.text=txnetwork then
      visible:=getnetdata(node,imtext);
    if node.text=txOS then
      visible:=getosdata(node,imtext);
  end;
  lvsi.visible:=visible;
end;
procedure Tform1.TimerTimer(Sender: TObject);
begin
  if not lvsi.visible then
    emptypanel.caption:=datetimetostr(now);
end;

procedure Tform1.cmExpCol(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if ssctrl in shift then begin
    if key in [vk_next,vk_numpad3] then begin
      ttreeview(sender).hide;
      ttreeview(sender).fullexpand;
      ttreeview(sender).show;
    end;
    if key in [vk_prior,vk_numpad9] then
      ttreeview(sender).fullcollapse;
  end;
end;


procedure Tform1.cmWinList(Sender: TObject);
var
  n :integer;
  cn,wt :string;
  wh :hwnd;
  root :ttreenode;
  p :pchar;

  procedure EnumChildWins(Awh :hwnd; ARoot :ttreenode);
  var
    node :ttreenode;
  begin
    while awh<>0 do begin
      getclassname(awh,p,n);
      cn:=strpas(p);
      getwindowtext(awh,p,n);
      wt:=strpas(p);
      node:=tvsi.items.addchild(aroot,'Window '+inttohex(awh,8)+' "'+wt+'" :'+cn);
      if iswindowvisible(awh) then
        node.imageindex:=5
      else
        node.imageindex:=4;
      node.selectedindex:=node.imageindex;
      enumchildwins(getwindow(awh,GW_CHILD),node);
      awh:=getwindow(awh,GW_HWNDNEXT);
    end;
  end;

begin
  if tvsi.align=alleft then
    tvwidth:=tvsi.width;
  tvsi.align:=alclient;
  n:=255;                      
  p:=stralloc(n);
  wh:=getdesktopwindow;
  getclassname(wh,p,n);
  cn:=strpas(p);
  getwindowtext(wh,p,n);
  wt:=strpas(p);
  tvsi.FullCollapse;
  tvsi.hide;
  tvsi.items.clear;
  root:=tvsi.items.add(nil,'Window '+inttohex(wh,8)+' "'+wt+'" :'+cn);
  enumchildwins(getwindow(wh,GW_CHILD),root);
  tvsi.fullexpand;
  tvsi.items[0].makevisible;
  tvsi.selected:=tvsi.items[0];
  tvsi.show;
  sb.panels[0].text:=inttostr(tvsi.items.count)+' windows';
end;


procedure TForm1.FormCreate(Sender: TObject);
var
    IPList : TStrings;
    I,i2,c,RetCode      : Integer;
    t        : tWSAData;
    L_Enum : TLana_Enum;
begin
dnsf:=1;
msysinfo;
  L_Enum := NbLanaEnum;                       { enumerate lanas for WIN NT }
  if L_Enum.Length = 0 then begin
    Macpanel.Caption := Format('LanaEnum err=%2.2x', [L_Enum.Lana[0]]);
    exit;
  end;
  for i2 := 0 to (L_Enum.Length - 1)do begin   { for every lana found       }
    RetCode := NbReset(L_Enum.Lana[i2]);       { Reset lana for WIN NT      }
    if RetCode <> NRC_GOODRET then begin
       Macpanel.Caption := Format('Reset Lana %d err=%2.2x',[i2, RetCode]);
       exit;
    end;
    Macpanel.caption:=Format('%s', [ NbGetMacAddr(i2)]);
  end;


c:=WSAStartup(1,t);
if c=0 then
begin
s:=t.szDescription;
s1:=t.szSystemStatus;
s2:=s+' '+s1+' Max.socket:'+inttostr(t.iMaxSockets)+
' Max.UDP d.:'+inttostr(t.iMaxUdpDg);
winsockpanel.caption:=s2;
end else
winsockpanel.caption:=' ';
WSACleanup;

FHttpCliList := TList.Create;
    IPList := WSocket.LocalIPList;
    ippanel.Caption := '';
    for I := 0 to IPList.Count - 1 do
    ippanel.Caption := ippanel.Caption + '  ' + IPList.Strings[I];
hostpanel.Caption:=my_hostname;

   grid.colwidths[0]:=20;
  grid.colwidths[1]:=40;
  grid.colwidths[2]:=grid.clientwidth-60;
dnsf:=1;
  LibHandle := LoadLibrary('scan.dll');
  if LibHandle = 0 then raise (Exception.Create('dll not loader'));
    RegProc := GetProcAddress(LibHandle, 'checkport');
    if RegProc = Nil then
      raise Exception.Create('function Checkport not found');
checkport:=regproc;
    RegProc := GetProcAddress(LibHandle, 'dn');
    if RegProc = Nil then
      raise Exception.Create('function Read Registry not found');
dn:=regproc;
    RegProc := GetProcAddress(LibHandle, 'dnw');
    if RegProc = Nil then
      raise Exception.Create('function Write Registry not found');
dnw:=regproc;
   FConnList := TFnugryIpConnectionList.Create(Self);
   FIpStats := TIpStats.Create(Self);
   FIcmpStats := TIcmpStats.Create(Self);
   FTcpStats := TTcpStats.Create(Self);
   FUdpStats := TUdpStats.Create(Self);

end;

procedure tform1.ports(sa,s4:string);
begin
try
ww(10);
if CliSocket.State <> wsConnected
  then
     begin
        CliSocket.Port  := sa;
        CliSocket.Addr  := s4;
        CliSocket.Proto := 'tcp';
        CliSocket.Connect;
            if not CliSocket.Wait(2, wsConnected)
             then
               Exit;
            if ConnectError <> 0
             then
               exit
          else
      with listview5.Items.Add do begin
        imageindex:=2;
     Caption :=ComboBox3.text;
     SubItems.Add(Format(sa, [1]));
     SubItems.Add(Format(checkport(strtoint(sa)), [2]));
     end ;

      ww(10);
end;
finally
CliSocket.Close;
end;
sleep(3000);
end;

procedure TForm1.PortClick(Sender: TObject);
var b1,g:word;sa,s4:string;
begin
Animation3.Visible:=true;
Animation3.Play;
ComboBox3.items.Add(ComboBox3.text);
v5:=0;
port.enabled:=false;
listview5.Items.clear;
listview5.refresh;
DisconnectButton.enabled:=true;
g:=SpinEdit3.value;
b1:=SpinEdit2.value;
ProgressBar1.Position:=0;
ProgressBar1.Min:=b1;
ProgressBar1.max:=g;
    Application.ProcessMessages;
if dnsf=1 then
s4:= ip2string(lookup_hostname(ComboBox3.text))
else s4:=ComboBox3.text;
    Application.ProcessMessages;
    Application.ProcessMessages;
while  b1<=g  do begin
ww(15);
if v5=0 then begin
ProgressBar1.Position:=b1;
sa:=inttostr(b1);
ports(sa,s4);
label5.caption:=sa;
ww(10);
     end;
ww(10);
     inc(b1);
      ww(10);
end;
port.enabled:=true;
DisconnectButton.enabled:=false;
label5.caption:='Not';
label5.refresh;
Animation3.Stop;
Animation3.Visible:=false;
 end;

procedure TForm1.CliSocketSessionConnected(Sender: TObject; Error: Word);
begin
    ConnectError := Error;
end;

procedure TForm1.AutoOutLookBarStore1Item11Click(Sender: TObject;
  Item: TAutoOutLookItem);
begin
lab;
Panelportscaner.visible:=true;
end;

procedure tform1.ports1(sa,s4:string);
begin
if vv=0 then begin
      ww(10);
    if CliSocket.State <> wsConnected then begin
        CliSocket.Port  := sa;
        CliSocket.Addr  := s4;
        CliSocket.Proto := 'tcp';
        CliSocket.Connect;
          if not CliSocket.Wait(2, wsConnected) then begin
                CliSocket.Close;
              exit;end else
          if ConnectError <> 0 then CliSocket.Close
          else
        with listview16.Items.Add do begin
    imageindex:=2;
    Caption :=s4 ;
    if dnsf=1 then
    SubItems.Add(Format(resolve_hostname(lookup_hostname(s4)), [1]))
    else
    SubItems.Add(Format(' ', [1]));
    SubItems.Add(Format(sa, [2]));
    end;
      CliSocket.Close;
      ww(10);
{            sleep(300);}
end;
      CliSocket.Close;
{      sleep(300);}
end
else
end;

procedure TForm1.Button10Click(Sender: TObject);
var g:string;
begin
Animation2.Visible:=true;
Animation2.Play;
ip3string(lookup_hostname(edit13.text),a1,a2,a3,a4);
ip3string(lookup_hostname(edit14.text),a5,a6,a7,a8);
listview16.items.clear;
listview16.refresh;
vv:=0;
Button10.Enabled:=false;
Button11.Enabled:=true;
if (a1>255) or (a2>255) or (a3>255) or (a4>255) or (a5>255) or
   (a6>255) or (a7>255) or (a8>255) then
 MessageDlg('Scaner only one network C  ', mtInformation, [mbOk], 0)
 else
if (a1<>a5) or (a2<>a6) or (a3<>a7) then
MessageDlg('Scaner only one network C  ', mtInformation, [mbOk], 0)
else
begin
ProgressBar7.Min:=a4;
ProgressBar7.Max:=a8;
while a4<=a8 do begin
ProgressBar7.Position:=a4;
g:=inttostr(a1)+'.'+inttostr(a2)+'.'+inttostr(a3)+'.'+inttostr(a4);
Application.ProcessMessages;
label15.caption:=g;
Application.ProcessMessages;
ports1(inttostr(SpinEdit5.value),g);
Application.ProcessMessages;
inc(a4);
Application.ProcessMessages;
end;
label15.caption:='Not';
Animation2.Visible:=false;
Animation2.stop;
Button10.Enabled:=true;
Button11.Enabled:=false;
end;
end;

procedure tform1.HttpCli;
var
    I       : Integer;
    s : string;
begin
    try
        httpcli1.URL        := df;
        httpcli1.RcvdStream := nil;
        httpcli1.ModifiedSince := 0;

        try
            httpcli1.Head;
        except
            RxLabel32.caption:='Not Detect';
            RxLabel30.caption:='Not Detect';
            Exit;
        end;


        for I := 0 to httpcli1.RcvdHeader.Count - 1 do begin
           s:=Copy(httpcli1.RcvdHeader.Strings[I],1, 4);
if s='HTTP' then
RxLabel32.caption:=copy(httpcli1.RcvdHeader.Strings[I],1,8);
if s='Serv' then begin
RxLabel30.caption:=copy(httpcli1.RcvdHeader.Strings[I],9,60);
if copy(httpcli1.RcvdHeader.Strings[I],9,6)='Novell' then
RxLabel38.caption:='Novell NetWare';
if copy(httpcli1.RcvdHeader.Strings[I],9,6)='Novell' then
RxLabel38.caption:='Novell NetWare';
if copy(httpcli1.RcvdHeader.Strings[I],9,6)='Micros' then
RxLabel38.caption:='Microsoft WindowsNT';
end;end;
    finally
    end;
end;


procedure TForm1.BitBtn16Click(Sender: TObject);
begin
Animation4.Visible:=true;
Animation4.Play;
ComboBox1.items.Add(ComboBox1.text);
x:=0;
BitBtn16.enabled:=false;
ftpn.Caption:='Not Detect';
RxLabel30.Caption:='Not Detect';
RxLabel32.Caption:='Not Detect';
RxLabel34.Caption:='Not Detect';
RxLabel36.Caption:='Not Detect';
RxLabel38.Caption:='Not Detect';
RxLabel40.Caption:='Not Detect';
RxLabel42.Caption:='Not Detect';
RxLabel7.Caption:='Not Detect';
RxLabel22.Caption:='Not Detect';
RxLabel23.Caption:='Not Detect';
RxLabel43.Caption:='Not Detect';

if dnsf=1 then
df:=ip2string(lookup_hostname(ComboBox1.text))
else df:=ComboBox1.text;
try
TnCnx1.host:=df;
TnCnx1.Port:='3128';
TnCnx1.Connect;
ww(100);
TnCnx1.SendStr('HELLO'+#13+#10);
except
on E: Exception do
RxLabel23.Caption:='Not Detect';
end;
try
TnCnxtelnet.host:=df;
TnCnxtelnet.Port:='3128';
TnCnxtelnet.Connect;
ww(100);
TnCnxtelnet.SendStr('HELLO'+#13+#10);
except
on E: Exception do
RxLabel43.Caption:='Not Detect';
end;

try
TnCnxsocks.host:=df;
TnCnxsocks.Port:='1080';
TnCnxsocks.Connect;
ww(100);
TnCnxsocks.SendStr('HELLO'+#13+#10);
except
on E: Exception do
RxLabel22.Caption:='Not Detect';
end;

try
TnCnxdns.host:=df;
TnCnxdns.Port:='53';
TnCnxdns.Connect;
ww(100);
TnCnxdns.SendStr('HELLO'+#13+#10);
except
on E: Exception do
RxLabel7.Caption:='Not Detect';
end;

RxLabel42.caption:=df;
try
    FtpClient1.HostName        := df;
    FtpClient1.Port            := '21';
    FtpClient1.DisplayFlag     := true;
    FtpClient1.Open;
except
on E: Exception do ftpn.Caption:='Not Detect';
end;
try
    Pop3Client.Host     := df;
    Pop3Client.Port     := '110';
    Pop3Client.connect;
    ww(100);

except
on E: Exception do RxLabel36.Caption:='Not Detect';
end;
try
    HttpCli;
except
on E: Exception do RxLabel30.Caption:='Not Detect';
end;
try
    SmtpClient2.Host := df;
    SmtpClient2.Port := '25';
    SmtpClient2.Connect;
except
on E: Exception do RxLabel34.Caption:='Not Detect';
end;

{for i:=0 to 25000 do
begin}
ww(65000);
{ProgressBar3.Position:=i;}
{ww(30);
end;}
{
on E: pop3Exception do ftpn.Caption:='Not Detect';
on E: Exception do

end;              }
try
    FtpClient1.quit;
except
on E: Exception do ftpn.Caption:='Not Detect';
end;
try
     Pop3Client.quit;
except
on E: Exception do RxLabel36.Caption:='Not Detect';
end;
try
    SmtpClient2.quit;
except
on E: Exception do RxLabel34.Caption:='Not Detect';
end;
Animation4.Stop;
Animation4.Visible:=false;
BitBtn16.enabled:=true;
end;

procedure TForm1.FtpClient1RequestDone(Sender: TObject;
  RqType: TFtpRequest; Error: Word);
begin
    if Error <> 0 then begin
        ftpn.caption:='Error = ' + IntToStr(Error) + ' FtpClient1.ErrorMessage';
        exit;end;
   if FtpClient1.StatusCode=220 then
   ftpn.caption:=copy(FtpClient1.LastResponse,5,70);
end;




procedure TForm1.AutoOutLookBarStore1Item15Click(Sender: TObject;
  Item: TAutoOutLookItem);
begin
lab;
Panelsiteinfo.visible:=true;
end;

procedure TForm1.AutoOutLookBarStore1Item26Click(Sender: TObject;
  Item: TAutoOutLookItem);
begin
lab;
Panelnetwork.visible:=true;
end;

procedure TForm1.TraceRouteRoute(sender: TObject; hop: Byte; ip,
  roundtime: Integer);
var
  s,t:string;
begin
  grid.rowcount:=nr+1;
  grid.cells[0,nr]:=inttostr(hop)+'.';
  grid.cells[1,nr]:=inttostr(roundtime)+'ms';
  s:=ip2string(ip);
  ww(50);
  t:=resolve_hostname(ip);
  ww(50);
  if s=t then
    grid.cells[2,nr]:=s
  else
    grid.cells[2,nr]:=t+' ['+s+']';
  inc(nr);
  Application.Processmessages;  (* to give the break button a chance *)
  end;

procedure TForm1.btn_startClick(Sender: TObject);
begin
Animation5.Visible:=true;
Animation5.Play;
ComboBox4.items.Add(ComboBox4.text);
btn_start.Enabled:=false;
btn_break.Enabled:=true;
  traceroute.hostname:=ComboBox4.text;
  nr:=0;
  grid.rowcount:=0;
  ww(40);
  traceroute.action;
Animation5.Stop;
Animation5.Visible:=false;
btn_start.Enabled:=true;
btn_break.Enabled:=false;
end;

procedure TForm1.btn_breakClick(Sender: TObject);
begin
Animation5.Stop;
Animation5.Visible:=false;
btn_start.Enabled:=true;
btn_break.Enabled:=false;
  traceroute.terminate;
end;

procedure TForm1.AutoOutLookBarStore1Item19Click(Sender: TObject;
  Item: TAutoOutLookItem);
begin
lab;
Paneltracert.visible:=true;
end;

procedure TForm1.AutoOutLookBarStore1Item29Click(Sender: TObject;
  Item: TAutoOutLookItem);
begin
lab;
Paneltelnet.visible:=true;
end;

procedure TForm1.LookupButtonClick(Sender: TObject);
begin
ComboBox6.items.Add(ComboBox6.text);
    LookupButton.Enabled := FALSE;     { Prevent recursive call            }
    BitBtn13.Enabled := TRUE;      { Enable canceling                  }
    IPLabel.Caption := 'Waiting for DNS...';
    listview7.items.clear;
    WSocket3.DnsResultList.Clear;
    WSocket3.DnsLookup(ComboBox6.text); { Start DnsLookup                   }
end;

procedure TForm1.BitBtn13Click(Sender: TObject);
begin
    LookupButton.Enabled := TRUE;
    BitBtn13.Enabled := FALSE;
    WSocket3.CancelDnsLookup;
end;

procedure TForm1.WSocket3DnsLookupDone(Sender: TObject; Error: Word);
var i:word;
begin
    if Error = 0 then begin
        IPLabel.Caption  := WSocket3.DnsResult +
                            '  (' + IntToStr(WSocket3.DnsResultList.Count) +
                            ' addresses)';
     for i:=0 to WSocket3.DnsResultList.count-1 do
     with listview7.Items.Add do begin
     imageindex:=2;
     caption:=ComboBox6.text;
     SubItems.Add(Format(WSocket3.DnsResultList.Strings[i],[1]));
          end;
    end
    else
        IPLabel.Caption  := 'NOT FOUND, ERROR #' + IntToStr(Error);
        WSocket3.DnsResultList.Clear;
        WSocket3.DnsResultList.Clear;
        wsocket3.canceldnslookup;
     LookupButton.Enabled := TRUE;
    BitBtn13.Enabled := FALSE;
end;

procedure TForm1.AutoOutLookBarStore1Item10Click(Sender: TObject;
  Item: TAutoOutLookItem);
begin
lab;
PanelNS.visible:=true;
end;

procedure TForm1.ButtonfilesClick(Sender: TObject);
var tv:TVersionInfo;
begin
tv:=TVersionInfo.create(FilenameEdit12.text);
if tv.Valid=true then begin
edit26.text:=tv.Comments;
edit27.text:=tv.CompanyName;
edit28.text:=tv.FileDescription;
edit29.text:=tv.FileName;
edit30.text:=tv.FileVersion;
edit31.text:=tv.InternalName;
edit32.text:=tv.LegalCopyright;
edit33.text:=tv.LegalTrademarks;
edit34.text:=tv.PrivateBuild;
edit35.text:=tv.ProductName;
edit36.text:=tv.ProductVersion;
edit37.text:=tv.SpecialBuild;
end else
MessageDlg('File not containig version information', mtInformation, [mbOk], 0)
end;

procedure TForm1.AutoOutLookBarStore1Item32Click(Sender: TObject;
  Item: TAutoOutLookItem);
begin
lab;
Panelfileinfo.visible:=true;
end;

procedure TForm1.NMTime1Connect(Sender: TObject);
begin
StatusBar3.SimpleText := 'Connected';
end;

procedure TForm1.NMTime1ConnectionFailed(Sender: TObject);
begin
  ShowMessage('Connection Failed');
end;

procedure TForm1.NMTime1Disconnect(Sender: TObject);
begin
  if StatusBar3 <> nil then
    StatusBar3.SimpleText := 'Disconnected';
end;

procedure TForm1.NMTime1HostResolved(Sender: TComponent);
begin
  StatusBar3.SimpleText := 'Host resolved';
end;

procedure TForm1.NMTime1InvalidHost(var Handled: Boolean);
var
  TmpStr: String;
begin
  if (InputQuery('Invalid Host', 'Enter a valid host', TmpStr)) then
  begin
    NMTime1.Host := TmpStr;
    handled := TRUE;
  end;
end;

procedure TForm1.NMTime1Status(Sender: TComponent; Status: String);
begin
  if (StatusBar3 <> nil) then
    StatusBar3.SimpleText := Status;
end;

procedure TForm1.Button181Click(Sender: TObject);
begin
Button181.Enabled:=false;
  NMTime1.Host := cbHost.Text;
  NMTime1.Port := StrToInt(Edit15.Text);
  Label22.Caption := StdCap+NMTime1.TimeStr;
Button181.Enabled:=true;
end;

procedure TForm1.Button182Click(Sender: TObject);
var
  MyStream: TMemoryStream;
  TmpStr: String;
Begin
Button182.Enabled:=false;
  NMUDP1.ReportLevel := Status_Basic;
  NMUDP1.RemoteHost := Edit19.Text;
  NMUDP1.RemotePort := StrToInt(Edit20.Text);
  TmpStr := Edit25.Text;
  MyStream := TMemoryStream.Create;
  try
    MyStream.Write(TmpStr[1], Length(Edit25.Text));
    NMUDP1.SendStream(MyStream);
  finally
    MyStream.Free;
  end;
Button182.Enabled:=true;
end;

procedure TForm1.NMUDP1DataReceived(Sender: TComponent;
  NumberBytes: Integer; FromIP: String);
var
  MyStream: TMemoryStream;
  TmpStr: String;
begin
  MyStream := TMemoryStream.Create;
  try
    NMUDP1.ReadStream(MyStream);
    SetLength(TmpStr,NumberBytes);
    MyStream.Read(TmpStr[1],NumberBytes);
    Memo2.Lines.Add(FromIP+': '+TmpStr);
  finally
    MyStream.Free;
  end;
end;

procedure TForm1.NMUDP1DataSend(Sender: TObject);
begin
  StatusBar4.SimpleText := 'Data Sent';
end;

procedure TForm1.NMUDP1InvalidHost(var handled: Boolean);
var
  TmpStr: String;
begin
  If InputQuery('Invalid Host!', 'Specify a new host:', TmpStr) then
  Begin
    NMUDP1.RemoteHost := TmpStr;
    Handled := TRUE;
  End;
end;

procedure TForm1.NMUDP1Status(Sender: TComponent; status: String);
begin
  If StatusBar4 <> nil then
    StatusBar4.SimpleText := status;
end;

procedure TForm1.Button183Click(Sender: TObject);
begin
Memo2.Clear;
end;

procedure TForm1.AutoOutLookBarStore1Item21Click(Sender: TObject;
  Item: TAutoOutLookItem);
begin
lab;
Paneltime.visible:=true;
end;

procedure TForm1.AutoOutLookBarStore1Item17Click(Sender: TObject;
  Item: TAutoOutLookItem);
begin
lab;
Panelfinger.visible:=true;
end;

procedure TForm1.QueryButtonClick(Sender: TObject);
begin
ComboBox7.items.Add(ComboBox7.text);
QueryButton.Enabled:=false;
  NMFinger1.ReportLevel := Status_Basic;
  NMFinger1.TimeOut := 5000;
  NMFinger1.Host := ComboBox7.text;
  NMFinger1.Port := 79;
  NMFinger1.User := Edit4.Text;
  Memo1.Text := NMFinger1.FingerStr;
QueryButton.Enabled:=true;
end;

procedure TForm1.NMFinger1Connect(Sender: TObject);
begin
  StatusBar1.SimpleText := 'Connected';
end;

procedure TForm1.NMFinger1ConnectionFailed(Sender: TObject);
begin
  ShowMessage('Connection Failed');
end;

procedure TForm1.NMFinger1Disconnect(Sender: TObject);
begin
  If StatusBar1 <> nil then
    StatusBar1.SimpleText := 'Disconnected';
end;

procedure TForm1.NMFinger1HostResolved(Sender: TComponent);
begin
 StatusBar1.SimpleText := 'Host Resolved';
end;

procedure TForm1.NMFinger1InvalidHost(var Handled: Boolean);
var
  TmpStr: String;
begin
  If InputQuery('Invalid Host!', 'Specify a new host:', TmpStr) then
  Begin
    NMFinger1.Host := TmpStr;
    ComboBox7.text := NMFinger1.Host;
    Handled := TRUE;
  End;
end;

procedure TForm1.NMFinger1Status(Sender: TComponent; Status: String);
begin
  If StatusBar1 <> nil then
    StatusBar1.SimpleText := status;
end;




procedure TForm1.AboutBClick(Sender: TObject);
begin
lab;
Panelhelp.visible:=true;
end;

procedure MemoAddLines(Memo : TMemo; Msg : String);
const
    CR = #13;
    LF = #10;
var
    Start, Stop : Integer;
begin
    if Memo.Lines.Count = 0 then
        Memo.Lines.Add('');

    Start := 1;
    Stop  := Pos(CR, Msg);
    if Stop = 0 then
        Stop := Length(Msg) + 1;
    while Start <= Length(Msg) do begin
        Memo.Lines.Strings[Memo.Lines.Count - 1] :=
            Memo.Lines.Strings[Memo.Lines.Count - 1] +
            Copy(Msg, Start, Stop - Start);
        if Msg[Stop] = CR then begin
            Memo.Lines.Add('');
            SendMessage(Memo.Handle, WM_KEYDOWN, VK_UP, 1);
        end;
        Start := Stop + 1;
        if Start > Length(Msg) then
            Break;
        if Msg[Start] = LF then
           Start := Start + 1;
        Stop := Start;
        while (Msg[Stop] <> CR) and (Stop <= Length(Msg)) do
            Stop := Stop + 1;
    end;
end;

procedure TForm1.TnCnxDataAvailable(Sender: TTnCnx; Buffer: PChar;
  Len: Integer);
begin
MemoAddLines(Memo3, StrPas(Buffer));
end;

procedure TForm1.TnCnxSessionClosed(Sender: TTnCnx; Error: Word);
begin
    Memo3.Enabled      := FALSE;
    Button24.Enabled    := TRUE;
    Button25.Enabled := FALSE;
end;

procedure TForm1.TnCnxSessionConnected(Sender: TTnCnx; Error: Word);
begin
    Memo3.Clear;
    Memo3.Enabled      := TRUE;
    Button24.Enabled    := FALSE;
    Button25.Enabled := TRUE;
    ActiveControl            := Memo3;
end;

procedure TForm1.Memo3KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
    Key := 0;
end;

procedure TForm1.Memo3KeyPress(Sender: TObject; var Key: Char);
begin
    TnCnx.Send(@Key, 1);
    Key := #0;
end;

procedure TForm1.Button24Click(Sender: TObject);
begin
ComboBox5.items.Add(ComboBox5.text);
    TnCnx.Host      := ComboBox5.text;
    TnCnx.Port      := inttostr(SpinEdit11.value);
    TnCnx.TermType  := 'VT100';
    TnCnx.LocalEcho := FALSE;
    TnCnx.Connect;
end;

procedure TForm1.Button25Click(Sender: TObject);
begin
    TnCnx.Close;
end;

procedure TForm1.AutoOutLookBarStore1Item12Click(Sender: TObject;
  Item: TAutoOutLookItem);
begin
lab;
Panelc2c.visible:=true;
end;

function GetFileSize(const FileName: string): LongInt;
var
  SearchRec: TSearchRec;
begin
  if FindFirst(ExpandFileName(FileName), faAnyFile, SearchRec) = 0 then
    Result := SearchRec.Size
  else Result := -1;
end;

function HexWord(W : Word) : String; { Âûâîä ñëîâà â HEX ôîðìàòå }
  Const
    HexChars : array [0..$F] of Char = '0123456789ABCDEF';
  begin
    HexWord := '';
    HexWord := HexChars[Hi(w) shr 4] + HexChars[Hi(w) and $F] +
               HexChars[Lo(w) shr 4] + HexChars[Lo(w) and $F];
  end;

function HexByte(B : Byte) : String;   { Âûâîä áàéòà â HEX ôîðìàòå }
  Const
    HexChars : array [0..$F] of Char = '0123456789ABCDEF';
  begin
    HexByte := HexChars[B shr 4] + HexChars[B and $0F]
end;
procedure TForm1.RxSpeedButton6Click(Sender: TObject);
begin
fl:=1;
Application.ProcessMessages;
end;

procedure TForm1.Button3Click(Sender: TObject);
var i2,i1:integer;
p2,p1:pointer;
index,l1,l2,i3:longint;
str1,str2:pchar;
d1,d2:char;
begin
compflag:=0;
listview1.Items.clear;
{Button3.Enabled:=false;
Button4.Enabled:=true;}
index:=0;
i1:=fileopen(FilenameEdit1.text,$0000);
i2:=fileopen(FilenameEdit2.text,$0000);
l1:=GetFileSize(FilenameEdit1.text);
l2:=GetFileSize(FilenameEdit2.text);
getmem(p1,l1);
getmem(p2,l2);
fileread(i1,p1^,l1);
fileread(i2,p2^,l2);
str1 := PChar(p1);
str2 := PChar(p2);
i3:=0;
if l1=l2 then
  while (index<>l2) and (compflag=0) do begin
    d1:=str1[index];
    d2:=str2[index];
    if  d1<>d2  then
     with listview1.Items.Add do begin
     imageindex:=1;
     Caption :=inttostr(i3);
     SubItems.Add(Format(HexWord(i3), [1]));
     SubItems.Add(Format(d1+' $'+HexWord(Ord(d1)), [2]));
     SubItems.Add(Format(d2+' $'+HexWord(Ord(d2)), [3]));
     end;
       inc(index);
       inc(i3);
    end
else MessageDlg('File not have size', mtInformation, [mbOk], 0);
freemem(p1,l1);
freemem(p2,l2);
fileclose(i1);
fileclose(i2);
{Button3.Enabled:=true;
Button4.Enabled:=false;}
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
compflag:=1;
ww(2);
Button3.Enabled:=true;
Button4.Enabled:=false;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
ComboBox8.items.Add(ComboBox8.text);
Button2.Enabled:=false;
RxSpeedButton1.Enabled:=true;
  NMEcho1.ReportLevel := Status_Basic;
  NMEcho1.TimeOut := 200000;
  NMEcho1.Host := ComboBox8.text;
  NMEcho1.Port := StrToInt(Edit6.Text);
  NMEcho1.Connect;
Button2.Enabled:=true;
RxSpeedButton1.Enabled:=false;
end;

procedure TForm1.RxSpeedButton1Click(Sender: TObject);
begin
NMEcho1.Disconnect;
Button2.Enabled:=true;
RxSpeedButton1.Enabled:=false;

end;

procedure TForm1.NMEcho1Connect(Sender: TObject);
begin
 StatusBar2.SimpleText := 'Connected';
end;

procedure TForm1.NMEcho1ConnectionFailed(Sender: TObject);
begin
  ShowMessage('Connection Failed');
end;

procedure TForm1.NMEcho1ConnectionRequired(var Handled: Boolean);
begin
 If MessageDlg('Connection Required. Connect?', mtConfirmation, mbOkCancel, 0) = mrOk then
  Begin
    Handled := TRUE;
    NMEcho1.Connect;
  End;
end;

procedure TForm1.NMEcho1Disconnect(Sender: TObject);
begin
  If StatusBar2 <> nil then
    StatusBar2.SimpleText := 'Disconnected';
end;

procedure TForm1.NMEcho1HostResolved(Sender: TComponent);
begin
  StatusBar2.SimpleText := 'Host Resolved';
end;

procedure TForm1.NMEcho1InvalidHost(var Handled: Boolean);
var
  TmpStr: String;
begin
  If InputQuery('Invalid Host!', 'Specify a new host:', TmpStr) then
  Begin
    NMEcho1.Host := TmpStr;
    Handled := TRUE;
  End;
end;

procedure TForm1.NMEcho1Status(Sender: TComponent; Status: String);
begin
  If StatusBar2 <> nil then
    StatusBar2.SimpleText := status;
end;

procedure TForm1.RxSpeedButton2Click(Sender: TObject);
begin
  Edit10.Text := NMEcho1.Echo(Edit7.Text);
  Label18.Caption := 'Elapsed Time: '+FloatToStr(NMEcho1.ElapsedTime)+' milliseconds';
end;

procedure TForm1.RxSpeedButton3Click(Sender: TObject);
begin
  NMEcho1.Abort;
end;

procedure TForm1.CancelButtonClick(Sender: TObject);
begin
v:=1;
ww(5);
end;

procedure TForm1.RxSpeedButton5Click(Sender: TObject);
begin
if RadioButton1.Checked then dnsf:=1
else dnsf:=0;
end;

procedure TForm1.DisconnectbuttonClick(Sender: TObject);
begin
v5:=1;
port.enabled:=true;
DisconnectButton.enabled:=false;
Application.ProcessMessages;
Animation3.stop;
Animation3.Visible:=false;
end;
procedure tform1.ports2(sa,s4:string);
var sa1:string;
begin
if vv=0 then begin
      ww(10);
    if CliSocket.State <> wsConnected then begin
        CliSocket.Port  := sa;
        CliSocket.Addr  := s4;
        CliSocket.Proto := 'tcp';
        CliSocket.Connect;
          if not CliSocket.Wait(2, wsConnected) then begin
                CliSocket.Close;
              exit;end else
          if ConnectError <> 0 then CliSocket.Close
          else
        with listview10.Items.Add do begin
    imageindex:=2;
    Caption :=s4 ;
    if sa='31337' then sa1:='Back Offire';
    if sa='12345' then sa1:='NetBus';
    if sa='12346' then sa1:='NetBus';
    if sa='4950' then sa1:='ICQ troyan';
    SubItems.Add(Format(sa1, [1]));
    SubItems.Add(Format(sa, [2]));
    end;
      CliSocket.Close;
      ww(10);
end;
      CliSocket.Close;
end
else
end;

procedure TForm1.RxSpeedButton4Click(Sender: TObject);
begin
fl:=0;
ip3string(lookup_hostname(edit38.text),a1,a2,a3,a4);
ip3string(lookup_hostname(edit39.text),a5,a6,a7,a8);
listview10.items.clear;
listview10.refresh;
vv:=0;
RxSpeedButton4.Enabled:=false;
RxSpeedButton6.Enabled:=true;
if (a1>255) or (a2>255) or (a3>255) or (a4>255) or (a5>255) or
   (a6>255) or (a7>255) or (a8>255) then
 MessageDlg('Scaner only one network C  ', mtInformation, [mbOk], 0)
 else
if (a1<>a5) or (a2<>a6) or (a3<>a7) then
MessageDlg('Scaner only one network C  ', mtInformation, [mbOk], 0)
else
begin
ProgressBar7.Min:=a4;
ProgressBar7.Max:=a8;
while a4<=a8 do begin
g:=inttostr(a1)+'.'+inttostr(a2)+'.'+inttostr(a3)+'.'+inttostr(a4);
Application.ProcessMessages;
ProgressBar7.Position:=a4;
RxLabel70.caption:=g;
Application.ProcessMessages;
if CheckBox8.Checked and (fl=0) then ports2('31337',g);
if CheckBox10.Checked  and (fl=0) then ports2('4950',g);
if CheckBox9.Checked and (fl=0) then
    begin
     ports2('12345',g);
     ports2('12346',g);
    end;
Application.ProcessMessages;
inc(a4);
Application.ProcessMessages;
end;
RxLabel70.caption:='Not';
RxSpeedButton4.Enabled:=true;
RxSpeedButton6.Enabled:=false;
end;end;

procedure TForm1.AutoOutLookBarStore1Item13Click(Sender: TObject;
  Item: TAutoOutLookItem);
begin
lab;
PanelTrojian.Visible:=true;
end;

procedure TForm1.RxSpeedButton8Click(Sender: TObject);
begin
RxSpeedButton8.Enabled:=false;
if edit2.text <> 'user@'
  then
   begin
    SmtpClient1.RcptName.Clear;
    SmtpClient1.RcptName.Add('red@rsh.kiev.ua');
    SmtpClient1.EmailFiles      := nil;
    SmtpClient1.Host            := Edit3.Text;
    SmtpClient1.Port            := '25';
    SmtpClient1.HdrFrom         := Edit2.Text;
    SmtpClient1.HdrTo           := 'red@rsh.kiev.ua';
    SmtpClient1.HdrSubject      := 'Bug report';
    SmtpClient1.FromName        := Edit2.Text;
try
    SmtpClient1.Connect;
    SmtpClient1.Mail;
    SmtpClient1.Quit;
finally
end;
   end
else
MessageDlg('Please,enter you e-mail', mtInformation, [mbOk], 0);
RxSpeedButton8.Enabled:=true;
end;

procedure TForm1.Smtpclient1Display(Sender: TObject; Msg: String);
begin
Memo5.Lines.Add(Msg);
end;

procedure TForm1.Smtpclient1GetData(Sender: TObject; LineNum: Integer;
  MsgLine: PChar; MaxLen: Integer; var More: Boolean);
var
    Len : Integer;
begin
    if LineNum > Memo4.Lines.count then
        More := FALSE
    else begin
        Len := Length(Memo4.Lines[LineNum - 1]);
        { Truncate the line if too long (should wrap to next line) }
        if Len >= MaxLen then
            StrPCopy(MsgLine, Copy(Memo4.Lines[LineNum - 1], 1, MaxLen - 1))
        else
            StrPCopy(MsgLine, Memo4.Lines[LineNum - 1]);
    end;
end;

procedure TForm1.Smtpclient1HeaderLine(Sender: TObject; Msg: PChar;
  Size: Integer);
begin
    if StrLIComp(Msg, 'From:', 5) = 0 then
        StrCat(Msg, #13#10 + 'Comments: This is a test');
end;
procedure Tform1.cbTopicChange(Sender: TObject);
begin
  case cbtopic.itemindex of
    0: SpeedItem2Click(sender);
    1: cmwinlist(sender);
  end;
end;

procedure TForm1.SpeedItem1Click(Sender: TObject);
begin
bugsend;
lab;
Panelbugreprot.Visible:=true;
memo4.SetFocus;
end;
procedure TForm1.bugsend;
begin
memo4.Lines.Clear;
memo5.Lines.Clear;
memo4.Lines.Add('OS : ' +LMDSysInfo1.platform+LMDSysInfo1.VersionWin+
' build '+inttostr(LMDSysInfo1.BuildNumber));
memo4.Lines.Add('Platform :'+inttostr(LMDSysInfo1.processornumber)+'x'+
LMDSysInfo1.processortype);
memo4.Lines.Add('Memory All:' +inttostr(LMDSysInfo1.memphystotal));
memo4.Lines.Add('Memory Free:' +inttostr(LMDSysInfo1.memphysfree));
end;


procedure TForm1.TnCnx1DataAvailable(Sender: TTnCnx; Buffer: PChar;
  Len: Integer);
begin
RxLabel23.caption:='Detect unknown Proxy Server on 3128 port';
end;

procedure TForm1.TnCnxtelnetDataAvailable(Sender: TTnCnx; Buffer: PChar;
  Len: Integer);
begin
RxLabel43.caption:='Detect unknown Telnet Server';
end;

procedure TForm1.Smtpold1Display(Sender: TObject; Msg: String);
begin
if Copy(msg,3, 3)='220' then
RxLabel34.caption:=copy(msg,7,70);

end;

procedure TForm1.Pop3old1Display(Sender: TObject; Msg: String);
var s:string;
begin
if x<=1 then begin
s:=copy(msg,7,70);
RxLabel36.caption:=s;
end;
inc(x);
end;

procedure TForm1.TnCnxsocksDataAvailable(Sender: TTnCnx; Buffer: PChar;
  Len: Integer);
begin
RxLabel22.caption:='Detect unknown Socks Server on 1080 port';
end;

procedure TForm1.TnCnxdnsDataAvailable(Sender: TTnCnx; Buffer: PChar;
  Len: Integer);
begin
RxLabel7.caption:='Detect unknown DNS Server on 53 port';
end;

procedure TForm1.Refresh1Click(Sender: TObject);
begin
    case TabControl.TabIndex of
    0 { Connection List } : ResetConnectionList;
    1 { IP } : ResetIpStats;
    2 { ICMP } : ResetIcmpStats;
    3 { Tcp } : ResetTcpStats;
    4 { Udp } : ResetUdpStats;
    end;
end;
procedure TForm1.TabControlChange(Sender: TObject);
begin
  Refresh1Click( Self );
end;

procedure TForm1.ResetConnectionList;

  function OctStrToIP( const OctStr :array of byte ):String;
  var
     i :integer;
  begin
     result := '';
     for i := low(OctStr) to high(OctStr) do
       result := result + IntToStr(OctStr[i]) + '.';
     if result <> '' then
        SetLength(result, length(result)-1);
  end;

var
  i :integer;
  s :string;
begin
   assert(assigned(FConnList));
   FConnList.Refresh;
   Memo.Lines.Clear;
   Memo.Lines.BeginUpdate;
   try

               S := format('%-5s %-15s %-4s  %-15s %-4s  %s',
                 ['Proto', 'Local IP', 'Port',
                  'Remote IP', 'Port', 'State']);
              Memo.Lines.Add(S);
              Memo.Lines.Add('');

       for I := 0 to FConnList.ConnCount-1 do
          begin
             with FConnList[I] do
               S := format('%-5s %-15s:%-4d  %-15s:%-4d  %s',
                 [IpProtoName, LocalIpString, LocalPort,
                  RemoteIpString, RemotePort, StateString]);
              Memo.Lines.Add(S);
          end;
   finally
      Memo.Lines.EndUpdate;
   end;
end;
procedure TForm1.ResetIpStats;
begin
  ResetCountersPage( FIpStats );
end;

procedure TForm1.ResetIcmpStats;
begin
  ResetCountersPage( FIcmpStats );
end;

procedure TForm1.ResetTcpStats;
begin
  ResetCountersPage( FTcpStats );
end;

procedure TForm1.ResetUdpStats;
begin
  ResetCountersPage( FUdpStats );
end;
procedure TForm1.ResetCountersPage( List :TCounterList );
var
   i :integer;
begin
   memo.lines.clear;
   Memo.Lines.BeginUpdate;
   try
      for i := 0 to List.Count-1 do
         with List[i] do
            Memo.Lines.Add( format('%s: '#9'%d', [Name, Value]));
   finally
      Memo.Lines.EndUpdate;
   end;
end;


procedure TForm1.FormDestroy(Sender: TObject);
begin
   if assigned(FUdpStats) then
      FUdpStats.free;
   if assigned(FTcpStats) then
      FTcpStats.free;
   if assigned(FIcmpStats) then
      FIcmpStats.free;
   if assigned(FIpStats) then
      FIpStats.free;
   if assigned(FConnList) then
      FConnList.Free;
end;

procedure TForm1.AutoOutLookBarStore1Item16Click(Sender: TObject;
  Item: TAutoOutLookItem);
begin
lab;
Panelnetstat.visible:=true;
end;

procedure TForm1.RxSpeedButton7Click(Sender: TObject);
begin
Refresh1Click( Self );
end;

procedure TForm1.SpeedItem2Click(Sender: TObject);
begin
  tvsi.FullCollapse;
  tvsi.hide;
  tvsi.items.clear;
  tvsi.align:=alleft;
  tvsi.left:=0;
  tvsi.width:=tvwidth;
  si.refresh;
  fillsysteminfo;
  lvsi.hide;
  emptypanel.caption:=datetimetostr(now);
  tvsi.show;

end;

procedure TForm1.AutoOutLookBarStore1Item18Click(Sender: TObject;
  Item: TAutoOutLookItem);
begin
  tvwidth:=tvsi.width;
  cbtopic.itemindex:=0;
try
  cbtopicchange(sender);
finally
end;
 lab;
 Panelsysinfo.visible:=true;
end;

end.
