⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 u_observersniffer.pas

📁 linux program to read packet data
💻 PAS
字号:
(*
 * One Way Network Sniffer (OWNS)
 * Copyright (C) 2001-2002 OWNS
 *
 * http://owns.sourceforge.net/
 * http://www.owns.st
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *)

(* $Id: u_ObserverSniffer.pas,v 1.4 2002/11/23 21:49:50 owns Exp $ *)

unit u_ObserverSniffer;
interface
uses Classes,
     sysutils,
     u_Sniffer,u_ObserverBfr,u_Debug;


type

  TSnifferThread = class;

  TObserverSniffer = class(TSniffer)
  private
    FThread : TSnifferThread;
    FObserverBfr : TObserverBfr;
    procedure threadTerminated(Sender: TObject);
  public
    constructor create; override;
    destructor Destroy; override;
    function getAdapters(var ErrStr : String) : boolean;
    function Activate(var ErrStr: string) : Boolean; override;
    function Deactivate(var ErrStr: string): boolean; override;
  end;

  TSnifferThread = class(TThread)
  private
    FParent: TObserverSniffer;
    FObserverBfr : TObserverBfr;
  protected
  public
    constructor Create(p_Parent : TObserverSniffer);
    destructor Destroy; override;
    procedure Execute; override;
  end;



implementation


constructor TObserverSniffer.create;
begin
  inherited Create;
  FThread := nil;
  FMode := offline; // cannot capture live
end;

destructor TObserverSniffer.Destroy;
var
  l_ErrStr : String;
begin
  if FSnoopStarted then Deactivate(l_ErrStr);
  inherited Destroy;
end;

function TObserverSniffer.getAdapters(var ErrStr : String) : boolean;
begin
  result := true;
end;

// start to sniff
function TObserverSniffer.Activate(var ErrStr: string) : Boolean;
begin
  Result := False;

  if (FSnoopStarted) then
  begin
    ErrStr := 'Snooping already activated';
    exit;
  end;

  FObserverBfr := TObserverBfr.create(FFilePath);

  //Create Thread
  FThread := TSnifferThread.Create(self); //Create Suspended Thread

  // cela 関ite d'appeler FThread.free dans StopSnoop qui peut 阾re appel

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -