SlideShare a Scribd company logo
Python for ethical hackers
Mohammad reza Kamalifard
kamalifard@datasec.ir
Python language essentials
Module 1:
Introduction to Python and Setting up an Environment for Programing
Part 2 :
Variables and Data Types
Variables, Objects and References
• There are integers, floating point numbers, strings, and

many more, but things are not the same as in C or C++.
• Python variables do not have any types associate with
them
• Don’t need declaration before use
• Variable name is a reference to an Object
Variables
• Something which can change
• Way of referring to a memory location used by a computer

program. Variable is a symbolic name for this physical
location
• Memory location contains values, like numbers, text or
more complicated types
Variables, Objects and References
Identifier

>>> name = 'reza'
>>> print name
reza
>>>
>>>name = 10
>>>name
10

Object
Data Type
>>> name = 10
>>> type(name)
<type 'int'>
>>> name = 'Reza'
>>> type(name)
<type 'str'>
>>> name = 10.42
>>> type(name)
<type 'float'>
>>>
Variables vs. Identifiers
Variables and identifiers are very often mistaken as
synonyms
●
The name of a variable is an identifier, but a variable is
"more than a name". 
●
An identifier is not only used for variables. An identifier can
denote various entities like variables, types, labels,
subroutines or functions, packages and so on.
●
Naming Identifiers of Variables
A valid identifier is a non-empty sequence of characters of
any length with:
●
the start character can be the underscore "_" or a capital or
lower case letter
●
the letters following the start character can be anything
which is permitted as a start character plus the digits.
●
Just a warning for Windows-spoilt users: Identifiers are
case-sensitive
●
Python keywords are not allowed as identifier names
and, as, assert, break, class, continue, def, del, elif, else,
except, finally, for, from, global, if, import, in, is, lambda,
nonlocal, not, or, pass, raise, return, try, while, with, yield
Variables vs. Identifiers
>>> name = 'reza'
>>> id(name)
3072831328L
>>> hex(id(name))
'0xb727af60L'
>>>
An other way to do that :
>>> name.__repr__
<method-wrapper '__repr__' of str object at 0xb727af60>
>>>
0xb727af60 is exact memory location where the object stored,
name is just a reference to that object.
Data Types Python offers
1.
2.
3.
4.
5.
6.
7.

Numbers
Strings
List
Dictionaries
Tuples
Boolean
…
Numbers - Integer
Normal integers
e.g. 4321
●
Octal literals (base 8)
A number prefixed by a 0 (zero) will be interpreted as an octal number
>>> a = 010
>>> print a
8
●
Hexadecimal literals (base 16)
Hexadecimal literals have to be prefixed either by "0x" or "0X".
>>> hex_number = 0xA0F
>>> print hex_number
2575
●
Long integers
these numbers are of unlimeted size
e.g.42000000000000000000L
●
Floating-point numbers
for example: 42.11, 3.1415e-10
●
Convert to Number
>>>int('10')
10
>>>int('0011',2)
3
>>>int('1111',2)
15
>>>int('0xff',16)
255
Strings
Strings are marked by quotes:
–

