i need get protocol(HTTP, FTP, SSMTP, IMAP, ETC) from ip address and port with Python3.
Example:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
protocol = s.connect( ("localhost", 80 )
print protocol #print HTTP
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In general, it’s not possible to detect the protocol type of a server listening on some port. The best you can get is request the name of the service that is normally associated with some port number: