Starting Python scripting
Setting up a Python environment
Tutorial by ande for Evilzone
Contents _0x00 -
Python0x01 -
Software0x02 -
Starting Python scripting0x00 - PythonPython - A easy to set up, dynamic scripting language, great for small quick projects but can be used for most about everything. Python can be set up on most OS's, I will be covering Windows and Debian(Or any other Linux distribution with APT installed).
0x01 - SoftwareIn order to run any Python script what so ever you will need the Python engine.
WindowsPython for windows can be downloaded at
www.python.org,
http://python.org/ftp/python/2.7/python-2.7.msiJust install it as you wish, and remember where you installed it. By default its c:\Python27 or something along those lines.
Open CMD and navigate to the folder you installed Python( cd c:\Python27 ). Then write python and hit enter. If you get something like this:
Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>>
You have done it right and are ready to start scripting!
LinuxTo install Python run this command:
- sudo apt-get install python
Then run "python", if you get something like this:
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
You have done it right and are ready to start scripting!
0x02 - Starting Python scriptingPython scripting is fairly easy, create .py files and stuff some Python script inside it and run "python YourScript.py". Here is a few examples:
Simple Hello World print
print "Hello World"
Variable print
Variable1 = "Hello World"
print Variable1
Math + print
Var1 = 10
Var2 = 10
Var3 = Var1 + Var2
print Var3
A great site for further quick learning:
http://www.sthurlow.com/python/A great example site for Python and many other languages:
http://www.java2s.com/Tutorial/Python/CatalogPython.htm /
http://www.java2s.com/Code/Python/CatalogPython.htm