Home | History | Annotate | Download | only in scapy
      1 #! /usr/bin/env python
      2 
      3 """
      4 Distutils setup file for Scapy.
      5 """
      6 
      7 
      8 from distutils import archive_util
      9 from distutils import sysconfig
     10 from distutils.core import setup
     11 from distutils.command.sdist import sdist
     12 import os
     13 
     14 
     15 EZIP_HEADER = """#! /bin/sh
     16 PYTHONPATH=$0/%s exec python -m scapy.__init__
     17 """
     18 
     19 
     20 def 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 
     40 archive_util.ARCHIVE_FORMATS["ezip"] = (
     41     make_ezipfile, [], 'Executable ZIP file')
     42 
     43 SCRIPTS = ['bin/scapy', 'bin/UTscapy']
     44 # On Windows we also need additional batch files to run the above scripts
     45 if os.name == "nt":
     46     SCRIPTS += ['bin/scapy.bat', 'bin/UTscapy.bat']
     47 
     48 setup(
     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