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
59a7b9f6
Commit
59a7b9f6
authored
7 years ago
by
gpotter2
Browse files
Options
Downloads
Patches
Plain Diff
Replaced thread by threading
parent
b0266116
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/pipetool.py
+8
-5
8 additions, 5 deletions
scapy/pipetool.py
with
8 additions
and
5 deletions
scapy/pipetool.py
+
8
−
5
View file @
59a7b9f6
...
@@ -5,12 +5,13 @@
...
@@ -5,12 +5,13 @@
## Copyright (C) Philippe Biondi <phil@secdev.org>
## Copyright (C) Philippe Biondi <phil@secdev.org>
## This program is published under a GPLv2 license
## This program is published under a GPLv2 license
import
os
,
thread
import
os
import
subprocess
import
subprocess
import
itertools
import
itertools
import
collections
import
collections
import
time
import
time
import
Queue
import
Queue
from
threading
import
Lock
,
Thread
from
scapy.automaton
import
Message
,
select_objects
from
scapy.automaton
import
Message
,
select_objects
from
scapy.consts
import
WINDOWS
from
scapy.consts
import
WINDOWS
...
@@ -43,8 +44,8 @@ class PipeEngine:
...
@@ -43,8 +44,8 @@ class PipeEngine:
self
.
active_drains
=
set
()
self
.
active_drains
=
set
()
self
.
active_sinks
=
set
()
self
.
active_sinks
=
set
()
self
.
_add_pipes
(
*
pipes
)
self
.
_add_pipes
(
*
pipes
)
self
.
thread_lock
=
thread
.
allocate_l
ock
()
self
.
thread_lock
=
L
ock
()
self
.
command_lock
=
thread
.
allocate_l
ock
()
self
.
command_lock
=
L
ock
()
self
.
__fd_queue
=
[]
self
.
__fd_queue
=
[]
self
.
__fdr
,
self
.
__fdw
=
os
.
pipe
()
self
.
__fdr
,
self
.
__fdw
=
os
.
pipe
()
self
.
threadid
=
None
self
.
threadid
=
None
...
@@ -149,7 +150,9 @@ class PipeEngine:
...
@@ -149,7 +150,9 @@ class PipeEngine:
def
start
(
self
):
def
start
(
self
):
if
self
.
thread_lock
.
acquire
(
0
):
if
self
.
thread_lock
.
acquire
(
0
):
self
.
threadid
=
thread
.
start_new_thread
(
self
.
run
,())
_t
=
Thread
(
target
=
self
.
run
)
_t
.
start
()
self
.
threadid
=
_t
.
ident
else
:
else
:
warning
(
"
Pipe engine already running
"
)
warning
(
"
Pipe engine already running
"
)
def
wait_and_stop
(
self
):
def
wait_and_stop
(
self
):
...
@@ -383,7 +386,7 @@ class ThreadGenSource(AutoSource):
...
@@ -383,7 +386,7 @@ class ThreadGenSource(AutoSource):
pass
pass
def
start
(
self
):
def
start
(
self
):
self
.
RUN
=
True
self
.
RUN
=
True
t
hread
.
s
tar
t_new_thread
(
self
.
generate
,
()
)
T
hread
(
tar
get
=
self
.
generate
).
start
()
def
stop
(
self
):
def
stop
(
self
):
self
.
RUN
=
False
self
.
RUN
=
False
...
...
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