scapy.pipetool

class scapy.pipetool.AutoSource(name: str | None = None)[源代码]

基类:Source

deliver() None[源代码]
class scapy.pipetool.CLIFeeder(name: str | None = None)[源代码]

基类:AutoSource

Send messages from python command line:

   +--------+
>>-|        |->>
   | send() |
 >-|   `----|->
   +--------+
close() None[源代码]
send(msg: str) int[源代码]
class scapy.pipetool.CLIHighFeeder(name: str | None = None)[源代码]

基类:CLIFeeder

Send messages from python command line to high output:

   +--------+
>>-|   .----|->>
   | send() |
 >-|        |->
   +--------+
send(msg: Any) int[源代码]
class scapy.pipetool.ConsoleSink(name: str | None = None)[源代码]

基类:Sink

Print messages on low and high entries to stdout

   +-------+
>>-|--.    |->>
   | print |
 >-|--'    |->
   +-------+
high_push(msg: str) None[源代码]
push(msg: str) None[源代码]
class scapy.pipetool.DownDrain(name: str | None = None)[源代码]

基类:Drain

Repeat messages from high entry to low exit:

   +-------+
>>-|--.    |->>
   |   \   |
 >-|    `--|->
   +-------+
high_push(msg: Any) None[源代码]
push(msg: Any) None[源代码]
class scapy.pipetool.Drain(name: str | None = None)[源代码]

基类:Pipe

Repeat messages from low/high entries to (resp.) low/high exits

   +-------+
>>-|-------|->>
   |       |
 >-|-------|->
   +-------+
high_push(msg: Any) None[源代码]
push(msg: Any) None[源代码]
class scapy.pipetool.PeriodicSource(msg: Iterable[Any] | Any, period: int, period2: int = 0, name: str | None = None)[源代码]

基类:ThreadGenSource

Generate messages periodically on low exit:

   +-------+
>>-|       |->>
   | msg,T |
 >-|  `----|->
   +-------+
generate() None[源代码]
class scapy.pipetool.Pipe(name: str | None = None)[源代码]

基类:object

start() None[源代码]
stop() None[源代码]
class scapy.pipetool.PipeEngine(*pipes: Pipe)[源代码]

基类:ObjectPipe[str]

add(*pipes: Pipe) None[源代码]
add_one_pipe(pipe: Pipe) None[源代码]
get_pipe_list(pipe: Pipe) Set[Any][源代码]
graph(**kargs: Any) None[源代码]
classmethod list_pipes() None[源代码]
classmethod list_pipes_detailed() None[源代码]
pipes: Dict[str, Type[Pipe]] = {'AutoSource': <class 'scapy.pipetool.AutoSource'>, 'CLIFeeder': <class 'scapy.pipetool.CLIFeeder'>, 'CLIHighFeeder': <class 'scapy.pipetool.CLIHighFeeder'>, 'ConsoleSink': <class 'scapy.pipetool.ConsoleSink'>, 'DownDrain': <class 'scapy.pipetool.DownDrain'>, 'Drain': <class 'scapy.pipetool.Drain'>, 'FDSourceSink': <class 'scapy.scapypipes.FDSourceSink'>, 'Inject3Sink': <class 'scapy.scapypipes.Inject3Sink'>, 'InjectSink': <class 'scapy.scapypipes.InjectSink'>, 'PeriodicSource': <class 'scapy.pipetool.PeriodicSource'>, 'Pipe': <class 'scapy.pipetool.Pipe'>, 'QueueSink': <class 'scapy.pipetool.QueueSink'>, 'RawConsoleSink': <class 'scapy.pipetool.RawConsoleSink'>, 'RdpcapSource': <class 'scapy.scapypipes.RdpcapSource'>, 'Sink': <class 'scapy.pipetool.Sink'>, 'SniffSource': <class 'scapy.scapypipes.SniffSource'>, 'Source': <class 'scapy.pipetool.Source'>, 'TCPConnectPipe': <class 'scapy.scapypipes.TCPConnectPipe'>, 'TCPListenPipe': <class 'scapy.scapypipes.TCPListenPipe'>, 'TermSink': <class 'scapy.pipetool.TermSink'>, 'ThreadGenSource': <class 'scapy.pipetool.ThreadGenSource'>, 'TransformDrain': <class 'scapy.pipetool.TransformDrain'>, 'TriggerDrain': <class 'scapy.scapypipes.TriggerDrain'>, 'TriggerSink': <class 'scapy.pipetool.TriggerSink'>, 'TriggeredMessage': <class 'scapy.scapypipes.TriggeredMessage'>, 'TriggeredQueueingValve': <class 'scapy.scapypipes.TriggeredQueueingValve'>, 'TriggeredSwitch': <class 'scapy.scapypipes.TriggeredSwitch'>, 'TriggeredValve': <class 'scapy.scapypipes.TriggeredValve'>, 'UDPClientPipe': <class 'scapy.scapypipes.UDPClientPipe'>, 'UDPDrain': <class 'scapy.scapypipes.UDPDrain'>, 'UDPServerPipe': <class 'scapy.scapypipes.UDPServerPipe'>, 'UpDrain': <class 'scapy.pipetool.UpDrain'>, 'WiresharkSink': <class 'scapy.scapypipes.WiresharkSink'>, 'WrpcapSink': <class 'scapy.scapypipes.WrpcapSink'>}
run() None[源代码]
start() None[源代码]
stop(_cmd: str = 'X') None[源代码]
wait_and_stop() None[源代码]
class scapy.pipetool.QueueSink(name: str | None = None)[源代码]

基类:Sink

Collects messages on the low and high entries into a Queue. Messages are dequeued with recv(). Both high and low entries share the same Queue.

   +-------+
>>-|--.    |->>
   | queue |
 >-|--'    |->
   +-------+
high_push(msg: Any) None[源代码]
push(msg: Any) None[源代码]
recv(block: bool = True, timeout: int | None = None) Any | None[源代码]

Reads the next message from the queue.

If no message is available in the queue, returns None.

参数:
  • block (bool) -- Blocks execution until a packet is available in the queue. Defaults to True.

  • timeout (None, int or float) -- Controls how long to wait if block=True. If None (the default), this method will wait forever. If a non-negative number, this is a number of seconds to wait before giving up (and returning None).

class scapy.pipetool.RawConsoleSink(name: str | None = None, newlines: bool = True)[源代码]

基类:Sink

Print messages on low and high entries, using os.write

   +-------+
>>-|--.    |->>
   | write |
 >-|--'    |->
   +-------+
参数:

newlines (bool) -- Include a new-line character after printing each packet. Defaults to True.

high_push(msg: str) None[源代码]
push(msg: str) None[源代码]
class scapy.pipetool.Sink(name: str | None = None)[源代码]

基类:Pipe

Does nothing; interface to extend for custom sinks.

All sinks have the following constructor parameters:

参数:

name (str) -- a human-readable name for the element

high_push(msg: Any) None[源代码]

Called by PipeEngine when there is a new message for the high entry.

参数:

msg -- The message data

返回:

None

返回类型:

None

push(msg: Any) None[源代码]

Called by PipeEngine when there is a new message for the low entry.

参数:

msg -- The message data

返回:

None

返回类型:

None

class scapy.pipetool.Source(name: str | None = None)[源代码]

基类:Pipe, ObjectPipe[Any]

deliver() None[源代码]
exhausted() bool[源代码]
class scapy.pipetool.TermSink(name: str | None = None, keepterm: bool = True, newlines: bool = True, openearly: bool = True)[源代码]

基类:Sink

Prints messages on the low and high entries, on a separate terminal (xterm or cmd).

   +-------+
>>-|--.    |->>
   | print |
 >-|--'    |->
   +-------+
参数:
  • keepterm (bool) -- Leave the terminal window open after stop() is called. Defaults to True.

  • newlines (bool) -- Include a new-line character after printing each packet. Defaults to True.

  • openearly (bool) -- Automatically starts the terminal when the constructor is called, rather than waiting for start(). Defaults to True.

high_push(msg: str) None[源代码]
push(msg: str) None[源代码]
start() None[源代码]
stop() None[源代码]
class scapy.pipetool.ThreadGenSource(name: str | None = None)[源代码]

基类:AutoSource

generate() None[源代码]
start() None[源代码]
stop() None[源代码]
class scapy.pipetool.TransformDrain(f: Callable[[Any], None], name: str | None = None)[源代码]

基类:Drain

Apply a function to messages on low and high entry:

   +-------+
>>-|--[f]--|->>
   |       |
 >-|--[f]--|->
   +-------+
high_push(msg: Any) None[源代码]
push(msg: Any) None[源代码]
class scapy.pipetool.TriggerSink(name: str | None = None)[源代码]

基类:Sink

on_trigger(msg: Any) None[源代码]
class scapy.pipetool.UpDrain(name: str | None = None)[源代码]

基类:Drain

Repeat messages from low entry to high exit:

   +-------+
>>-|    ,--|->>
   |   /   |
 >-|--'    |->
   +-------+
high_push(msg: Any) None[源代码]
push(msg: Any) None[源代码]