diff --git a/README.md b/README.md index 0717c1e..e046e5b 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,12 @@ Add php-torcontrol to your `composer.json`: Usage ----- +When using `password authentication` while controlling TOR, the password must be generated using the command: +`~> tor --hash-password "random_password"` +which will generate a `hashed password` beginning with `16:DEE07A96....` (just an example). +This `hashed password` must be inserted in `/etc/tor/torrc`: +`HashedControlPassword 16:DEE07A96....` + ```php 'localhost', 'port' => 9051, - 'password' => 'MySecr3tPassw0rd', + 'password' => 'random_password', + // the original password not the hashed one 'authmethod' => 1 ) ); @@ -56,10 +63,6 @@ $res = $tc->executeCommand('SIGNAL NEWNYM'); // Echo the server reply code and message echo $res[0]['code'].': '.$res[0]['message']; - -// Quit -$tc->quit(); - ``` Related diff --git a/composer.json b/composer.json index 81d7d4f..8b47685 100644 --- a/composer.json +++ b/composer.json @@ -3,20 +3,24 @@ "type": "library", "description": "Tor control library", "keywords": ["tor"], - "homepage": "http://dunglas.fr", + "homepage": "https://dunglas.fr", "license": "MIT", - "authors": [ - { + "authors": [{ "name": "Kévin Dunglas", - "email": "dunglas@gmail.com" - } - ], + "email": "dunglas@gmail.com", + "homepage": "https://dunglas.fr" + }], + "require": { + "php": ">=5.4" + }, "autoload": { - "psr-0": { - "": "src/" + "psr-4": { + "TorControl\\": "src/" } }, - "require": { - "php": ">=5.4" + "autoload-dev": { + "psr-4": { + "TorControl\\Tests\\": "tests/Tests/" + } } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 9a4bcbd..a8a922f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -12,13 +12,13 @@ - ./tests/TorControl/Tests + ./tests/Tests - ./src/TorControl + ./src diff --git a/src/TorControl/Exception/IOError.php b/src/Exception/IOError.php similarity index 100% rename from src/TorControl/Exception/IOError.php rename to src/Exception/IOError.php diff --git a/src/TorControl/Exception/ProtocolError.php b/src/Exception/ProtocolError.php similarity index 100% rename from src/TorControl/Exception/ProtocolError.php rename to src/Exception/ProtocolError.php diff --git a/src/TorControl/Exception/TorError.php b/src/Exception/TorError.php similarity index 100% rename from src/TorControl/Exception/TorError.php rename to src/Exception/TorError.php diff --git a/src/TorControl/TorControl.php b/src/TorControl.php similarity index 100% rename from src/TorControl/TorControl.php rename to src/TorControl.php diff --git a/tests/TorControl/Tests/TorControlTest.php b/tests/Tests/TorControlTest.php similarity index 100% rename from tests/TorControl/Tests/TorControlTest.php rename to tests/Tests/TorControlTest.php