SlideShare a Scribd company logo
Python for Ethical Hackers
Mohammad reza Kamalifard
Python Language Essentials
Module 2: System Programming
Part 2 :
Directory Navigation
Directory Details
Methods for traversing directories
Listing file and their information
Creating and deleting directories and files
Test to check if something is a file or directory
>>> import os
>>>
>>> os.getcwd()
'/home/reza/code/PYSEC101/dir'
>>>
>>>
>>>os.mkdir('class')
$ ls
Class jalase7 jalase7.py
os.rmdir()
>>> os.listdir('.')
['class', 'jalase7', 'jalase7.py']
>>>
>>> os.listdir('/')
['opt', 'initrd.img.old', 'lib', 'selinux', 'dev', 'home',
'initrd.img', 'lost+found', 'bin', 'usr', 'sys', 'lib64',
'windows', 'vmlinuz.old', 'proc', 'tmp', 'cdrom', 'run',
'sbin', 'mnt', 'root', 'boot', 'media', 'var', 'vmlinuz',
'etc', 'srv']
>>>
>>> for item in os.listdir('.'):
... if os.path.isfile(item):
... print item + ' is a file'
... elif os.path.isdir(item):
... print item + ' is a directory'
... else:
... print 'unknown'
...
Class is a directory
Jalase7 is a directory
jalase7.py is a file
>>>
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.

More Related Content

PPTX
PPTX
How Secure Are Docker Containers?
PDF
Redis - Usability and Use Cases
PDF
Linux cheat-sheet
PDF
Haskell Packageのdeb化
PDF
Стажировка 2016-07-27 02 Денис Нелюбин. PostgreSQL и jsonb
PPTX
ODT
Huong dan cai dat hadoop
How Secure Are Docker Containers?
Redis - Usability and Use Cases
Linux cheat-sheet
Haskell Packageのdeb化
Стажировка 2016-07-27 02 Денис Нелюбин. PostgreSQL и jsonb
Huong dan cai dat hadoop

What's hot (20)

PDF
Konfigurasi freeradius server
PDF
Groovy on the Shell
PDF
Pry at the Ruby Drink-up of Sophia, February 2012
PDF
Linux system admin
PPTX
Cutting Back Processing Time
PPTX
19. CodeIgniter imagini in mysql
PPTX
Basics of shell programming
PPTX
Death matchtournament del2014
PDF
Configuration surgery with Augeas (OggCamp 12)
DOC
Most frequently used unix commands for database administrator
DOCX
Hadoop installation
TXT
C99[2]
PDF
Redis SoCraTes 2014
PDF
Talk NullByteCon 2015
PPT
TXT
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v
PDF
Archlinux install
PPTX
자바스터디 4
PPTX
Ch3(working with file)
PDF
Beyond Golden Containers: Complementing Docker with Puppet
Konfigurasi freeradius server
Groovy on the Shell
Pry at the Ruby Drink-up of Sophia, February 2012
Linux system admin
Cutting Back Processing Time
19. CodeIgniter imagini in mysql
Basics of shell programming
Death matchtournament del2014
Configuration surgery with Augeas (OggCamp 12)
Most frequently used unix commands for database administrator
Hadoop installation
C99[2]
Redis SoCraTes 2014
Talk NullByteCon 2015
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v
Archlinux install
자바스터디 4
Ch3(working with file)
Beyond Golden Containers: Complementing Docker with Puppet
Ad

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

ODP
Linux Command Line
PPTX
Fun with exploits old and new
ODP
NUMOSS 4th Week - Commandline Tutorial
PDF
Statistical computing 01
PDF
Perforce Object and Record Model
PDF
Python for Penetration testers
PDF
Linux commands cheat sheet by linoxide.com
PDF
20090514 Introducing Puppet To Sasag
PPTX
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
PDF
Deep Visibility for Production Microservices
PPTX
PenTest using Python By Purna Chander
PDF
Attacking Oracle with the Metasploit Framework
PPT
Python Training v2
PDF
Unix commands in etl testing
PDF
Unixcommandsinetltesting 130712050932-phpapp01
ODP
Asian Spirit 3 Day Dba On Ubl
PDF
Does Your IBM i Security Meet the Bar for GDPR?
PPTX
Linux commands and basics of networking v2.pptx
PDF
Unix for Librarians
PPTX
Python and Oracle : allies for best of data management
Linux Command Line
Fun with exploits old and new
NUMOSS 4th Week - Commandline Tutorial
Statistical computing 01
Perforce Object and Record Model
Python for Penetration testers
Linux commands cheat sheet by linoxide.com
20090514 Introducing Puppet To Sasag
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Deep Visibility for Production Microservices
PenTest using Python By Purna Chander
Attacking Oracle with the Metasploit Framework
Python Training v2
Unix commands in etl testing
Unixcommandsinetltesting 130712050932-phpapp01
Asian Spirit 3 Day Dba On Ubl
Does Your IBM i Security Meet the Bar for GDPR?
Linux commands and basics of networking v2.pptx
Unix for Librarians
Python and Oracle : allies for best of data management
Ad