single quotes (')
'This is a string with single quotes‘
– double quotes (")
"Obama's dog is called Bo""
– triple quotes, both single (''') and (""")
'''String in triple quotes can extend
over multiple lines, like this on, and can contain
'single' and "double" quotes.'''
Strings
>>>name = 'reza'
>>>name = "reza"
>>>name = "rez'a"
>>>name = 'Mohammdnreza'
>>>print name
Mohammad
reza
Strings
>>>name = r'Mohammdnreza'
raw string and turns off escaping
print name
Mohammdnreza
>>>
Strings
>>> name = '''

... Hello Dear Students
... Welcome to PYSEC101 Course!
... Python Scripting Course for Ethical Hackers
... '''
>>> name
'nHello Dear StudentsnWelcome to PYSEC101 Course!nPython
Scripting Course for Ethical Hackersn'
>>> print name
Hello Dear Students
Welcome to PYSEC101 Course!
Python Scripting Course for Ethical Hackers
String Index
●

A string in Python consists of a series or sequence of
characters - letters, numbers, and special characters.
Unicode
Used for internationalization
●
“Wide Characters” are they are called(code all languages)
>>>name = u'Mohammad'
>>> name
u'Mohammad'
>>>
unicode to regular string conversion
>>> str(name)
'Mohammad'
>>>
regular string to unicode conversion
>>> unicode(name)
u'Mohammad'
>>>
●
Concatenating Strings
Strings can be glued together (concatenated) with the +
operator
>>>s1 + s2
>>> s1 = 'Hamid'
>>> s2 = 'rezaie'
>>> s1 + s2
'Hamidrezaie'
>>> s1 + ' ' + s2
'Hamid rezaie'
>>>
●
Repetition
String can be repeated or repeatedly concatenated with
the asterisk operator "*“
>>> buffer = 'A' * 20
>>> buffer
'AAAAAAAAAAAAAAAAAAAA'
>>>
●
Int to string
>>> 'a' + 42
●
Traceback (most recent call last):
●
File "<stdin>", line 1, in <module>
●
TypeError: cannot concatenate 'str' and 'int' objects
●
>>>
●
>>> str(42)
●
'42'
●
>>>>'a' + str(42)
●
Slicing
Substrings can be created with the slice or slicing notation,
i.e. two indices in square brackets separated by a colon:
●
"Python"[2:4] -> "th“
●
>>>string[start:end:steps]
●
>>> name = 'Mohammad reza'
>>> name[5:10]
'mad r'
>>> name[0:10]
'Mohammad r'
>>> name[0:-1]
'Mohammad rez'
>>> name[0:-5]
'Mohammad'
>>> name[:]
'Mohammad reza'
>>> name[::-1]
'azer dammahoM'
>>> name[::2]
'Mhma ea'
>>>
Stirngs are immutable objects
>>>name = 'reza'
>>>name[0]
r
name [0] = 'a'
TypeError: 'str' object does not support item
assignment
You can not change String Object directly in memory
because they are immutable
>>>name = 'reza'
name = 'Mohammad'
●
'reza' object still does exists now name is referenced to
'Mohammad' object
String Methods
string.find()
●
string.replace()
●
string.split()
●
>>> name = 'mohammad reza'
>>> name.find('PYSEC101')
-1
>>> name.find('mma')
4
>>>
>>> name.split()
['mohammad', 'reza']
by default split on white spaces and return list of strings.
split on 'a'
>>> name.split('a')
['moh', 'mm', 'd rez', '']
>>>
>>> name.replace('m', 'H')
'HohaHHad reza'
>>>
String Formatting
>>> ip = '192.168.1.252'
>>> line = 'Crack this IP :%s' % ip
>>> line
'Crack this IP :192.168.1.252'
>>>
>>> line = 'Crack this IP : %s and name %s ' % (ip,
'Reza-PC')
>>> line
'Crack this IP : 192.168.1.252 and name Reza-PC '
References
SPSE securitytube training by Vivek Ramachandran
SANS Python for Pentesters (SEC573)
Violent python
Security Power Tools
python-course.eu
----------------------------http://www.tutorialspoint.com/python/python_strings.htm
http://www.tutorialspoint.com/python/python_numbers.htm
http://www.python-course.eu/variables.php
http://www.python-course.eu/sequential_data_types.php
http://www.python-course.eu/sets_frozensets.php
This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 Unported License.
To view a copy of this license, visit
http://creativecommons.org/licenses/by-nd/3.0/

Copyright 2013 Mohammad Reza Kamalifard
All rights reserved.
Go to Kamalifard.ir/pysec101 to Download Slides and Course martials .

More Related Content

What's hot

Porting to Python 3
Porting to Python 3Porting to Python 3
Porting to Python 3
Lennart Regebro
 
Java Basics - Part1
Java Basics - Part1Java Basics - Part1
Java Basics - Part1
Vani Kandhasamy
 
Java arrays
Java    arraysJava    arrays
Java arrays
Mohammed Sikander
 
Basics of Python programming (part 2)
Basics of Python programming (part 2)Basics of Python programming (part 2)
Basics of Python programming (part 2)
Pedro Rodrigues
 
Java notes 1 - operators control-flow
Java notes   1 - operators control-flowJava notes   1 - operators control-flow
Java notes 1 - operators control-flow
Mohammed Sikander
 
Arrays in java language
Arrays in java languageArrays in java language
Arrays in java language
Hareem Naz
 
Algorithms devised for a google interview
Algorithms devised for a google interviewAlgorithms devised for a google interview
Algorithms devised for a google interview
Russell Childs
 
String Handling in c++
String Handling in c++String Handling in c++
String Handling in c++
Fahim Adil
 
Hash Techniques in Cryptography
Hash Techniques in CryptographyHash Techniques in Cryptography
Hash Techniques in Cryptography
Basudev Saha
 
Interview C++11 code
Interview C++11 codeInterview C++11 code
Interview C++11 code
Russell Childs
 
structure
structurestructure
structure
teach4uin
 
15. Streams Files and Directories
15. Streams Files and Directories 15. Streams Files and Directories
15. Streams Files and Directories
Intro C# Book
 
Strings
StringsStrings
Strings
Nilesh Dalvi
 
18. Dictionaries, Hash-Tables and Set
18. Dictionaries, Hash-Tables and Set18. Dictionaries, Hash-Tables and Set
18. Dictionaries, Hash-Tables and Set
Intro C# Book
 
Cheat sheet python3
Cheat sheet python3Cheat sheet python3
Cheat sheet python3
sxw2k
 
Python_ 3 CheatSheet
Python_ 3 CheatSheetPython_ 3 CheatSheet
Python_ 3 CheatSheet
Dr. Volkan OBAN
 
Python 2.5 reference card (2009)
Python 2.5 reference card (2009)Python 2.5 reference card (2009)
Python 2.5 reference card (2009)
gekiaruj
 
Groovy closures
Groovy closuresGroovy closures
Groovy closures
Vijay Shukla
 
The Ring programming language version 1.10 book - Part 31 of 212
The Ring programming language version 1.10 book - Part 31 of 212The Ring programming language version 1.10 book - Part 31 of 212
The Ring programming language version 1.10 book - Part 31 of 212
Mahmoud Samir Fayed
 
Strings in c++
Strings in c++Strings in c++

What's hot (20)

Porting to Python 3
Porting to Python 3Porting to Python 3
Porting to Python 3
 
Java Basics - Part1
Java Basics - Part1Java Basics - Part1
Java Basics - Part1
 
Java arrays
Java    arraysJava    arrays
Java arrays
 
Basics of Python programming (part 2)
Basics of Python programming (part 2)Basics of Python programming (part 2)
Basics of Python programming (part 2)
 
Java notes 1 - operators control-flow
Java notes   1 - operators control-flowJava notes   1 - operators control-flow
Java notes 1 - operators control-flow
 
Arrays in java language
Arrays in java languageArrays in java language
Arrays in java language
 
Algorithms devised for a google interview
Algorithms devised for a google interviewAlgorithms devised for a google interview
Algorithms devised for a google interview
 
String Handling in c++
String Handling in c++String Handling in c++
String Handling in c++
 
Hash Techniques in Cryptography
Hash Techniques in CryptographyHash Techniques in Cryptography
Hash Techniques in Cryptography
 
Interview C++11 code
Interview C++11 codeInterview C++11 code
Interview C++11 code
 
structure
structurestructure
structure
 
15. Streams Files and Directories
15. Streams Files and Directories 15. Streams Files and Directories
15. Streams Files and Directories
 
Strings
StringsStrings
Strings
 
18. Dictionaries, Hash-Tables and Set
18. Dictionaries, Hash-Tables and Set18. Dictionaries, Hash-Tables and Set
18. Dictionaries, Hash-Tables and Set
 
Cheat sheet python3
Cheat sheet python3Cheat sheet python3
Cheat sheet python3
 
Python_ 3 CheatSheet
Python_ 3 CheatSheetPython_ 3 CheatSheet
Python_ 3 CheatSheet
 
Python 2.5 reference card (2009)
Python 2.5 reference card (2009)Python 2.5 reference card (2009)
Python 2.5 reference card (2009)
 
Groovy closures
Groovy closuresGroovy closures
Groovy closures
 
The Ring programming language version 1.10 book - Part 31 of 212
The Ring programming language version 1.10 book - Part 31 of 212The Ring programming language version 1.10 book - Part 31 of 212
The Ring programming language version 1.10 book - Part 31 of 212
 
Strings in c++
Strings in c++Strings in c++
Strings in c++
 

Viewers also liked

Internet Age
Internet AgeInternet Age
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
Mohammad Reza Kamalifard
 
Tehlug 26 Nov 2013 Hackers,Cyberwarfare and Online privacy
Tehlug 26 Nov 2013 Hackers,Cyberwarfare and Online privacyTehlug 26 Nov 2013 Hackers,Cyberwarfare and Online privacy
Tehlug 26 Nov 2013 Hackers,Cyberwarfare and Online privacy
Mohammad Reza Kamalifard
 
جلسه اول پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه اول پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲جلسه اول پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه اول پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
Mohammad Reza Kamalifard
 
Pycon - Python for ethical hackers
Pycon - Python for ethical hackers Pycon - Python for ethical hackers
Pycon - Python for ethical hackers
Mohammad Reza Kamalifard
 
Introduction to Flask Micro Framework
Introduction to Flask Micro FrameworkIntroduction to Flask Micro Framework
Introduction to Flask Micro Framework
Mohammad Reza Kamalifard
 

Viewers also liked (6)

Internet Age
Internet AgeInternet Age
Internet Age
 
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
 
Tehlug 26 Nov 2013 Hackers,Cyberwarfare and Online privacy
Tehlug 26 Nov 2013 Hackers,Cyberwarfare and Online privacyTehlug 26 Nov 2013 Hackers,Cyberwarfare and Online privacy
Tehlug 26 Nov 2013 Hackers,Cyberwarfare and Online privacy
 
جلسه اول پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه اول پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲جلسه اول پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه اول پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
 
Pycon - Python for ethical hackers
Pycon - Python for ethical hackers Pycon - Python for ethical hackers
Pycon - Python for ethical hackers
 
Introduction to Flask Micro Framework
Introduction to Flask Micro FrameworkIntroduction to Flask Micro Framework
Introduction to Flask Micro Framework
 

Similar to جلسه دوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲

Python course
Python coursePython course
Learning python
Learning pythonLearning python
Learning python
Tony Nguyen
 
Learning python
Learning pythonLearning python
Learning python
Fraboni Ec
 
Learning python
Learning pythonLearning python
Learning python
Young Alista
 
Learning python
Learning pythonLearning python
Learning python
Luis Goldster
 
Learning python
Learning pythonLearning python
Learning python
Hoang Nguyen
 
Learning python
Learning pythonLearning python
Learning python
Harry Potter
 
Learning python
Learning pythonLearning python
Learning python
James Wong
 
Lecture 9_Classes.pptx
Lecture 9_Classes.pptxLecture 9_Classes.pptx
Lecture 9_Classes.pptx
NelyJay
 
Python course in_mumbai
Python course in_mumbaiPython course in_mumbai
Python course in_mumbai
vibrantuser
 
Python course in_mumbai
Python course in_mumbaiPython course in_mumbai
Python course in_mumbai
vibrantuser
 
Basics of Python
Basics of PythonBasics of Python
Basics of Python
Ease3
 
Python
PythonPython
Python material
Python materialPython material
Python material
Ruchika Sinha
 
C++ process new
C++ process newC++ process new
C++ process new
敬倫 林
 
Python String Revisited.pptx
Python String Revisited.pptxPython String Revisited.pptx
Python String Revisited.pptx
Chandrapriya Jayabal
 
Introduction to python programming 1
Introduction to python programming   1Introduction to python programming   1
Introduction to python programming 1
Giovanni Della Lunga
 
Programming python quick intro for schools
Programming python quick intro for schoolsProgramming python quick intro for schools
Programming python quick intro for schools
Dan Bowen
 
Python
PythonPython
Python Workshop
Python  Workshop Python  Workshop
Python Workshop
Assem CHELLI
 

Similar to جلسه دوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲ (20)

Python course
Python coursePython course
Python course
 
Learning python
Learning pythonLearning python
Learning python
 
Learning python
Learning pythonLearning python
Learning python
 
Learning python
Learning pythonLearning python
Learning python
 
Learning python
Learning pythonLearning python
Learning python
 
Learning python
Learning pythonLearning python
Learning python
 
Learning python
Learning pythonLearning python
Learning python
 
Learning python
Learning pythonLearning python
Learning python
 
Lecture 9_Classes.pptx
Lecture 9_Classes.pptxLecture 9_Classes.pptx
Lecture 9_Classes.pptx
 
Python course in_mumbai
Python course in_mumbaiPython course in_mumbai
Python course in_mumbai
 
Python course in_mumbai
Python course in_mumbaiPython course in_mumbai
Python course in_mumbai
 
Basics of Python
Basics of PythonBasics of Python
Basics of Python
 
Python
PythonPython
Python
 
Python material
Python materialPython material
Python material
 
C++ process new
C++ process newC++ process new
C++ process new
 
Python String Revisited.pptx
Python String Revisited.pptxPython String Revisited.pptx
Python String Revisited.pptx
 
Introduction to python programming 1
Introduction to python programming   1Introduction to python programming   1
Introduction to python programming 1
 
Programming python quick intro for schools
Programming python quick intro for schoolsProgramming python quick intro for schools
Programming python quick intro for schools
 
Python
PythonPython
Python
 
Python Workshop
Python  Workshop Python  Workshop
Python Workshop
 

More from Mohammad Reza Kamalifard

جلسه چهارم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه چهارم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲جلسه چهارم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه چهارم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
Mohammad Reza Kamalifard
 
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
Mohammad Reza Kamalifard
 
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
Mohammad Reza Kamalifard
 
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
Mohammad Reza Kamalifard
 
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
Mohammad Reza Kamalifard
 
جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
Mohammad Reza Kamalifard
 
اسلاید اول جلسه اول دوره پاییز کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه اول دوره پاییز کلاس پایتون برای هکرهای قانونیاسلاید اول جلسه اول دوره پاییز کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه اول دوره پاییز کلاس پایتون برای هکرهای قانونیMohammad Reza Kamalifard
 
اسلاید دوم جلسه یازدهم کلاس پایتون برای هکر های قانونی
اسلاید دوم جلسه یازدهم کلاس پایتون برای هکر های قانونیاسلاید دوم جلسه یازدهم کلاس پایتون برای هکر های قانونی
اسلاید دوم جلسه یازدهم کلاس پایتون برای هکر های قانونی
Mohammad Reza Kamalifard
 
اسلاید اول جلسه یازدهم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه یازدهم کلاس پایتون برای هکرهای قانونیاسلاید اول جلسه یازدهم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه یازدهم کلاس پایتون برای هکرهای قانونی
Mohammad Reza Kamalifard
 
اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
Mohammad Reza Kamalifard
 
اسلاید ارائه اول جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه اول جلسه ۱۰ کلاس پایتون برای هکر های قانونی اسلاید ارائه اول جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه اول جلسه ۱۰ کلاس پایتون برای هکر های قانونی
Mohammad Reza Kamalifard
 
اسلاید ارائه سوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه سوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی اسلاید ارائه سوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه سوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
Mohammad Reza Kamalifard
 
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونیاسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
Mohammad Reza Kamalifard
 
اسلاید اول جلسه هشتم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه هشتم کلاس پایتون برای هکرهای قانونیاسلاید اول جلسه هشتم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه هشتم کلاس پایتون برای هکرهای قانونی
Mohammad Reza Kamalifard
 
اسلاید سوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید سوم جلسه هفتم کلاس پایتون برای هکرهای قانونیاسلاید سوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید سوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
Mohammad Reza Kamalifard
 
اسلاید دوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه هفتم کلاس پایتون برای هکرهای قانونیاسلاید دوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
Mohammad Reza Kamalifard
 
اسلاید اول جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه هفتم کلاس پایتون برای هکرهای قانونیاسلاید اول جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه هفتم کلاس پایتون برای هکرهای قانونی
Mohammad Reza Kamalifard
 
اسلاید اول جلسه پنجم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه پنجم کلاس پایتون برای هکرهای قانونیاسلاید اول جلسه پنجم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه پنجم کلاس پایتون برای هکرهای قانونی
Mohammad Reza Kamalifard
 
اسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونیاسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونی
Mohammad Reza Kamalifard
 
اسلاید دوم جلسه چهارم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه چهارم کلاس پایتون برای هکرهای قانونیاسلاید دوم جلسه چهارم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه چهارم کلاس پایتون برای هکرهای قانونی
Mohammad Reza Kamalifard
 

More from Mohammad Reza Kamalifard (20)

جلسه چهارم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه چهارم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲جلسه چهارم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه چهارم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
 
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
 
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
 
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
 
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
 
جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
 
اسلاید اول جلسه اول دوره پاییز کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه اول دوره پاییز کلاس پایتون برای هکرهای قانونیاسلاید اول جلسه اول دوره پاییز کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه اول دوره پاییز کلاس پایتون برای هکرهای قانونی
 
اسلاید دوم جلسه یازدهم کلاس پایتون برای هکر های قانونی
اسلاید دوم جلسه یازدهم کلاس پایتون برای هکر های قانونیاسلاید دوم جلسه یازدهم کلاس پایتون برای هکر های قانونی
اسلاید دوم جلسه یازدهم کلاس پایتون برای هکر های قانونی
 
اسلاید اول جلسه یازدهم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه یازدهم کلاس پایتون برای هکرهای قانونیاسلاید اول جلسه یازدهم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه یازدهم کلاس پایتون برای هکرهای قانونی
 
اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
 
اسلاید ارائه اول جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه اول جلسه ۱۰ کلاس پایتون برای هکر های قانونی اسلاید ارائه اول جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه اول جلسه ۱۰ کلاس پایتون برای هکر های قانونی
 
اسلاید ارائه سوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه سوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی اسلاید ارائه سوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه سوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
 
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونیاسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
 
اسلاید اول جلسه هشتم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه هشتم کلاس پایتون برای هکرهای قانونیاسلاید اول جلسه هشتم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه هشتم کلاس پایتون برای هکرهای قانونی
 
اسلاید سوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید سوم جلسه هفتم کلاس پایتون برای هکرهای قانونیاسلاید سوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید سوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
 
اسلاید دوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه هفتم کلاس پایتون برای هکرهای قانونیاسلاید دوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
 
اسلاید اول جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه هفتم کلاس پایتون برای هکرهای قانونیاسلاید اول جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه هفتم کلاس پایتون برای هکرهای قانونی
 
اسلاید اول جلسه پنجم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه پنجم کلاس پایتون برای هکرهای قانونیاسلاید اول جلسه پنجم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه پنجم کلاس پایتون برای هکرهای قانونی
 
اسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونیاسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونی
 
اسلاید دوم جلسه چهارم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه چهارم کلاس پایتون برای هکرهای قانونیاسلاید دوم جلسه چهارم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه چهارم کلاس پایتون برای هکرهای قانونی
 

Recently uploaded

Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
JomonJoseph58
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
سمير بسيوني
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
nitinpv4ai
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 

Recently uploaded (20)

Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 

جلسه دوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲

  • 1. Python for ethical hackers Mohammad reza Kamalifard kamalifard@datasec.ir
  • 2. Python language essentials Module 1: Introduction to Python and Setting up an Environment for Programing Part 2 : Variables and Data Types
  • 3. Variables, Objects and References • There are integers, floating point numbers, strings, and many more, but things are not the same as in C or C++. • Python variables do not have any types associate with them • Don’t need declaration before use • Variable name is a reference to an Object
  • 4. Variables • Something which can change • Way of referring to a memory location used by a computer program. Variable is a symbolic name for this physical location • Memory location contains values, like numbers, text or more complicated types
  • 5. Variables, Objects and References Identifier >>> name = 'reza' >>> print name reza >>> >>>name = 10 >>>name 10 Object
  • 6. Data Type >>> name = 10 >>> type(name) <type 'int'> >>> name = 'Reza' >>> type(name) <type 'str'> >>> name = 10.42 >>> type(name) <type 'float'> >>>
  • 7. Variables vs. Identifiers Variables and identifiers are very often mistaken as synonyms ● The name of a variable is an identifier, but a variable is "more than a name".  ● An identifier is not only used for variables. An identifier can denote various entities like variables, types, labels, subroutines or functions, packages and so on. ●
  • 8. Naming Identifiers of Variables A valid identifier is a non-empty sequence of characters of any length with: ● the start character can be the underscore "_" or a capital or lower case letter ● the letters following the start character can be anything which is permitted as a start character plus the digits. ● Just a warning for Windows-spoilt users: Identifiers are case-sensitive ● Python keywords are not allowed as identifier names and, as, assert, break, class, continue, def, del, elif, else, except, finally, for, from, global, if, import, in, is, lambda, nonlocal, not, or, pass, raise, return, try, while, with, yield
  • 9. Variables vs. Identifiers >>> name = 'reza' >>> id(name) 3072831328L >>> hex(id(name)) '0xb727af60L' >>> An other way to do that : >>> name.__repr__ <method-wrapper '__repr__' of str object at 0xb727af60> >>> 0xb727af60 is exact memory location where the object stored, name is just a reference to that object.
  • 10. Data Types Python offers 1. 2. 3. 4. 5. 6. 7. Numbers Strings List Dictionaries Tuples Boolean …
  • 11. Numbers - Integer Normal integers e.g. 4321 ● Octal literals (base 8) A number prefixed by a 0 (zero) will be interpreted as an octal number >>> a = 010 >>> print a 8 ● Hexadecimal literals (base 16) Hexadecimal literals have to be prefixed either by "0x" or "0X". >>> hex_number = 0xA0F >>> print hex_number 2575 ● Long integers these numbers are of unlimeted size e.g.42000000000000000000L ● Floating-point numbers for example: 42.11, 3.1415e-10 ●
  • 13. Strings Strings are marked by quotes: – single quotes (') 'This is a string with single quotes‘ – double quotes (") "Obama's dog is called Bo"" – triple quotes, both single (''') and (""") '''String in triple quotes can extend over multiple lines, like this on, and can contain 'single' and "double" quotes.'''
  • 14. Strings >>>name = 'reza' >>>name = "reza" >>>name = "rez'a" >>>name = 'Mohammdnreza' >>>print name Mohammad reza
  • 15. Strings >>>name = r'Mohammdnreza' raw string and turns off escaping print name Mohammdnreza >>>
  • 16. Strings >>> name = ''' ... Hello Dear Students ... Welcome to PYSEC101 Course! ... Python Scripting Course for Ethical Hackers ... ''' >>> name 'nHello Dear StudentsnWelcome to PYSEC101 Course!nPython Scripting Course for Ethical Hackersn' >>> print name Hello Dear Students Welcome to PYSEC101 Course! Python Scripting Course for Ethical Hackers
  • 17. String Index ● A string in Python consists of a series or sequence of characters - letters, numbers, and special characters.
  • 18. Unicode Used for internationalization ● “Wide Characters” are they are called(code all languages) >>>name = u'Mohammad' >>> name u'Mohammad' >>> unicode to regular string conversion >>> str(name) 'Mohammad' >>> regular string to unicode conversion >>> unicode(name) u'Mohammad' >>> ●
  • 19. Concatenating Strings Strings can be glued together (concatenated) with the + operator >>>s1 + s2 >>> s1 = 'Hamid' >>> s2 = 'rezaie' >>> s1 + s2 'Hamidrezaie' >>> s1 + ' ' + s2 'Hamid rezaie' >>> ●
  • 20. Repetition String can be repeated or repeatedly concatenated with the asterisk operator "*“ >>> buffer = 'A' * 20 >>> buffer 'AAAAAAAAAAAAAAAAAAAA' >>> ●
  • 21. Int to string >>> 'a' + 42 ● Traceback (most recent call last): ● File "<stdin>", line 1, in <module> ● TypeError: cannot concatenate 'str' and 'int' objects ● >>> ● >>> str(42) ● '42' ● >>>>'a' + str(42) ●
  • 22. Slicing Substrings can be created with the slice or slicing notation, i.e. two indices in square brackets separated by a colon: ● "Python"[2:4] -> "th“ ● >>>string[start:end:steps] ●
  • 23. >>> name = 'Mohammad reza' >>> name[5:10] 'mad r' >>> name[0:10] 'Mohammad r' >>> name[0:-1] 'Mohammad rez' >>> name[0:-5] 'Mohammad' >>> name[:] 'Mohammad reza' >>> name[::-1] 'azer dammahoM' >>> name[::2] 'Mhma ea' >>>
  • 24. Stirngs are immutable objects >>>name = 'reza' >>>name[0] r name [0] = 'a' TypeError: 'str' object does not support item assignment You can not change String Object directly in memory because they are immutable >>>name = 'reza' name = 'Mohammad' ● 'reza' object still does exists now name is referenced to 'Mohammad' object
  • 26. >>> name = 'mohammad reza' >>> name.find('PYSEC101') -1 >>> name.find('mma') 4 >>> >>> name.split() ['mohammad', 'reza'] by default split on white spaces and return list of strings. split on 'a' >>> name.split('a') ['moh', 'mm', 'd rez', ''] >>> >>> name.replace('m', 'H') 'HohaHHad reza' >>>
  • 27. String Formatting >>> ip = '192.168.1.252' >>> line = 'Crack this IP :%s' % ip >>> line 'Crack this IP :192.168.1.252' >>> >>> line = 'Crack this IP : %s and name %s ' % (ip, 'Reza-PC') >>> line 'Crack this IP : 192.168.1.252 and name Reza-PC '
  • 28. References SPSE securitytube training by Vivek Ramachandran SANS Python for Pentesters (SEC573) Violent python Security Power Tools python-course.eu ----------------------------http://www.tutorialspoint.com/python/python_strings.htm http://www.tutorialspoint.com/python/python_numbers.htm http://www.python-course.eu/variables.php http://www.python-course.eu/sequential_data_types.php http://www.python-course.eu/sets_frozensets.php
  • 29. This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/3.0/ Copyright 2013 Mohammad Reza Kamalifard All rights reserved. Go to Kamalifard.ir/pysec101 to Download Slides and Course martials .