Every secret agent needs a good set of tools and gadgets. When an agent's missions involve gathering data, high-powered data processing is required. This book will provide you with the kinds of information processing tools that will help you gather, analyze, and communicate the data that the HQ demands.
Python allows agents to write simple scripts to gather data, perform sophisticated calculations, and produce useful results. Agents can also use Python to extract data from local files, HTTP web servers, and FTP file servers.
Python has numerous add-on packages. This book will explore just two: Pillow allows for sophisticated image conversion and manipulation, and BeautifulSoup allows an agent to extract data from HTML web pages. Agents with specific needs might have to explore the Python Natural Language Toolkit (NLTK), Numeric Python (NumPy), or even Scientific Python (SciPy).
Chapter 1, Our Espionage Toolkit, exposes the basics of installing and using Python. We'll write scripts to help agents work with foreign currency conversions and learn how an agent can recover a lost password from a ZIP archive.
Chapter 2, Acquiring Intelligence Data, shows how we can use Python to extract information from various kinds of file servers. Agents will learn how to work with different Internet protocols and use Representational State Transfer (REST) to interact with web services. This will include techniques to work with cyptocurrencies, such as bitcoins.
Chapter 3, Encoding Secret Messages with Steganography, shows how we can add the Pillow toolset to work with images. An agent with Pillow can create thumbnails and convert, crop, and enhance images. We'll also explore some steganography algorithms to bury our messages in an image file.
Chapter 4, Drops, Hideouts, Meetups, and Lairs, provides a closer look at geocoding and geolocation. This includes the use of web services to convert an address into a latitude and longitude. We'll also learn how to convert a latitude and longitude back into an address. We'll take a look at the haversine formula to get the correct distance between locations. We'll also look at some of the ways in which geographic locations can be represented for tidy storage and communication.
Chapter 5, A Spymaster's More Sensitive Analyses, shows how we can use Python for a basic data analysis. A good agent doesn't just spout facts and figures; a good agent does enough analysis to confirm that the data is realistic. Being able to examine the correlation between datasets is what creates a valuable intelligence asset.