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
83c9b88a
Commit
83c9b88a
authored
16 years ago
by
Phil
Browse files
Options
Downloads
Patches
Plain Diff
Cleaned up some temprary files creation
parent
cac1f1a9
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
scapy/modules/voip.py
+2
-1
2 additions, 1 deletion
scapy/modules/voip.py
scapy/packet.py
+3
-3
3 additions, 3 deletions
scapy/packet.py
scapy/plist.py
+3
-3
3 additions, 3 deletions
scapy/plist.py
scapy/sendrecv.py
+2
-2
2 additions, 2 deletions
scapy/sendrecv.py
scapy/utils.py
+2
-2
2 additions, 2 deletions
scapy/utils.py
with
12 additions
and
11 deletions
scapy/modules/voip.py
+
2
−
1
View file @
83c9b88a
...
...
@@ -13,6 +13,7 @@ from scapy.sendrecv import sniff
from
scapy.packet
import
Raw
from
scapy.layers.inet
import
IP
,
UDP
from
scapy.layers.rtp
import
RTP
from
scapy.utils
import
get_temp_file
def
merge
(
x
,
y
,
sample_size
=
2
):
...
...
@@ -29,7 +30,7 @@ def merge(x,y,sample_size=2):
def
voip_play
(
s1
,
list
=
None
,
**
kargs
):
FIFO
=
"
/tmp/conv1.%i.%%i
"
%
os
.
getpid
()
FIFO
=
get_temp_file
()
FIFO1
=
FIFO
%
1
FIFO2
=
FIFO
%
2
...
...
This diff is collapsed.
Click to expand it.
scapy/packet.py
+
3
−
3
View file @
83c9b88a
...
...
@@ -8,7 +8,7 @@ from fields import StrField,ConditionalField,Emph,PacketListField
from
config
import
conf
from
base_classes
import
BasePacket
,
Gen
,
SetGen
,
Packet_metaclass
,
NewDefaultValues
from
volatile
import
VolatileValue
from
utils
import
import_hexcap
,
tex_escape
,
colgen
from
utils
import
import_hexcap
,
tex_escape
,
colgen
,
get_temp_file
from
error
import
Scapy_Exception
,
log_runtime
try
:
...
...
@@ -339,7 +339,7 @@ class Packet(BasePacket):
Creates an EPS file describing a packet. If filename is not provided a temporary file is created and gs is called.
"""
canvas
=
self
.
canvas_dump
(
**
kargs
)
if
filename
is
None
:
fname
=
"
/tmp/scapy.%i
"
%
os
.
getpid
(
)
fname
=
get_temp_file
(
autoext
=
"
.eps
"
)
canvas
.
writeEPSfile
(
fname
)
os
.
system
(
"
%s
'
%s.eps
'
&
"
%
(
conf
.
prog
.
psreader
,
fname
))
else
:
...
...
@@ -350,7 +350,7 @@ Creates an EPS file describing a packet. If filename is not provided a temporary
Creates a PDF file describing a packet. If filename is not provided a temporary file is created and xpdf is called.
"""
canvas
=
self
.
canvas_dump
(
**
kargs
)
if
filename
is
None
:
fname
=
"
/tmp/scapy.%i
"
%
os
.
getpid
(
)
fname
=
get_temp_file
(
autoext
=
"
.pdf
"
)
canvas
.
writePDFfile
(
fname
)
os
.
system
(
"
%s
'
%s.pdf
'
&
"
%
(
conf
.
prog
.
pdfreader
,
fname
))
else
:
...
...
This diff is collapsed.
Click to expand it.
scapy/plist.py
+
3
−
3
View file @
83c9b88a
...
...
@@ -8,7 +8,7 @@ from config import conf
from
base_classes
import
BasePacket
,
BasePacketList
from
packet
import
Padding
from
utils
import
do_graph
,
hexdump
,
make_table
,
make_lined_table
,
make_tex_table
from
utils
import
do_graph
,
hexdump
,
make_table
,
make_lined_table
,
make_tex_table
,
get_temp_file
import
arch
if
arch
.
GNUPLOT
:
...
...
@@ -360,7 +360,7 @@ lfilter: truth function to apply to each packet to decide whether it will be dis
conf.prog.psreader is called
"""
d
=
self
.
_dump_document
(
**
kargs
)
if
filename
is
None
:
filename
=
"
/tmp/scapy.psd.%i
"
%
os
.
getpid
(
)
filename
=
get_temp_file
(
autoext
=
"
.ps
"
)
d
.
writePSfile
(
filename
)
os
.
system
(
"
%s %s.ps &
"
%
(
conf
.
prog
.
psreader
,
filename
))
else
:
...
...
@@ -373,7 +373,7 @@ lfilter: truth function to apply to each packet to decide whether it will be dis
conf.prog.pdfreader is called
"""
d
=
self
.
_dump_document
(
**
kargs
)
if
filename
is
None
:
filename
=
"
/tmp/scapy.psd.%i
"
%
os
.
getpid
(
)
filename
=
get_temp_file
(
autoext
=
"
.pdf
"
)
d
.
writePDFfile
(
filename
)
os
.
system
(
"
%s %s.pdf &
"
%
(
conf
.
prog
.
pdfreader
,
filename
))
else
:
...
...
This diff is collapsed.
Click to expand it.
scapy/sendrecv.py
+
2
−
2
View file @
83c9b88a
...
...
@@ -9,7 +9,7 @@ from data import *
from
arch
import
*
from
config
import
conf
from
packet
import
Gen
from
utils
import
warning
from
utils
import
warning
,
get_temp_file
import
plist
from
error
import
log_runtime
,
log_interactive
...
...
@@ -265,7 +265,7 @@ def sendpfast(x, pps=None, mbps=None, realtime=None, loop=0, iface=None):
if
loop
:
argv
.
append
(
"
--loop=%i
"
%
loop
)
f
=
os
.
tempnam
(
"
scapy
"
)
f
=
get_temp_file
(
)
argv
.
append
(
f
)
wrpcap
(
f
,
x
)
try
:
...
...
This diff is collapsed.
Click to expand it.
scapy/utils.py
+
2
−
2
View file @
83c9b88a
...
...
@@ -21,10 +21,10 @@ from base_classes import BasePacketList
## Tools ##
###########
def
get_temp_file
(
keep
=
False
):
def
get_temp_file
(
keep
=
False
,
autoext
=
""
):
f
=
os
.
tempnam
(
""
,
"
scapy
"
)
if
not
keep
:
conf
.
temp_files
.
append
(
f
)
conf
.
temp_files
.
append
(
f
+
autoext
)
return
f
def
sane_color
(
x
):
...
...
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