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
180abb8a
Commit
180abb8a
authored
8 years ago
by
Guillaume Valadon
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #484 from p-l-/fix-64bits
Fix 64 bits architectures detection
parents
73b92e79
c37d00a9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
scapy/arch/__init__.py
+1
-1
1 addition, 1 deletion
scapy/arch/__init__.py
scapy/arch/linux.py
+2
-5
2 additions, 5 deletions
scapy/arch/linux.py
scapy/consts.py
+3
-5
3 additions, 5 deletions
scapy/consts.py
with
6 additions
and
11 deletions
scapy/arch/__init__.py
+
1
−
1
View file @
180abb8a
...
...
@@ -10,7 +10,7 @@ Operating system specific functionality.
import
socket
from
scapy.consts
import
LINUX
,
OPENBSD
,
FREEBSD
,
NETBSD
,
DARWIN
,
\
SOLARIS
,
WINDOWS
,
BSD
,
X86_64
,
ARM_64
,
LOOPBACK_NAME
,
plt
,
MATPLOTLIB_INLINED
,
\
SOLARIS
,
WINDOWS
,
BSD
,
IS_64BITS
,
LOOPBACK_NAME
,
plt
,
MATPLOTLIB_INLINED
,
\
MATPLOTLIB_DEFAULT_PLOT_KARGS
,
PYX
,
parent_function
from
scapy.error
import
*
import
scapy.config
...
...
This diff is collapsed.
Click to expand it.
scapy/arch/linux.py
+
2
−
5
View file @
180abb8a
...
...
@@ -11,7 +11,7 @@ import sys,os,struct,socket,time
from
select
import
select
from
fcntl
import
ioctl
from
scapy.consts
import
LOOPBACK_NAME
from
scapy.consts
import
LOOPBACK_NAME
,
IS_64BITS
import
scapy.utils
import
scapy.utils6
from
scapy.packet
import
Packet
,
Padding
...
...
@@ -149,10 +149,7 @@ def attach_filter(s, bpf_filter, iface):
# XXX. Argl! We need to give the kernel a pointer on the BPF,
# python object header seems to be 20 bytes. 36 bytes for x86 64bits arch.
if
scapy
.
arch
.
X86_64
or
scapy
.
arch
.
ARM_64
:
bpfh
=
struct
.
pack
(
"
HL
"
,
nb
,
id
(
bpf
)
+
36
)
else
:
bpfh
=
struct
.
pack
(
"
HI
"
,
nb
,
id
(
bpf
)
+
20
)
bpfh
=
struct
.
pack
(
"
HL
"
,
nb
,
id
(
bpf
)
+
(
36
if
IS_64BITS
else
20
))
s
.
setsockopt
(
SOL_SOCKET
,
SO_ATTACH_FILTER
,
bpfh
)
def
set_promisc
(
s
,
iff
,
val
=
1
):
...
...
This diff is collapsed.
Click to expand it.
scapy/consts.py
+
3
−
5
View file @
180abb8a
...
...
@@ -4,7 +4,7 @@
## This program is published under a GPLv2 license
import
os
,
inspect
from
sys
import
platform
from
sys
import
platform
,
maxsize
import
platform
as
platform_lib
from
scapy.error
import
*
...
...
@@ -40,10 +40,10 @@ DARWIN = platform.startswith("darwin")
SOLARIS
=
platform
.
startswith
(
"
sunos
"
)
WINDOWS
=
platform
.
startswith
(
"
win32
"
)
BSD
=
DARWIN
or
FREEBSD
or
OPENBSD
or
NETBSD
# See https://docs.python.org/3/library/platform.html#cross-platform
IS_64BITS
=
maxsize
>
2
**
32
if
WINDOWS
:
X86_64
=
False
ARM_64
=
False
try
:
if
float
(
platform_lib
.
release
())
>=
8.1
:
LOOPBACK_NAME
=
"
Microsoft KM-TEST Loopback Adapter
"
...
...
@@ -53,8 +53,6 @@ if WINDOWS:
LOOPBACK_NAME
=
"
Microsoft Loopback Adapter
"
else
:
uname
=
os
.
uname
()
X86_64
=
uname
[
4
]
==
'
x86_64
'
ARM_64
=
uname
[
4
]
==
'
aarch64
'
LOOPBACK_NAME
=
"
lo
"
if
LINUX
else
"
lo0
"
def
parent_function
():
...
...
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