Created
April 9, 2017 18:44
Revisions
-
inter-coder created this gist
Apr 9, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ #!/usr/bin/env python # Determining whether the services are working at a remote location from socket import * def DoesServiceExist(host, port): targetIP = gethostbyname(host) s = socket(AF_INET, SOCK_STREAM) s.settimeout(1) result = s.connect_ex((targetIP,port)) s.close() if(result == 0) : return True return False #example if DoesServiceExist("smtp.gmail.com",465): print("YES mail server is UP") else: print("NO mail server is DOWN")