Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scapy
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
external
scapy
Commits
36f92713
Commit
36f92713
authored
15 years ago
by
Phil
Browse files
Options
Downloads
Patches
Plain Diff
Automaton thread's exception tracebacks transfered to foreground
parent
952833b1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scapy/automaton.py
+34
-26
34 additions, 26 deletions
scapy/automaton.py
with
34 additions
and
26 deletions
scapy/automaton.py
+
34
−
26
View file @
36f92713
...
@@ -141,6 +141,7 @@ class _ATMT_Command:
...
@@ -141,6 +141,7 @@ class _ATMT_Command:
NEXT
=
"
NEXT
"
NEXT
=
"
NEXT
"
STOP
=
"
STOP
"
STOP
=
"
STOP
"
END
=
"
END
"
END
=
"
END
"
EXCEPTION
=
"
EXCEPTION
"
SINGLESTEP
=
"
SINGLESTEP
"
SINGLESTEP
=
"
SINGLESTEP
"
INTERCEPT
=
"
INTERCEPT
"
INTERCEPT
=
"
INTERCEPT
"
ACCEPT
=
"
ACCEPT
"
ACCEPT
=
"
ACCEPT
"
...
@@ -395,33 +396,38 @@ class Automaton:
...
@@ -395,33 +396,38 @@ class Automaton:
singlestep
=
True
singlestep
=
True
self
.
debug
(
3
,
"
Starting control thread [tid=%i]
"
%
self
.
threadid
)
self
.
debug
(
3
,
"
Starting control thread [tid=%i]
"
%
self
.
threadid
)
stop
=
False
stop
=
False
while
not
stop
:
try
:
c
=
self
.
cmdin
.
recv
()
while
not
stop
:
self
.
debug
(
5
,
"
Received command %s
"
%
c
.
type
)
c
=
self
.
cmdin
.
recv
()
if
c
.
type
==
_ATMT_Command
.
RUN
:
self
.
debug
(
5
,
"
Received command %s
"
%
c
.
type
)
singlestep
=
False
if
c
.
type
==
_ATMT_Command
.
RUN
:
elif
c
.
type
==
_ATMT_Command
.
NEXT
:
singlestep
=
False
singlestep
=
True
elif
c
.
type
==
_ATMT_Command
.
NEXT
:
elif
c
.
type
==
_ATMT_Command
.
STOP
:
singlestep
=
True
break
elif
c
.
type
==
_ATMT_Command
.
STOP
:
while
True
:
try
:
state
=
self
.
do_next
()
except
KeyboardInterrupt
:
self
.
debug
(
1
,
"
Interrupted by user
"
)
stop
=
True
break
except
self
.
CommandMessage
:
break
except
StopIteration
,
e
:
c
=
Message
(
type
=
_ATMT_Command
.
END
,
result
=
e
.
args
[
0
])
self
.
cmdout
.
send
(
c
)
stop
=
True
break
if
singlestep
:
c
=
Message
(
type
=
_ATMT_Command
.
SINGLESTEP
,
state
=
state
)
self
.
cmdout
.
send
(
c
)
break
break
while
True
:
try
:
state
=
self
.
do_next
()
except
KeyboardInterrupt
:
self
.
debug
(
1
,
"
Interrupted by user
"
)
stop
=
True
break
except
self
.
CommandMessage
:
break
except
StopIteration
,
e
:
c
=
Message
(
type
=
_ATMT_Command
.
END
,
result
=
e
.
args
[
0
])
self
.
cmdout
.
send
(
c
)
stop
=
True
break
if
singlestep
:
c
=
Message
(
type
=
_ATMT_Command
.
SINGLESTEP
,
state
=
state
)
self
.
cmdout
.
send
(
c
)
break
except
Exception
,
e
:
self
.
debug
(
3
,
"
Transfering exception [%s] from tid=%i
"
%
(
e
,
self
.
threadid
))
m
=
Message
(
type
=
_ATMT_Command
.
EXCEPTION
,
exception
=
e
)
self
.
cmdout
.
send
(
m
)
self
.
debug
(
3
,
"
Stopping control thread (tid=%i)
"
%
self
.
threadid
)
self
.
debug
(
3
,
"
Stopping control thread (tid=%i)
"
%
self
.
threadid
)
self
.
threadid
=
None
self
.
threadid
=
None
...
@@ -522,6 +528,8 @@ class Automaton:
...
@@ -522,6 +528,8 @@ class Automaton:
return
c
.
pkt
return
c
.
pkt
elif
c
.
type
==
_ATMT_Command
.
SINGLESTEP
:
elif
c
.
type
==
_ATMT_Command
.
SINGLESTEP
:
return
c
.
state
return
c
.
state
elif
c
.
type
==
_ATMT_Command
.
EXCEPTION
:
raise
c
.
exception
def
next
(
self
):
def
next
(
self
):
return
self
.
run
(
resume
=
Message
(
type
=
_ATMT_Command
.
NEXT
))
return
self
.
run
(
resume
=
Message
(
type
=
_ATMT_Command
.
NEXT
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment