getTorExitNode is a tool that aims at providing torproxy (from tortunnel) with a valid Tor exit node. It returns one or all valid Tor exit nodes. Written in Python.
You can download it from the following link: https://packetstormsecurity.com/files/download/98371/getTorExitNode.py.txt
Source: https://packetstormsecurity.com/files/98371/getTorExitNode-Python-Script.html

