1*7dc08ffcSJunyu Lai#! /usr/bin/env python 2*7dc08ffcSJunyu Lai 3*7dc08ffcSJunyu Lai""" 4*7dc08ffcSJunyu LaiDistutils setup file for Scapy. 5*7dc08ffcSJunyu Lai""" 6*7dc08ffcSJunyu Lai 7*7dc08ffcSJunyu Lai 8*7dc08ffcSJunyu Laifrom distutils import archive_util 9*7dc08ffcSJunyu Laifrom distutils import sysconfig 10*7dc08ffcSJunyu Laifrom distutils.core import setup 11*7dc08ffcSJunyu Laifrom distutils.command.sdist import sdist 12*7dc08ffcSJunyu Laiimport os 13*7dc08ffcSJunyu Lai 14*7dc08ffcSJunyu Lai 15*7dc08ffcSJunyu LaiEZIP_HEADER = """#! /bin/sh 16*7dc08ffcSJunyu LaiPYTHONPATH=$0/%s exec python -m scapy.__init__ 17*7dc08ffcSJunyu Lai""" 18*7dc08ffcSJunyu Lai 19*7dc08ffcSJunyu Lai 20*7dc08ffcSJunyu Laidef make_ezipfile(base_name, base_dir, verbose=0, dry_run=0, **kwargs): 21*7dc08ffcSJunyu Lai fname = archive_util.make_zipfile(base_name, base_dir, verbose, dry_run) 22*7dc08ffcSJunyu Lai ofname = fname + ".old" 23*7dc08ffcSJunyu Lai os.rename(fname, ofname) 24*7dc08ffcSJunyu Lai of = open(ofname) 25*7dc08ffcSJunyu Lai f = open(fname, "w") 26*7dc08ffcSJunyu Lai f.write(EZIP_HEADER % base_dir) 27*7dc08ffcSJunyu Lai while True: 28*7dc08ffcSJunyu Lai data = of.read(8192) 29*7dc08ffcSJunyu Lai if not data: 30*7dc08ffcSJunyu Lai break 31*7dc08ffcSJunyu Lai f.write(data) 32*7dc08ffcSJunyu Lai f.close() 33*7dc08ffcSJunyu Lai os.system("zip -A '%s'" % fname) 34*7dc08ffcSJunyu Lai of.close() 35*7dc08ffcSJunyu Lai os.unlink(ofname) 36*7dc08ffcSJunyu Lai os.chmod(fname, 0o755) 37*7dc08ffcSJunyu Lai return fname 38*7dc08ffcSJunyu Lai 39*7dc08ffcSJunyu Lai 40*7dc08ffcSJunyu Laiarchive_util.ARCHIVE_FORMATS["ezip"] = ( 41*7dc08ffcSJunyu Lai make_ezipfile, [], 'Executable ZIP file') 42*7dc08ffcSJunyu Lai 43*7dc08ffcSJunyu LaiSCRIPTS = ['bin/scapy', 'bin/UTscapy'] 44*7dc08ffcSJunyu Lai# On Windows we also need additional batch files to run the above scripts 45*7dc08ffcSJunyu Laiif os.name == "nt": 46*7dc08ffcSJunyu Lai SCRIPTS += ['bin/scapy.bat', 'bin/UTscapy.bat'] 47*7dc08ffcSJunyu Lai 48*7dc08ffcSJunyu Laisetup( 49*7dc08ffcSJunyu Lai name='scapy', 50*7dc08ffcSJunyu Lai version=__import__('scapy').VERSION, 51*7dc08ffcSJunyu Lai packages=[ 52*7dc08ffcSJunyu Lai 'scapy', 53*7dc08ffcSJunyu Lai 'scapy/arch', 54*7dc08ffcSJunyu Lai 'scapy/arch/bpf', 55*7dc08ffcSJunyu Lai 'scapy/arch/windows', 56*7dc08ffcSJunyu Lai 'scapy/contrib', 57*7dc08ffcSJunyu Lai 'scapy/layers', 58*7dc08ffcSJunyu Lai 'scapy/layers/tls', 59*7dc08ffcSJunyu Lai 'scapy/layers/tls/crypto', 60*7dc08ffcSJunyu Lai 'scapy/modules', 61*7dc08ffcSJunyu Lai 'scapy/modules/krack', 62*7dc08ffcSJunyu Lai 'scapy/asn1', 63*7dc08ffcSJunyu Lai 'scapy/tools', 64*7dc08ffcSJunyu Lai ], 65*7dc08ffcSJunyu Lai scripts=SCRIPTS, 66*7dc08ffcSJunyu Lai data_files=[('share/man/man1', ["doc/scapy.1.gz"])], 67*7dc08ffcSJunyu Lai package_data={ 68*7dc08ffcSJunyu Lai 'scapy': ['VERSION'], 69*7dc08ffcSJunyu Lai }, 70*7dc08ffcSJunyu Lai 71*7dc08ffcSJunyu Lai # Metadata 72*7dc08ffcSJunyu Lai author='Philippe BIONDI', 73*7dc08ffcSJunyu Lai author_email='phil(at)secdev.org', 74*7dc08ffcSJunyu Lai maintainer='Pierre LALET, Guillaume VALADON', 75*7dc08ffcSJunyu Lai description='Scapy: interactive packet manipulation tool', 76*7dc08ffcSJunyu Lai license='GPLv2', 77*7dc08ffcSJunyu Lai url='http://www.secdev.org/projects/scapy', 78*7dc08ffcSJunyu Lai download_url='https://github.com/secdev/scapy/tarball/master', 79*7dc08ffcSJunyu Lai keywords=["network"], 80*7dc08ffcSJunyu Lai classifiers=[ 81*7dc08ffcSJunyu Lai "Development Status :: 5 - Production/Stable", 82*7dc08ffcSJunyu Lai "Environment :: Console", 83*7dc08ffcSJunyu Lai "Intended Audience :: Developers", 84*7dc08ffcSJunyu Lai "Intended Audience :: Information Technology", 85*7dc08ffcSJunyu Lai "Intended Audience :: Science/Research", 86*7dc08ffcSJunyu Lai "Intended Audience :: System Administrators", 87*7dc08ffcSJunyu Lai "Intended Audience :: Telecommunications Industry", 88*7dc08ffcSJunyu Lai "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", 89*7dc08ffcSJunyu Lai "Programming Language :: Python :: 2", 90*7dc08ffcSJunyu Lai "Programming Language :: Python :: 2.7", 91*7dc08ffcSJunyu Lai "Programming Language :: Python :: 3", 92*7dc08ffcSJunyu Lai "Programming Language :: Python :: 3.3", 93*7dc08ffcSJunyu Lai "Programming Language :: Python :: 3.4", 94*7dc08ffcSJunyu Lai "Programming Language :: Python :: 3.5", 95*7dc08ffcSJunyu Lai "Programming Language :: Python :: 3.6", 96*7dc08ffcSJunyu Lai "Topic :: Security", 97*7dc08ffcSJunyu Lai "Topic :: System :: Networking", 98*7dc08ffcSJunyu Lai "Topic :: System :: Networking :: Monitoring", 99*7dc08ffcSJunyu Lai ] 100*7dc08ffcSJunyu Lai) 101