Created
          September 11, 2019 07:37 
        
      - 
      
- 
        Save palashkulsh/105e5136012d49c714a1fbe147f54680 to your computer and use it in GitHub Desktop. 
    custom telnet script for db connection in python
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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