SlideShare a Scribd company logo
P U R N A C H A N D E R
Pen-Test Techniques using
Python
Why?
Easy ( Install, learn, Code)
Tons of Libraries
Code is easy to understand
Multiplatform
Good for Prototyping
Free
History
Conceived in late 80´s and first implementation in
1989
Created by Guido Van Rossum
Actually there are two branches 2.x and 3.0
Python
Interpreted language
Object oriented
Indentation is significant in Python, block delimiter.
Usual control structures (if, while, etc)
Multiple levels of organization (function, classes,
modules, packages)
Who is using Python?
Canvas W3AF
Sqlmap Impacket
Google
ImmunityDebugger
Peach
Sulley
Paimei
Scapy
Spike Proxy
Core Impact
Data Types
Data types:
Strings - “Hello”
Numbers – 123
Lists – [‘hello’,’2’,’1’]
Tuples - (‘1’,’2’,’3’) (immutable)
Dictionaries – d = {‘key1’:’dog’,’key2’:’cat’}
Basic Code bits
import sys
ofile = ”names.txt”
fil = open(ofile,'w’)
x = fil.readlines()
for y in x:
print y
Urllib2
Library to deal with HTTP
import urllib2
response = urllib2.urlopen('http://python.org/')
html = response.read()
print html
Basic fuzzer
import sys, urllib2
ofile = ”dirs.txt”
fil = open(ofile,'w')
dirs = fil.readlines()
for x in dirs:
response = urllib2.urlopen('http://python.org/’+x)
html = response.read()
Encoding
import base64
string=“TEST”
base64.standard_b64encode(string)
'VEVTVA=='
import hashlib
m=hashlib.new('md5’)
m.update(string)
res = m.hexdigest()
print res
033bd94b1168d7e4f0d644c3c95e35bf
7 Zip Cracker
import os, sys,
pas = open('passwords.txt', 'rb')
password=pas.readlines()
for x in password:
try:
fp = open('test.7z', 'rb')
archive = Archive7z(fp, password=x)
print ”The password is" + x
sys.exit()
except Exception, e:
fp.close()
Win32Com
Library that allows us to access COM objects in
Win32 systems
We can automate Word, Excel, Powerpoint, access
WMI and etc..
Excel Processing
from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")
xlApp.Visible = 1
xlApp.Workbooks.open("test.xls")
for x in range(1,100):
nombre=str(xlApp.ActiveSheet.Cells(x,5))
print nombre
xlApp.Quit()
WMI
import wmi
c = wmi.WMI ()
for process in c.Win32_Process ():
print process.ProcessId, process.Name
THANK YOU
Q & A

More Related Content

PDF
Python for Penetration testers
Christian Martorella
 
PDF
Python build your security tools.pdf
TECHNOLOGY CONTROL CO.
 
ODP
Pycon Sec
guesta762e4
 
PDF
Python for Linux System Administration
vceder
 
PPT
Os Vanrossum
oscon2007
 
PPT
Unix Programming with Perl 2
Kazuho Oku
 
PPTX
Linux networking
Arie Bregman
 
PPT
Unix Programming with Perl
Kazuho Oku
 
Python for Penetration testers
Christian Martorella
 
Python build your security tools.pdf
TECHNOLOGY CONTROL CO.
 
Pycon Sec
guesta762e4
 
Python for Linux System Administration
vceder
 
Os Vanrossum
oscon2007
 
Unix Programming with Perl 2
Kazuho Oku
 
Linux networking
Arie Bregman
 
Unix Programming with Perl
Kazuho Oku
 

What's hot (20)

PDF
Python for-unix-and-linux-system-administration
Victor Marcelino
 
PPTX
Using the Power to Prove
Kazuho Oku
 
PDF
Quick start bash script
Simon Su
 
ODP
Os Cook
oscon2007
 
PDF
LibreSSL, one year later
Giovanni Bechis
 
PPTX
Shell & Shell Script
Amit Ghosh
 
PPTX
Writing and using php streams and sockets
Elizabeth Smith
 
PDF
Snake bites : Python for Pentesters
Anant Shrivastava
 
PDF
System Programming and Administration
Krasimir Berov (Красимир Беров)
 
PPTX
system management -shell programming by gaurav raikar
GauravRaikar3
 
PDF
Shell scripting
Geeks Anonymes
 
PDF
Quick tour of PHP from inside
julien pauli
 
PDF
IO Streams, Files and Directories
Krasimir Berov (Красимир Беров)
 
ODP
Hands on Session on Python
Sumit Raj
 
PPT
Unix And Shell Scripting
Jaibeer Malik
 
ODP
Biopython
Karin Lagesen
 
PPT
Linux shell scripting
Mohamed Abubakar Sittik A
 
PPTX
(Practical) linux 104
Arie Bregman
 
PPT
Chap06
Dr.Ravi
 
Python for-unix-and-linux-system-administration
Victor Marcelino
 
Using the Power to Prove
Kazuho Oku
 
Quick start bash script
Simon Su
 
Os Cook
oscon2007
 
LibreSSL, one year later
Giovanni Bechis
 
Shell & Shell Script
Amit Ghosh
 
Writing and using php streams and sockets
Elizabeth Smith
 
Snake bites : Python for Pentesters
Anant Shrivastava
 
System Programming and Administration
Krasimir Berov (Красимир Беров)
 
system management -shell programming by gaurav raikar
GauravRaikar3
 
Shell scripting
Geeks Anonymes
 
Quick tour of PHP from inside
julien pauli
 
IO Streams, Files and Directories
Krasimir Berov (Красимир Беров)
 
Hands on Session on Python
Sumit Raj
 
Unix And Shell Scripting
Jaibeer Malik
 
Biopython
Karin Lagesen
 
Linux shell scripting
Mohamed Abubakar Sittik A
 
(Practical) linux 104
Arie Bregman
 
Chap06
Dr.Ravi
 
Ad

Similar to Penetration testing using python (20)

PPTX
PenTest using Python By Purna Chander
nforceit
 
PPTX
Python Traning presentation
Nimrita Koul
 
PDF
What is Python?
wesley chun
 
PPTX
Python_Introduction_Good_PPT.pptx
lemonchoos
 
PDF
Biopython: Overview, State of the Art and Outlook
Asociación Argentina de Bioinformática y Biología Computacional
 
PPT
1B-Introduction_to_python.ppt
AmritMarwaha1
 
PPT
python1.ppt
arivukarasi2
 
PDF
Python_Fundamentals_for_Everyone_Usefull
rravipssrivastava
 
PDF
Becoming a Pythonist
Raji Engg
 
PPTX
Presentation of Python, Django, DockerStack
David Sanchez
 
PPT
Python_intro.ppt
Mariela Gamarra Paredes
 
PPTX
Introduction to python.pptx
pcjoshi02
 
PDF
Python For Scientists
aeberspaecher
 
PPT
Python ppt
Mohita Pandey
 
PDF
DEF CON 27 - AMIT WAISEL and HILA COHEN - malproxy
Felipe Prado
 
PPTX
python_harshdfghmgfdfghhdsdfgxvxa[1].pptx
NickKumar17
 
PPT
ENGLISH PYTHON.ppt
GlobalTransLogistics
 
PPT
mooc_presentataion_mayankmanral on the subject puthon
garvitbisht27
 
PPTX
unit (1)INTRODUCTION TO PYTHON course.pptx
usvirat1805
 
PenTest using Python By Purna Chander
nforceit
 
Python Traning presentation
Nimrita Koul
 
What is Python?
wesley chun
 
Python_Introduction_Good_PPT.pptx
lemonchoos
 
Biopython: Overview, State of the Art and Outlook
Asociación Argentina de Bioinformática y Biología Computacional
 
1B-Introduction_to_python.ppt
AmritMarwaha1
 
python1.ppt
arivukarasi2
 
Python_Fundamentals_for_Everyone_Usefull
rravipssrivastava
 
Becoming a Pythonist
Raji Engg
 
Presentation of Python, Django, DockerStack
David Sanchez
 
Python_intro.ppt
Mariela Gamarra Paredes
 
Introduction to python.pptx
pcjoshi02
 
Python For Scientists
aeberspaecher
 
Python ppt
Mohita Pandey
 
DEF CON 27 - AMIT WAISEL and HILA COHEN - malproxy
Felipe Prado
 
python_harshdfghmgfdfghhdsdfgxvxa[1].pptx
NickKumar17
 
ENGLISH PYTHON.ppt
GlobalTransLogistics
 
mooc_presentataion_mayankmanral on the subject puthon
garvitbisht27
 
unit (1)INTRODUCTION TO PYTHON course.pptx
usvirat1805
 
Ad

Recently uploaded (20)

PPTX
Crypto Recovery California Services.pptx
lionsgate network
 
PPT
1965 INDO PAK WAR which Pak will never forget.ppt
sanjaychief112
 
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
APNIC
 
PPTX
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
PPTX
Unlocking Hope : How Crypto Recovery Services Can Reclaim Your Lost Funds
lionsgate network
 
PPTX
原版北不列颠哥伦比亚大学毕业证文凭UNBC成绩单2025年新版在线制作学位证书
e7nw4o4
 
PDF
UI/UX Developer Guide: Tools, Trends, and Tips for 2025
Penguin peak
 
PPTX
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
PPTX
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
PPTX
Microsoft PowerPoint Student PPT slides.pptx
Garleys Putin
 
PDF
Cybersecurity Awareness Presentation ppt.
banodhaharshita
 
PDF
DNSSEC Made Easy, presented at PHNOG 2025
APNIC
 
PPTX
Google SGE SEO: 5 Critical Changes That Could Wreck Your Rankings in 2025
Reversed Out Creative
 
PPT
Introduction to dns domain name syst.ppt
MUHAMMADKAVISHSHABAN
 
PPTX
Slides Powerpoint: Eco Economic Epochs.pptx
Steven McGee
 
PPTX
How tech helps people in the modern era.
upadhyayaryan154
 
PPT
Transformaciones de las funciones elementales.ppt
rirosel211
 
PPTX
dns domain name system history work.pptx
MUHAMMADKAVISHSHABAN
 
PDF
LB# 820-1889_051-7370_C000.schematic.pdf
matheusalbuquerqueco3
 
PPTX
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
Crypto Recovery California Services.pptx
lionsgate network
 
1965 INDO PAK WAR which Pak will never forget.ppt
sanjaychief112
 
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
APNIC
 
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
Unlocking Hope : How Crypto Recovery Services Can Reclaim Your Lost Funds
lionsgate network
 
原版北不列颠哥伦比亚大学毕业证文凭UNBC成绩单2025年新版在线制作学位证书
e7nw4o4
 
UI/UX Developer Guide: Tools, Trends, and Tips for 2025
Penguin peak
 
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
Microsoft PowerPoint Student PPT slides.pptx
Garleys Putin
 
Cybersecurity Awareness Presentation ppt.
banodhaharshita
 
DNSSEC Made Easy, presented at PHNOG 2025
APNIC
 
Google SGE SEO: 5 Critical Changes That Could Wreck Your Rankings in 2025
Reversed Out Creative
 
Introduction to dns domain name syst.ppt
MUHAMMADKAVISHSHABAN
 
Slides Powerpoint: Eco Economic Epochs.pptx
Steven McGee
 
How tech helps people in the modern era.
upadhyayaryan154
 
Transformaciones de las funciones elementales.ppt
rirosel211
 
dns domain name system history work.pptx
MUHAMMADKAVISHSHABAN
 
LB# 820-1889_051-7370_C000.schematic.pdf
matheusalbuquerqueco3
 
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 

Penetration testing using python