/** * Bookmarklet driver */ (function() { if ( wappalyzer == null ) return; var w = wappalyzer, debug = true d = window.document, container = d.getElementById('wappalyzer-container'), domain = window.top.location.host, url = window.top.location.href, categoryNames = { 1: 'CMS', 2: 'Message Board', 3: 'Database Manager', 4: 'Documentation Tool', 5: 'Widget', 6: 'Web Shop', 7: 'Photo Gallery', 8: 'Wiki', 9: 'Hosting Panel', 10: 'Analytics', 11: 'Blog', 12: 'Javascript Framework', 13: 'Issue Tracker', 14: 'Video Player', 15: 'Comment System', 16: 'Captcha', 17: 'Font Script', 18: 'Web Framework', 19: 'Miscellaneous', 20: 'Editor', 21: 'LMS', 22: 'Web Server', 23: 'Cache Tool', 24: 'Rich Text Editor', 25: 'Javascript Graphics', 26: 'Mobile Framework', 27: 'Programming Language', 28: 'Operating System', 29: 'Search Engine' } ; w.driver = { /** * Log messages to console */ log: function(args) { if ( debug && console != null && console[args.type] != null ) { console[args.type](args.message); } }, /** * Initialize */ init: function() { w.driver.getEnvironmentVars(); w.driver.getResponseHeaders(); }, getEnvironmentVars: function() { w.log('func: getEnvironmentVars'); var env = new Array; for ( i in window ) { env.push(i); } w.analyze(domain, url, { html: d.documentElement.innerHTML, env: env }); }, getResponseHeaders: function() { w.log('func: getResponseHeaders'); var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.onreadystatechange = function() { if ( xhr.readyState === 4 && xhr.status ) { var headers = xhr.getAllResponseHeaders().split("\n"); if ( headers.length > 0 && headers[0] != '' ) { w.log('responseHeaders: ' + xhr.getAllResponseHeaders()); var responseHeaders = {}; headers.forEach(function(line) { if ( line ) { name = line.substring(0, line.indexOf(': ')); value = line.substring(line.indexOf(': ') + 2, line.length - 1); responseHeaders[name] = value; } }); w.analyze(domain, url, { headers: responseHeaders }); } } } xhr.send(); }, /** * Display apps */ displayApps: function() { var category, html ; html = '' + 'Close' + '' + '
' ; if ( false && w.detected[url] != null && w.detected[url].length ) { w.detected[url].map(function(app, i) { html += '
' + '' + '' + ' ' + app + '' + '' ; for ( cat in w.apps[app].cats ) { category = w.apps[app].cats[cat]; html += '' + categoryNames[category] + ''; } html += '
'; }); } else { html += '
No applications detected
'; } html += '
'; container.innerHTML = html; }, /** * Go to URL */ goToURL: function(args) { window.open(args.url); } }; w.init(); })();