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
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 to
stdout
+-------+ >>-|--. |->> | 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
Collects messages on the low and high entries into a
Queue
. Messages are dequeued withrecv()
. Both high and low entries share the sameQueue
.+-------+ >>-|--. |->> | queue | >-|--' |-> +-------+
-
high_push
(msg)¶
-
push
(msg)¶
-
recv
(block=True, timeout=None)¶ Reads the next message from the queue.
If no message is available in the queue, returns None.
- Parameters
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=None, newlines=True)¶ Bases:
scapy.pipetool.Sink
Print messages on low and high entries, using os.write
+-------+ >>-|--. |->> | write | >-|--' |-> +-------+
- Parameters
newlines (bool) – Include a new-line character after printing each packet. Defaults to True.
-
high_push
(msg)¶
-
push
(msg)¶
-
class
scapy.pipetool.
Sink
(name=None)¶ Bases:
scapy.pipetool.Pipe
Does nothing; interface to extend for custom sinks.
All sinks have the following constructor parameters:
- Parameters
name (str) – a human-readable name for the element
-
high_push
(msg)¶ Called by
PipeEngine
when there is a new message for the high entry.- Parameters
msg – The message data
- Returns
None
- Return type
None
-
push
(msg)¶ Called by
PipeEngine
when there is a new message for the low entry.- Parameters
msg – The message data
- 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
Prints messages on the low and high entries, on a separate terminal (xterm or cmd).
+-------+ >>-|--. |->> | print | >-|--' |-> +-------+
- Parameters
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)¶
-
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)¶
-