Generating tor controlport password

2019-07-20 04:19发布

问题:

I am using the tor-request node module and am having problems. I have followed all steps and directions I could find, Ive searched every site online and I've restarted my computer. I cant finish my project and really am struggling. I keep getting Double Quote Error. Id appreciate any help.

//started tor

tor &

I generated the password with tor --hash-password "myPasswordHere" | tail -n 1

//I also tried
tor --hash-password myPasswordHereWithOutQuotes

//torr file

ControlPort 9051

HashedControlPassword 16:7{{numbers that ^^ returned}}786C1

//index.js / tor-request

var TorControlPort = {
  password: "myPasswordHere", 
  host: 'localhost',
  port: 9051,
  ...

ERROR Uncaught Error: Error communicating with Tor ControlPort 551 Invalid quoted string. You need to put the password in double quotes.

回答1:

This looks like a bug in the library.

I checked out the source here and it doesn't look like the library is quoting the password as it should.

Relevant code:

var commands = [
  'authenticate '+ password +'', // authenticate the connection

As you can see the password is not quoted.

A temporary workaround you should be able to use would be to convert your ascii password to hex which Tor will allow without quotes. e.g password = 70617373776f7264.



回答2:

drew010 is correct. I've responded to the github issue and pushed a fix and updated the README to be more helpful.

Sadly I can't upvote or comment on drew010's reply since I don't have required reputation.

[EDIT]: (I'm the author of the tor-request module)