Author Topic: Starting Python scripting - Setting up a Python environment  (Read 27398 times)

0 Members and 1 Guest are viewing this topic.

Offline ande

  • Owner
  • Titan
  • *
  • Posts: 2664
  • Cookies: 256
    • View Profile
Starting Python scripting - Setting up a Python environment
« on: October 03, 2010, 06:58:59 pm »
Starting Python scripting
Setting up a Python environment
Tutorial by ande for Evilzone

Contents _
0x00 - Python
0x01 - Software
0x02 - Starting Python scripting



0x00 - Python
Python - 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 - Software
In order to run any Python script what so ever you will need the Python engine.

Windows
Python for windows can be downloaded at www.python.org, http://python.org/ftp/python/2.7/python-2.7.msi
Just 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:
Quote
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!


Linux
To install Python run this command:
  • sudo apt-get install python

Then run "python", if you get something like this:
Quote
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 scripting
Python 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
Code: [Select]
print "Hello World"

Variable print
Code: [Select]
Variable1 = "Hello World"
print Variable1

Math + print
Code: [Select]
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
« Last Edit: October 03, 2010, 07:08:54 pm by ande »
if($statement) { unless(!$statement) { // Very sure } }
https://evilzone.org/?hack=true

Bursihido

  • Guest
Re: Starting Python scripting - Setting up a Python environment
« Reply #1 on: March 27, 2011, 12:59:30 am »
Nice work ande :)

Offline hanorotu

  • Dj Rapture
  • VIP
  • Majesty
  • *
  • Posts: 1173
  • Cookies: 98
  • ( ͡° ʖ ͡°)
    • View Profile
    • Rapture
Re: Starting Python scripting - Setting up a Python environment
« Reply #2 on: August 18, 2012, 10:28:52 am »
Thanks, this is the alternative for the java/javascript.

It's looking good so far. Pretty easy to code in this. More natural.


Life is hard, then you get buried.
If you want to use my work all of my music is licensed under GNU General Public License v3 (GPL-3) - http://bit.ly/TfUOBA

Offline Ullen

  • Peasant
  • *
  • Posts: 65
  • Cookies: 5
  • I may be down, but i'm not out!!
    • View Profile
Re: Starting Python scripting - Setting up a Python environment
« Reply #3 on: September 10, 2012, 01:08:56 pm »
Thanks ande. I'm trying to learn Python.
"The only real wisdom is knowing you know nothing"

Offline Dark Nebulae

  • Peasant
  • *
  • Posts: 117
  • Cookies: -79
  • Unleash the Hacker within you
    • View Profile
Re: Starting Python scripting - Setting up a Python environment
« Reply #4 on: October 06, 2012, 11:16:02 am »
Hey admin, can u please post tutorials for RUBY language. It would be a great help.
Trust is like a piece of paper.Once it is crumbled,it can never be perfect.

Offline rxsmed

  • NULL
  • Posts: 4
  • Cookies: 1
    • View Profile
Re: Starting Python scripting - Setting up a Python environment
« Reply #5 on: November 11, 2012, 03:05:38 am »
Well i'm learning Python as a first programming language and i can tell, its cool and easy to learn.
I found this book to be interesting as a first one and theres also this one here. (First is PDF, second is HTML).
Avoid "learning python the hard way" cuz it sucks.

Bye.

Offline Corrupted_Fear

  • Knight
  • **
  • Posts: 336
  • Cookies: 34
  • Is dangerous to go alone! Take this! @xxxx[{:::::>
    • View Profile
Re: Starting Python scripting - Setting up a Python environment
« Reply #6 on: November 11, 2012, 04:05:29 am »
so glad to see a python tutorial here. And "Learning python the hard way" isn't a good beginner book, but more like a second level book. It gives you examples for you to copy and then explains how they work. Not a good starter if you have no idea how to work they Python language.

by | Angel | Devil |

"Welcome to le trove that is my home. Welcome to EvilZone." -- DeepCopy

Offline ande

  • Owner
  • Titan
  • *
  • Posts: 2664
  • Cookies: 256
    • View Profile
Re: Starting Python scripting - Setting up a Python environment
« Reply #7 on: November 19, 2012, 10:49:06 am »
Hey admin, can u please post tutorials for RUBY language. It would be a great help.

Sorry for a very late reply. But oh well. I am afraid I don't know ruby all that well, but I encourage anyone who do to make one like this.
if($statement) { unless(!$statement) { // Very sure } }
https://evilzone.org/?hack=true

Offline pyte

  • Peasant
  • *
  • Posts: 79
  • Cookies: -7
    • View Profile
Re: Starting Python scripting - Setting up a Python environment
« Reply #8 on: December 09, 2012, 08:26:32 am »
Ande


python happens to be my latest darlin though new in programming/ screepting i can already see its going to be cool.
one problem though, MODULES are such a hustle to find.is there any way to update and install all modules at a go?
If you don't go into the tiger's cave, how will you get the cub?

Offline ande

  • Owner
  • Titan
  • *
  • Posts: 2664
  • Cookies: 256
    • View Profile
Re: Starting Python scripting - Setting up a Python environment
« Reply #9 on: December 10, 2012, 05:08:39 pm »
Ande


python happens to be my latest darlin though new in programming/ screepting i can already see its going to be cool.
one problem though, MODULES are such a hustle to find.is there any way to update and install all modules at a go?

If you are not linux, hopefully debian based. A lot of python modules can be found with aptitude and easily installed from there.

If not, or you cant find a package version of the module you want. Here is everything you need to know: http://docs.python.org/2/install/index.html
if($statement) { unless(!$statement) { // Very sure } }
https://evilzone.org/?hack=true

Offline pyte

  • Peasant
  • *
  • Posts: 79
  • Cookies: -7
    • View Profile
Re: Starting Python scripting - Setting up a Python environment
« Reply #10 on: December 10, 2012, 09:47:40 pm »
seems il eventualy join the linux revolution now that im interested in network securities.

If you don't go into the tiger's cave, how will you get the cub?

EMOKDOOM

  • Guest
Re: Starting Python scripting - Setting up a Python environment
« Reply #11 on: February 22, 2013, 05:26:51 pm »
Care to show how to run the interactive interpreter?
I've been trying from Pythons documentation and some ebook i got from here but i can't seem to get it down.

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Starting Python scripting - Setting up a Python environment
« Reply #12 on: February 22, 2013, 05:52:00 pm »
Care to show how to run the interactive interpreter?
Start -> Run -> type in "python" -> press enter -> should work.
If not then do:
Start -> Run -> type in "cmd" -> press enter -> cd into where you installed python -> type in "python" -> should work.

EMOKDOOM

  • Guest
Re: Starting Python scripting - Setting up a Python environment
« Reply #13 on: February 24, 2013, 11:29:23 am »
Oh, i'm sorry, think i explained wrong.

I wanted to run an output box. Like the one on codeacademy or learnpthon.org
Is it even possible or do i need some other Python interpreter?

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Starting Python scripting - Setting up a Python environment
« Reply #14 on: February 24, 2013, 06:11:29 pm »
I wanted to run an output box. Like the one on codeacademy or learnpthon.org
Is it even possible or do i need some other Python interpreter?
Regardless, isn't the Python shell not good enough?