Skip to content

Instantly share code, notes, and snippets.

@quininer
Last active September 1, 2015 16:56
Show Gist options
  • Save quininer/750c0bf465e554b8d3c5 to your computer and use it in GitHub Desktop.
Save quininer/750c0bf465e554b8d3c5 to your computer and use it in GitHub Desktop.
观察你都连接到了哪些 Tox node.
#!/usr/bin/env python
# encoding: utf-8
from sys import argv
from sh import ss, grep
from requests import get
def main(_, port=33445, *__):
for ip in map((lambda t: t.strip().split()[-1].split(':')[0]), grep(ss(), "33445")):
res = get("http://ip.cn/?ip={}".format(ip), headers={
'User-Agent': "curl/7"
}).text
print(res)
if __name__ == "__main__":
main(*argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment