Book Image

Python for Secret Agents

By : Steven F. Lott, Steven F. Lott
Book Image

Python for Secret Agents

By: Steven F. Lott, Steven F. Lott

Overview of this book

Table of Contents (12 chapters)
Python for Secret Agents
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Getting more tools – a text editor


To create Python applications, we're going to need a proper programmers' text editor. A word processor won't do because the files created by a word processor are too complex. We need simple text. Our emphasis is on simplicity. Python3 works in Unicode without bolding or italicizing the content. (Python 2 didn't work as well with Unicode. This is one of the reasons to leave it behind.)

If you've worked with text editors or integrated development environments (IDEs), you may already have a favorite. Feel free to use it. Some of the popular IDEs have Python support.

Python is called a dynamic language. It's not always simple to determine what names or keywords are legal in a given context. The Python compiler doesn't perform a lot of static checking. An IDE can't easily prompt with a short list of all legal alternatives. Some IDEs do take a stab at having logical suggestions, but they're not necessarily complete.

If you haven't worked with a programmer's editor (or an IDE), your first mission is to locate a text editor you can work with. Python includes an editor named IDLE that is easy to use. It's a good place to start.

The Active State Komodo Edit might be suitable (http://komodoide.com/komodo-edit/). It's a lightweight version of a commercial product. It's got some very clever ways to handle the dynamic language aspects of Python.

There are many other code editors. Your first training mission is to locate something you can work with. You're on your own. We have faith in you.

Getting other developer tools

Most GNU/Linux agents have various C compilers and other developer tools available. Many Linux distributions are already configured to support developers, so the tools are already there.

Mac OS X agents will usually need Xcode. Get it from https://developer.apple.com/xcode/downloads/. Every Mac OS X agent should have this.

When installing this, be sure to also install the command line developer tools. This is another big download above and beyond the basic Xcode download.

Windows agents will generally find that pre-built binaries are available for most packages of interest. If, in a rare case, that pre-built code isn't available, tools such as Cygwin may be necessary. See http://www.cygwin.com.

Getting a tool to get more Python components

In order to effectively and simply download additional Python modules, we often use a tool to get tools. There are two popular ways to add Python modules: PIP and the easy_install script.

To install easy_install, go to https://pypi.python.org/pypi/setuptools/3.6.

The setuptools package will include the easy_install script, which we'll use to add modules to Python.

If you've got multiple versions of Python installed, be sure to download and then install the correct easy install version for Python 3.3. This means that you'll generally be using the easy_install-3.3 script to add new software tools.

To install PIP, go to https://pypi.python.org/pypi/pip/1.5.6.

We'll be adding the Pillow package in Chapter 3, Encoding Secret Messages with Steganography. We'll also be adding the Beautiful Soup package in Chapter 4, Drops, Hideouts, Meetups, and Lairs.

The Python 3.4 distribution should include the PIP tool. You don't need to download it separately.