This repository was archived by the owner on Sep 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
68 lines (58 loc) · 2.19 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Malvm Setup.py configuration."""
import glob
import shutil
import sys
from pathlib import Path
import codecs
import os.path
import setuptools
def get_config_root() -> Path:
"""Returns path for config and temp files."""
platform = sys.platform.lower()
if platform in ["linux", "linux2", "darwin"]:
config_path = Path.home() / ".local/share/malvm"
elif platform in ["windows", "win32"]:
config_path = Path.home().absolute() / "/AppData/Local/malvm"
else:
raise OSError(f"Your platform <{platform}> is not supported by malvm.")
if not config_path.exists():
config_path.mkdir(parents=True)
return config_path
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()
def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith('__version__'):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")
DATA_FILES = [
str(file.absolute())
for file in (Path(__file__).parent / "src/malvm/data").rglob("*")
]
setuptools.setup(
name="malvm",
version=get_version("src/malvm/__init__.py"),
author="Leander Kohler",
author_email="[email protected]",
description="Creates non detectable VMs to analyze Malware.",
classifiers=["Programming Language :: Python :: 3"],
url="https://gitlab.com/shk_fkie/analysevm/",
project_urls={"GitLab.com Source": "https://gitlab.com/shk_fkie/analysevm/"},
python_requires=">=3.6",
packages=setuptools.find_packages(where="src"),
package_dir={"": "src"},
install_requires=["click", "inquirer", "pyyaml",
'wmi; platform_system=="Windows"'],
package_data={"malvm": DATA_FILES},
entry_points={"console_scripts": ["malvm = malvm.__main__:main"]},
)
# Add malvm installation file to config folder
# Needed for installing malvm on each Virtual Machine
for file in glob.glob(r"dist/malvm*.tar.gz"):
shutil.copy(file, str((get_config_root() / "malvm.tar.gz").absolute()))