def test_get_analyze_with_categories(): webpage = WebPage('http://example.com', '<html>aaa</html>', {}) categories = { "1": { "name": "cat1", "priority": 1 }, "2": { "name": "cat2", "priority": 1 } } technologies = { 'a': { 'html': 'aaa', 'cats': [1], }, 'b': { 'html': 'bbb', 'cats': [1, 2], } } analyzer = Wappalyzer(categories=categories, technologies=technologies) result = analyzer.analyze_with_categories(webpage) assert result == {"a": {"categories": ["cat1"]}}
def test_analyze_no_apps(self): analyzer = Wappalyzer(categories={}, apps={}) webpage = WebPage('http://example.com', '<html></html>', {}) detected_apps = analyzer.analyze(webpage) self.assertEquals(detected_apps, set())
def test_analyze_no_technologies(): analyzer = Wappalyzer(categories={}, technologies={}) webpage = WebPage('http://example.com', '<html></html>', {}) detected_technologies = analyzer.analyze(webpage) assert detected_technologies == set()
def test_analyze_with_versions_and_categories_pattern_lists(): webpage = WebPage( 'http://wordpress-example.com', '<html><head><meta name="generator" content="WordPress 5.4.2"></head></html>', {}) categories = { "1": { "name": "CMS", "priority": 1 }, "11": { "name": "Blog", "priority": 1 } } technologies = { "WordPress": { "cats": [1, 11], "html": [], "icon": "WordPress.svg", "implies": ["PHP", "MySQL"], "meta": { "generator": [ "Whatever123", "Whatever456", "^WordPress ?([\\d.]+)?\\;version:\\1", "Whatever" ] }, "website": "https://wordpress.org" }, 'b': { 'html': 'bbb', 'cats': [1, 2], }, "PHP": { "website": "http://php.net" }, "MySQL": { "website": "http://mysql.com" }, } analyzer = Wappalyzer(categories=categories, technologies=technologies) result = analyzer.analyze_with_versions_and_categories(webpage) assert ("WordPress", { "categories": ["CMS", "Blog"], "versions": ["5.4.2"] }) in result.items()
def test_get_analyze_with_categories(self): webpage = WebPage('http://example.com', '<html>aaa</html>', {}) analyzer = Wappalyzer(categories={"1": "cat1", "2": "cat2"}, apps={ 'a': { 'html': 'aaa', 'cats': [1], }, 'b': { 'html': 'bbb', 'cats': [1, 2], }, }) result = analyzer.analyze_with_categories(webpage) self.assertEquals(result, {"a": {"categories": ["cat1"]}})
def test_get_implied_apps(self): analyzer = Wappalyzer(categories={}, apps={ 'a': { 'implies': 'b', }, 'b': { 'implies': 'c', }, 'c': { 'implies': 'a', }, }) implied_apps = analyzer._get_implied_apps('a') self.assertEquals(implied_apps, set(['a', 'b', 'c']))
def test_get_implied_apps(): analyzer = Wappalyzer(categories={}, apps={ 'a': { 'implies': 'b', }, 'b': { 'implies': 'c', }, 'c': { 'implies': 'a', }, }) implied_apps = analyzer._get_implied_apps('a') assert implied_apps == set(['a', 'b', 'c'])
def get(self): try: if self.debug != 0: print( "\033[96m [+] \033[97mPerforming \033[96mTechnology \033[97mscan" ) result = {} w = Wappalyzer() data = w.analyze(self.schema + self.hostname) if isinstance(data, dict) and len(data) > 0: result = data return result except Exception: raise Exception("error recovering used technology")