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

📄 u_connectionpop3.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_ConnectionPop3.pas,v 1.5 2002/11/02 14:05:37 owns Exp $
 * Represents a Pop3 connection
 * A pop3 connection is composed from several mails
 * You can save all the mails with saveMails
 *)

unit u_ConnectionPop3;
interface
uses sysUtils, classes,
     u_IPPacket, u_Statistics,u_Filter,u_MimeTypes,u_FileStreamCapture;

// cf RFC 1939

type
  TConnectionpop3  = class
  private
    FData            : PChar;        // data for the TCP connection
    FSize            : Integer;      // size of FData
    FPosition        : Integer;
    FIPSource        : IP_ADDR;
    FSourcePort      : Word;
    FIPDest          : IP_ADDR;
    FDestPort        : Word;
    FNumConnection   : LongInt;
    FDamaged         : Boolean;

    FResponse        : String;
    FStatusIndicator : String;
    FResponseBody    : PChar;
    FResponseBodyLength : Integer;
    function readLine : String;
    function firstResponse : String;
    function nextResponse : String;
    procedure readBody;
    function getStatusIndicator(p_Line : String) : string;
  public
    constructor create(p_Data : PChar; p_Size : LongInt;p_NumConnection : LongInt;
                       p_IPSourceAddr : PIP_ADDR; p_SourcePort : Word;
                       p_IPDestAddr : PIP_ADDR; p_DestPort : Word; p_Damaged : Boolean);
    procedure firstMail;
    procedure nextMail;
    procedure saveMails;
    property Response : String read FResponse;
    property StatusIndicator : String read FStatusIndicator;
    property ResponseBody : PChar read FResponseBody;
    property ResponseBodyLength : Integer read FResponseBodyLength;

    property IPSource : IP_ADDR read FIPSource;
    property SourcePort : Word read FSourcePort;
    property IPDest : IP_ADDR read FIPDest;
    property DestPort : Word read FDestPort;
  end;

implementation

// read a line
function TConnectionPop3.readLine : String;
begin
  result := '';
  while (FData[FPosition] <> #13) do
  begin
    result := result + FData[FPosition];
    Inc(FPosition);
  end;
  Inc(FPosition,2); // pour le #13 #10 (CRLF)
end;

// returns the first response
function TConnectionPop3.firstResponse : String;
begin
  FPosition := 0;
  nextResponse;
end;

// returns response statusIndictor (+OK or -ERR)
// permet 間alement de savoir si la ligne correspond 

⌨️ 快捷键说明

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