NIT-Hamirpur-NITH / ProxyHelper

This repository will contain the code for a cool application that would remove the need to use FoxyProxy and likes.
8 stars 11 forks source link

Error when running torpinger #26

Closed lokeshh closed 8 years ago

lokeshh commented 8 years ago

I opened Tor on port 9050 and while running Torpinger I encountered the following error:

root@kali:~# python3 torpinger.py 
[9050]
Time out <urlopen error [Errno -2] Name or service not known>
Time out <urlopen error [Errno -2] Name or service not known>
Time out <urlopen error [Errno -2] Name or service not known>
^C

Cancelled run forever operation
clearnote01 commented 8 years ago

Can you try this again with the latest version? I don't think its a problem with ProxyHelper. It seems to be a problem in your internet connection. Can you confirm net via tor works for you?

Akarshit commented 8 years ago

@clearnote01 Even if it is a problem with the internet connection, I think we should atleast display a better message.

swedishmike commented 8 years ago

I think I've found where this goes wrong and should be able to commit a pull request with some further error trapping in a day or two.

In the meantime I just spotted some spelling and formatting that looked a bit odd:

"Sorry dude couldn't find any active tor connection in the given time, exitting"

I'm just about to submit a pull request with that adjusted for now. Should hopefully be back with a possible fix for this particular issue soon too.

swedishmike commented 8 years ago

I'm just about to commit the pull request for a suggested 'fix' for this. The error @lokeshh is getting is due to name resolution error. normally I'd trigger on 'socket.gaierror' but for some reason that triggers yet another exception here - something that might have to do with urllib wanting to be king of the hill.

For now I took the easy option of just adding a sys.exit(1) if it errors so it doesn't loop ad infinitum and can also be caught if you script the usage.

I'll try and dig deeper into these nested exceptions - but can't promise a quick fix for that. ;)

swedishmike commented 8 years ago

Ok - new pull request on its way. Couldn't get the squash to work so did it another way.

clearnote01 commented 8 years ago

@swedishmike thanks for the PR. But I think I might be mistaken in my earlier observation and maybe this was not just a problem with @lokeshh network. Can you guys check if it the program works at all? it should show 'Microsoft NCSI' as output every few seconds (if everything works fine).

I suspect it might be a problem with torrc configuration :O

swedishmike commented 8 years ago

@clearnote01 It works for me, tried on both Xubuntu 16.06 and Centos 6.

When there's a tor daemon present I see something along the lines of:

<- Cut -> [9050] b'Microsoft NCSI' b'Microsoft NCSI' b'Microsoft NCSI' <- Cut ->

And so on...

clearnote01 commented 8 years ago

@swedishmike Cool! that makes this easy. So the error was indeed due to error in the network itself and the your PR fixed the issue.

@Akarshit guess we can close this thread?

Akarshit commented 8 years ago

Great!