Skip to content

Commit b4fabcc

Browse files
committed
Added entrypoint script under speakeasy.cli
Also added `__main__.py` file so that `python -m speakeasy` will also work.
1 parent 55f9977 commit b4fabcc

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

setup.py

+13-12
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,35 @@
22

33
import setuptools
44

5-
with open('README.md', 'r', encoding='utf8') as fh:
5+
with open("README.md", "r", encoding="utf8") as fh:
66
long_description = fh.read()
77

8-
with open("speakeasy/version.py", encoding='utf8') as fp:
8+
with open("speakeasy/version.py", encoding="utf8") as fp:
99
vl = fp.readline()
10-
gv, ver_num = vl.split('=')
11-
if gv.strip() != '__version__':
12-
raise Exception('Invalid version file found')
13-
version = ver_num.strip().strip("\"\'")
10+
gv, ver_num = vl.split("=")
11+
if gv.strip() != "__version__":
12+
raise Exception("Invalid version file found")
13+
version = ver_num.strip().strip("\"'")
1414

1515
with open("requirements.txt", encoding="utf-8") as f:
1616
requirements = [line.strip() for line in f.readlines()]
1717

1818
setuptools.setup(
19-
name='speakeasy-emulator',
20-
author='Andrew Davis',
21-
description='Speakeasy malware emulation framework',
19+
name="speakeasy-emulator",
20+
author="Andrew Davis",
21+
description="Speakeasy malware emulation framework",
2222
version=version,
2323
long_description=long_description,
24-
long_description_content_type='text/markdown',
24+
long_description_content_type="text/markdown",
2525
packages=setuptools.find_packages(),
26-
url='https://github.com/fireeye/speakeasy',
26+
url="https://github.com/fireeye/speakeasy",
2727
include_package_data=True,
2828
install_requires=requirements,
2929
classifiers=[
3030
"Programming Language :: Python :: 3",
3131
"License :: OSI Approved :: MIT License",
3232
"Operating System :: OS Independent",
3333
],
34-
python_requires='>=3.6',
34+
python_requires=">=3.6",
35+
entry_points={"console_scripts": ["speakeasy=speakeasy.cli:main"]},
3536
)

speakeasy/__main__.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
2+
from speakeasy.cli import main
3+
4+
main()

run_speakeasy.py speakeasy/cli.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ def __init__(self, parser):
197197
f.write(report)
198198

199199

200-
if __name__ == '__main__':
200+
def main():
201+
""" speakeasy command line entrypoint """
201202

202203
parser = argparse.ArgumentParser(description='Emulate a Windows binary with speakeasy')
203204
parser.add_argument('-t', '--target', action='store', dest='target',
@@ -245,3 +246,6 @@ def __init__(self, parser):
245246
'speakeasy itself (using pdb.set_trace()).\n')
246247

247248
Main(parser)
249+
250+
if __name__ == "__main__":
251+
main()

0 commit comments

Comments
 (0)