More from Mohammad Reza Kamalifard (20)

PDF
PDF
Introduction to Flask Micro Framework
PDF
Pycon - Python for ethical hackers
PDF
Tehlug 26 Nov 2013 Hackers,Cyberwarfare and Online privacy
PDF
جلسه دوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
PDF
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
PDF
جلسه چهارم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
PDF
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
PDF
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
PDF
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
PDF
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
PDF
جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
PDF
جلسه اول پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
PDF
اسلاید اول جلسه اول دوره پاییز کلاس پایتون برای هکرهای قانونی
PDF
اسلاید دوم جلسه یازدهم کلاس پایتون برای هکر های قانونی
PDF
اسلاید اول جلسه یازدهم کلاس پایتون برای هکرهای قانونی
PDF
اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
PDF
اسلاید ارائه اول جلسه ۱۰ کلاس پایتون برای هکر های قانونی
PDF
اسلاید ارائه سوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
PDF
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
Introduction to Flask Micro Framework
Pycon - Python for ethical hackers
Tehlug 26 Nov 2013 Hackers,Cyberwarfare and Online privacy
جلسه دوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه چهارم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه اول پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
اسلاید اول جلسه اول دوره پاییز کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه یازدهم کلاس پایتون برای هکر های قانونی
اسلاید اول جلسه یازدهم کلاس پایتون برای هکرهای قانونی
اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه اول جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه سوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی

Recently uploaded (20)

PDF
Business Ethics Teaching Materials for college
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
Complications of Minimal Access Surgery at WLH
PPTX
master seminar digital applications in india
PDF
Pre independence Education in Inndia.pdf
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Business Ethics Teaching Materials for college
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
STATICS OF THE RIGID BODIES Hibbelers.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
human mycosis Human fungal infections are called human mycosis..pptx
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Anesthesia in Laparoscopic Surgery in India
Microbial diseases, their pathogenesis and prophylaxis
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Complications of Minimal Access Surgery at WLH
master seminar digital applications in india
Pre independence Education in Inndia.pdf
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES

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

  • 1. Python for Ethical Hackers Mohammad reza Kamalifard
  • 2. Python Language Essentials Module 2: System Programming Part 2 : Directory Navigation
  • 3. Directory Details Methods for traversing directories Listing file and their information Creating and deleting directories and files Test to check if something is a file or directory
  • 4. >>> import os >>> >>> os.getcwd() '/home/reza/code/PYSEC101/dir' >>> >>> >>>os.mkdir('class') $ ls Class jalase7 jalase7.py os.rmdir()
  • 5. >>> os.listdir('.') ['class', 'jalase7', 'jalase7.py'] >>> >>> os.listdir('/') ['opt', 'initrd.img.old', 'lib', 'selinux', 'dev', 'home', 'initrd.img', 'lost+found', 'bin', 'usr', 'sys', 'lib64', 'windows', 'vmlinuz.old', 'proc', 'tmp', 'cdrom', 'run', 'sbin', 'mnt', 'root', 'boot', 'media', 'var', 'vmlinuz', 'etc', 'srv'] >>>
  • 6. >>> for item in os.listdir('.'): ... if os.path.isfile(item): ... print item + ' is a file' ... elif os.path.isdir(item): ... print item + ' is a directory' ... else: ... print 'unknown' ... Class is a directory Jalase7 is a directory jalase7.py is a file >>>
  • 7. 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.