2019-10-05 23:23:31 +02:00
|
|
|
#!/usr/bin/env python3
|
2019-10-06 23:25:02 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2019-10-05 23:23:31 +02:00
|
|
|
from setuptools import setup, find_packages
|
2019-10-31 12:48:15 +01:00
|
|
|
import os
|
|
|
|
import glob
|
|
|
|
import shutil
|
2020-01-16 18:52:40 +01:00
|
|
|
import re
|
2019-10-31 12:48:15 +01:00
|
|
|
|
|
|
|
|
2019-11-01 12:12:37 +01:00
|
|
|
def install_file(source_filename, dest_filename):
|
|
|
|
# do not overwrite network configuration if it exists already
|
|
|
|
# https://github.com/evilsocket/pwnagotchi/issues/483
|
|
|
|
if dest_filename.startswith('/etc/network/interfaces.d/') and os.path.exists(dest_filename):
|
|
|
|
print("%s exists, skipping ..." % dest_filename)
|
|
|
|
return
|
|
|
|
|
|
|
|
print("installing %s to %s ..." % (source_filename, dest_filename))
|
|
|
|
try:
|
2019-10-31 12:48:15 +01:00
|
|
|
dest_folder = os.path.dirname(dest_filename)
|
2019-11-01 12:12:37 +01:00
|
|
|
if not os.path.isdir(dest_folder):
|
|
|
|
os.makedirs(dest_folder)
|
|
|
|
|
|
|
|
shutil.copyfile(source_filename, dest_filename)
|
|
|
|
except Exception as e:
|
|
|
|
print("error installing %s: %s" % (source_filename, e))
|
|
|
|
|
|
|
|
|
|
|
|
def install_system_files():
|
|
|
|
setup_path = os.path.dirname(__file__)
|
|
|
|
data_path = os.path.join(setup_path, "builder/data")
|
|
|
|
|
|
|
|
for source_filename in glob.glob("%s/**" % data_path, recursive=True):
|
|
|
|
if os.path.isfile(source_filename):
|
|
|
|
dest_filename = source_filename.replace(data_path, '')
|
|
|
|
install_file(source_filename, dest_filename)
|
2019-10-31 12:48:15 +01:00
|
|
|
|
2019-11-01 12:12:37 +01:00
|
|
|
# reload systemd units
|
|
|
|
os.system("systemctl daemon-reload")
|
2019-10-31 12:48:15 +01:00
|
|
|
|
|
|
|
|
2019-11-08 13:36:27 +01:00
|
|
|
def installer():
|
|
|
|
install_system_files()
|
|
|
|
# for people updating https://github.com/evilsocket/pwnagotchi/pull/551/files
|
|
|
|
os.system("systemctl enable fstrim.timer")
|
|
|
|
|
2020-01-16 18:52:40 +01:00
|
|
|
def version(version_file):
|
|
|
|
with open(version_file, 'rt') as vf:
|
|
|
|
version_file_content = vf.read()
|
|
|
|
|
|
|
|
version_match = re.search(r"__version__\s*=\s*[\"\']([^\"\']+)", version_file_content)
|
|
|
|
if version_match:
|
|
|
|
return version_match.groups()[0]
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
2019-11-08 13:36:27 +01:00
|
|
|
|
|
|
|
installer()
|
2019-10-05 23:23:31 +02:00
|
|
|
|
|
|
|
with open('requirements.txt') as fp:
|
2019-12-02 13:32:36 -08:00
|
|
|
required = [line.strip() for line in fp if line.strip() != ""]
|
2019-10-05 23:23:31 +02:00
|
|
|
|
2020-01-16 18:52:40 +01:00
|
|
|
VERSION_FILE = 'pwnagotchi/_version.py'
|
|
|
|
pwnagotchi_version = version(VERSION_FILE)
|
2019-10-31 12:48:15 +01:00
|
|
|
|
2019-10-05 23:23:31 +02:00
|
|
|
setup(name='pwnagotchi',
|
2020-01-16 18:52:40 +01:00
|
|
|
version=pwnagotchi_version,
|
2019-10-05 23:30:06 +02:00
|
|
|
description='(⌐■_■) - Deep Reinforcement Learning instrumenting bettercap for WiFI pwning.',
|
2019-10-05 23:23:31 +02:00
|
|
|
author='evilsocket && the dev team',
|
|
|
|
author_email='evilsocket@gmail.com',
|
|
|
|
url='https://pwnagotchi.ai/',
|
2019-10-05 23:28:29 +02:00
|
|
|
license='GPL',
|
2019-10-05 23:23:31 +02:00
|
|
|
install_requires=required,
|
|
|
|
scripts=['bin/pwnagotchi'],
|
2019-10-08 21:41:34 +02:00
|
|
|
package_data={'pwnagotchi': ['defaults.yml', 'pwnagotchi/defaults.yml', 'locale/*/LC_MESSAGES/*.mo']},
|
2019-10-06 13:41:55 -05:00
|
|
|
include_package_data=True,
|
2019-10-05 21:22:03 -05:00
|
|
|
packages=find_packages(),
|
2019-10-05 23:23:31 +02:00
|
|
|
classifiers=[
|
|
|
|
'Programming Language :: Python :: 3',
|
|
|
|
'Development Status :: 5 - Production/Stable',
|
|
|
|
'License :: OSI Approved :: GNU General Public License (GPL)',
|
|
|
|
'Environment :: Console',
|
2019-10-05 21:22:03 -05:00
|
|
|
])
|