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
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
external
scapy
Commits
0246b2eb
Commit
0246b2eb
authored
9 years ago
by
Pierre LALET
Browse files
Options
Downloads
Patches
Plain Diff
Update TracerouteResult.world_trace() to use Matplotlib
parent
4581f834
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
scapy/layers/inet.py
+24
-7
24 additions, 7 deletions
scapy/layers/inet.py
with
24 additions
and
7 deletions
scapy/layers/inet.py
+
24
−
7
View file @
0246b2eb
...
@@ -10,7 +10,6 @@ IPv4 (Internet Protocol v4).
...
@@ -10,7 +10,6 @@ IPv4 (Internet Protocol v4).
import
os
,
time
,
struct
,
re
,
socket
,
new
import
os
,
time
,
struct
,
re
,
socket
,
new
from
select
import
select
from
select
import
select
from
collections
import
defaultdict
from
collections
import
defaultdict
import
Gnuplot
from
scapy.utils
import
checksum
from
scapy.utils
import
checksum
from
scapy.layers.l2
import
*
from
scapy.layers.l2
import
*
...
@@ -1112,7 +1111,7 @@ class TracerouteResult(SndRcvList):
...
@@ -1112,7 +1111,7 @@ class TracerouteResult(SndRcvList):
movcenter
=
visual
.
scene
.
mouse
.
pos
movcenter
=
visual
.
scene
.
mouse
.
pos
def
world_trace
(
self
):
def
world_trace
(
self
,
**
kargs
):
import
GeoIP
import
GeoIP
db
=
GeoIP
.
open
(
conf
.
geoip_city
,
0
)
db
=
GeoIP
.
open
(
conf
.
geoip_city
,
0
)
ips
=
{}
ips
=
{}
...
@@ -1153,11 +1152,29 @@ class TracerouteResult(SndRcvList):
...
@@ -1153,11 +1152,29 @@ class TracerouteResult(SndRcvList):
if
loctrace
:
if
loctrace
:
trt
[
trace_id
]
=
loctrace
trt
[
trace_id
]
=
loctrace
tr
=
map
(
lambda
x
:
Gnuplot
.
Data
(
x
,
with_
=
"
lines
"
),
trt
.
values
())
# Mimic the default gnuplot output
g
=
Gnuplot
.
Gnuplot
()
if
kargs
==
{}:
world
=
Gnuplot
.
File
(
conf
.
gnuplot_world
,
with_
=
"
lines
"
)
kargs
=
MATPLOTLIB_DEFAULT_PLOT_KARGS
g
.
plot
(
world
,
*
tr
)
lines
=
[
plt
.
plot
(
*
zip
(
*
tr
),
**
kargs
)
for
tr
in
trt
.
itervalues
()]
return
g
with
open
(
conf
.
gnuplot_world
)
as
fdesc
:
curline
=
[]
for
line
in
fdesc
:
line
=
line
.
strip
()
if
not
line
:
plt
.
plot
(
*
zip
(
*
curline
),
color
=
"
r
"
)
curline
=
[]
continue
if
line
.
startswith
(
'
#
'
):
continue
curline
.
append
(
line
.
split
())
plt
.
plot
(
*
zip
(
*
curline
))
del
curline
# Call show() if matplotlib is not inlined
if
not
MATPLOTLIB_INLINED
:
plt
.
show
()
return
lines
def
make_graph
(
self
,
ASres
=
None
,
padding
=
0
):
def
make_graph
(
self
,
ASres
=
None
,
padding
=
0
):
if
ASres
is
None
:
if
ASres
is
None
:
...
...
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