From ea4d887a12086de3414cf8d3eaf9b169343113f7 Mon Sep 17 00:00:00 2001 From: Elbert Alias Date: Sat, 21 Mar 2015 09:59:08 +1100 Subject: [PATCH] Added Dockerfile to PhantomJS driver, exit PhantomJS on error --- src/apps.json | 24 ++++++++-------- src/drivers/phantomjs/Dockerfile | 29 +++++++++++++++++++ src/drivers/phantomjs/driver.js | 46 +++++++++++++++---------------- src/icons/aaa.png | Bin 0 -> 1050 bytes 4 files changed, 64 insertions(+), 35 deletions(-) create mode 100644 src/drivers/phantomjs/Dockerfile create mode 100644 src/icons/aaa.png diff --git a/src/apps.json b/src/apps.json index 3c1a75a48..ac4844b2e 100755 --- a/src/apps.json +++ b/src/apps.json @@ -2513,6 +2513,17 @@ "implies": "Windows Server", "website": "www.iis.net" }, + "INFOnline": { + "cats": [ + 10 + ], + "env": [ + "^szmvars$", + "^iam_data$" + ], + "script": "^https?://(?:[^/]+\\.)?i(?:oam|v)wbox\\.de/", + "website": "infonline.de" + }, "IPB": { "cats": [ 2 @@ -2547,17 +2558,6 @@ }, "website": "impresspages.org" }, - "INFOnline": { - "cats": [ - 10 - ], - "env": [ - "^szmvars$", - "^iam_data$" - ], - "script": "^https?://(?:[^/]+\\.)?i(?:oam|v)wbox\\.de/", - "website": "infonline.de" - }, "InProces": { "cats": [ 1 @@ -7238,4 +7238,4 @@ "49": "feed-readers", "50": "document-management-systems" } -} +} \ No newline at end of file diff --git a/src/drivers/phantomjs/Dockerfile b/src/drivers/phantomjs/Dockerfile new file mode 100644 index 000000000..42d120a67 --- /dev/null +++ b/src/drivers/phantomjs/Dockerfile @@ -0,0 +1,29 @@ +FROM phusion/baseimage + +MAINTAINER Elbert Alias + +ENV DEBIAN_FRONTEND noninteractive + +RUN \ + apt-get update && apt-get install -y \ + libfreetype6 \ + libfontconfig \ + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +WORKDIR /usr/local + +# PhantomJS +RUN \ + mkdir phantomjs && \ + curl -L https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2 | tar xvjC phantomjs --strip 1 + +# Wappalyzer +RUN \ + mkdir wappalyzer && \ + curl -sSL https://github.com/AliasIO/Wappalyzer/archive/master.tar.gz | tar xzC wappalyzer --strip 1 + +RUN wappalyzer/bin/wappalyzer-links wappalyzer + +WORKDIR wappalyzer/src/drivers/phantomjs + +ENTRYPOINT ["/usr/local/phantomjs/bin/phantomjs", "--load-images=false", "--ignore-ssl-errors=yes", "driver.js"] diff --git a/src/drivers/phantomjs/driver.js b/src/drivers/phantomjs/driver.js index 83245f5aa..c1e6372ea 100644 --- a/src/drivers/phantomjs/driver.js +++ b/src/drivers/phantomjs/driver.js @@ -105,7 +105,7 @@ return; } - if ( response.stage === 'end' && response.contentType.indexOf('text/html') !== -1 ) { + if ( response.stage === 'end' && response.status === 200 && response.contentType.indexOf('text/html') !== -1 ) { response.headers.forEach(function(header) { headers[header.name.toLowerCase()] = header.value; }); @@ -116,36 +116,36 @@ page.open(url, function(status) { var html, environmentVars; - if ( status === 'fail' ) { - return; - } + wappalyzer.log('page.open: ' + status); - html = page.content; + if ( status === 'success' ) { + html = page.content; - if ( html.length > 50000 ) { - html = html.substring(0, 25000) + html.substring(html.length - 25000, html.length); - } + if ( html.length > 50000 ) { + html = html.substring(0, 25000) + html.substring(html.length - 25000, html.length); + } - // Collect environment variables - environmentVars = page.evaluate(function() { - var i, environmentVars; + // Collect environment variables + environmentVars = page.evaluate(function() { + var i, environmentVars; - for ( i in window ) { - environmentVars += i + ' '; - } + for ( i in window ) { + environmentVars += i + ' '; + } - return environmentVars; - }); + return environmentVars; + }); - wappalyzer.log({ message: 'environmentVars: ' + environmentVars }); + wappalyzer.log({ message: 'environmentVars: ' + environmentVars }); - environmentVars = environmentVars.split(' ').slice(0, 500); + environmentVars = environmentVars.split(' ').slice(0, 500); - wappalyzer.analyze(hostname, url, { - html: html, - headers: headers, - env: environmentVars - }); + wappalyzer.analyze(hostname, url, { + html: html, + headers: headers, + env: environmentVars + }); + } phantom.exit(); }); diff --git a/src/icons/aaa.png b/src/icons/aaa.png new file mode 100644 index 0000000000000000000000000000000000000000..f16159bc024a8e24813c3cfb7d669e092872bf79 GIT binary patch literal 1050 zcmV+#1m*jQP)?Q^EBmnIw1@9>a?iI~V#n4f;9=|2PQzIt%_{{8&_ z|Ns8}{{R2~|Nr_CUpN2&0$WK$K~xwS1%N?ooMjY+pL6f~&1BLB(X1vH?5RGLI5)?{YBx%Y@Z3B@4DPz0$+6iS3hU~~t&h*8KLgb5l* zff0Fu9Yz(h0D&ckTVN@lN|t4{90q7W76G#J0%Xa?VaY;(Kz1PV#FW4yIsyU09oVwa zfJ(Zflep^zOe_y!AEAy)4?254Kt26)`KW<-`0da%qJdEWyBLb~^W&w1j_LGzMK)Yl5s@^KG`>FMV3f{~e-y;#0p7=X}lZI_kJW_3;lO;GVp z?nOsH7z zbC7*?MH2Jk`CIJnuE6c~o694_9P5`quVZHT@ds;n*S@20yY&9DN5|&X!FaV9Eia$V zRc?2<%Dw*lXr8E8|Cr;Kbr;io`0*`O?y#vodltz&-G6n`efG^}n#nkRvTMp=8}_D9 zy}ogE+}>CKRPSBU?ylS4TeI%IJlR&wr!Ur;tFQmmzPmF4rk_51