Skip to content

Commit

Permalink
slips.py: use slips version from the config file
Browse files Browse the repository at this point in the history
  • Loading branch information
AlyaGomaa committed Mar 7, 2023
1 parent e90d82f commit c248087
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions slips.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
from daemon import Daemon
from multiprocessing import Queue

version = '1.0.2'

# Ignore warnings on CPU from tensorflow
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
Expand All @@ -66,6 +65,7 @@ def __init__(self, testing=False):
self.start_port = 32768
self.end_port = 32850
self.conf = ConfigParser()
self.version = self.conf.get_slips_version()
self.args = self.conf.get_args()
# in testing mode we manually set the following params
if not testing:
Expand Down Expand Up @@ -573,8 +573,9 @@ def add_metadata(self):
now = utils.convert_format(now, utils.alerts_format)

self.info_path = os.path.join(metadata_dir, 'info.txt')

with open(self.info_path, 'w') as f:
f.write(f'Slips version: {version}\n'
f.write(f'Slips version: {self.version}\n'
f'File: {self.input_information}\n'
f'Branch: {branch}\n'
f'Commit: {commit}\n'
Expand Down Expand Up @@ -1534,7 +1535,7 @@ def set_input_metadata(self):
to_ignore = self.conf.get_disabled_modules(self.input_type)

info = {
'slips_version': version,
'slips_version': self.version,
'name': self.input_information,
'analysis_start': now,
'disabled_modules': json.dumps(to_ignore),
Expand Down Expand Up @@ -1610,7 +1611,7 @@ def check_output_redirection(self) -> tuple:
return (current_stdout, stderr, slips_logfile)

def print_version(self):
slips_version = f'Slips. Version {self.green(version)}'
slips_version = f'Slips. Version {self.green(self.version)}'
branch_info = utils.get_branch_info()
if branch_info != False:
# it's false when we're in docker because there's no .git/ there
Expand Down Expand Up @@ -1655,6 +1656,7 @@ def update_slips_running_stats(self):
def start(self):
"""Main Slips Function"""
try:

self.print_version()
print('https://stratosphereips.org')
print('-' * 27)
Expand Down
6 changes: 6 additions & 0 deletions slips_files/common/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ def get_entropy_threshold(self):
return float(threshold)
except Exception as ex:
return 5
def get_slips_version(self):
version = self.read_configuration(
'version', 'slips_version', ''
)

return version


def get_pastebin_download_threshold(self):
Expand Down

0 comments on commit c248087

Please sign in to comment.