From a55c302c83b107ea67ec6a78265bfd95ea40d76c Mon Sep 17 00:00:00 2001 From: sud0nick Date: Tue, 25 Dec 2018 18:31:37 -0500 Subject: [PATCH] Version 1.9 --- PortalAuth/includes/changelog/Version 1.9 | 5 +++ PortalAuth/includes/scripts/PortalCloner.py | 35 +++++++++++---------- PortalAuth/js/module.js | 2 +- PortalAuth/module.info | 2 +- 4 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 PortalAuth/includes/changelog/Version 1.9 diff --git a/PortalAuth/includes/changelog/Version 1.9 b/PortalAuth/includes/changelog/Version 1.9 new file mode 100644 index 0000000..cfcab5d --- /dev/null +++ b/PortalAuth/includes/changelog/Version 1.9 @@ -0,0 +1,5 @@ +Dec 25, 2018 +

+ - Moved captive portal test page to AWS S3
+ - Added exception handling to CSS parser
+ - Fixed typo in PortalCloner.py diff --git a/PortalAuth/includes/scripts/PortalCloner.py b/PortalAuth/includes/scripts/PortalCloner.py index 4442ea4..c3a8b54 100755 --- a/PortalAuth/includes/scripts/PortalCloner.py +++ b/PortalAuth/includes/scripts/PortalCloner.py @@ -153,23 +153,26 @@ class PortalCloner: # Search for CSS files linked with the @import statement and remove for style in self.soup.find_all("style"): parser = tinycss.make_parser('page3') - stylesheet = parser.parse_stylesheet(style.string) - for rule in stylesheet.rules: - if rule.at_keyword == "@import": - - # Get the name of the resource - fname = str(rule.uri).split("/")[-1] + try: + stylesheet = parser.parse_stylesheet(style.string) + for rule in stylesheet.rules: + if rule.at_keyword == "@import": - # Download the resource - resourceURLs.append([rul.uri, fname]) - - # Parse the CSS to get image links - _key = "resources/" + fname - self.css_urls[_key] = self.parseCSS(urlparse.urljoin(self.url, rule.uri)) - - # Replace the old link of the CSS with the new one - modStyle = style.string - style.string.replace_with(modStyle.replace(rule.uri, "resources/" + fname)) + # Get the name of the resource + fname = str(rule.uri).split("/")[-1] + + # Download the resource + resourceURLs.append([rule.uri, fname]) + + # Parse the CSS to get image links + _key = "resources/" + fname + self.css_urls[_key] = self.parseCSS(urlparse.urljoin(self.url, rule.uri)) + + # Replace the old link of the CSS with the new one + modStyle = style.string + style.string.replace_with(modStyle.replace(rule.uri, "resources/" + fname)) + except: + pass # Find and download all images and CSS files linked with diff --git a/PortalAuth/js/module.js b/PortalAuth/js/module.js index d776514..680a334 100755 --- a/PortalAuth/js/module.js +++ b/PortalAuth/js/module.js @@ -113,7 +113,7 @@ registerController('PortalAuthController', ['$api', '$scope', '$sce', '$interval configs['dataExpected'] = $scope.dataExpected; configs['p_archive'] = $scope.portalArchive; } else { - configs['testSite'] = "https://www.puffycode.com/cptest.html"; + configs['testSite'] = "https://portalauth.s3.us-east-2.amazonaws.com/cptest.html"; configs['dataExpected'] = "No Captive Portal"; configs['p_archive'] = "/root/portals/"; } diff --git a/PortalAuth/module.info b/PortalAuth/module.info index f27567e..ca97766 100755 --- a/PortalAuth/module.info +++ b/PortalAuth/module.info @@ -6,5 +6,5 @@ "tetra" ], "title": "Portal Auth", - "version": "1.8" + "version": "1.9" }