Changed Driver references to Wappalyzer

main
ElbertF 12 years ago
parent b1ca36e19b
commit e09936c4f4

@ -86,25 +86,26 @@ want to port Wappalyzer to a new platform.
**PHP**
Getting the PHP driver up and running on Debian Linux:
The PHP driver requires the [V8js](http://php.net/manual/en/book.v8js.php) class. Installing V8js
using PECL on Debian Linux or Ubuntu should be very straight forward:
* `# aptitude install php5-dev php-pear libv8-dev`
* `# pecl install channel://pecl.php.net/v8js-0.1.3`
* `# echo "extension=v8js.so" > /etc/php5/conf.d/v8js.ini`
Runnning it from the command line:
Runnning Wappalyzer from the command line:
`$ php drivers/php/wappalyzer.php http://wappalyzer.com`
`$ php drivers/php/index.php wappalyzer.com`
Running it inside a PHP script:
Running Wappalyzer inside a PHP script:
```php
require('DriverException.php');
require('Driver.php');
require('WappalyzerException.php');
require('Wappalyzer.php');
$driver = new Driver;
$wappalyzer = new Wappaylzer($url);
$detectedApps = $driver->analyze($url);
$detectedApps = $wappalyzer->analyze();
```

@ -1,4 +0,0 @@
<?php
class DriverException extends Exception
{ }

@ -1,6 +1,6 @@
<?php
class Driver
class Wappalyzer
{
public
$debug = false,
@ -21,21 +21,23 @@ class Driver
/**
* Constructor
*/
public function __construct()
public function __construct($url)
{
$this->v8 = new V8Js();
$this->url = $url;
}
/**
* Analyze a website
* @param string $url
*/
public function analyze($url)
public function analyze()
{
try {
$this->load(array('wappalyzer.js', 'apps.js', 'driver.js'));
$result = $this->curl($url);
$result = $this->curl($this->url);
$json = json_encode(array(
'host' => $this->host,
@ -51,7 +53,7 @@ class Driver
w.driver.init();
');
} catch ( V8JsException $e ) {
throw new DriverException('JavaScript error: ' . $e->getMessage());
throw new WappalyzerException('JavaScript error: ' . $e->getMessage());
}
}
@ -91,13 +93,13 @@ class Driver
$response = curl_exec($ch);
if ( curl_errno($ch) !== 0 ) {
throw new DriverException('cURL error: ' . curl_error($ch));
throw new WappalyzerException('cURL error: ' . curl_error($ch));
}
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ( $httpCode != 200 ) {
throw new DriverException('cURL request returned HTTP code ' . $httpCode);
throw new WappalyzerException('cURL request returned HTTP code ' . $httpCode);
}
$this->url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);

@ -0,0 +1,4 @@
<?php
class WappalyzerException extends Exception
{ }

@ -1,7 +1,7 @@
<?php
require('DriverException.php');
require('Driver.php');
require('WappalyzerException.php');
require('Wappalyzer.php');
try {
if ( php_sapi_name() !== 'cli' ) {
@ -16,9 +16,9 @@ try {
exit(0);
}
$driver = new Driver;
$wappalyzer = new Wappalyzer($url);
$detectedApps = $driver->analyze($url);
$detectedApps = $wappalyzer->analyze();
if ( $detectedApps ) {
echo implode("\n", $detectedApps) . "\n";