matamorphosis / Scrummage

The Ultimate OSINT and Threat Hunting Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strange scheduling problem

Joukahainen123 opened this issue · comments

For some reason the default cronjobs do not seem to work in my case (vanilla Ubuntu 20.4.1 LTS).

If I run /usr/bin/python3 /home/username/Scrummage/lib/plugin_caller.py -t 1 from any other folder than /home/username/Scrummage/lib/ I will get the following error.

username@scrummage:~/Scrummage$ /usr/bin/python3 /home/username/Scrummage/lib/plugin_caller.py -t 1
WARNING:root:2020-12-22 11:17:34 Connectors Library - Failed to load configuration file.
WARNING:root:2020-12-22 11:17:34 Connectors Library - Failed to connect to database.
[-] Invalid Task ID, please provide a valid Task ID.

If I run the /usr/bin/python3 /home/username/Scrummage/lib/plugin_caller.py -t from /home/username/Scrummage/lib/ everything works. The story is the same, if I add the path to my cronjob, example below:

5 0 * * * cd /home/username/Scrummage/lib/ && /usr/bin/python3 /home/username/Scrummage/lib/plugin_caller.py -t 1

Hi Joukahainen123,

Thanks again for raising this I have pushed a fix, so if you could again pull the latest changes to get this working. A couple of extra steps are required.

  1. As the bash user you are running the Scrummage web service with, type the command crontab -e and clear all tasks related to calling the the "plugin_caller.py" file.
  2. For each task you are running on a schedule, you will need to edit the task and take note of the current frequency, then clear the frequency field and save the changes. Then edit the same task enter the previously cleared frequency and save.
  3. After doing this to each task, in a new terminal as the Scrummage bash user, again type crontab -e and ensure you have the updated of the cron jobs present.

Cheers,

matamorphosis

Hi, did git pull and the changes. Now getting the following error (when running out of lib folder).

Usernamewashere@scrummage:~/Scrummage$ /usr/bin/python3 /home/Usernamewashere/Scrummage/lib/plugin_caller.py -t 8 -c /home/Usernamewashere/Scrummage/lib/plugins/common/config/config.json
WARNING:root:2020-12-28 11:04:07 Connectors Library - Failed to load configuration file.
WARNING:root:2020-12-28 11:04:07 Connectors Library - Failed to connect to database.
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/Usernamewashere/Scrummage/lib/plugin_caller.py", line 5, in Starter
Cursor = Connection.cursor()
AttributeError: 'NoneType' object has no attribute 'cursor'
INFO:root:2020-12-28 11:04:07 - Shodan_Search - Loading configuration data.
WARNING:root:2020-12-28 11:04:07 - Shodan_Search - Failed to load location details.
INFO:root:2020-12-28 11:04:07 General Library - No cache file found, caching will not be used for this session.
ERROR:root:2020-12-28 11:04:08 - Shodan_Search - Invalid API key.
WARNING:root:2020-12-28 11:04:08 Connectors Library - Failed to load configuration file.
WARNING:root:2020-12-28 11:04:08 Connectors Library - Failed to connect to database.
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/Usernamewashere/Scrummage/lib/plugin_caller.py", line 12, in Stopper
Cursor = Connection.cursor()
AttributeError: 'NoneType' object has no attribute 'cursor'

Thanks for that, not sure how I missed it but there was a mass issue preventing either Scrummage.py or plugin_caller.py being run from any other location than /path/to/Scrummage/lib. I've fixed it up and tested both those python files which now works for me.

If I could get you to once again pull the latest changes, and also either manually revoke the changes you made to the cron entries. Just everything from -c onwards so an example would be */5 * * * * /usr/bin/python3 /home/user/Downloads/Installers/Scrummage/lib/plugin_caller.py -t 22 (Make sure there are no spaces after the ending number). If this is too complex just delete all cron entries and re-follow the steps in my last comment.

Thanks again for your support with this.

Now working. Thanks.