scapy.automaton

具有状态,过渡和动作的自动机.

class scapy.automaton.ATMT

Bases: object

ACTION = 'Action'
CONDITION = 'Condition'
IOEVENT = 'I/O event'
exception NewStateRequested(state_func, automaton, *args, **kargs)

Bases: Exception

action_parameters(*args, **kargs)
run()
RECV = 'Receive condition'
STATE = 'State'
TIMEOUT = 'Timeout condition'
static action(cond, prio=0)
static condition(state, prio=0)
static ioevent(state, name, prio=0, as_supersocket=None)
static receive_condition(state, prio=0)
static state(initial=0, final=0, error=0)
static timeout(state, timeout)
class scapy.automaton.Automaton(*args, **kargs)

Bases: object

exception AutomatonError(msg, state=None, result=None)

Bases: scapy.automaton.AutomatonException

exception AutomatonException(msg, state=None, result=None)

Bases: Exception

exception AutomatonStopped(msg, state=None, result=None)

Bases: scapy.automaton.AutomatonException

exception Breakpoint(msg, state=None, result=None)

Bases: scapy.automaton.AutomatonStopped

exception CommandMessage(msg, state=None, result=None)

Bases: scapy.automaton.AutomatonException

exception ErrorState(msg, state=None, result=None)

Bases: scapy.automaton.AutomatonException

exception InterceptionPoint(msg, state=None, result=None, packet=None)

Bases: scapy.automaton.AutomatonStopped

exception Singlestep(msg, state=None, result=None)

Bases: scapy.automaton.AutomatonStopped

exception Stuck(msg, state=None, result=None)

Bases: scapy.automaton.AutomatonException

accept_packet(pkt=None, wait=False)
actions = {}
add_breakpoints(*bps)
add_interception_points(*ipts)
conditions = {}
debug(lvl, msg)
initial_states = []
ioevents = {}
ionames = []
iosupersockets = []
master_filter(pkt)
my_send(pkt)
next()
parse_args(debug=0, store=1, **kargs)
recv_conditions = {}
reject_packet(wait=False)
remove_breakpoints(*bps)
remove_interception_points(*ipts)
restart(*args, **kargs)
run(resume=None, wait=True)
runbg(resume=None, wait=False)
send(pkt)
start(*args, **kargs)
state = None
states = {}
stop()
timeout = {}
class scapy.automaton.Automaton_metaclass

Bases: type

build_graph()
graph(**kargs)
class scapy.automaton.Message(**args)

Bases: object

class scapy.automaton.ObjectPipe

Bases: scapy.automaton.SelectableObject

check_recv()
close()
fileno()
read(n=0)
read_allowed_exceptions = ()
recv(n=0)
static select(sockets, remain=0.05)
send(obj)
write(obj)
class scapy.automaton.SelectableObject

Bases: object

DEV:要实现其中之一,您需要在对象中添加2件事:-添加" check_recv"功能-准备好阅读后,调用" self.call_release"

如果要#noqa,可以在类中将__selectable_force_select__设置为True:E501:强制处理程序使用fileno(). 这只能在使用#noqa创建的套接字上使用:E501内置套接字API.

call_release(arborted=False)

DEV:当对象准备好读取时必须调用. 释放_wait_non_ressources的锁

check_recv()

DEV :(在开始时)仅被调用一次,以检查对象是否准备就绪.

register_hook(hook)

DEV:当调用call_release()时,该挂钩也将

wait_return(callback)

SelectableObject的入口点:注册回调

class scapy.automaton.SelectableSelector(inputs, remain)

Bases: object

选择SelectableObject对象.

输入:要处理的对象保持:超时. 如果为0,则返回[]. customTypes:具有check_recv函数的对象的类型.

process()

SelectableSelector的入口点

scapy.automaton.select_objects(inputs, remain)

选择SelectableObject对象. select.select([inputs], [], [], remain)于: select.select([inputs], [], [], remain)但也适用于Windows,仅适用于SelectableObject.

Parameters
  • 输入 –要处理的对象

  • 保持 –超时. 如果为0,则返回[].