Launches tor with the '--quiet' flag when attempting to get the hashed password for the control port. Uses 'os.EOL' instead of '\n' when creating the config file for compatibility with windows

This commit is contained in:
Zachary Boyd 2018-08-10 15:43:28 -04:00
parent 7d996ffa81
commit 56b34f2133
4 changed files with 278 additions and 283 deletions

View file

@ -5,5 +5,4 @@ yarn.lock
npm-debug.log
docker-compose.yml
.env
README.md
.travis.yml
README.md

View file

@ -1,5 +1,4 @@
node_modules
yarn.lock
npm-debug.log
.env
.travis.yml
.env

550
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,7 @@ const { TorController } = require('granax');
const { connect } = require('net');
const shell = require('shelljs');
const crypto = require('crypto');
const os = require('os');
temp.track();
class TorProcess extends EventEmitter {
@ -103,10 +104,10 @@ class TorProcess extends EventEmitter {
DNSPort: `127.0.0.1:${context.dnsPort}`,
SocksPort: `127.0.0.1:${context.socksPort}`,
ControlPort: `127.0.0.1:${context.controlPort}`,
HashedControlPassword: shell.exec(`${this.tor_path} --hash-password "${this.control_password}"`, { async: false, silent: true }).stdout.trim()
HashedControlPassword: shell.exec(`${this.tor_path} --quiet --hash-password "${this.control_password}"`, { async: false, silent: true }).stdout.trim()
};
let config = _.extend(_.extend({}, this.tor_config), options);
let text = Object.keys(config).map((key) => `${key} ${config[key]}`).join("\n");
let text = Object.keys(config).map((key) => `${key} ${config[key]}`).join(os.EOL);
temp.open('tor-router', (err, info) => {
if (err) return callback(err);