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
aaa3a7de
Commit
aaa3a7de
authored
16 years ago
by
Phil
Browse files
Options
Downloads
Patches
Plain Diff
Moved ARP cache db to conf.arp_cache
parent
ddf8525d
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
scapy/arch.py
+4
-5
4 additions, 5 deletions
scapy/arch.py
scapy/config.py
+1
-0
1 addition, 0 deletions
scapy/config.py
scapy/route.py
+2
-2
2 additions, 2 deletions
scapy/route.py
scapy/sendrecv.py
+2
-2
2 additions, 2 deletions
scapy/sendrecv.py
with
9 additions
and
9 deletions
scapy/arch.py
+
4
−
5
View file @
aaa3a7de
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
sys
,
os
,
struct
,
socket
,
time
import
sys
,
os
,
struct
,
socket
,
time
from
fcntl
import
ioctl
from
fcntl
import
ioctl
from
data
import
*
from
data
import
*
from
config
import
conf
try
:
try
:
import
Gnuplot
import
Gnuplot
...
@@ -371,8 +372,6 @@ def get_if_hwaddr(iff):
...
@@ -371,8 +372,6 @@ def get_if_hwaddr(iff):
ARPTIMEOUT
=
120
ARPTIMEOUT
=
120
# XXX Fill arp_cache with /etc/ether and arp cache
arp_cache
=
{}
if
0
and
DNET
:
## XXX Can't use this because it does not resolve IPs not in cache
if
0
and
DNET
:
## XXX Can't use this because it does not resolve IPs not in cache
dnet_arp_object
=
dnet
.
arp
()
dnet_arp_object
=
dnet
.
arp
()
...
@@ -401,8 +400,8 @@ else:
...
@@ -401,8 +400,8 @@ else:
if
gw
!=
"
0.0.0.0
"
:
if
gw
!=
"
0.0.0.0
"
:
ip
=
gw
ip
=
gw
if
arp_cache
.
has_key
(
ip
):
if
conf
.
arp_cache
.
has_key
(
ip
):
mac
,
timeout
=
arp_cache
[
ip
]
mac
,
timeout
=
conf
.
arp_cache
[
ip
]
if
not
timeout
or
(
time
.
time
()
-
timeout
<
ARPTIMEOUT
):
if
not
timeout
or
(
time
.
time
()
-
timeout
<
ARPTIMEOUT
):
return
mac
return
mac
...
@@ -415,7 +414,7 @@ else:
...
@@ -415,7 +414,7 @@ else:
nofilter
=
1
)
nofilter
=
1
)
if
res
is
not
None
:
if
res
is
not
None
:
mac
=
res
.
payload
.
hwsrc
mac
=
res
.
payload
.
hwsrc
arp_cache
[
ip
]
=
(
mac
,
time
.
time
())
conf
.
arp_cache
[
ip
]
=
(
mac
,
time
.
time
())
return
mac
return
mac
return
None
return
None
This diff is collapsed.
Click to expand it.
scapy/config.py
+
1
−
0
View file @
aaa3a7de
...
@@ -174,6 +174,7 @@ extensions_paths: path or list of paths where extensions are to be looked for
...
@@ -174,6 +174,7 @@ extensions_paths: path or list of paths where extensions are to be looked for
manufdb
=
load_manuf
(
"
/usr/share/wireshark/wireshark/manuf
"
)
manufdb
=
load_manuf
(
"
/usr/share/wireshark/wireshark/manuf
"
)
stats_classic_protocols
=
[]
stats_classic_protocols
=
[]
stats_dot11_protocols
=
[]
stats_dot11_protocols
=
[]
arp_cache
=
{}
conf
=
Conf
()
conf
=
Conf
()
...
...
This diff is collapsed.
Click to expand it.
scapy/route.py
+
2
−
2
View file @
aaa3a7de
...
@@ -85,8 +85,8 @@ class Route:
...
@@ -85,8 +85,8 @@ class Route:
self
.
routes
[
i
]
=
(
the_net
,
the_msk
,
gw
,
iface
,
the_addr
)
self
.
routes
[
i
]
=
(
the_net
,
the_msk
,
gw
,
iface
,
the_addr
)
else
:
else
:
self
.
routes
[
i
]
=
(
net
,
msk
,
gw
,
iface
,
the_addr
)
self
.
routes
[
i
]
=
(
net
,
msk
,
gw
,
iface
,
the_addr
)
for
i
in
arp_cache
.
keys
():
for
i
in
conf
.
arp_cache
.
keys
():
del
(
arp_cache
[
i
])
del
(
conf
.
arp_cache
[
i
])
...
...
This diff is collapsed.
Click to expand it.
scapy/sendrecv.py
+
2
−
2
View file @
aaa3a7de
...
@@ -91,7 +91,7 @@ def sndrcv(pks, pkt, timeout = 2, inter = 0, verbose=None, chainCC=0, retry=0, m
...
@@ -91,7 +91,7 @@ def sndrcv(pks, pkt, timeout = 2, inter = 0, verbose=None, chainCC=0, retry=0, m
try
:
try
:
os
.
setpgrp
()
# Chance process group to avoid ctrl-C
os
.
setpgrp
()
# Chance process group to avoid ctrl-C
sent_times
=
[
p
.
sent_time
for
p
in
all_stimuli
if
p
.
sent_time
]
sent_times
=
[
p
.
sent_time
for
p
in
all_stimuli
if
p
.
sent_time
]
cPickle
.
dump
(
(
arp_cache
,
sent_times
),
wrpipe
)
cPickle
.
dump
(
(
conf
.
arp_cache
,
sent_times
),
wrpipe
)
wrpipe
.
close
()
wrpipe
.
close
()
except
:
except
:
pass
pass
...
@@ -161,7 +161,7 @@ def sndrcv(pks, pkt, timeout = 2, inter = 0, verbose=None, chainCC=0, retry=0, m
...
@@ -161,7 +161,7 @@ def sndrcv(pks, pkt, timeout = 2, inter = 0, verbose=None, chainCC=0, retry=0, m
except
EOFError
:
except
EOFError
:
warning
(
"
Child died unexpectedly. Packets may have not been sent %i
"
%
os
.
getpid
())
warning
(
"
Child died unexpectedly. Packets may have not been sent %i
"
%
os
.
getpid
())
else
:
else
:
arp_cache
.
update
(
ac
)
conf
.
arp_cache
.
update
(
ac
)
for
p
,
t
in
zip
(
all_stimuli
,
sent_times
):
for
p
,
t
in
zip
(
all_stimuli
,
sent_times
):
p
.
sent_time
=
t
p
.
sent_time
=
t
os
.
waitpid
(
pid
,
0
)
os
.
waitpid
(
pid
,
0
)
...
...
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