Run me like this. Or maybe not! it's dangerous!
curl -sL "https://gist.github.com/mariocesar/b628c91e7b00cca0dca371ac2d54544c/raw/script.py?v=$(date +%s)" | python3 - google.com:443
| import sys | |
| import socket | |
| host, port = sys.argv[1].split(':') | |
| print(f"trying {host}:{port}") | |
| print("socket.gethostbyname") | |
| try: | |
| print(socket.gethostbyname(host)) | |
| except Exception as exc: | |
| print(exc) | |
| print("socket.getaddrinfo") | |
| try: | |
| print(socket.getaddrinfo( | |
| host, | |
| port, | |
| proto=socket.IPPROTO_TCP, | |
| type=socket.SOCK_STREAM | |
| )) | |
| except Exception as exc: | |
| print(exc) |