-
Notifications
You must be signed in to change notification settings - Fork 250
/
setup.py
164 lines (147 loc) · 6.88 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
################################################################################
#
# Copyright 2015-2020 Felix Brezo and Yaiza Rubio
#
# This program is part of OSRFramework. You can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
import os
import sys
from setuptools import setup, find_packages
try:
print("[*] OSRFramework > Checking Python version...")
assert sys.version_info >= (3, 6)
print("OSRFramework > Python version Ok: {}.{}.{}.".format(sys.version_info.major,
sys.version_info.minor,
sys.version_info.micro))
except AssertionError:
print("[*] OSRFramework > Installation aborted!")
print("[*] OSRFramework > Since OSRFramework 0.20+, Python 3.6+ is required. Python 2.7 reached its end of life on 2019/12/31.")
print("[*] OSRFramework > Try to install it using Python 3.6+.")
sys.exit(1)
import osrframework
import osrframework.utils.configuration as configuration
HERE = os.path.abspath(os.path.dirname(__file__))
# Importing the temporal scripts for the setup and taking the new version number
NEW_VERSION = osrframework.__version__
print("[*] OSRFramework > Reading requirements...")
with open("requirements.txt") as file:
requirements = file.read().splitlines()
# Depending on the place in which the project is going to be upgraded
"""def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()"""
# Creating the application paths
paths = configuration.get_config_path()
print("[*] OSRFramework > Launching the installation of the osrframework module...")
# Launching the setup
setup(
name="osrframework",
version=NEW_VERSION,
description="OSRFramework - A set of AGPLv3+ OSINT tools developed by i3visio analysts for online research.",
author="Felix Brezo and Yaiza Rubio",
author_email="[email protected]",
url="http://github.com/i3visio/osrframework",
license="COPYING",
keywords="python osint harvesting profiling username socialmedia forums",
entry_points={
'console_scripts': [
'alias_generator = osrframework.alias_generator:main',
'alias_generator.py = osrframework.alias_generator:main',
'domainfy = osrframework.domainfy:main',
'domainfy.py = osrframework.domainfy:main',
'checkfy = osrframework.checkfy:main',
'checkfy.py = osrframework.checkfy:main',
'mailfy = osrframework.mailfy:main',
'mailfy.py = osrframework.mailfy:main',
'phonefy = osrframework.phonefy:main',
'phonefy.py = osrframework.phonefy:main',
'searchfy = osrframework.searchfy:main',
'searchfy.py = osrframework.searchfy:main',
'usufy = osrframework.usufy:main',
'usufy.py = osrframework.usufy:main',
'osrf = osrframework.launcher:main',
'osrframework-cli = osrframework.launcher:main',
],
},
classifiers=[
'Development Status :: 4 - Beta',
'Topic :: Software Development :: Libraries',
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.6',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'Intended Audience :: Science/Research',
'Intended Audience :: Telecommunications Industry',
'Natural Language :: English',
'Topic :: Communications',
'Topic :: Internet :: WWW/HTTP :: Indexing/Search',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Scientific/Engineering :: Visualization',
'Topic :: Text Processing :: Markup :: HTML'
],
packages=find_packages(),
#long_description=read('README.md'),
long_description_content_type="text/markdown",
install_requires=requirements,
)
############################
### Creating other files ###
############################
print("[*] OSRFramework > Changing permissions of the user folders...")
try:
configuration.change_permissions_recursively(paths["appPath"], int(os.getenv('SUDO_UID')), int(os.getenv('SUDO_GID')))
except:
# Something happened with the permissions... We omit this.
pass
print("[*] OSRFramework > Population OSRFramework's configuration folder...")
files_to_copy= {
paths["appPath"] : [
os.path.join("config", "browser.cfg"),
os.path.join("config", "general.cfg"),
],
paths["appPathDefaults"] : [
os.path.join("config", "accounts.cfg"),
os.path.join("config", "api_keys.cfg"),
os.path.join("config", "browser.cfg"),
os.path.join("config", "general.cfg"),
],
paths["appPathWrappers"] : [
os.path.join("config", "plugins", "wrapper.py.sample"),
os.path.join("config", "plugins", "wrapper_v2.py.sample"),
]
}
# Iterating through all destinations to write the info
for destiny in files_to_copy.keys():
# Grabbing each source file to be moved
for source_file in files_to_copy[destiny]:
file_to_move = os.path.join(HERE, source_file)
cmd = ""
# Choosing the command depending on the SO
if sys.platform == 'win32':
if os.path.isdir(file_to_move):
cmd = "echo d | xcopy \"" + file_to_move + "\" \"" + destiny + "\" /s /e"
else:
cmd = "copy \"" + file_to_move + "\" \"" + destiny + "\""
elif sys.platform == 'linux' or sys.platform == 'darwin':
if not os.geteuid() == 0:
cmd = "cp -r -- \"" + file_to_move + "\" \"" + destiny + "\""
else:
cmd = "sudo cp -r -- \"" + file_to_move + "\" \"" + destiny + "\""
else:
print("File '{file_to_move}' could not be copied in a {sys.platform.title()} system.")
continue
print(f"\t> {cmd}")
output = os.popen(cmd).read()
print("[*] OSRFramework > Installation ended. If you don't know where to start, run `osrf` to start working on it.")