Hacking Secret Ciphers with Python

(Ann) #1

18 http://inventwithpython.com/hacking


Email questions to the author: [email protected]


OS X Instructions
The installation for OS X is similar. Instead of downloading the .msi file from the Python
website, download the .dmg Mac Installer Disk Image file instead. The link to this file will look
something like “Python 3. 3. 0 Mac OS X” on the “Download Python Software” web page.


Ubuntu and Linux Instructions
If your operating system is Ubuntu, you can install Python by opening a terminal window (click
on Applications ► Accessories ► Terminal) and entering sudo apt-get install
python3. 3 then pressing Enter. You will need to enter the root password to install Python, so
ask the person who owns the computer to type in this password.


You also need to install the IDLE software. From the terminal, type in sudo apt-get
install idle3. You will also need the root password to install IDLE.


Downloading pyperclip.py


Almost every program in this book uses a custom module I wrote called pyperclip.py. This
module provides functions for letting your program copy and paste text to the clipboard. This
module does not come with Python, but you can download it from: http://invpy.com/pyperclip.py


This file must be in the same folder as the Python program files that you type. (A folder is also
called a directory.) Otherwise you will see this error message when you try to run your program:


ImportError: No module named pyperclip


Starting IDLE


We will be using the IDLE software to type in our programs and run them. IDLE stands for
Interactive DeveLopment Environment. While Python is the software that interprets and runs
your Python programs, the IDLE software is what you type your programs in.


If your operating system is Windows XP, you should be able to run Python by clicking the Start
button, then selecting Programs ► Python 3. 3 ► IDLE (Python GUI). For Windows Vista or
Windows 7, click the Windows button in the lower left corner, type “IDLE” and select “IDLE
(Python GUI)”.


If your operating system is Max OS X, start IDLE by opening the Finder window and clicking on
Applications, then click Python 3.3, then click the IDLE icon.

Free download pdf