Chapter 6: Gathering Information from Servers

  1. What do we need to access the Shodan Developer API?

Register at the Shodan website and use API_KEY, which gives you access to their services.

  1. Which method should be called in the Shodan API to obtain information about a given host and what data structure does that method return?

The method is the host() method, and it returns the dictionary data structure.

  1. Which module can be used to obtain the banner of a server?

We need to create a socket with the sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) instruction, send a GET request with the sock.sendall(http_get) instruction, and finally receive data with the data = sock.recvfrom(1024) instruction.

  1. Which method should be called ...

Get Mastering Python for Networking and Security now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.