/usr/share/doc/python-txsocksx/examples/get-ip-http.py is in python-txsocksx 1.15.0.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Copyright (c) Aaron Gallagher <_@habnab.it>
# See COPYING for details.
from __future__ import print_function
from twisted.internet.endpoints import TCP4ClientEndpoint
from twisted.internet.task import react
from twisted.web.client import readBody
from txsocksx.http import SOCKS5Agent
def main(reactor):
torEndpoint = TCP4ClientEndpoint(reactor, '127.0.0.1', 9050)
agent = SOCKS5Agent(reactor, proxyEndpoint=torEndpoint)
d = agent.request('GET', 'http://api.externalip.net/ip/')
d.addCallback(readBody)
d.addCallback(print)
return d
react(main, [])
|