Skip to content

Commit

Permalink
Merge pull request #16 from Der-Henning/dev
Browse files Browse the repository at this point in the history
security updates, added version check on startup
  • Loading branch information
Der-Henning authored Oct 25, 2021
2 parents ede4cef + faa7893 commit d224931
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
__pycache__
build
dist
.vscode

.env
config.ini
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
service: base
env_file:
- .env
command: /bin/bash -c "pip install -r requirements.txt && cd src && python -m unittest"
command: /bin/bash -c "pip install -r requirements.txt && python -m unittest discover -v -s ./src"
bash:
extends:
service: base
Expand Down
8 changes: 5 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
certifi==2021.5.30
charset-normalizer==2.0.6
idna==3.2
certifi==2021.10.8
charset-normalizer==2.0.7
idna==3.3
packaging==21.0
pyparsing==3.0.1
python-pushsafer==0.4
requests==2.26.0
urllib3==1.26.7
20 changes: 18 additions & 2 deletions src/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
from os import path
from notifiers import Notifiers
from models import Item, Config, ConfigurationError, TGTGConfigurationError
from packaging import version
import requests

VERSION_URL = 'https://api.github.com/repos/Der-Henning/tgtg/releases/latest'
VERSION = "1.2.4"

version = "1.2.3"
prog_folder = path.dirname(sys.executable) if getattr(
sys, '_MEIPASS', False) else path.dirname(path.abspath(__file__))
config_file = path.join(prog_folder, 'config.ini')
Expand Down Expand Up @@ -110,20 +114,32 @@ def run(self):


def welcome_message():
# pylint: disable=W1401
log.info(" ____ ___ ____ ___ ____ ___ __ __ _ __ _ ____ ____ ")
log.info(" (_ _)/ __)(_ _)/ __) / ___) / __) / _\ ( ( \( ( \( __)( _ \ ")
log.info(" )( ( (_ \ )( ( (_ \ \___ \( (__ / \/ // / ) _) ) / ")
log.info(" (__) \___/ (__) \___/ (____/ \___)\_/\_/\_)__)\_)__)(____)(__\_) ")
log.info("")
log.info(f"Version {version}")
log.info(f"Version {VERSION}")
log.info("©2021, Henning Merklinger")
log.info("For documentation and support please visit https://github.com/Der-Henning/tgtg")
log.info("")
# pylint: enable=W1401

def check_version():
try:
last_release = requests.get(VERSION_URL).json()
if version.parse(VERSION) < version.parse(last_release['tag_name']):
log.info(f"New Version {version.parse(last_release['tag_name'])} available!")
log.info(f"Please visit {last_release['html_url']}")
log.info("")
except:
log.error("Version check Error! - {0}".format(sys.exc_info()))

def main():
try:
welcome_message()
check_version()
scanner = Scanner()
scanner.run()
except ConfigurationError as err:
Expand Down

0 comments on commit d224931

Please sign in to comment.