Skip to content

Instantly share code, notes, and snippets.

@palashkulsh
Created September 11, 2019 07:37
Show Gist options
  • Save palashkulsh/105e5136012d49c714a1fbe147f54680 to your computer and use it in GitHub Desktop.
Save palashkulsh/105e5136012d49c714a1fbe147f54680 to your computer and use it in GitHub Desktop.
custom telnet script for db connection in python
import sys
import socket
s=0
try:
s=socket.create_connection((sys.argv[1],3306),timeout=(1))
except:
s=0
if s:
print("{},yes".format(sys.argv[1]))
else:
print("{},no".format(sys.argv[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment