misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
855b493040
commit
df246b255a
@ -4,15 +4,16 @@ __name__ = 'auto-update'
|
|||||||
__license__ = 'GPL3'
|
__license__ = 'GPL3'
|
||||||
__description__ = 'This plugin checks when updates are available and applies them when internet is available.'
|
__description__ = 'This plugin checks when updates are available and applies them when internet is available.'
|
||||||
|
|
||||||
|
import os
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
import requests
|
import requests
|
||||||
import platform
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
import glob
|
import glob
|
||||||
|
import pkg_resources
|
||||||
|
|
||||||
import pwnagotchi
|
import pwnagotchi
|
||||||
import os
|
|
||||||
from pwnagotchi.utils import StatusFile
|
from pwnagotchi.utils import StatusFile
|
||||||
|
|
||||||
OPTIONS = dict()
|
OPTIONS = dict()
|
||||||
@ -45,7 +46,10 @@ def check(version, repo, native=True):
|
|||||||
info['available'] = latest_ver = latest['tag_name'].replace('v', '')
|
info['available'] = latest_ver = latest['tag_name'].replace('v', '')
|
||||||
is_arm = info['arch'].startswith('arm')
|
is_arm = info['arch'].startswith('arm')
|
||||||
|
|
||||||
if latest_ver != info['current']:
|
local = pkg_resources.parse_version(info['current'])
|
||||||
|
remote = pkg_resources.parse_requirements(latest_ver)
|
||||||
|
|
||||||
|
if remote > local:
|
||||||
if not native:
|
if not native:
|
||||||
info['url'] = "https://github.com/%s/archive/%s.zip" % (repo, latest['tag_name'])
|
info['url'] = "https://github.com/%s/archive/%s.zip" % (repo, latest['tag_name'])
|
||||||
else:
|
else:
|
||||||
@ -165,7 +169,7 @@ def on_internet_available(agent):
|
|||||||
to_install = []
|
to_install = []
|
||||||
to_check = [
|
to_check = [
|
||||||
('bettercap/bettercap', subprocess.getoutput('bettercap -version').split(' ')[1].replace('v', ''),
|
('bettercap/bettercap', subprocess.getoutput('bettercap -version').split(' ')[1].replace('v', ''),
|
||||||
True, 'bettercap'),
|
True, 'bettercap'),
|
||||||
('evilsocket/pwngrid', subprocess.getoutput('pwngrid -version').replace('v', ''), True, 'pwngrid-peer'),
|
('evilsocket/pwngrid', subprocess.getoutput('pwngrid -version').replace('v', ''), True, 'pwngrid-peer'),
|
||||||
('evilsocket/pwnagotchi', pwnagotchi.version, False, 'pwnagotchi')
|
('evilsocket/pwnagotchi', pwnagotchi.version, False, 'pwnagotchi')
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user