mirror of
https://github.com/pentoo/pentoo-overlay
synced 2026-04-18 21:00:56 +02:00
scapy: support both python2 and 3 via virual ebuild properly
This commit is contained in:
parent
4ea199acb3
commit
75f8565716
11 changed files with 339 additions and 8 deletions
1
dev-python/scapy-python3/Manifest
Normal file
1
dev-python/scapy-python3/Manifest
Normal file
|
|
@ -0,0 +1 @@
|
|||
DIST scapy-python3-0.20.tar.gz 1167308 SHA256 a239522e88bf2fb9a9568acd69559ebedca622b119e5cc046897bfd79caefd63 SHA512 34f425dd8c3c016100f17e294cc576f8da10a447c8824d7cbb7e9b7d6c13a8a28a7a1ca012f4673a9b760c3a77fe7a3adb54447c0cf954ccd629c635131df112 WHIRLPOOL 184f92583cc6b587d0dca39905bb1cbb1f9092065cc9bf1aa25df77d486c8950839980813c36ccb8951c3cf01b8a200d930680889078cf4635d9c177de1d72b0
|
||||
11
dev-python/scapy-python3/metadata.xml
Normal file
11
dev-python/scapy-python3/metadata.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<email>klausman@gentoo.org</email>
|
||||
<name>Tobias Klausmann</name>
|
||||
</maintainer>
|
||||
<upstream>
|
||||
<remote-id type="pypi">scapy-python3</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
26
dev-python/scapy-python3/scapy-python3-0.20.ebuild
Normal file
26
dev-python/scapy-python3/scapy-python3-0.20.ebuild
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Copyright 1999-2016 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=5
|
||||
|
||||
PYTHON_COMPAT=( python3_{4,5} )
|
||||
|
||||
IUSE="test"
|
||||
inherit distutils-r1
|
||||
|
||||
DESCRIPTION="Packet crafting/sending/... PCAP processing tool with python3 compatibility"
|
||||
HOMEPAGE="https://pypi.python.org/pypi/scapy-python3/"
|
||||
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64"
|
||||
|
||||
DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
|
||||
PDEPEND="virtual/python-scapy"
|
||||
|
||||
src_prepare(){
|
||||
#we provide common files (binaries/man/doc) via virtual package
|
||||
sed -i -e '/scripts = SCRIPTS/d' setup.py
|
||||
sed -i -e '/data_files/d' setup.py
|
||||
}
|
||||
1
net-analyzer/scapy/Manifest
Normal file
1
net-analyzer/scapy/Manifest
Normal file
|
|
@ -0,0 +1 @@
|
|||
DIST scapy-2.3.3.tar.gz 1459132 SHA256 67642cf7b806e02daeddd588577588caebddc3426db7904e7999a0b0334a63b5 SHA512 47ca2eceafe7b693c569a92c106782037d869c323aaaec41cace07dfdeb3c6a7e9f7bc8ca1150b3c0daea54e6665f93eb1dfc3c511419cfa28eb2e0753bf9ba4 WHIRLPOOL dae454a65a41126d69fd03bbcff9e35eda754b3415ff82e0ccbac7f4a3bbf19ad1038add58cc1ac49fce90afad956bcf508b684272112872055d382ab0e1921d
|
||||
37
net-analyzer/scapy/scapy-2.3.3-r1.ebuild
Normal file
37
net-analyzer/scapy/scapy-2.3.3-r1.ebuild
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# Copyright 1999-2017 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="5"
|
||||
|
||||
PYTHON_COMPAT=( python2_7 )
|
||||
|
||||
inherit eutils distutils-r1
|
||||
|
||||
DESCRIPTION="A Python interactive packet manipulation program for mastering the network"
|
||||
HOMEPAGE="http://www.secdev.org/projects/scapy/"
|
||||
SRC_URI="https://github.com/secdev/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
IUSE="gnuplot pyx crypt graphviz imagemagick visual tcpreplay"
|
||||
|
||||
RDEPEND="
|
||||
net-analyzer/tcpdump
|
||||
gnuplot? ( dev-python/gnuplot-py[${PYTHON_USEDEP}] )
|
||||
pyx? ( dev-python/pyx[${PYTHON_USEDEP}] )
|
||||
crypt? ( || ( dev-python/pycryptodome[${PYTHON_USEDEP}]
|
||||
dev-python/pycrypto[${PYTHON_USEDEP}] ) )
|
||||
graphviz? ( media-gfx/graphviz )
|
||||
imagemagick? ( virtual/imagemagick-tools )
|
||||
visual? ( dev-python/visual )
|
||||
tcpreplay? ( net-analyzer/tcpreplay )
|
||||
"
|
||||
|
||||
PDEPEND="virtual/python-scapy"
|
||||
|
||||
src_prepare(){
|
||||
#we provide common files (binaries/man/doc) via virtual package
|
||||
sed -i -e '/scripts=SCRIPTS/d' setup.py
|
||||
sed -i -e '/data_files/d' setup.py
|
||||
}
|
||||
|
|
@ -168,7 +168,7 @@ dev-python/simplesoapy
|
|||
=dev-python/netfilterqueue-0.8*
|
||||
~dev-python/libarchive-c-2.7
|
||||
~dev-python/scapy-http-1.8
|
||||
~dev-python/scapy-python3-0.18
|
||||
~dev-python/scapy-python3-0.20
|
||||
~dev-python/service_identity-16.0.0
|
||||
|
||||
# required by net-analyzer/owtf-2.0a::pentoo
|
||||
|
|
|
|||
|
|
@ -10,7 +10,3 @@ net-wireless/wifite extra dict
|
|||
net-analyzer/wireshark lua
|
||||
net-wireless/wpa_supplicant ap eap-sim uncommon-eap-types tdls p2p wps
|
||||
net-wireless/soapysdr bladerf hackrf rtlsdr uhd
|
||||
|
||||
~net-wireless/wifi-pumpkin-0.8.5 -python_targets_python3_4 -python_targets_python3_5
|
||||
dev-python/scapy-http -python_targets_python3_4 -python_targets_python3_5
|
||||
virtual/python-scapy -python_targets_python3_4 -python_targets_python3_5
|
||||
|
|
|
|||
27
virtual/python-scapy/files/UTscapy
Executable file
27
virtual/python-scapy/files/UTscapy
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#! /usr/bin/env python
|
||||
|
||||
|
||||
#############################################################################
|
||||
## ##
|
||||
## UTscapy.py --- Unit Tests with scapy ##
|
||||
## see http://www.secdev.org/projects/UTscapy/ ##
|
||||
## for more informations ##
|
||||
## ##
|
||||
## Copyright (C) 2005 Philippe Biondi <phil@secdev.org> ##
|
||||
## ##
|
||||
## This program is free software; you can redistribute it and/or modify it ##
|
||||
## under the terms of the GNU General Public License version 2 as ##
|
||||
## published by the Free Software Foundation. ##
|
||||
## ##
|
||||
## This program is distributed in the hope that it will be useful, but ##
|
||||
## WITHOUT ANY WARRANTY; without even the implied warranty of ##
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ##
|
||||
## General Public License for more details. ##
|
||||
## ##
|
||||
#############################################################################
|
||||
|
||||
|
||||
import sys
|
||||
from scapy.tools.UTscapy import main
|
||||
|
||||
main(sys.argv[1:])
|
||||
25
virtual/python-scapy/files/scapy
Executable file
25
virtual/python-scapy/files/scapy
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#! /usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
## ##
|
||||
## scapy.py --- Interactive packet manipulation tool ##
|
||||
## see http://www.secdev.org/projects/scapy/ ##
|
||||
## for more informations ##
|
||||
## ##
|
||||
## Copyright (C) Philippe Biondi <phil@secdev.org> ##
|
||||
## ##
|
||||
## This program is free software; you can redistribute it and/or modify it ##
|
||||
## under the terms of the GNU General Public License version 2 as ##
|
||||
## published by the Free Software Foundation. ##
|
||||
## ##
|
||||
## This program is distributed in the hope that it will be useful, but ##
|
||||
## WITHOUT ANY WARRANTY; without even the implied warranty of ##
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ##
|
||||
## General Public License for more details. ##
|
||||
## ##
|
||||
#############################################################################
|
||||
|
||||
|
||||
from scapy.main import interact
|
||||
|
||||
interact()
|
||||
198
virtual/python-scapy/files/scapy.1
Normal file
198
virtual/python-scapy/files/scapy.1
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
.TH SCAPY 1 "May 12, 2003"
|
||||
.SH NAME
|
||||
scapy \- Interactive packet manipulation tool
|
||||
.SH SYNOPSIS
|
||||
.B scapy
|
||||
.RI [ options ]
|
||||
.SH DESCRIPTION
|
||||
This manual page documents briefly the
|
||||
.B scapy
|
||||
tool.
|
||||
.PP
|
||||
\fBscapy\fP is a powerful interactive packet manipulation tool,
|
||||
packet generator, network scanner, network discovery, packet sniffer,
|
||||
etc. It can for the moment replace hping, parts of nmap, arpspoof, arp-sk,
|
||||
arping, tcpdump, tshark, p0f, ...
|
||||
.PP
|
||||
\fBscapy\fP uses the python interpreter as a command board. That means that
|
||||
you can use directly python language (assign variables, use loops,
|
||||
define functions, etc.) If you give a file as parameter when you run
|
||||
\fBscapy\fP, your session (variables, functions, intances, ...) will be saved
|
||||
when you leave the interpretor, and restored the next time you launch
|
||||
\fBscapy\fP.
|
||||
.PP
|
||||
The idea is simple. Those kind of tools do two things : sending packets
|
||||
and receiving answers. That's what \fBscapy\fP does : you define a set of
|
||||
packets, it sends them, receives answers, matches requests with answers
|
||||
and returns a list of packet couples (request, answer) and a list of
|
||||
unmatched packets. This has the big advantage over tools like nmap or
|
||||
hping that an answer is not reduced to (open/closed/filtered), but is
|
||||
the whole packet.
|
||||
.PP
|
||||
On top of this can be build more high level functions, for example one
|
||||
that does traceroutes and give as a result only the start TTL of the
|
||||
request and the source IP of the answer. One that pings a whole network
|
||||
and gives the list of machines answering. One that does a portscan and
|
||||
returns a LaTeX report.
|
||||
|
||||
.SH OPTIONS
|
||||
Options for scapy are:
|
||||
.TP
|
||||
\fB\-h\fR
|
||||
display usage
|
||||
.TP
|
||||
\fB\-d\fR
|
||||
increase log verbosity. Can be used many times.
|
||||
.TP
|
||||
\fB\-s\fR FILE
|
||||
use FILE to save/load session values (variables, functions, intances, ...)
|
||||
.TP
|
||||
\fB\-p\fR PRESTART_FILE
|
||||
use PRESTART_FILE instead of $HOME/.scapy_prestart.py as pre-startup file
|
||||
.TP
|
||||
\fB\-P\fR
|
||||
do not run prestart file
|
||||
.TP
|
||||
\fB\-c\fR STARTUP_FILE
|
||||
use STARTUP_FILE instead of $HOME/.scapy_startup.py as startup file
|
||||
.TP
|
||||
\fB\-C\fR
|
||||
do not run startup file
|
||||
|
||||
.SH COMMANDS
|
||||
Only the vital commands to begin are listed here for the moment.
|
||||
.TP
|
||||
\fBls()\fR
|
||||
lists supported protocol layers. If a protocol layer is given as parameter, lists its fields and types of fields.
|
||||
.TP
|
||||
\fBlsc()\fR
|
||||
lists some user commands. If a command is given as parameter, its documentation is displayed.
|
||||
.TP
|
||||
\fBconf\fR
|
||||
this object contains the configuration.
|
||||
|
||||
.SH FILES
|
||||
\fB$HOME/.scapy_prestart.py\fR
|
||||
This file is run before scapy core is loaded. Only the \fb\conf\fP object
|
||||
is available. This file can be used to manipulate \fBconf.load_layers\fP
|
||||
list to choose which layers will be loaded:
|
||||
|
||||
.nf
|
||||
conf.load_layers.remove("bluetooth")
|
||||
conf.load_layers.append("new_layer")
|
||||
.fi
|
||||
|
||||
\fB$HOME/.scapy_startup.py\fR
|
||||
This file is run after scapy is loaded. It can be used to configure
|
||||
some of the scapy behaviors:
|
||||
|
||||
.nf
|
||||
conf.prog.pdfreader="xpdf"
|
||||
split_layers(UDP,DNS)
|
||||
.fi
|
||||
|
||||
.SH EXAMPLES
|
||||
|
||||
More verbose examples are available at
|
||||
http://www.secdev.org/projects/scapy/demo.html
|
||||
Just run \fBscapy\fP and try the following commands in the interpreter.
|
||||
|
||||
.LP
|
||||
Test the robustness of a network stack with invalid packets:
|
||||
.nf
|
||||
sr(IP(dst="172.16.1.1", ihl=2, options="\verb$\x02$", version=3)/ICMP())
|
||||
.fi
|
||||
|
||||
.LP
|
||||
Packet sniffing and dissection (with a bpf filter or thetereal-like output):
|
||||
.nf
|
||||
a=sniff(filter="tcp port 110")
|
||||
a=sniff(prn = lambda x: x.display)
|
||||
.fi
|
||||
|
||||
.LP
|
||||
Sniffed packet reemission:
|
||||
.nf
|
||||
a=sniff(filter="tcp port 110")
|
||||
sendp(a)
|
||||
.fi
|
||||
|
||||
.LP
|
||||
Pcap file packet reemission:
|
||||
.nf
|
||||
sendp(rdpcap("file.cap"))
|
||||
.fi
|
||||
|
||||
.LP
|
||||
Manual TCP traceroute:
|
||||
.nf
|
||||
sr(IP(dst="www.google.com", ttl=(1,30))/TCP(seq=RandInt(), sport=RandShort(), dport=dport)
|
||||
.fi
|
||||
|
||||
.LP
|
||||
Protocol scan:
|
||||
.nf
|
||||
sr(IP(dst="172.16.1.28", proto=(1,254)))
|
||||
.fi
|
||||
|
||||
.LP
|
||||
ARP ping:
|
||||
.nf
|
||||
srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst="172.16.1.1/24"))
|
||||
.fi
|
||||
|
||||
.LP
|
||||
ACK scan:
|
||||
.nf
|
||||
sr(IP(dst="172.16.1.28")/TCP(dport=(1,1024), flags="A"))
|
||||
.fi
|
||||
|
||||
.LP
|
||||
Passive OS fingerprinting:
|
||||
.nf
|
||||
sniff(prn=prnp0f)
|
||||
.fi
|
||||
|
||||
.LP
|
||||
Active OS fingerprinting:
|
||||
.nf
|
||||
nmap_fp("172.16.1.232")
|
||||
.fi
|
||||
|
||||
|
||||
.LP
|
||||
ARP cache poisonning:
|
||||
.nf
|
||||
sendp(Ether(dst=tmac)/ARP(op="who-has", psrc=victim, pdst=target))
|
||||
.fi
|
||||
|
||||
.LP
|
||||
Reporting:
|
||||
.nf
|
||||
report_ports("192.168.2.34", (20,30))
|
||||
.fi
|
||||
|
||||
.SH SEE ALSO
|
||||
|
||||
.nf
|
||||
http://www.secdev.org/projects/scapy
|
||||
http://trac.secdev.org/scapy
|
||||
.fi
|
||||
|
||||
.SH BUGS
|
||||
Does not give the right source IP for routes that use interface aliases.
|
||||
|
||||
May miss packets under heavy load.
|
||||
|
||||
Session saving is limited by Python ability to marshal objects. As a
|
||||
consequence, lambda functions and generators can't be saved, which seriously
|
||||
reduce usefulness of this feature.
|
||||
|
||||
BPF filters don't work on Point-to-point interfaces.
|
||||
|
||||
|
||||
.SH AUTHOR
|
||||
Philippe Biondi <phil@secdev.org>
|
||||
.PP
|
||||
This manual page was written by Alberto Gonzalez Iniesta <agi@agi.as>
|
||||
and Philippe Biondi.
|
||||
|
|
@ -10,10 +10,19 @@ inherit python-r1
|
|||
DESCRIPTION="A virtual for scapy, for Python 2 & 3"
|
||||
SLOT="0"
|
||||
KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ppc ppc64 ~s390 ~sh sparc x86 ~amd64-linux ~x86-linux"
|
||||
#REQUIRED_USE="${PYTHON_REQUIRED_USE}"
|
||||
REQUIRED_USE="^^ ( python_targets_python2_7 python_targets_python3_4 )"
|
||||
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
|
||||
|
||||
RDEPEND="${PYTHON_DEPS}
|
||||
$(python_gen_cond_dep 'net-analyzer/scapy[${PYTHON_USEDEP}]' python2*)
|
||||
$(python_gen_cond_dep 'dev-python/scapy-python3[${PYTHON_USEDEP}]' python3*)"
|
||||
DEPEND=""
|
||||
DEPEND="!!<net-analyzer/scapy-2.3.3-r1
|
||||
!!<dev-python/scapy-python3-0.19"
|
||||
|
||||
S=${WORKDIR}
|
||||
|
||||
src_install(){
|
||||
dobin ${FILESDIR}/scapy
|
||||
dobin ${FILESDIR}/UTscapy
|
||||
python_replicate_script ${D}/usr/bin/scapy
|
||||
python_replicate_script ${D}/usr/bin/UTscapy
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue