banner grabber api 1

banner grabber api

 #!/usr/bin/python

 import socket
 socket.setdefaulttimeout(2)
 s = socket.socket()
 target = raw_input('Target Web Server : ')
 tport = 80
 s.connect((target, tport))
 s.send('HEAD / HEAD/1.1\nHost: ' + target + '\n\n')
 print s.recv(1024)
 s.close()

Here is what the above code is Doing:
1. It imports the socket module.
2. It sets the default timeout to 2 seconds.
3. It creates a socket object.
4. It asks the user for the target web server.
5. It sets the target port to 80.
6. It connects to the target web server.
7. It sends a HEAD request to the target web server.
8. It prints the response from the target web server.
9. It closes the socket.

Similar Posts