scapy.pipetool

class scapy.pipetool.AutoSource(name=None)

Bases: scapy.pipetool.Source, scapy.automaton.SelectableObject

check_recv()
deliver()
fileno()
class scapy.pipetool.CLIFeeder(name=None)

Bases: scapy.pipetool.AutoSource

从python命令行发送消息:

   +--------+
>>-|        |->>
   | send() |
 >-|   `----|->
   +--------+
close()
send(msg)
class scapy.pipetool.CLIHighFeeder(name=None)

Bases: scapy.pipetool.CLIFeeder

从python命令行发送消息到高输出:

   +--------+
>>-|   .----|->>
   | send() |
 >-|        |->
   +--------+
send(msg)
class scapy.pipetool.ConsoleSink(name=None)

Bases: scapy.pipetool.Sink

将高低条目上的消息打印到stdout

   +-------+
>>-|--.    |->>
   | print |
 >-|--'    |->
   +-------+
high_push(msg)
push(msg)
class scapy.pipetool.DownDrain(name=None)

Bases: scapy.pipetool.Drain

从高入口到低出口重复消息:

   +-------+
>>-|--.    |->>
   |   \   |
 >-|    `--|->
   +-------+
high_push(msg)
push(msg)
class scapy.pipetool.Drain(name=None)

Bases: scapy.pipetool.Pipe

将消息从低/高条目重复到(分别)低/高退出

   +-------+
>>-|-------|->>
   |       |
 >-|-------|->
   +-------+
high_push(msg)
push(msg)
start()
stop()
class scapy.pipetool.PeriodicSource(msg, period, period2=0, name=None)

Bases: scapy.pipetool.ThreadGenSource

在低退出时定期生成消息:

   +-------+
>>-|       |->>
   | msg,T |
 >-|  `----|->
   +-------+
generate()
class scapy.pipetool.Pipe(name=None)

Bases: scapy.pipetool._ConnectorLogic

class scapy.pipetool.PipeEngine(*pipes)

Bases: scapy.automaton.SelectableObject

add(*pipes)
add_one_pipe(pipe)
check_recv()

由于select.select不可用,因此我们使用存储指针的列表来检查是否有一些数据要读取.

fileno()
get_pipe_list(pipe)
graph(**kargs)
classmethod list_pipes()
classmethod list_pipes_detailed()
pipes = {'AutoSource': <class 'scapy.pipetool.AutoSource'>, 'CLIFeeder': <class 'scapy.pipetool.CLIFeeder'>, 'CLIHighFeeder': <class 'scapy.pipetool.CLIHighFeeder'>, 'ConsoleSink': <class 'scapy.pipetool.ConsoleSink'>, 'ConvertPipe': <class 'scapy.scapypipes.ConvertPipe'>, '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'>, 'TriggeredMessage': <class 'scapy.scapypipes.TriggeredMessage'>, 'TriggeredQueueingValve': <class 'scapy.scapypipes.TriggeredQueueingValve'>, 'TriggeredSwitch': <class 'scapy.scapypipes.TriggeredSwitch'>, 'TriggeredValve': <class 'scapy.scapypipes.TriggeredValve'>, 'UDPDrain': <class 'scapy.scapypipes.UDPDrain'>, 'UpDrain': <class 'scapy.pipetool.UpDrain'>, 'WiresharkSink': <class 'scapy.scapypipes.WiresharkSink'>, 'WrpcapSink': <class 'scapy.scapypipes.WrpcapSink'>}
run()
start()
stop(_cmd='X')
wait_and_stop()
class scapy.pipetool.QueueSink(name=None)

Bases: scapy.pipetool.Sink

将低和高条目上的消息收集到Queue . 消息使用recv()出队. 高条目和低条目都共享相同的Queue .

   +-------+
>>-|--.    |->>
   | queue |
 >-|--'    |->
   +-------+
high_push(msg)
push(msg)
recv(block=True, timeout=None)

从队列中读取下一条消息.

如果队列中没有可用消息,则返回None.

Parameters
  • blockbool )–阻止执行,直到队列中有可用数据包为止. 默认为True.

  • 超时 整数 浮点数 )–如果block=True则控制等待多长时间. 如果为None(默认值),则此方法将永远等待. 如果为非负数,则为放弃(并返回无)之前要等待的秒数.

class scapy.pipetool.RawConsoleSink(name=None, newlines=True)

Bases: scapy.pipetool.Sink

使用os.write在高低条目上打印消息

   +-------+
>>-|--.    |->>
   | write |
 >-|--'    |->
   +-------+
Parameters

换行符bool )–打印每个数据包后,请包含换行符 . 默认为True.

high_push(msg)
push(msg)
class scapy.pipetool.Sink(name=None)

Bases: scapy.pipetool.Pipe

什么也没做; 接口以扩展自定义接收器.

所有接收器均具有以下构造函数参数:

Parameters

名称str )–元素的可读名称

high_push(msg)

当有新的高位消息PipeEngine时,由PipeEngine调用.

Parameters

msg –消息数据

Returns

None

Return type

None

push(msg)

当低端条目有PipeEngine时,由PipeEngine调用.

Parameters

msg –消息数据

Returns

None

Return type

None

start()
stop()
class scapy.pipetool.Source(name=None)

Bases: scapy.pipetool.Pipe, scapy.automaton.SelectableObject

check_recv()
deliver()
exhausted()
fileno()
start()
stop()
class scapy.pipetool.TermSink(name=None, keepterm=True, newlines=True, openearly=True)

Bases: scapy.pipetool.Sink

在单独的终端(xterm或cmd)上的低和高条目上打印消息.

   +-------+
>>-|--.    |->>
   | print |
 >-|--'    |->
   +-------+
Parameters
  • keeptermbool )–在调用stop()之后使终端窗口保持打开状态. 默认为True.

  • 换行符bool )–打印每个数据包后,请包含换行符 . 默认为True.

  • openearlybool )–调用构造函数时自动启动终端,而不是等待start() . 默认为True.

high_push(msg)
push(msg)
start()
stop()
class scapy.pipetool.ThreadGenSource(name=None)

Bases: scapy.pipetool.AutoSource

generate()
start()
stop()
class scapy.pipetool.TransformDrain(f, name=None)

Bases: scapy.pipetool.Drain

将函数应用于高低输入的消息:

   +-------+
>>-|--[f]--|->>
   |       |
 >-|--[f]--|->
   +-------+
high_push(msg)
push(msg)
class scapy.pipetool.UpDrain(name=None)

Bases: scapy.pipetool.Drain

从低入口到高出口重复消息:

   +-------+
>>-|    ,--|->>
   |   /   |
 >-|--'    |->
   +-------+
high_push(msg)
push(msg)