Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Change how random irc nicknames are generated. #121

Merged
merged 2 commits into from
Aug 2, 2015
Merged

Change how random irc nicknames are generated. #121

merged 2 commits into from
Aug 2, 2015

Conversation

CohibAA
Copy link
Contributor

@CohibAA CohibAA commented Jul 3, 2015

I believe this is a more anonymous and random method and possibly more efficient way to generate random_nick for ircnick. Thoughts?

I believe this is a more anonymous and random method and possibly more efficient way to generate random_nick for ircnick.  Thoughts?
@CohibAA
Copy link
Contributor Author

CohibAA commented Jul 3, 2015

Forgot to mention, I believe urllib2 may have also been causing an error in tor logs when generating the nickname...

[warn] Socks version 80 not recognized. (Tor is not an http proxy.)

but I am not 100% sure of the cause of the tor log error, so feedback is appreciated.

disallow digits in first position of nickname
@chris-belcher
Copy link
Collaborator

I used wikipedia because I thought the english-language words would make it less clear which IRC nick was a bot and which was an actual human. It might be important for a tumbler bot for example which idles in the channel for a long time and never publicly says anything.

@CohibAA
Copy link
Contributor Author

CohibAA commented Jul 3, 2015

That makes sense, regarding why to use Wikipedia for names. My primary concern was the call to get the wiki page and urllib2's impact on tor integrity, hence this workaround method.

Regarding urllib2 and tor, this is likely what caused the tor log warnings.

The problem is that httplib.HTTPConnection uses the socket module's create_connection helper function which does the DNS request via the usual getaddrinfo method before connecting the socket.

I have not seen the warnings while not using the urllib2 import. This is the solution suggested on stackflow.

The solution is to make your own create_connection function and monkey-patch it into the socket module before importing urllib2, just like we do with the socket class.

Suggested code example:

import socks
import socket
def create_connection(address, timeout=None, source_address=None):
    sock = socks.socksocket()
    sock.connect(address)
    return sock

socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050)

# patch the socket module
socket.socket = socks.socksocket
socket.create_connection = create_connection

import urllib2

I haven't researched completely nor tested at all, but this looks to fit at first glance. I will revert to the Wikipedia names method and try this solution to see if the tor warnings stay away.

@BlinkyStitt
Copy link
Contributor

I like this PR. If someone wants to "hide" in the channel by pretending to be a bot, they can pick some random numbers or letters just as easily as they can pick a random page off wikipedia. There's no need to make an http request.

@chris-belcher
Copy link
Collaborator

The http request really kills it actually.
Has anyone tried this yet? I'll merge after trying it.

@kristovatlas
Copy link

There's python code for connecting to Tor in this script that works, if anyone is interested: https://github.com/kristovatlas/onion-uptime/blob/master/check-onion-status.py

@tailsjoin
Copy link
Contributor

I have tried this code and it works fine. It should be merged immediately imo because this unproxied http call is messing things up for Tails while using Bitcoin core. Torify is not a possible solution for my situation either as it will torify rpc calls as well.

@CohibAA
Copy link
Contributor Author

CohibAA commented Aug 2, 2015

my watcher bot is also using this, no problems

chris-belcher added a commit that referenced this pull request Aug 2, 2015
Change how random irc nicknames are generated.
@chris-belcher chris-belcher merged commit 5eef8f4 into JoinMarket-Org:master Aug 2, 2015
@chris-belcher
Copy link
Collaborator

Hope not to offend @CohibAA by throwing away his code, but I couldn't resist coming up with a way to produce more pronounceable names. As in https://gist.github.com/chris-belcher/cd51b9edf3465c19c8f1

@CohibAA
Copy link
Contributor Author

CohibAA commented Aug 3, 2015

No offense! My main concern was getting away from the http call, however it is accomplished.

@CohibAA CohibAA deleted the patch-5 branch August 3, 2015 18:30
ghtdak pushed a commit to ghtdak/joinmarket that referenced this pull request Oct 1, 2015
Change how random irc nicknames are generated.
ghtdak pushed a commit to ghtdak/joinmarket that referenced this pull request Oct 4, 2015
Change how random irc nicknames are generated.
ghtdak pushed a commit to ghtdak/joinmarket that referenced this pull request Dec 4, 2015
Change how random irc nicknames are generated.
[gitreformat yapf-ify (github/ghtdak) on Fri Dec  4 04:50:29 2015]
[from commit: 5eef8f4]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants