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