scapy.pipetool module

class scapy.pipetool.AutoSource(name=None)

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

check_recv()

DEV: will be called only once (at beginning) to check if the object is ready.

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

Bases: scapy.pipetool.AutoSource

Send messages from python command line:

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

Bases: scapy.pipetool.CLIFeeder

Send messages from python command line to high output:

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

Bases: scapy.pipetool.Sink

Print messages on low and high entries:

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

Bases: scapy.pipetool.Drain

Repeat messages from high entry to low exit:

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

Bases: scapy.pipetool.Pipe

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

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

Bases: scapy.pipetool.ThreadGenSource

Generage messages periodically on low exit:

   +-------+
>>-|       |->>
   | 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()

As select.select is not available, we check if there is some data to read by using a list that stores pointers.

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

Collect messages from high and low entries and queue them. Messages are unqueued with the .recv() method:

   +-------+
>>-|--.    |->>
   | queue |
 >-|--'    |->
   +-------+
high_push(msg)
push(msg)
recv(block=True, timeout=None)
class scapy.pipetool.RawConsoleSink(name=None, newlines=True)

Bases: scapy.pipetool.Sink

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

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

Bases: scapy.pipetool.Pipe

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

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

check_recv()

DEV: will be called only once (at beginning) to check if the object is ready.

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

Bases: scapy.pipetool.Sink

Print messages on low and high entries on a separate terminal:

   +-------+
>>-|--.    |->>
   | print |
 >-|--'    |->
   +-------+
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

Apply a function to messages on low and high entry:

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

Bases: scapy.pipetool.Drain

Repeat messages from low entry to high exit:

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