id int64 0 328k | repository_name stringlengths 7 58 | file_path stringlengths 9 302 | class_name stringlengths 5 256 | human_written_code stringlengths 16 2.16M | class_skeleton stringlengths 18 1.49M ⌀ | total_program_units int64 1 1.76k | total_doc_str int64 0 771 | AvgCountLine float64 0 7.89k | AvgCountLineBlank float64 0 297 | AvgCountLineCode float64 0 7.89k | AvgCountLineComment float64 0 7.89k | AvgCyclomatic float64 0 130 | CommentToCodeRatio float64 0 168 | CountClassBase float64 0 40 | CountClassCoupled float64 0 583 | CountClassCoupledModified float64 0 575 | CountClassDerived float64 0 5.35k | CountDeclInstanceMethod float64 0 529 | CountDeclInstanceVariable float64 0 296 | CountDeclMethod float64 0 599 | CountDeclMethodAll float64 0 1.12k | CountLine float64 1 40.4k | CountLineBlank float64 0 8.16k | CountLineCode float64 1 25.7k | CountLineCodeDecl float64 1 8.15k | CountLineCodeExe float64 0 24.2k | CountLineComment float64 0 16.5k | CountStmt float64 1 9.71k | CountStmtDecl float64 1 8.15k | CountStmtExe float64 0 9.69k | MaxCyclomatic float64 0 759 | MaxInheritanceTree float64 0 16 | MaxNesting float64 0 34 | SumCyclomatic float64 0 2.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
30,400 | secdev/scapy | secdev_scapy/scapy/packet.py | scapy.packet.Packet | from scapy.error import Scapy_Exception, log_runtime, warning
import time
from scapy.fields import AnyField, BitField, ConditionalField, Emph, EnumField, Field, FlagsField, FlagValue, MayEnd, MultiEnumField, MultipleTypeField, PadField, PacketListField, RawVal, StrField
from scapy.volatile import RandField, VolatileVal... |
class Packet(BasePacket, _CanvasDumpExtended, metaclass=Packet_metaclass):
@classmethod
def from_hexcap(cls):
pass
@classmethod
def upper_bonds(self):
pass
@classmethod
def lower_bonds(self):
pass
def __init__(self, _pkt=b'', post_transform=None, _internal=0, _unde... | 113 | 53 | 16 | 1 | 13 | 4 | 3 | 0.34 | 3 | 39 | 14 | 1,918 | 92 | 22 | 95 | 119 | 1,710 | 154 | 1,233 | 363 | 1,093 | 419 | 961 | 323 | 858 | 20 | 3 | 6 | 342 |
30,401 | secdev/scapy | secdev_scapy/scapy/packet.py | scapy.packet.Padding | from scapy.compat import raw, orb, bytes_encode
class Padding(Raw):
name = 'Padding'
def self_build(self):
return b''
def build_padding(self):
return (bytes_encode(self.load) if self.raw_packet_cache is None else self.raw_packet_cache) + self.payload.build_padding() |
class Padding(Raw):
def self_build(self):
pass
def build_padding(self):
pass | 3 | 0 | 5 | 0 | 4 | 1 | 2 | 0.22 | 1 | 0 | 0 | 0 | 2 | 0 | 2 | 124 | 13 | 2 | 9 | 4 | 6 | 2 | 6 | 4 | 3 | 2 | 5 | 0 | 3 |
30,402 | secdev/scapy | secdev_scapy/scapy/packet.py | scapy.packet.Raw | from scapy.config import conf, _version_checker
from scapy.compat import raw, orb, bytes_encode
from scapy.fields import AnyField, BitField, ConditionalField, Emph, EnumField, Field, FlagsField, FlagValue, MayEnd, MultiEnumField, MultipleTypeField, PadField, PacketListField, RawVal, StrField
class Raw(Packet):
nam... |
class Raw(Packet):
def __init__(self, _pkt=b'', *args, **kwargs):
pass
def answers(self, other):
pass
def mysummary(self):
pass | 4 | 0 | 7 | 0 | 6 | 1 | 2 | 0.14 | 1 | 3 | 0 | 4 | 3 | 0 | 3 | 122 | 27 | 3 | 21 | 8 | 17 | 3 | 19 | 8 | 15 | 3 | 4 | 2 | 7 |
30,403 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.AutoSource | from scapy.automaton import Message, ObjectPipe, select_objects
class AutoSource(Source):
def __init__(self, name=None):
Source.__init__(self, name=name)
def _gen_data(self, msg):
ObjectPipe.send(self, (msg, False, False))
def _gen_high_data(self, msg):
ObjectPipe.send(self, (msg... |
class AutoSource(Source):
def __init__(self, name=None):
pass
def _gen_data(self, msg):
pass
def _gen_high_data(self, msg):
pass
def _exhaust(self):
pass
def deliver(self):
pass | 6 | 0 | 4 | 0 | 3 | 1 | 1 | 0.35 | 1 | 0 | 0 | 2 | 5 | 0 | 5 | 54 | 26 | 4 | 17 | 7 | 11 | 6 | 16 | 7 | 10 | 3 | 5 | 1 | 7 |
30,404 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.CLIFeeder | class CLIFeeder(AutoSource):
"""Send messages from python command line:
.. code::
+--------+
>>-| |->>
| send() |
>-| `----|->
+--------+
"""
def send(self, msg):
self._gen_data(msg)
return 1
def close(self):
self.is_exhaus... | class CLIFeeder(AutoSource):
'''Send messages from python command line:
.. code::
+--------+
>>-| |->>
| send() |
>-| `----|->
+--------+
'''
def send(self, msg):
pass
def close(self):
pass | 3 | 1 | 4 | 0 | 3 | 1 | 1 | 1.67 | 1 | 0 | 0 | 1 | 2 | 1 | 2 | 56 | 20 | 4 | 6 | 4 | 3 | 10 | 6 | 4 | 3 | 1 | 6 | 0 | 2 |
30,405 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.CLIHighFeeder | class CLIHighFeeder(CLIFeeder):
"""Send messages from python command line to high output:
.. code::
+--------+
>>-| .----|->>
| send() |
>-| |->
+--------+
"""
def send(self, msg):
self._gen_high_data(msg)
return 1 | class CLIHighFeeder(CLIFeeder):
'''Send messages from python command line to high output:
.. code::
+--------+
>>-| .----|->>
| send() |
>-| |->
+--------+
'''
def send(self, msg):
pass | 2 | 1 | 4 | 0 | 3 | 1 | 1 | 2.25 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 57 | 16 | 3 | 4 | 2 | 2 | 9 | 4 | 2 | 2 | 1 | 7 | 0 | 1 |
30,406 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.ConsoleSink | class ConsoleSink(Sink):
"""Print messages on low and high entries to ``stdout``
.. code::
+-------+
>>-|--. |->>
| print |
>-|--' |->
+-------+
"""
def push(self, msg):
print('>' + repr(msg))
def high_push(self, msg):
print('>>' + re... | class ConsoleSink(Sink):
'''Print messages on low and high entries to ``stdout``
.. code::
+-------+
>>-|--. |->>
| print |
>-|--' |->
+-------+
'''
def push(self, msg):
pass
def high_push(self, msg):
pass | 3 | 1 | 3 | 0 | 2 | 1 | 1 | 2 | 1 | 0 | 0 | 0 | 2 | 0 | 2 | 34 | 19 | 4 | 5 | 3 | 2 | 10 | 5 | 3 | 2 | 1 | 5 | 0 | 2 |
30,407 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.DownDrain | class DownDrain(Drain):
"""Repeat messages from high entry to low exit:
.. code::
+-------+
>>-|--. |->>
| \\ |
>-| `--|->
+-------+
"""
def push(self, msg):
pass
def high_push(self, msg):
self._send(msg) | class DownDrain(Drain):
'''Repeat messages from high entry to low exit:
.. code::
+-------+
>>-|--. |->>
| \ |
>-| `--|->
+-------+
'''
def push(self, msg):
pass
def high_push(self, msg):
pass | 3 | 1 | 3 | 0 | 2 | 1 | 1 | 2 | 1 | 0 | 0 | 0 | 2 | 0 | 2 | 30 | 19 | 4 | 5 | 3 | 2 | 10 | 5 | 3 | 2 | 1 | 5 | 0 | 2 |
30,408 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.Drain | class Drain(Pipe):
"""Repeat messages from low/high entries to (resp.) low/high exits
.. code::
+-------+
>>-|-------|->>
| |
>-|-------|->
+-------+
"""
def push(self, msg):
self._send(msg)
def high_push(self, msg):
self._high_send(m... | class Drain(Pipe):
'''Repeat messages from low/high entries to (resp.) low/high exits
.. code::
+-------+
>>-|-------|->>
| |
>-|-------|->
+-------+
'''
def push(self, msg):
pass
def high_push(self, msg):
pass | 3 | 1 | 3 | 0 | 2 | 1 | 1 | 2 | 1 | 0 | 0 | 9 | 2 | 0 | 2 | 28 | 19 | 4 | 5 | 3 | 2 | 10 | 5 | 3 | 2 | 1 | 4 | 0 | 2 |
30,409 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.PeriodicSource | import time
class PeriodicSource(ThreadGenSource):
"""Generate messages periodically on low exit:
.. code::
+-------+
>>-| |->>
| msg,T |
>-| `----|->
+-------+
"""
def __init__(self, msg, period, period2=0, name=None):
ThreadGenSource.__init__(... |
class PeriodicSource(ThreadGenSource):
'''Generate messages periodically on low exit:
.. code::
+-------+
>>-| |->>
| msg,T |
>-| `----|->
+-------+
'''
def __init__(self, msg, period, period2=0, name=None):
pass
def generate(self):
p... | 3 | 1 | 11 | 0 | 10 | 2 | 3 | 0.55 | 1 | 3 | 0 | 0 | 2 | 4 | 2 | 60 | 34 | 4 | 20 | 9 | 17 | 11 | 19 | 9 | 16 | 4 | 7 | 2 | 6 |
30,410 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.Pipe | from scapy.config import conf
class Pipe(metaclass=_PipeMeta):
def __init__(self, name=None):
self.sources = set()
self.sinks = set()
self.high_sources = set()
self.high_sinks = set()
self.trigger_sources = set()
self.trigger_sinks = set()
if name is None:
... |
class Pipe(metaclass=_PipeMeta):
def __init__(self, name=None):
pass
def _send(self, msg):
pass
def _high_send(self, msg):
pass
def _trigger(self, msg=None):
pass
def __gt__(self, other):
pass
def __rshift__(self, other):
pass
def __xor... | 13 | 0 | 7 | 0 | 6 | 2 | 2 | 0.36 | 1 | 1 | 0 | 3 | 12 | 7 | 12 | 26 | 101 | 14 | 75 | 25 | 62 | 27 | 69 | 25 | 56 | 10 | 3 | 2 | 25 |
30,411 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.PipeEngine | from scapy.error import log_runtime, warning
from threading import Lock, Thread
from scapy.automaton import Message, ObjectPipe, select_objects
from scapy.utils import get_temp_file, do_graph
class PipeEngine(ObjectPipe[str]):
pipes = {}
@classmethod
def list_pipes(cls):
for pn, pc in sorted(cls.p... |
class PipeEngine(ObjectPipe[str]):
@classmethod
def list_pipes(cls):
pass
@classmethod
def list_pipes_detailed(cls):
pass
def __init__(self, *pipes):
pass
def __getattr__(self, attr):
pass
def f(*args, **kargs):
... | 20 | 0 | 11 | 0 | 10 | 2 | 3 | 0.19 | 1 | 8 | 3 | 0 | 13 | 7 | 15 | 34 | 198 | 15 | 166 | 59 | 144 | 31 | 151 | 54 | 133 | 13 | 2 | 6 | 55 |
30,412 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.QueueSink | import queue
from typing import Any, Callable, Dict, Iterable, Optional, Set, Tuple, Union, Type, TypeVar, cast
class QueueSink(Sink):
"""
Collects messages on the low and high entries into a :py:class:`Queue`.
Messages are dequeued with :py:meth:`recv`.
Both high and low entries share the same :py:cla... |
class QueueSink(Sink):
'''
Collects messages on the low and high entries into a :py:class:`Queue`.
Messages are dequeued with :py:meth:`recv`.
Both high and low entries share the same :py:class:`Queue`.
.. code::
+-------+
>>-|--. |->>
| queue |
>-|--' |->
... | 5 | 2 | 8 | 1 | 3 | 4 | 1 | 2.08 | 1 | 2 | 0 | 0 | 4 | 1 | 4 | 36 | 48 | 8 | 13 | 6 | 8 | 27 | 13 | 6 | 8 | 2 | 5 | 1 | 5 |
30,413 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.RawConsoleSink | import os
class RawConsoleSink(Sink):
"""Print messages on low and high entries, using os.write
.. code::
+-------+
>>-|--. |->>
| write |
>-|--' |->
+-------+
:param newlines: Include a new-line character after printing each packet.
Def... |
class RawConsoleSink(Sink):
'''Print messages on low and high entries, using os.write
.. code::
+-------+
>>-|--. |->>
| write |
>-|--' |->
+-------+
:param newlines: Include a new-line character after printing each packet.
Defaults to True... | 4 | 1 | 5 | 0 | 4 | 1 | 2 | 1.08 | 1 | 0 | 0 | 0 | 3 | 2 | 3 | 35 | 33 | 6 | 13 | 6 | 9 | 14 | 13 | 6 | 9 | 2 | 5 | 1 | 5 |
30,414 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.Sink | class Sink(Pipe):
"""
Does nothing; interface to extend for custom sinks.
All sinks have the following constructor parameters:
:param name: a human-readable name for the element
:type name: str
"""
def push(self, msg):
"""
Called by :py:class:`PipeEngine` when there is a n... | class Sink(Pipe):
'''
Does nothing; interface to extend for custom sinks.
All sinks have the following constructor parameters:
:param name: a human-readable name for the element
:type name: str
'''
def push(self, msg):
'''
Called by :py:class:`PipeEngine` when there is a new... | 7 | 3 | 7 | 0 | 3 | 3 | 1 | 1.24 | 1 | 0 | 0 | 7 | 6 | 0 | 6 | 32 | 56 | 9 | 21 | 7 | 14 | 26 | 21 | 7 | 14 | 1 | 4 | 0 | 6 |
30,415 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.Source | from scapy.automaton import Message, ObjectPipe, select_objects
from typing import Any, Callable, Dict, Iterable, Optional, Set, Tuple, Union, Type, TypeVar, cast
class Source(Pipe, ObjectPipe[Any]):
def __init__(self, name=None):
ObjectPipe.__init__(self, name)
Pipe.__init__(self, name=name)
... |
class Source(Pipe, ObjectPipe[Any]):
def __init__(self, name=None):
pass
def _read_message(self):
pass
def deliver(self):
pass
def exhausted(self):
pass | 5 | 0 | 4 | 0 | 3 | 1 | 1 | 0.33 | 2 | 1 | 1 | 5 | 4 | 1 | 4 | 49 | 19 | 3 | 12 | 7 | 7 | 4 | 12 | 7 | 7 | 1 | 4 | 0 | 4 |
30,416 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.TermSink | from scapy.config import conf
from scapy.consts import WINDOWS
import os
from scapy.utils import get_temp_file, do_graph
import subprocess
class TermSink(Sink):
"""
Prints messages on the low and high entries, on a separate terminal (xterm
or cmd).
.. code::
+-------+
>>-|--. |->>
... |
class TermSink(Sink):
'''
Prints messages on the low and high entries, on a separate terminal (xterm
or cmd).
.. code::
+-------+
>>-|--. |->>
| print |
>-|--' |->
+-------+
:param keepterm: Leave the terminal window open after :py:meth:`~Pipe.stop`
... | 11 | 1 | 9 | 0 | 8 | 2 | 2 | 0.46 | 1 | 3 | 0 | 0 | 10 | 9 | 10 | 42 | 124 | 12 | 78 | 29 | 65 | 36 | 67 | 28 | 55 | 4 | 5 | 2 | 22 |
30,417 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.ThreadGenSource | from threading import Lock, Thread
class ThreadGenSource(AutoSource):
def __init__(self, name=None):
AutoSource.__init__(self, name=name)
self.RUN = False
def generate(self):
pass
def start(self):
self.RUN = True
Thread(target=self.generate, name='scapy.pipetool.T... |
class ThreadGenSource(AutoSource):
def __init__(self, name=None):
pass
def generate(self):
pass
def start(self):
pass
def stop(self):
pass | 5 | 0 | 4 | 0 | 3 | 1 | 1 | 0.33 | 1 | 1 | 0 | 1 | 4 | 1 | 4 | 58 | 19 | 3 | 12 | 6 | 7 | 4 | 11 | 6 | 6 | 1 | 6 | 0 | 4 |
30,418 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.TransformDrain | class TransformDrain(Drain):
"""Apply a function to messages on low and high entry:
.. code::
+-------+
>>-|--[f]--|->>
| |
>-|--[f]--|->
+-------+
"""
def __init__(self, f, name=None):
Drain.__init__(self, name=name)
self.f = f
def p... | class TransformDrain(Drain):
'''Apply a function to messages on low and high entry:
.. code::
+-------+
>>-|--[f]--|->>
| |
>-|--[f]--|->
+-------+
'''
def __init__(self, f, name=None):
pass
def push(self, msg):
pass
def high_push(... | 4 | 1 | 3 | 0 | 2 | 1 | 1 | 1.38 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 31 | 24 | 5 | 8 | 5 | 4 | 11 | 8 | 5 | 4 | 1 | 5 | 0 | 3 |
30,419 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.TriggerSink | class TriggerSink(Sink):
def on_trigger(self, msg):
pass | class TriggerSink(Sink):
def on_trigger(self, msg):
pass | 2 | 0 | 3 | 0 | 2 | 1 | 1 | 0.33 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 33 | 4 | 0 | 3 | 2 | 1 | 1 | 3 | 2 | 1 | 1 | 5 | 0 | 1 |
30,420 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool.UpDrain | class UpDrain(Drain):
"""Repeat messages from low entry to high exit:
.. code::
+-------+
>>-| ,--|->>
| / |
>-|--' |->
+-------+
"""
def push(self, msg):
self._high_send(msg)
def high_push(self, msg):
pass | class UpDrain(Drain):
'''Repeat messages from low entry to high exit:
.. code::
+-------+
>>-| ,--|->>
| / |
>-|--' |->
+-------+
'''
def push(self, msg):
pass
def high_push(self, msg):
pass | 3 | 1 | 3 | 0 | 2 | 1 | 1 | 2 | 1 | 0 | 0 | 0 | 2 | 0 | 2 | 30 | 19 | 4 | 5 | 3 | 2 | 10 | 5 | 3 | 2 | 1 | 5 | 0 | 2 |
30,421 | secdev/scapy | secdev_scapy/scapy/pipetool.py | scapy.pipetool._PipeMeta | from typing import Any, Callable, Dict, Iterable, Optional, Set, Tuple, Union, Type, TypeVar, cast
class _PipeMeta(type):
def __new__(cls, name, bases, dct):
c = cast('Type[Pipe]', super(_PipeMeta, cls).__new__(cls, name, bases, dct))
PipeEngine.pipes[name] = c
return c |
class _PipeMeta(type):
def __new__(cls, name, bases, dct):
pass | 2 | 0 | 10 | 0 | 9 | 4 | 1 | 0.4 | 1 | 2 | 1 | 1 | 1 | 0 | 1 | 14 | 11 | 0 | 10 | 7 | 4 | 4 | 5 | 3 | 3 | 1 | 2 | 0 | 1 |
30,422 | secdev/scapy | secdev_scapy/scapy/plist.py | scapy.plist.PacketList | from scapy.base_classes import BasePacket, BasePacketList, PacketList_metaclass, SetGen, _CanvasDumpExtended
from scapy.packet import Packet
class PacketList(_PacketList[Packet], BasePacketList[Packet], _CanvasDumpExtended):
def sr(self, multi=False, lookahead=None):
"""
Matches packets in the lis... |
class PacketList(_PacketList[Packet], BasePacketList[Packet], _CanvasDumpExtended):
def sr(self, multi=False, lookahead=None):
'''
Matches packets in the list
:param multi: True if a packet can have multiple answers
:param lookahead: Maximum number of packets between packet and ans... | 2 | 1 | 36 | 1 | 26 | 10 | 7 | 0.34 | 3 | 1 | 1 | 1 | 1 | 0 | 1 | 42 | 39 | 1 | 29 | 10 | 25 | 10 | 27 | 8 | 25 | 7 | 3 | 4 | 7 |
30,423 | secdev/scapy | secdev_scapy/scapy/plist.py | scapy.plist.SndRcvList | from scapy.base_classes import BasePacket, BasePacketList, PacketList_metaclass, SetGen, _CanvasDumpExtended
class SndRcvList(_PacketList[QueryAnswer], BasePacketList[QueryAnswer], _CanvasDumpExtended):
__slots__ = []
def __init__(self, res=None, name='Results', stats=None):
super(SndRcvList, self).__... |
class SndRcvList(_PacketList[QueryAnswer], BasePacketList[QueryAnswer], _CanvasDumpExtended):
def __init__(self, res=None, name='Results', stats=None):
pass
def _elt2pkt(self, elt):
pass
def _elt2sum(self, elt):
pass | 4 | 0 | 4 | 0 | 3 | 2 | 1 | 0.5 | 3 | 1 | 0 | 3 | 3 | 0 | 3 | 44 | 20 | 3 | 14 | 11 | 4 | 7 | 8 | 5 | 4 | 1 | 3 | 0 | 3 |
30,424 | secdev/scapy | secdev_scapy/scapy/plist.py | scapy.plist._PacketList | from scapy.base_classes import BasePacket, BasePacketList, PacketList_metaclass, SetGen, _CanvasDumpExtended
from typing import Any, Callable, DefaultDict, Dict, Generic, Iterator, List, Optional, Tuple, Type, TypeVar, Union, TYPE_CHECKING
from scapy.utils import do_graph, hexdump, make_table, make_lined_table, make_te... |
class _PacketList(Generic[_Inner], metaclass=PacketList_metaclass):
def __init__(self, res=None, name='PacketList', stats=None):
'''create a packet list from a list of packets
res: the list of packets
stats: a list of classes that will appear in the stats (defaults to [TCP,UDP,ICMP])'''... | 37 | 24 | 19 | 1 | 14 | 6 | 4 | 0.47 | 2 | 14 | 2 | 2 | 33 | 3 | 33 | 35 | 673 | 70 | 450 | 170 | 355 | 212 | 323 | 115 | 283 | 17 | 1 | 7 | 130 |
30,425 | secdev/scapy | secdev_scapy/scapy/route.py | scapy.route.Route | from scapy.error import Scapy_Exception, warning
from scapy.utils import atol, ltoa, itom, pretty_list
from scapy.interfaces import resolve_iface
from scapy.config import conf
from scapy.compat import plain_str
class Route:
def __init__(self):
self.routes = []
self.invalidate_cache()
if co... |
class Route:
def __init__(self):
pass
def invalidate_cache(self):
pass
def resync(self):
pass
def __repr__(self):
pass
def make_route(self, host=None, net=None, gw=None, dev=None, metric=1):
pass
def add(self, *args, **kargs):
'''Add a route... | 13 | 3 | 17 | 1 | 12 | 5 | 4 | 0.43 | 0 | 8 | 1 | 0 | 12 | 2 | 12 | 12 | 214 | 23 | 145 | 54 | 125 | 63 | 124 | 48 | 110 | 14 | 0 | 2 | 43 |
30,426 | secdev/scapy | secdev_scapy/scapy/route6.py | scapy.route6.Route6 | from scapy.pton_ntop import inet_pton, inet_ntop
from scapy.utils import pretty_list
from scapy.interfaces import resolve_iface, NetworkInterface
from scapy.config import conf
import socket
from scapy.utils6 import in6_ptop, in6_cidr2mask, in6_and, in6_islladdr, in6_ismlladdr, in6_isincluded, in6_isgladdr, in6_isaddr6t... |
class Route6:
def __init__(self):
pass
def invalidate_cache(self):
pass
def flush(self):
pass
def resync(self):
pass
def __repr__(self):
pass
def make_route(self, dst, gw=None, dev=None):
'''Internal function : create a route for 'dst' via '... | 14 | 7 | 21 | 2 | 13 | 7 | 4 | 0.53 | 0 | 5 | 0 | 0 | 13 | 3 | 13 | 13 | 292 | 43 | 174 | 62 | 156 | 93 | 155 | 58 | 141 | 20 | 0 | 3 | 48 |
30,427 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.FDSourceSink | from scapy.pipetool import Source, Drain, Sink
class FDSourceSink(Source):
"""Use a file descriptor as source and sink
.. code::
+-------------+
>>-| |->>
| |
>-|-[file desc]-|->
+-------------+
"""
def __init__(self, fd, name=None):
... |
class FDSourceSink(Source):
'''Use a file descriptor as source and sink
.. code::
+-------------+
>>-| |->>
| |
>-|-[file desc]-|->
+-------------+
'''
def __init__(self, fd, name=None):
pass
def push(self, msg):
pass... | 5 | 1 | 3 | 0 | 2 | 1 | 1 | 1.2 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 53 | 28 | 6 | 10 | 6 | 5 | 12 | 10 | 6 | 5 | 1 | 5 | 0 | 4 |
30,428 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.Inject3Sink | from scapy.config import conf
class Inject3Sink(InjectSink):
def start(self):
self.s = conf.L3socket(iface=self.iface) |
class Inject3Sink(InjectSink):
def start(self):
pass | 2 | 0 | 3 | 0 | 2 | 1 | 1 | 0.33 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 37 | 4 | 0 | 3 | 3 | 1 | 1 | 3 | 3 | 1 | 1 | 6 | 0 | 1 |
30,429 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.InjectSink | from scapy.config import conf
from scapy.pipetool import Source, Drain, Sink
class InjectSink(Sink):
"""Packets received on low input are injected to an interface
.. code::
+-----------+
>>-| |->>
| |
>-|--[iface] |->
+-----------+
"""
def... |
class InjectSink(Sink):
'''Packets received on low input are injected to an interface
.. code::
+-----------+
>>-| |->>
| |
>-|--[iface] |->
+-----------+
'''
def __init__(self, iface=None, name=None):
pass
def start(self):
... | 5 | 1 | 4 | 0 | 3 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 4 | 2 | 4 | 36 | 30 | 6 | 12 | 7 | 7 | 12 | 12 | 7 | 7 | 2 | 5 | 1 | 5 |
30,430 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.RdpcapSource | from scapy.pipetool import Source, Drain, Sink
from scapy.utils import ContextManagerSubprocess, PcapReader, PcapWriter
class RdpcapSource(Source):
"""Read packets from a PCAP file send them to low exit.
.. code::
+----------+
>>-| |->>
| |
>-| [pcap]--|->
... |
class RdpcapSource(Source):
'''Read packets from a PCAP file send them to low exit.
.. code::
+----------+
>>-| |->>
| |
>-| [pcap]--|->
+----------+
'''
def __init__(self, fname, name=None):
pass
def start(self):
pass
... | 6 | 1 | 4 | 0 | 3 | 1 | 1 | 0.72 | 1 | 2 | 1 | 0 | 5 | 3 | 5 | 54 | 38 | 7 | 18 | 10 | 12 | 13 | 18 | 10 | 12 | 2 | 5 | 1 | 6 |
30,431 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.SniffSource | import socket
from typing import Any, Callable, List, Optional, cast
from scapy.config import conf
from scapy.supersocket import SuperSocket
from scapy.pipetool import Source, Drain, Sink
class SniffSource(Source):
"""Read packets from an interface and send them to low exit.
.. code::
+---------... |
class SniffSource(Source):
'''Read packets from an interface and send them to low exit.
.. code::
+-----------+
>>-| |->>
| |
>-| [iface]--|->
+-----------+
If neither of the ``iface`` or ``socket`` parameters are specified, t... | 6 | 1 | 7 | 0 | 6 | 2 | 2 | 0.83 | 1 | 3 | 1 | 0 | 5 | 4 | 5 | 54 | 60 | 11 | 29 | 16 | 18 | 24 | 23 | 11 | 17 | 3 | 5 | 2 | 10 |
30,432 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.TCPConnectPipe | from scapy.pipetool import Source, Drain, Sink
import socket
from typing import Any, Callable, List, Optional, cast
class TCPConnectPipe(Source):
"""TCP connect to addr:port and use it as source and sink
.. code::
+-------------+
>>-| |->>
| |
>-|-[addr:... |
class TCPConnectPipe(Source):
'''TCP connect to addr:port and use it as source and sink
.. code::
+-------------+
>>-| |->>
| |
>-|-[addr:port]-|->
+-------------+
'''
def __init__(self, addr='', port=0, name=None):
pass
def ... | 7 | 1 | 5 | 0 | 4 | 1 | 2 | 0.56 | 1 | 1 | 0 | 2 | 6 | 3 | 6 | 55 | 47 | 8 | 25 | 12 | 18 | 14 | 25 | 12 | 18 | 3 | 5 | 1 | 9 |
30,433 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.TCPListenPipe | import socket
from typing import Any, Callable, List, Optional, cast
from queue import Queue, Empty
class TCPListenPipe(TCPConnectPipe):
"""TCP listen on [addr:]port and use first connection as source and sink;
send peer address to high output
.. code::
+------^------+
>>-| +-[peer]-|->... |
class TCPListenPipe(TCPConnectPipe):
'''TCP listen on [addr:]port and use first connection as source and sink;
send peer address to high output
.. code::
+------^------+
>>-| +-[peer]-|->>
| / |
>-|-[addr:port]-|->
+-------------+
'''
def __init... | 5 | 1 | 10 | 0 | 9 | 1 | 3 | 0.34 | 1 | 3 | 0 | 1 | 4 | 3 | 4 | 59 | 57 | 6 | 38 | 11 | 33 | 13 | 36 | 11 | 31 | 6 | 6 | 3 | 10 |
30,434 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.TriggerDrain | from scapy.pipetool import Source, Drain, Sink
class TriggerDrain(Drain):
"""Pass messages and trigger when a condition is met
.. code::
+------^------+
>>-|-[condition]-|->>
| | |
>-|-[condition]-|->
+-------------+
"""
def __init__(self, f, name=No... |
class TriggerDrain(Drain):
'''Pass messages and trigger when a condition is met
.. code::
+------^------+
>>-|-[condition]-|->>
| | |
>-|-[condition]-|->
+-------------+
'''
def __init__(self, f, name=None):
pass
def push(self, msg):
... | 4 | 1 | 5 | 0 | 4 | 1 | 2 | 0.79 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 31 | 30 | 5 | 14 | 7 | 10 | 11 | 14 | 7 | 10 | 2 | 5 | 1 | 5 |
30,435 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.TriggeredMessage | from scapy.pipetool import Source, Drain, Sink
class TriggeredMessage(Drain):
"""Send a preloaded message when triggered and trigger in chain
.. code::
+------^------+
>>-| | /----|->>
| |/ |
>-|-[ message ]-|->
+------^------+
"""
def __init__(s... |
class TriggeredMessage(Drain):
'''Send a preloaded message when triggered and trigger in chain
.. code::
+------^------+
>>-| | /----|->>
| |/ |
>-|-[ message ]-|->
+------^------+
'''
def __init__(self, msg, name=None):
pass
def on_tr... | 3 | 1 | 5 | 0 | 4 | 1 | 1 | 1.25 | 1 | 0 | 0 | 0 | 2 | 1 | 2 | 30 | 22 | 4 | 8 | 4 | 5 | 10 | 8 | 4 | 5 | 1 | 5 | 0 | 2 |
30,436 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.TriggeredQueueingValve | from scapy.pipetool import Source, Drain, Sink
from queue import Queue, Empty
from typing import Any, Callable, List, Optional, cast
class TriggeredQueueingValve(Drain):
"""Let messages alternatively pass or queued, changing on trigger
.. code::
+------^-------+
>>-|-[pass/queue]-|->>
... |
class TriggeredQueueingValve(Drain):
'''Let messages alternatively pass or queued, changing on trigger
.. code::
+------^-------+
>>-|-[pass/queue]-|->>
| | |
>-|-[pass/queue]-|->
+------^-------+
'''
def __init__(self, start_state=True, name=None):
... | 6 | 1 | 7 | 0 | 6 | 1 | 2 | 0.43 | 1 | 2 | 0 | 0 | 5 | 2 | 5 | 33 | 50 | 7 | 30 | 9 | 24 | 13 | 27 | 9 | 21 | 4 | 5 | 3 | 10 |
30,437 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.TriggeredSwitch | from scapy.pipetool import Source, Drain, Sink
class TriggeredSwitch(Drain):
"""Let messages alternatively high or low, changing on trigger
.. code::
+------^------+
>>-|-\\ | /-|->>
| [up/down] |
>-|-/ | \\-|->
+------^------+
"""
def __init__(s... |
class TriggeredSwitch(Drain):
'''Let messages alternatively high or low, changing on trigger
.. code::
+------^------+
>>-|-\ | /-|->>
| [up/down] |
>-|-/ | \-|->
+------^------+
'''
def __init__(self, start_state=True, name=None):
pass
... | 4 | 1 | 5 | 0 | 4 | 1 | 1 | 0.85 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 31 | 29 | 5 | 13 | 6 | 9 | 11 | 12 | 6 | 8 | 2 | 5 | 1 | 4 |
30,438 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.TriggeredValve | from scapy.pipetool import Source, Drain, Sink
class TriggeredValve(Drain):
"""Let messages alternatively pass or not, changing on trigger
.. code::
+------^------+
>>-|-[pass/stop]-|->>
| | |
>-|-[pass/stop]-|->
+------^------+
"""
def __init__(self, st... |
class TriggeredValve(Drain):
'''Let messages alternatively pass or not, changing on trigger
.. code::
+------^------+
>>-|-[pass/stop]-|->>
| | |
>-|-[pass/stop]-|->
+------^------+
'''
def __init__(self, start_state=True, name=None):
pass
def... | 5 | 1 | 4 | 0 | 3 | 1 | 2 | 0.92 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 32 | 31 | 6 | 13 | 6 | 8 | 12 | 13 | 6 | 8 | 2 | 5 | 1 | 6 |
30,439 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.UDPClientPipe | import socket
class UDPClientPipe(TCPConnectPipe):
"""UDP send packets to addr:port and use it as source and sink
Start trying to receive only once a packet has been send
.. code::
+-------------+
>>-| |->>
| |
>-|-[addr:port]-|->
+---------... |
class UDPClientPipe(TCPConnectPipe):
'''UDP send packets to addr:port and use it as source and sink
Start trying to receive only once a packet has been send
.. code::
+-------------+
>>-| |->>
| |
>-|-[addr:port]-|->
+-------------+
'''
... | 5 | 1 | 6 | 0 | 5 | 1 | 2 | 0.65 | 1 | 1 | 0 | 0 | 4 | 2 | 4 | 59 | 39 | 6 | 20 | 8 | 15 | 13 | 20 | 8 | 15 | 4 | 6 | 1 | 7 |
30,440 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.UDPDrain | from scapy.pipetool import Source, Drain, Sink
from scapy.compat import raw
class UDPDrain(Drain):
"""UDP payloads received on high entry are sent over UDP
.. code::
+-------------+
>>-|--[payload]--|->>
| X |
>-|----[UDP]----|->
+-------------+
"""
... |
class UDPDrain(Drain):
'''UDP payloads received on high entry are sent over UDP
.. code::
+-------------+
>>-|--[payload]--|->>
| X |
>-|----[UDP]----|->
+-------------+
'''
def __init__(self, ip='127.0.0.1', port=1234):
pass
def push(self... | 4 | 1 | 5 | 0 | 4 | 1 | 1 | 0.79 | 1 | 2 | 2 | 0 | 3 | 2 | 3 | 31 | 30 | 5 | 14 | 10 | 8 | 11 | 14 | 10 | 8 | 2 | 5 | 1 | 4 |
30,441 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.UDPServerPipe | import socket
from queue import Queue, Empty
class UDPServerPipe(TCPListenPipe):
"""UDP bind to [addr:]port and use as source and sink
Use (ip, port) from first received IP packet as destination for all data
.. code::
+------^------+
>>-| +-[peer]-|->>
| / |
>-... |
class UDPServerPipe(TCPListenPipe):
'''UDP bind to [addr:]port and use as source and sink
Use (ip, port) from first received IP packet as destination for all data
.. code::
+------^------+
>>-| +-[peer]-|->>
| / |
>-|-[addr:port]-|->
+-------------+
... | 5 | 1 | 9 | 0 | 8 | 1 | 3 | 0.41 | 1 | 1 | 0 | 0 | 4 | 2 | 4 | 63 | 53 | 6 | 34 | 9 | 29 | 14 | 32 | 9 | 27 | 7 | 7 | 3 | 11 |
30,442 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.WiresharkSink | from scapy.utils import ContextManagerSubprocess, PcapReader, PcapWriter
from scapy.config import conf
import subprocess
class WiresharkSink(WrpcapSink):
"""
Streams :py:class:`Packet` from the low entry to Wireshark.
Packets are written into a ``pcap`` stream (like :py:class:`WrpcapSink`),
and stream... |
class WiresharkSink(WrpcapSink):
'''
Streams :py:class:`Packet` from the low entry to Wireshark.
Packets are written into a ``pcap`` stream (like :py:class:`WrpcapSink`),
and streamed to a new Wireshark process on its ``stdin``.
Wireshark is run with the ``-ki -`` arguments, which cause it to treat... | 3 | 1 | 11 | 1 | 8 | 3 | 2 | 1.71 | 1 | 2 | 1 | 0 | 2 | 2 | 2 | 38 | 60 | 15 | 17 | 7 | 14 | 29 | 12 | 7 | 9 | 2 | 6 | 2 | 3 |
30,443 | secdev/scapy | secdev_scapy/scapy/scapypipes.py | scapy.scapypipes.WrpcapSink | from scapy.pipetool import Source, Drain, Sink
from scapy.utils import ContextManagerSubprocess, PcapReader, PcapWriter
class WrpcapSink(Sink):
"""
Writes :py:class:`Packet` on the low entry to a ``pcap`` file.
Ignores all messages on the high entry.
.. note::
Due to limitations of the ``pcap... |
class WrpcapSink(Sink):
'''
Writes :py:class:`Packet` on the low entry to a ``pcap`` file.
Ignores all messages on the high entry.
.. note::
Due to limitations of the ``pcap`` format, all packets **must** be of
the same link type. This class will not mutate packets to conform with
... | 5 | 1 | 5 | 0 | 4 | 1 | 2 | 1.94 | 1 | 1 | 1 | 1 | 4 | 4 | 4 | 36 | 60 | 14 | 16 | 9 | 11 | 31 | 16 | 9 | 11 | 2 | 5 | 1 | 6 |
30,444 | secdev/scapy | secdev_scapy/scapy/sendrecv.py | scapy.sendrecv.AsyncSniffer | from scapy.plist import PacketList, QueryAnswer, SndRcvList
from scapy.utils import get_temp_file, tcpdump, wrpcap, ContextManagerSubprocess, PcapReader, EDecimal
from scapy.sessions import DefaultSession
from scapy.packet import Packet
from scapy.error import log_runtime, log_interactive, Scapy_Exception
from scapy.da... |
class AsyncSniffer(object):
'''
Sniff packets and return a list of packets.
Args:
count: number of packets to capture. 0 means infinity.
store: whether to store sniffed packets or discard them
prn: function to apply to each packet. If something is returned, it
is displa... | 11 | 3 | 32 | 1 | 27 | 7 | 7 | 0.52 | 1 | 15 | 6 | 0 | 6 | 9 | 6 | 6 | 340 | 18 | 230 | 55 | 203 | 120 | 148 | 36 | 137 | 44 | 1 | 7 | 60 |
30,445 | secdev/scapy | secdev_scapy/scapy/sendrecv.py | scapy.sendrecv.SndRcvHandler | import time
from scapy.error import log_runtime, log_interactive, Scapy_Exception
from scapy.config import conf
import itertools
from threading import Thread, Event
from scapy.packet import Packet
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union, cast
import os
from scapy.plist impor... |
class SndRcvHandler(object):
'''
Util to send/receive packets, used by sr*().
Do not use directly.
This matches the requests and answers.
Notes::
- threaded: if you're planning to send/receive many packets, it's likely
a good idea to use threaded mode.
- DEVS: store the outgoing... | 7 | 5 | 38 | 3 | 32 | 7 | 9 | 0.27 | 1 | 13 | 4 | 0 | 6 | 23 | 6 | 6 | 248 | 22 | 193 | 58 | 170 | 52 | 147 | 41 | 140 | 21 | 1 | 5 | 51 |
30,446 | secdev/scapy | secdev_scapy/scapy/sendrecv.py | scapy.sendrecv._FloodGenerator | from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union, cast
from scapy.packet import Packet
from threading import Thread, Event
class _FloodGenerator(object):
def __init__(self, tobesent, maxretries):
self.tobesent = tobesent
self.maxretries = maxretries
self... |
class _FloodGenerator(object):
def __init__(self, tobesent, maxretries):
pass
def __iter__(self):
pass
@property
def sent_time(self):
pass
@sent_time.setter
def sent_time(self):
pass
def stop(self):
pass | 8 | 0 | 6 | 0 | 5 | 1 | 2 | 0.18 | 1 | 1 | 0 | 0 | 5 | 4 | 5 | 5 | 37 | 4 | 28 | 15 | 20 | 5 | 26 | 13 | 20 | 6 | 1 | 3 | 10 |
30,447 | secdev/scapy | secdev_scapy/scapy/sendrecv.py | scapy.sendrecv.debug | from scapy.plist import PacketList, QueryAnswer, SndRcvList
class debug:
recv = PacketList([], 'Received')
sent = PacketList([], 'Sent')
match = SndRcvList([], 'Matched')
crashed_on = None |
class debug:
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 5 | 5 | 4 | 1 | 5 | 5 | 4 | 0 | 0 | 0 | 0 |
30,448 | secdev/scapy | secdev_scapy/scapy/sessions.py | scapy.sessions.DefaultSession | from typing import Any, Callable, DefaultDict, Dict, Iterator, List, Optional, Tuple, Type, cast, TYPE_CHECKING
from scapy.packet import Packet
from scapy.compat import Self
class DefaultSession(object):
"""Default session: no stream decoding"""
def __init__(self, supersession: Optional[Self]=None):
i... |
class DefaultSession(object):
'''Default session: no stream decoding'''
def __init__(self, supersession: Optional[Self]=None):
pass
def process(self, pkt: Packet) -> Optional[Packet]:
'''
Called to pre-process the packet
'''
pass
def recv(self, sock: 'SuperSoc... | 4 | 3 | 7 | 0 | 5 | 2 | 2 | 0.5 | 1 | 0 | 0 | 5 | 3 | 1 | 3 | 3 | 27 | 3 | 16 | 6 | 12 | 8 | 16 | 6 | 12 | 3 | 1 | 1 | 7 |
30,449 | secdev/scapy | secdev_scapy/scapy/sessions.py | scapy.sessions.IPSession | from collections import defaultdict
from typing import Any, Callable, DefaultDict, Dict, Iterator, List, Optional, Tuple, Type, cast, TYPE_CHECKING
from scapy.packet import Packet
class IPSession(DefaultSession):
"""Defragment IP packets 'on-the-flow'.
Usage:
>>> sniff(session=IPSession)
"""
def ... |
class IPSession(DefaultSession):
'''Defragment IP packets 'on-the-flow'.
Usage:
>>> sniff(session=IPSession)
'''
def __init__(self, *args, **kwargs):
pass
def process(self, packet: Packet) -> Optional[Packet]:
pass | 3 | 1 | 6 | 0 | 5 | 2 | 2 | 0.64 | 1 | 2 | 1 | 2 | 2 | 1 | 2 | 5 | 19 | 3 | 11 | 5 | 7 | 7 | 11 | 5 | 7 | 3 | 2 | 1 | 4 |
30,450 | secdev/scapy | secdev_scapy/scapy/sessions.py | scapy.sessions.StringBuffer | from typing import Any, Callable, DefaultDict, Dict, Iterator, List, Optional, Tuple, Type, cast, TYPE_CHECKING
class StringBuffer(object):
"""StringBuffer is an object used to re-order data received during
a TCP transmission.
Each TCP fragment contains a sequence number, which marks
(relatively to th... |
class StringBuffer(object):
'''StringBuffer is an object used to re-order data received during
a TCP transmission.
Each TCP fragment contains a sequence number, which marks
(relatively to the first sequence number) the index of the data contained
in the fragment.
If a TCP fragment is missed, th... | 10 | 1 | 6 | 0 | 4 | 2 | 1 | 0.74 | 1 | 6 | 0 | 0 | 9 | 4 | 9 | 9 | 76 | 11 | 39 | 16 | 29 | 29 | 39 | 16 | 29 | 5 | 1 | 1 | 13 |
30,451 | secdev/scapy | secdev_scapy/scapy/sessions.py | scapy.sessions.TCPSession | import struct
from scapy.config import conf
from scapy.compat import orb
from scapy.pton_ntop import inet_pton
from collections import defaultdict
from typing import Any, Callable, DefaultDict, Dict, Iterator, List, Optional, Tuple, Type, cast, TYPE_CHECKING
import socket
from scapy.packet import Packet
class TCPSessi... |
class TCPSession(IPSession):
'''A Session that reconstructs TCP streams.
NOTE: this has the same effect as wrapping a real socket.socket into StreamSocket,
but for all concurrent TCP streams (can be used on pcaps or sniffed sessions).
NOTE: only protocols that implement a ``tcp_reassemble`` function wi... | 7 | 4 | 36 | 1 | 27 | 9 | 7 | 0.49 | 1 | 7 | 3 | 2 | 5 | 7 | 5 | 10 | 249 | 16 | 162 | 38 | 151 | 79 | 134 | 35 | 125 | 29 | 3 | 4 | 43 |
30,452 | secdev/scapy | secdev_scapy/scapy/supersocket.py | scapy.supersocket.IterSocket | from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, cast
from scapy.plist import PacketList, SndRcvList, _PacketIterable
class IterSocket(SuperSocket):
desc = 'wrapper around an iterable'
nonblocking_socket = True
def __init__(self, obj):
if not obj:
self.iter = iter([... |
class IterSocket(SuperSocket):
def __init__(self, obj):
pass
def _iter(obj=cast(SndRcvList, obj)):
pass
@staticmethod
def select(sockets, remain=None):
pass
def recv(self, x=None, **kwargs):
pass
def close(self):
pass | 7 | 0 | 8 | 0 | 7 | 1 | 3 | 0.18 | 1 | 6 | 2 | 0 | 3 | 1 | 4 | 35 | 43 | 4 | 34 | 13 | 27 | 6 | 28 | 11 | 22 | 6 | 4 | 2 | 13 |
30,453 | secdev/scapy | secdev_scapy/scapy/supersocket.py | scapy.supersocket.L2ListenTcpdump | from scapy.interfaces import network_name
from scapy.data import MTU, ETH_P_IP, ETH_P_IPV6, SOL_PACKET, SO_TIMESTAMPNS
from scapy.config import conf
from scapy.consts import DARWIN, WINDOWS
from scapy.utils import PcapReader, tcpdump
class L2ListenTcpdump(SuperSocket):
desc = 'read packets at layer 2 using tcpdump... |
class L2ListenTcpdump(SuperSocket):
def __init__(self, iface=None, promisc=None, filter=None, nofilter=False, prog=None, quiet=False, *arg, **karg):
pass
def recv(self, x=MTU, **kwargs):
pass
def close(self):
pass
@staticmethod
def select(sockets, remain=None):
pa... | 6 | 0 | 12 | 0 | 11 | 3 | 3 | 0.29 | 1 | 0 | 0 | 0 | 3 | 5 | 4 | 35 | 53 | 4 | 45 | 22 | 30 | 13 | 33 | 12 | 28 | 9 | 4 | 3 | 13 |
30,454 | secdev/scapy | secdev_scapy/scapy/supersocket.py | scapy.supersocket.SimpleSocket | from scapy.data import MTU, ETH_P_IP, ETH_P_IPV6, SOL_PACKET, SO_TIMESTAMPNS
from scapy.consts import DARWIN, WINDOWS
from scapy.config import conf
class SimpleSocket(SuperSocket):
desc = 'wrapper around a classic socket'
__selectable_force_select__ = True
def __init__(self, sock, basecls=None):
s... |
class SimpleSocket(SuperSocket):
def __init__(self, sock, basecls=None):
pass
def recv_raw(self, x=MTU):
pass
@staticmethod
def select(sockets, remain=None):
pass | 5 | 0 | 5 | 0 | 4 | 1 | 1 | 0.19 | 1 | 0 | 0 | 2 | 2 | 3 | 3 | 34 | 22 | 3 | 16 | 11 | 10 | 3 | 15 | 10 | 10 | 2 | 4 | 1 | 4 |
30,455 | secdev/scapy | secdev_scapy/scapy/supersocket.py | scapy.supersocket.StreamSocket | from scapy.packet import Packet, NoPayload
from scapy.data import MTU, ETH_P_IP, ETH_P_IPV6, SOL_PACKET, SO_TIMESTAMPNS
from scapy.config import conf
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, cast
import socket
class StreamSocket(SimpleSocket):
"""
Wrap a stream socket into a layer 2... |
class StreamSocket(SimpleSocket):
'''
Wrap a stream socket into a layer 2 SuperSocket
:param sock: the socket to wrap
:param basecls: the base class packet to use to dissect the packet
'''
def __init__(self, sock, basecls=None):
pass
def recv(self, x=None, **kwargs):
p... | 3 | 1 | 18 | 0 | 16 | 4 | 4 | 0.39 | 1 | 4 | 0 | 4 | 2 | 4 | 2 | 36 | 46 | 3 | 33 | 15 | 26 | 13 | 30 | 12 | 26 | 6 | 5 | 1 | 7 |
30,456 | secdev/scapy | secdev_scapy/scapy/supersocket.py | scapy.supersocket.SuperSocket | import time
import struct
from scapy.consts import DARWIN, WINDOWS
from scapy.error import warning, log_runtime
from scapy.compat import raw
import errno
from scapy.data import MTU, ETH_P_IP, ETH_P_IPV6, SOL_PACKET, SO_TIMESTAMPNS
import socket
from scapy.config import conf
from select import select, error as select_er... |
class SuperSocket(metaclass=_SuperSocket_metaclass):
def __init__(self, family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0, iface=None, **kwargs):
pass
def send(self, x):
'''Sends a `Packet` object
:param x: `Packet` to be send
:return: Number of bytes that have been sent... | 19 | 12 | 12 | 1 | 8 | 5 | 3 | 0.64 | 1 | 7 | 2 | 23 | 16 | 4 | 17 | 31 | 234 | 25 | 138 | 59 | 104 | 89 | 115 | 47 | 92 | 11 | 3 | 4 | 43 |
30,457 | secdev/scapy | secdev_scapy/scapy/supersocket.py | scapy.supersocket._SuperSocket_metaclass | class _SuperSocket_metaclass(type):
desc = None
def __repr__(self):
if self.desc is not None:
return '<%s: %s>' % (self.__name__, self.desc)
else:
return '<%s>' % self.__name__ | class _SuperSocket_metaclass(type):
def __repr__(self):
pass | 2 | 0 | 6 | 0 | 5 | 1 | 2 | 0.29 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 14 | 9 | 1 | 7 | 3 | 5 | 2 | 6 | 3 | 4 | 2 | 2 | 1 | 2 |
30,458 | secdev/scapy | secdev_scapy/scapy/supersocket.py | scapy.supersocket.tpacket_auxdata | import ctypes
class tpacket_auxdata(ctypes.Structure):
_fields_ = [('tp_status', ctypes.c_uint), ('tp_len', ctypes.c_uint), ('tp_snaplen', ctypes.c_uint), ('tp_mac', ctypes.c_ushort), ('tp_net', ctypes.c_ushort), ('tp_vlan_tci', ctypes.c_ushort), ('tp_vlan_tpid', ctypes.c_ushort)] |
class tpacket_auxdata(ctypes.Structure):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 0 | 10 | 2 | 9 | 1 | 2 | 2 | 1 | 0 | 0 | 0 | 0 |
30,459 | secdev/scapy | secdev_scapy/scapy/themes.py | scapy.themes.AnsiColorTheme | class AnsiColorTheme(ColorTheme):
def __getattr__(self, attr):
if attr.startswith('__'):
raise AttributeError(attr)
s = 'style_%s' % attr
if s in self.__class__.__dict__:
before = getattr(self, s)
after = self.style_normal
elif not isinstance(self... | class AnsiColorTheme(ColorTheme):
def __getattr__(self, attr):
pass | 2 | 0 | 15 | 1 | 13 | 1 | 4 | 0.07 | 1 | 2 | 1 | 5 | 1 | 0 | 1 | 5 | 16 | 1 | 14 | 5 | 12 | 1 | 12 | 5 | 10 | 4 | 1 | 1 | 4 |
30,460 | secdev/scapy | secdev_scapy/scapy/themes.py | scapy.themes.BlackAndWhite | class BlackAndWhite(AnsiColorTheme, NoTheme):
pass | class BlackAndWhite(AnsiColorTheme, NoTheme):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
30,461 | secdev/scapy | secdev_scapy/scapy/themes.py | scapy.themes.BrightTheme | class BrightTheme(AnsiColorTheme):
style_normal = Color.normal
style_punct = Color.normal
style_id = Color.yellow + Color.bold
style_layer_name = Color.red + Color.bold
style_field_name = Color.yellow + Color.bold
style_field_value = Color.purple + Color.bold
style_emph_field_name = Color.ye... | class BrightTheme(AnsiColorTheme):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 19 | 0 | 19 | 19 | 18 | 0 | 19 | 19 | 18 | 0 | 2 | 0 | 0 |
30,462 | secdev/scapy | secdev_scapy/scapy/themes.py | scapy.themes.ColorOnBlackTheme | class ColorOnBlackTheme(AnsiColorTheme):
"""Color theme for black backgrounds"""
style_normal = Color.normal
style_prompt = Color.green + Color.bold
style_punct = Color.normal
style_id = Color.green
style_not_printable = Color.black + Color.bold
style_layer_name = Color.yellow + Color.bold
... | class ColorOnBlackTheme(AnsiColorTheme):
'''Color theme for black backgrounds'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.04 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 25 | 0 | 24 | 24 | 23 | 1 | 24 | 24 | 23 | 0 | 2 | 0 | 0 |
30,463 | secdev/scapy | secdev_scapy/scapy/themes.py | scapy.themes.ColorTable | class ColorTable:
colors = {'black': ('\x1b[30m', '#ansiblack'), 'red': ('\x1b[31m', '#ansired'), 'green': ('\x1b[32m', '#ansigreen'), 'yellow': ('\x1b[33m', '#ansiyellow'), 'blue': ('\x1b[34m', '#ansiblue'), 'purple': ('\x1b[35m', '#ansipurple'), 'cyan': ('\x1b[36m', '#ansicyan'), 'white': ('\x1b[37m', '#ansiwhite... | class ColorTable:
def __repr__(self):
pass
def __getattr__(self, attr):
pass
def ansi_to_pygments(self, x):
'''
Transform ansi encoded text to Pygments text
'''
pass | 4 | 1 | 5 | 0 | 3 | 2 | 1 | 0.78 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 48 | 3 | 36 | 7 | 32 | 28 | 11 | 7 | 7 | 2 | 0 | 1 | 4 |
30,464 | secdev/scapy | secdev_scapy/scapy/themes.py | scapy.themes.ColorTheme | class ColorTheme:
style_normal = ''
style_prompt = ''
style_punct = ''
style_id = ''
style_not_printable = ''
style_layer_name = ''
style_field_name = ''
style_field_value = ''
style_emph_field_name = ''
style_emph_field_value = ''
style_depreciate_field_name = ''
style_p... | class ColorTheme:
def __repr__(self):
pass
def __reduce__(self):
pass
def __getattr__(self, attr):
pass
def format(self, string, fmt):
pass | 5 | 0 | 4 | 0 | 3 | 1 | 2 | 0.11 | 0 | 1 | 0 | 3 | 4 | 0 | 4 | 4 | 46 | 4 | 38 | 30 | 33 | 4 | 37 | 30 | 32 | 2 | 0 | 1 | 6 |
30,465 | secdev/scapy | secdev_scapy/scapy/themes.py | scapy.themes.DefaultTheme | class DefaultTheme(AnsiColorTheme):
style_normal = Color.normal
style_prompt = Color.blue + Color.bold
style_punct = Color.normal
style_id = Color.blue + Color.bold
style_not_printable = Color.white
style_depreciate_field_name = Color.grey
style_layer_name = Color.red + Color.bold
style_... | class DefaultTheme(AnsiColorTheme):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 25 | 0 | 25 | 25 | 24 | 0 | 25 | 25 | 24 | 0 | 2 | 0 | 0 |
30,466 | secdev/scapy | secdev_scapy/scapy/themes.py | scapy.themes.FormatTheme | class FormatTheme(ColorTheme):
def __getattr__(self, attr: str) -> _ColorFormatterType:
if attr.startswith('__'):
raise AttributeError(attr)
colfmt = self.__class__.__dict__.get('style_%s' % attr, '%s')
return create_styler(fmt2=colfmt) | class FormatTheme(ColorTheme):
def __getattr__(self, attr: str) -> _ColorFormatterType:
pass | 2 | 0 | 5 | 0 | 5 | 0 | 2 | 0 | 1 | 3 | 1 | 3 | 1 | 0 | 1 | 5 | 6 | 0 | 6 | 3 | 4 | 0 | 6 | 3 | 4 | 2 | 1 | 1 | 2 |
30,467 | secdev/scapy | secdev_scapy/scapy/themes.py | scapy.themes.LatexTheme | from typing import Any, List, Optional, Tuple, cast
class LatexTheme(FormatTheme):
"""
You can prepend the output from this theme with
\\tt\\obeyspaces\\obeylines\\tiny\\noindent
"""
style_prompt = '\\textcolor{blue}{%s}'
style_not_printable = '\\textcolor{gray}{%s}'
style_layer_name = '\\t... |
class LatexTheme(FormatTheme):
'''
You can prepend the output from this theme with
\tt\obeyspaces\obeylines\tiny\noindent
'''
def __getattr__(self, attr: str) -> _ColorFormatterType:
pass | 2 | 1 | 7 | 0 | 7 | 0 | 1 | 0.35 | 1 | 3 | 1 | 0 | 1 | 0 | 1 | 6 | 30 | 1 | 23 | 19 | 20 | 8 | 20 | 19 | 17 | 1 | 2 | 0 | 1 |
30,468 | secdev/scapy | secdev_scapy/scapy/themes.py | scapy.themes.LatexTheme2 | class LatexTheme2(FormatTheme):
style_prompt = '@`@textcolor@[@blue@]@@[@%s@]@'
style_not_printable = '@`@textcolor@[@gray@]@@[@%s@]@'
style_layer_name = '@`@textcolor@[@red@]@@[@@`@bfseries@[@@]@%s@]@'
style_field_name = '@`@textcolor@[@blue@]@@[@%s@]@'
style_field_value = '@`@textcolor@[@purple@]@... | class LatexTheme2(FormatTheme):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 18 | 0 | 17 | 17 | 16 | 2 | 17 | 17 | 16 | 0 | 2 | 0 | 0 |
30,469 | secdev/scapy | secdev_scapy/scapy/themes.py | scapy.themes.RastaTheme | class RastaTheme(AnsiColorTheme):
style_normal = Color.normal + Color.green + Color.bold
style_prompt = Color.yellow + Color.bold
style_punct = Color.red
style_id = Color.green + Color.bold
style_not_printable = Color.green
style_layer_name = Color.red + Color.bold
style_field_name = Color.y... | class RastaTheme(AnsiColorTheme):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 21 | 0 | 21 | 21 | 20 | 0 | 21 | 21 | 20 | 0 | 2 | 0 | 0 |
30,470 | secdev/scapy | secdev_scapy/scapy/themes.py | scapy.themes._ColorFormatterType | from typing import Any, List, Optional, Tuple, cast
from scapy.compat import Protocol
class _ColorFormatterType(Protocol):
def __call__(self, val: Any, fmt: Optional[str]=None, fmt2: str='', before: str='', after: str='') -> str:
pass |
class _ColorFormatterType(Protocol):
def __call__(self, val: Any, fmt: Optional[str]=None, fmt2: str='', before: str='', after: str='') -> str:
pass | 2 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 25 | 8 | 0 | 8 | 7 | 1 | 0 | 3 | 2 | 1 | 1 | 5 | 0 | 1 |
30,471 | secdev/scapy | secdev_scapy/scapy/tools/UTscapy.py | scapy.tools.UTscapy.Bunch | class Bunch:
__init__ = lambda self, **kw: setattr(self, '__dict__', kw) | class Bunch:
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 0 | 0 | 0 |
30,472 | secdev/scapy | secdev_scapy/scapy/tools/UTscapy.py | scapy.tools.UTscapy.External_Files | class External_Files:
UTscapy_js = File('UTscapy.js', 'https://scapy.net/files/UTscapy/UTscapy.js', 'QlpoOTFBWSZTWWVijKQAAXxfgERUYOvAChIhBAC\n/79+qQAH8AFA0poANAMjQAAAGABo0NGEZNBo0\n0BhgAaNDRhGTQaNNAYFURJinp\nlGaKbRkJiekzSenqmpA0Gm1LFMpRUklVQlK9WUTZYpNFI1IiEWE\nFT09Sfj5uO+\nqO6S5DQwKIxM92+Zku94wL6V/1KTKan2c66Ug6SmVK... | class External_Files:
def get_local_dict(cls):
pass
def get_URL_dict(cls):
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0.04 | 0 | 1 | 1 | 0 | 2 | 0 | 2 | 2 | 47 | 2 | 45 | 5 | 42 | 2 | 9 | 5 | 6 | 1 | 0 | 0 | 2 |
30,473 | secdev/scapy | secdev_scapy/scapy/tools/UTscapy.py | scapy.tools.UTscapy.File | import bz2
from scapy.compat import base64_bytes
class File:
def __init__(self, name, URL, local):
self.name = name
self.local = local.encode('utf8')
self.URL = URL
def get_local(self):
return bz2.decompress(base64_bytes(self.local))
def get_URL(self):
return self... |
class File:
def __init__(self, name, URL, local):
pass
def get_local(self):
pass
def get_URL(self):
pass
def write(self, dir):
pass | 5 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 4 | 3 | 4 | 4 | 17 | 3 | 14 | 9 | 9 | 0 | 14 | 8 | 9 | 2 | 0 | 1 | 5 |
30,474 | secdev/scapy | secdev_scapy/scapy/tools/UTscapy.py | scapy.tools.UTscapy.Format | class Format(EnumClass):
TEXT = 1
ANSI = 2
HTML = 3
LATEX = 4
XUNIT = 5
LIVE = 6 | class Format(EnumClass):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 7 | 0 | 7 | 7 | 6 | 0 | 7 | 7 | 6 | 0 | 1 | 0 | 0 |
30,475 | secdev/scapy | secdev_scapy/scapy/tools/UTscapy.py | scapy.tools.UTscapy.TestCampaign | class TestCampaign(TestClass):
def __init__(self, title):
self.title = title
self.filename = None
self.headcomments = ''
self.campaign = []
self.keywords = set()
self.crc = None
self.sha = None
self.preexec = None
self.preexec_output = None
... | class TestCampaign(TestClass):
def __init__(self, title):
pass
def add_testset(self, testset):
pass
def trunc(self, index):
pass
def startNum(self, beginpos):
pass
def __iter__(self):
pass
def all_tests(self):
pass | 7 | 0 | 5 | 0 | 5 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 6 | 12 | 6 | 8 | 36 | 5 | 31 | 23 | 24 | 0 | 31 | 23 | 24 | 3 | 1 | 2 | 10 |
30,476 | secdev/scapy | secdev_scapy/scapy/tools/UTscapy.py | scapy.tools.UTscapy.TestClass | class TestClass:
def __getitem__(self, item):
return getattr(self, item)
def add_keywords(self, kws):
if isinstance(kws, str):
kws = [kws.lower()]
for kwd in kws:
kwd = kwd.lower()
if kwd.startswith('-'):
try:
self... | class TestClass:
def __getitem__(self, item):
pass
def add_keywords(self, kws):
pass | 3 | 0 | 7 | 0 | 7 | 0 | 3 | 0 | 0 | 2 | 0 | 3 | 2 | 0 | 2 | 2 | 16 | 1 | 15 | 4 | 12 | 0 | 14 | 4 | 11 | 5 | 0 | 3 | 6 |
30,477 | secdev/scapy | secdev_scapy/scapy/tools/UTscapy.py | scapy.tools.UTscapy.TestSet | class TestSet(TestClass):
def __init__(self, name):
self.name = name
self.tests = []
self.comments = ''
self.keywords = set()
self.crc = None
self.expand = 1
def add_test(self, test):
self.tests.append(test)
test.keywords.update(self.keywords)
... | class TestSet(TestClass):
def __init__(self, name):
pass
def add_test(self, test):
pass
def trunc(self, index):
pass
def __iter__(self):
pass | 5 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 4 | 6 | 4 | 6 | 18 | 3 | 15 | 11 | 10 | 0 | 15 | 11 | 10 | 1 | 1 | 0 | 4 |
30,478 | secdev/scapy | secdev_scapy/scapy/tools/UTscapy.py | scapy.tools.UTscapy.no_debug_dissector | from scapy.config import conf
class no_debug_dissector:
"""Context object used to disable conf.debug_dissector"""
def __init__(self, reverse=False):
self.new_value = reverse
def __enter__(self):
self.old_dbg = conf.debug_dissector
conf.debug_dissector = self.new_value
def __e... |
class no_debug_dissector:
'''Context object used to disable conf.debug_dissector'''
def __init__(self, reverse=False):
pass
def __enter__(self):
pass
def __exit__(self, exc_type, exc_value, traceback):
pass | 4 | 1 | 2 | 0 | 2 | 0 | 1 | 0.13 | 0 | 0 | 0 | 0 | 3 | 2 | 3 | 3 | 11 | 2 | 8 | 6 | 4 | 1 | 8 | 6 | 4 | 1 | 0 | 0 | 3 |
30,479 | secdev/scapy | secdev_scapy/scapy/tools/automotive/xcpscanner.py | scapy.tools.automotive.xcpscanner.ScannerParams | class ScannerParams:
def __init__(self):
self.id_range = None
self.sniff_time = None
self.verbose = False
self.channel = None
self.broadcast = False | class ScannerParams:
def __init__(self):
pass | 2 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 5 | 1 | 1 | 7 | 0 | 7 | 7 | 5 | 0 | 7 | 7 | 5 | 1 | 0 | 0 | 1 |
30,480 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.CLIUtil | from typing import cast, Any, AnyStr, Callable, Dict, IO, Iterator, List, Optional, TYPE_CHECKING, Tuple, Type, Union, overload
import traceback
from scapy.compat import DecoratorCallable, Literal
import inspect
import re
class CLIUtil(metaclass=_CLIUtilMetaclass):
"""
Provides a Util class to easily create si... |
class CLIUtil(metaclass=_CLIUtilMetaclass):
'''
Provides a Util class to easily create simple CLI tools in Scapy,
that can still be used as an API.
Doc:
- override the ps1() function
- register commands with the @CLIUtil.addcomment decorator
- call the loop() function when ready... | 26 | 14 | 18 | 0 | 15 | 4 | 3 | 0.35 | 0 | 16 | 1 | 1 | 6 | 0 | 12 | 12 | 281 | 17 | 208 | 66 | 169 | 72 | 144 | 48 | 122 | 17 | 0 | 5 | 51 |
30,481 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.ContextManagerCaptureOutput | import sys
from scapy.compat import orb, plain_str, chb, hex_bytes, bytes_encode
class ContextManagerCaptureOutput(object):
"""
Context manager that intercept the console's output.
Example:
>>> with ContextManagerCaptureOutput() as cmco:
... print("hey")
... assert cmco.get_output() ==... |
class ContextManagerCaptureOutput(object):
'''
Context manager that intercept the console's output.
Example:
>>> with ContextManagerCaptureOutput() as cmco:
... print("hey")
... assert cmco.get_output() == "hey"
'''
def __init__(self):
pass
def __enter__(self):
... | 6 | 1 | 5 | 0 | 4 | 1 | 1 | 0.63 | 1 | 1 | 0 | 0 | 4 | 2 | 4 | 4 | 37 | 6 | 19 | 10 | 12 | 12 | 19 | 10 | 12 | 2 | 1 | 1 | 6 |
30,482 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.ContextManagerSubprocess | from scapy.error import log_interactive, log_runtime, Scapy_Exception, warning
class ContextManagerSubprocess(object):
"""
Context manager that eases checking for unknown command, without
crashing.
Example:
>>> with ContextManagerSubprocess("tcpdump"):
>>> subprocess.Popen(["tcpdump", "--v... |
class ContextManagerSubprocess(object):
'''
Context manager that eases checking for unknown command, without
crashing.
Example:
>>> with ContextManagerSubprocess("tcpdump"):
>>> subprocess.Popen(["tcpdump", "--version"])
ERROR: Could not execute tcpdump, is it installed?
'''
de... | 4 | 1 | 9 | 0 | 8 | 3 | 2 | 0.67 | 1 | 0 | 0 | 0 | 3 | 2 | 3 | 3 | 41 | 5 | 24 | 11 | 16 | 16 | 16 | 7 | 12 | 4 | 1 | 1 | 6 |
30,483 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.EDecimal | from decimal import Decimal
import decimal
class EDecimal(Decimal):
"""Extended Decimal
This implements arithmetic and comparison with float for
backward compatibility
"""
def __add__(self, other, context=None):
return EDecimal(Decimal.__add__(self, Decimal(other)))
def __radd__(self... |
class EDecimal(Decimal):
'''Extended Decimal
This implements arithmetic and comparison with float for
backward compatibility
'''
def __add__(self, other, context=None):
pass
def __radd__(self, other):
pass
def __sub__(self, other):
pass
def __rsub__(self, oth... | 15 | 1 | 3 | 0 | 2 | 1 | 1 | 0.54 | 1 | 3 | 0 | 0 | 14 | 0 | 14 | 131 | 68 | 15 | 35 | 17 | 20 | 19 | 34 | 16 | 19 | 2 | 2 | 1 | 15 |
30,484 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.ERFEthernetReader | from scapy.config import conf
import time
import struct
from decimal import Decimal
from scapy.data import MTU, DLT_EN10MB, DLT_RAW
from scapy.error import log_interactive, log_runtime, Scapy_Exception, warning
class ERFEthernetReader(PcapReader, metaclass=ERFEthernetReader_metaclass):
def __init__(self, filename... |
class ERFEthernetReader(PcapReader, metaclass=ERFEthernetReader_metaclass):
def __init__(self, filename, fdesc=None):
pass
def _convert_erf_timestamp(self, t):
pass
def read_packet(self, size=MTU, **kwargs):
pass | 4 | 0 | 20 | 2 | 14 | 6 | 3 | 0.51 | 2 | 8 | 4 | 0 | 3 | 3 | 3 | 40 | 70 | 9 | 43 | 19 | 35 | 22 | 41 | 18 | 34 | 8 | 5 | 2 | 10 |
30,485 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.ERFEthernetReader_metaclass | from scapy.error import log_interactive, log_runtime, Scapy_Exception, warning
import gzip
class ERFEthernetReader_metaclass(PcapReader_metaclass):
def __call__(cls, filename):
i = cls.__new__(cls, cls.__name__, cls.__bases__, cls.__dict__)
filename, fdesc = cls.open(filename)
try:
... |
class ERFEthernetReader_metaclass(PcapReader_metaclass):
def __call__(cls, filename):
pass
@staticmethod
def open(fname):
'''Open (if necessary) filename'''
pass | 4 | 1 | 21 | 2 | 18 | 4 | 4 | 0.18 | 1 | 3 | 1 | 1 | 1 | 0 | 2 | 18 | 45 | 4 | 38 | 10 | 33 | 7 | 30 | 7 | 27 | 4 | 3 | 3 | 7 |
30,486 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.ERFEthernetWriter | import time
import struct
class ERFEthernetWriter(PcapWriter):
"""A stream ERF Ethernet writer with more control than wrerf()"""
def __init__(self, filename, gz=False, append=False, sync=False):
"""
:param filename: the name of the file to write packets to, or an open,
writable fil... |
class ERFEthernetWriter(PcapWriter):
'''A stream ERF Ethernet writer with more control than wrerf()'''
def __init__(self, filename, gz=False, append=False, sync=False):
'''
:param filename: the name of the file to write packets to, or an open,
writable file-like object.
:pa... | 5 | 3 | 14 | 1 | 8 | 7 | 2 | 0.82 | 1 | 4 | 1 | 0 | 4 | 0 | 4 | 18 | 63 | 9 | 33 | 17 | 22 | 27 | 24 | 12 | 18 | 4 | 5 | 1 | 8 |
30,487 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.EnumElement | from scapy.compat import orb, plain_str, chb, hex_bytes, bytes_encode
class EnumElement:
def __init__(self, key, value):
self._key = key
self._value = value
def __repr__(self):
return '<%s %s[%r]>' % (self.__dict__.get('_name', self.__class__.__name__), self._key, self._value)
de... |
class EnumElement:
def __init__(self, key, value):
pass
def __repr__(self):
pass
def __getattr__(self, attr):
pass
def __str__(self):
pass
def __bytes__(self):
pass
def __hash__(self):
pass
def __int__(self):
pass
def __eq_... | 10 | 0 | 3 | 0 | 2 | 1 | 1 | 0.5 | 0 | 1 | 0 | 2 | 9 | 2 | 9 | 9 | 37 | 8 | 20 | 12 | 10 | 10 | 20 | 12 | 10 | 1 | 0 | 0 | 9 |
30,488 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.Enum_metaclass | class Enum_metaclass(type):
element_class = EnumElement
def __new__(cls, name, bases, dct):
rdict = {}
for k, v in dct.items():
if isinstance(v, int):
v = cls.element_class(k, v)
dct[k] = v
rdict[v] = k
dct['__rdict__'] = rdict... | class Enum_metaclass(type):
def __new__(cls, name, bases, dct):
pass
def __getitem__(self, attr):
pass
def __contains__(self, val):
pass
def get(self, attr, val=None):
pass
def __repr__(self):
pass | 6 | 0 | 4 | 0 | 3 | 2 | 1 | 0.42 | 1 | 2 | 0 | 2 | 5 | 0 | 5 | 18 | 29 | 5 | 19 | 9 | 13 | 8 | 19 | 9 | 13 | 3 | 2 | 2 | 7 |
30,489 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.GenericPcapWriter | from scapy.config import conf
from scapy.data import MTU, DLT_EN10MB, DLT_RAW
from scapy.error import log_interactive, log_runtime, Scapy_Exception, warning
from scapy.compat import orb, plain_str, chb, hex_bytes, bytes_encode
class GenericPcapWriter(object):
nano = False
linktype: int
def _write_header(s... |
class GenericPcapWriter(object):
def _write_header(self, pkt):
pass
def _write_packet(self, packet, linktype, sec=None, usec=None, caplen=None, wirelen=None, ifname=None, direction=None, comments=None):
pass
def _get_time(self, packet, sec, usec):
pass
def write_header(self,... | 6 | 1 | 22 | 1 | 15 | 9 | 4 | 0.59 | 1 | 6 | 0 | 1 | 5 | 0 | 5 | 5 | 118 | 9 | 80 | 36 | 54 | 47 | 46 | 16 | 40 | 7 | 1 | 3 | 18 |
30,490 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.GenericRawPcapWriter | from scapy.config import conf
from scapy.error import log_interactive, log_runtime, Scapy_Exception, warning
from scapy.consts import DARWIN, OPENBSD, WINDOWS
class GenericRawPcapWriter(GenericPcapWriter):
header_present = False
nano = False
sync = False
f = None
def fileno(self):
return -... |
class GenericRawPcapWriter(GenericPcapWriter):
def fileno(self):
pass
def flush(self):
pass
def close(self):
pass
def __enter__(self):
pass
def __exit__(self, exc_type, exc_value, tracback):
pass
def write(self, pkt):
'''
Writes a Pa... | 7 | 1 | 8 | 1 | 5 | 2 | 2 | 0.4 | 1 | 3 | 1 | 2 | 6 | 0 | 6 | 11 | 57 | 9 | 35 | 13 | 27 | 14 | 30 | 13 | 22 | 6 | 2 | 3 | 13 |
30,491 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.PcapNgReader | from scapy.config import conf
from typing import cast, Any, AnyStr, Callable, Dict, IO, Iterator, List, Optional, TYPE_CHECKING, Tuple, Type, Union, overload
from scapy.data import MTU, DLT_EN10MB, DLT_RAW
class PcapNgReader(RawPcapNgReader, PcapReader):
alternative = PcapReader
def __init__(self, filename, f... |
class PcapNgReader(RawPcapNgReader, PcapReader):
def __init__(self, filename, fdesc=None, magic=None):
pass
def __enter__(self):
pass
def read_packet(self, size=MTU, **kwargs):
pass
def recv(self, size: int=MTU, **kwargs: Any) -> 'Packet':
pass | 5 | 0 | 9 | 0 | 8 | 3 | 3 | 0.3 | 2 | 7 | 1 | 0 | 4 | 0 | 4 | 52 | 42 | 5 | 33 | 11 | 27 | 10 | 33 | 11 | 27 | 8 | 5 | 2 | 11 |
30,492 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.PcapNgWriter | class PcapNgWriter(RawPcapNgWriter):
"""A stream pcapng writer with more control than wrpcapng()"""
def _get_time(self, packet, sec, usec):
if hasattr(packet, 'time'):
if sec is None:
sec = float(packet.time)
if usec is None:
usec = 0
return (sec,... | class PcapNgWriter(RawPcapNgWriter):
'''A stream pcapng writer with more control than wrpcapng()'''
def _get_time(self, packet, sec, usec):
pass | 2 | 1 | 14 | 2 | 11 | 5 | 4 | 0.5 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 22 | 17 | 3 | 12 | 6 | 6 | 6 | 8 | 2 | 6 | 4 | 4 | 2 | 4 |
30,493 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.PcapReader | import os
from scapy.data import MTU, DLT_EN10MB, DLT_RAW
from decimal import Decimal
from scapy.error import log_interactive, log_runtime, Scapy_Exception, warning
from scapy.config import conf
class PcapReader(RawPcapReader):
def __init__(self, filename, fdesc=None, magic=None):
RawPcapReader.__init__(s... |
class PcapReader(RawPcapReader):
def __init__(self, filename, fdesc=None, magic=None):
pass
def __enter__(self):
pass
def read_packet(self, size=MTU, **kwargs):
pass
def recv(self, size=MTU, **kwargs):
pass
def __iter__(self):
pass
def __next__(self... | 8 | 0 | 9 | 0 | 8 | 3 | 3 | 0.35 | 1 | 9 | 2 | 2 | 6 | 1 | 6 | 35 | 60 | 6 | 46 | 17 | 35 | 16 | 44 | 17 | 33 | 7 | 4 | 2 | 15 |
30,494 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.PcapReader_metaclass | from scapy.error import log_interactive, log_runtime, Scapy_Exception, warning
import gzip
class PcapReader_metaclass(type):
"""Metaclass for (Raw)Pcap(Ng)Readers"""
def __new__(cls, name, bases, dct):
"""The `alternative` class attribute is declared in the PcapNg
variant, and set here to the ... |
class PcapReader_metaclass(type):
'''Metaclass for (Raw)Pcap(Ng)Readers'''
def __new__(cls, name, bases, dct):
'''The `alternative` class attribute is declared in the PcapNg
variant, and set here to the Pcap variant.
'''
pass
def __call__(cls, filename):
'''Creates... | 5 | 4 | 23 | 1 | 18 | 5 | 3 | 0.29 | 1 | 5 | 1 | 2 | 2 | 0 | 3 | 16 | 75 | 7 | 56 | 12 | 50 | 16 | 39 | 10 | 35 | 5 | 2 | 2 | 10 |
30,495 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.PcapWriter | class PcapWriter(RawPcapWriter):
"""A stream PCAP writer with more control than wrpcap()"""
pass | class PcapWriter(RawPcapWriter):
'''A stream PCAP writer with more control than wrpcap()'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 14 | 3 | 0 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 4 | 0 | 0 |
30,496 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.PeriodicSenderThread | import threading
from typing import cast, Any, AnyStr, Callable, Dict, IO, Iterator, List, Optional, TYPE_CHECKING, Tuple, Type, Union, overload
class PeriodicSenderThread(threading.Thread):
def __init__(self, sock, pkt, interval=0.5, ignore_exceptions=True):
""" Thread to send packets periodically
... |
class PeriodicSenderThread(threading.Thread):
def __init__(self, sock, pkt, interval=0.5, ignore_exceptions=True):
''' Thread to send packets periodically
Args:
sock: socket where packet is sent periodically
pkt: packet or list of packets to send
interval: inter... | 6 | 1 | 9 | 0 | 7 | 2 | 2 | 0.35 | 1 | 4 | 0 | 3 | 5 | 6 | 5 | 30 | 50 | 5 | 34 | 14 | 28 | 12 | 32 | 13 | 26 | 7 | 1 | 4 | 12 |
30,497 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.RawPcapNgReader | from scapy.config import conf
from uuid import UUID
from typing import cast, Any, AnyStr, Callable, Dict, IO, Iterator, List, Optional, TYPE_CHECKING, Tuple, Type, Union, overload
import struct
from scapy.data import MTU, DLT_EN10MB, DLT_RAW
from scapy.error import log_interactive, log_runtime, Scapy_Exception, warning... |
class RawPcapNgReader(RawPcapReader):
'''A stateful pcapng reader. Each packet is returned as
bytes.
'''
def __init__(self, filename, fdesc=None, magic=None):
pass
def _read_block(self, size=MTU):
pass
def _read_block_tail(self, blocklen):
pass
def _read_block_sh... | 14 | 10 | 30 | 2 | 24 | 5 | 5 | 0.21 | 1 | 8 | 1 | 1 | 13 | 7 | 13 | 42 | 412 | 43 | 320 | 73 | 305 | 66 | 229 | 72 | 214 | 10 | 4 | 3 | 70 |
30,498 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.RawPcapNgWriter | import struct
from typing import cast, Any, AnyStr, Callable, Dict, IO, Iterator, List, Optional, TYPE_CHECKING, Tuple, Type, Union, overload
from scapy.compat import orb, plain_str, chb, hex_bytes, bytes_encode
class RawPcapNgWriter(GenericRawPcapWriter):
"""A stream pcapng writer with more control than wrpcapng(... |
class RawPcapNgWriter(GenericRawPcapWriter):
'''A stream pcapng writer with more control than wrpcapng()'''
def __init__(self, filename):
pass
def _get_time(self, packet, sec, usec):
pass
def _add_padding(self, raw_data):
pass
def build_block(self, block_type, block_body... | 11 | 2 | 24 | 3 | 13 | 10 | 3 | 0.77 | 1 | 4 | 0 | 1 | 10 | 7 | 10 | 21 | 247 | 37 | 132 | 62 | 94 | 102 | 101 | 35 | 90 | 7 | 3 | 2 | 27 |
30,499 | secdev/scapy | secdev_scapy/scapy/utils.py | scapy.utils.RawPcapReader | from scapy.consts import DARWIN, OPENBSD, WINDOWS
import struct
from scapy.data import MTU, DLT_EN10MB, DLT_RAW
from scapy.error import log_interactive, log_runtime, Scapy_Exception, warning
import gzip
import collections
class RawPcapReader(metaclass=PcapReader_metaclass):
"""A stateful pcap reader. Each packet i... |
class RawPcapReader(metaclass=PcapReader_metaclass):
'''A stateful pcap reader. Each packet is returned as a string'''
def __init__(self, filename, fdesc=None, magic=None):
pass
def __enter__(self):
pass
def __iter__(self):
pass
def __next__(self):
'''
im... | 15 | 6 | 9 | 0 | 6 | 3 | 2 | 0.52 | 1 | 6 | 1 | 2 | 12 | 6 | 13 | 29 | 141 | 19 | 88 | 36 | 69 | 46 | 69 | 30 | 55 | 6 | 3 | 2 | 26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.