SlideShare una empresa de Scribd logo
1 de 42
Descargar para leer sin conexión
Python For Ethical Hackers
Mohammad reza Kamalifard
Ethical Hacker
Ethical Hacker
Penetration Tester
Ethical Hacker
Penetration Tester
Ethical Hacker = Penetration Tester
Why Python?
Easy to learn
Easy to use
Clean syntax and code readability
Rich set of libraries
Tons of tools already written
Rapid prototyping – POC ( proof on concept )
Why Python?
Easy to learn
Easy to use
Clean syntax and code readability
Rich set of libraries
Tons of tools already written
Rapid prototyping – POC ( proof on concept )
Why Python?
Easy to learn
Easy to use
Clean syntax and code readability
Rich set of libraries
Tons of tools already written
Rapid prototyping – POC ( proof on concept )
Why Python?
Easy to learn
Easy to use
Clean syntax and code readability
Rich set of libraries
Tons of tools already written
Rapid prototyping – POC ( proof on concept )
Why Python?
Easy to learn
Easy to use
Clean syntax and code readability
Rich set of libraries
Tons of tools already written
Rapid prototyping – POC ( proof on concept )
Why Python?
Easy to learn
Easy to use
Clean syntax and code readability
Rich set of libraries
Tons of tools already written
Rapid prototyping – POC ( proof on concept )
Who is using Python
Core Impact – Comprehensive penetration testing solution
Immunity CANVAS – Exploit development framework
W3AF – Web Application Attack and Audit Framework
Sqlmap – Automatic SQL injection tool
Immunity Debugger – Powerful Debugger
Peach – Fuzzer
Sulley – Fully automated and unattended fuzzing framework
Paimei – Reverse engineering framework
Scapy – Packet manipulation tool
Easy File Handling
>>>
>>>
>>>
>>>

file_add = 'c:/users/reza/desktop/passwords.txt'
file_dis = open(file_add, 'r')
emails = file_dis.readlines()
for email in emails:
print email

shahed_soltani@yahoo.com
sir1_kabir@ymail.com
peyman_dabir@yahoo.com
sanaz808@iran.ir
gity_hashemi@yahoo.com
zeuos63@yahoo.com
seyedali_rezaie@datasec.ir
.
.
.
Requests
Library to deal with HTTP : HTTP for Humans
>>> import requests
>>> requests.get('http://kamalifard.ir')
<Response [200]>
>>> r = _
>>> r.headers
CaseInsensitiveDict({'content-length': '771', 'contentencoding': 'gzip', 'accept-ranges': 'bytes', 'vary': 'AcceptEncoding', 'server': 'Apache/2.2.16 (Debian)', 'last-modified':
'Sat, 21 Sep 2013 05:19:57 GMT', 'etag': '"15b565-62b4e6ddf0165940"', 'date': 'Sun, 27 Oct 2013 14:23:54 GMT',
'content-type': 'text/html'})
>>> r.text
u'<!doctype html>n<html lang="en">n<head>nt<meta
charset="UTF-8">nt<title>Mohammad reza
Kamalifard</title>nt<link rel="stylesheet" href="style.css"
/>nn</head>n<body>nt<div class="wrap">ntt<h1>Mohammad
reza Kamalifard</h1>ntt<p>Software
Basic fuzzer
import requests as req
>>>
>>>
>>>
>>>
>>>
...
...

url = 'http://kamalifard.ir/'
file_add = 'c:/users/reza/desktop/dirss.txt'
file_dis = open(file_add, 'r')
dirs= file_dis.readlines()
for x in dirs:
resp = req.get(url + x)
html = resp.text
hashlib
>>> import hashlib
>>> hashlib.algorithms
('md5', 'sha1', 'sha224', 'sha256', 'sha384',
'sha512')
>>> m = hashlib.md5()
>>> m.update('reza')
>>> m.digest()
'xbbx98xb1xd0xb5#xd5xe7x83xf91Urwx02xb6'
>>> m.hexdigest()
'bb98b1d0b523d5e783f931550d7702b6'
>>>
Sockets
• TCP and UDP Sockets
• Regular Servers and Clients
• Raw Sockets
• Sniffing and Injection
Port Scanner
import socket
def connScan(tgtHost, tgtPort):
try:
tcp_socket = socket.socket(socket.AF_INET,
socket.SOCK_STREAM)
tcp_socket.connect((tgtHost, tgtPort))
tcp_socket.send(‘PyCon2013rn')
results = tcp_socket.recv(100)
print '%d/tcp open' % tgtPort
print str(results)
except:
print '%d/tcp closed' % tgtPort
finally:
tcp_socket.close()
ECHO Server
import socket
tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
tcp_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,
1)
tcp_socket.bind(('127.0.0.1', 8000))
tcp_socket.listen(2)
print 'Waiting for client ...'
(client, (ip, port)) = tcp_socket.accept()
print 'Revived connection from : ', ip
print 'Starting ECHO output...'
data = 'dummy'
while len(data):
data = client.recv(2048)
print 'Client send : ', data
client.send(data)
client.close()
Client
import socket
import sys
if len(sys.argv) < 3 :
print 'Please Enter address and port'
sys.exit()
tcp_socket = socket.socket(socket.AF_INET,
socket.SOCK_STREAM)
tcp_socket.connect((sys.argv[1], int(sys.argv[2])))
while True:
userInput = raw_input('Please Enter a Message! : ')
tcp_socket.send(userInput)
print 'Server Send back : ' +
str(tcp_socket.recv(2048))
tcp_socket.close()
-----Client----python client.py 127.0.0.1 8000
Please Enter a Message! : Salam
Server Send back : Salam
Please Enter a Message! : WELCOME TO PYCON 2013!
Server Send back : WELCOME TO PYCON 2013!
Please Enter a Message! :
-----Server----Waiting for client ...
Revived connection from : 127.0.0.1
Starting ECHO output...
Client send : Salam
Client send : WELCOME TO PYCON 2013!
Client send :
Closing Connection
SocketServer Framework
• Framework in Python to create TCP and UDP servers
• Does all the basic steps for you in the background
• Comes in handy if you want to create a server to lure a

client and
• analyze its behavior
SocketServer Framework
import SocketServer
class EchoHandler(SocketServer.BaseRequestHandler):
def handle(self):
print 'Got Connection from : ', self.client_address
data = 'dummy'
while len(data):
data = self.request.recv(1024)
print 'Client sent :' + data
self.request.send(data)
print 'client left‘
server_address = ('127.0.0.1', 9050)
server = SocketServer.TCPServer(server_address, EchoHandler)
server.serve_forever()
Nmap
import nmap
tgtHost = '192.168.1.254'
tgtPort = '80'
nmapScan = nmap.PortScanner()
nmapScan.scan(tgtHost, tgtPort)
state=nmapScan[tgtHost]['tcp'][int(tgtPort)]['state']
print tgtHost + ' tcp/' +tgtPort + ' ' +state
Simple HTTP Server
import SocketServer
import SimpleHTTPServer
httpServer = SocketServer.TCPServer(('', 8080),
SimpleHTTPServer.SimpleHTTPRequestHandler)
httpServer.serve_forever()
Raw Sockets
import struct, socket, binascii
rawSocket = socket.socket(socket.PF_PACKET, socket.SOCK_RAW,
socket.htons(0x800))
pkt = rawSocket.recvfrom(2048)
ethernetHeader = pkt[0][0:14]
eth_hdr = struct.unpack('!6s6s2s', ethernetHeader)
binascii.hexlify(eth_hdr[0])
binascii.hexlify(eth_hdr[1])
binascii.hexlify(eth_hdr[2])
ipHeader = pkt[0][14:34]
ip_hdr = struct.unpack('!12s4s4s', ipHeader)
print 'Source IP address : ' + socket.inet_ntoa(ip_hdr[1])
print 'Destination IP address : ' + socket.inet_ntoa(ip_hdr[2])
tcpHeader = pkt[0][34:54]
tcp_hdr = struct.unpack('!HH16s', tcpHeader)
Packet Injection with Raw Sockets
import socket
import struct
rawSocket = socket.socket(socket.PF_PACKET,
socket.SOCK_RAW,
socket.htons(0x800))
rawSocket.bind(('wlan0', socket.htons(0x800)))
packet = struct.pack('!6s6s2s',
'xaaxaaxaaxaaxaaxaa',
'xbbxbbxbbxbbxbbxbb' , 'x08x00')
rawSocket.send(packet + 'Welcome to PYCON')
Scapy
• Interactive packet manipulation tool
• Forge or decode packets
• Wide number of protocols
• Send Packet on the wire
• Capture Packet
• Match requests and replies
Scapy
reza@kamalifard$ sudo scapy
WARNING: No route found for IPv6 destination :: (no
default route?)
Welcome to Scapy (2.2.0)
>>>ls()
ARP : ARP
DHCP : DHCP options
DNS : DNS
GPRS : GPRSdummy
L2TP : None
PPPoE : PPP over Ethernet
[...]
Sniff
>>> p = sniff(count = 5)
>>> p
<Sniffed: TCP:5 UDP:0 ICMP:0 Other:0>
>>> p.show()
0000
0001
0002
0003
0004
>>>

Ether
Ether
Ether
Ether
Ether

/
/
/
/
/

IP
IP
IP
IP
IP

/
/
/
/
/

TCP
TCP
TCP
TCP
TCP

46.165.248.173:4948 > 192.168.1.2:47981 PA/ Raw
192.168.1.2:47981 > 46.165.248.173:4948 A
127.0.0.1:mmcc > 127.0.0.1:48852 PA / Raw
127.0.0.1:mmcc > 127.0.0.1:48852 PA / Raw
127.0.0.1:48852 > 127.0.0.1:mmcc A
Create Packet
>>> pkt = IP(dst ='192.168.1.254')/TCP(dport = 25)
>>> pkt
<IP frag=0 proto=tcp dst=192.168.1.254 |<TCP
dport=smtp |>>
>>> print pkt
E(@�~�����P
e
>>> str(pkt)
'Ex00x00(x00x01x00x00@x06xf6~xc0xa8x01x02
xc0xa8x01xfex00x14x00x19x00x00x00x00x00
x00x00x00Px02 x00x0bex00x00'
>>> pkt.show()
###[ IP ]###
version= 4
ihl= None
tos= 0x0
len= None
id= 1
flags=
frag= 0
ttl= 64
proto= tcp
chksum= None
src= 192.168.1.2
dst= 192.168.1.254
options
###[ TCP ]###
sport= ftp_data
dport= smtp
seq= 0
ack= 0
dataofs= None
reserved= 0
flags= S
window= 8192
chksum= None
urgptr= 0
options= {}
>>>
###[ IP ]###
version= 4
ihl= None
tos= 0x0
len= None
id= 1
flags=
frag= 0
ttl= 64
proto= tcp
chksum= None
src= 192.168.1.2
dst= 192.168.1.254
options
###[ TCP ]###
sport= ftp_data
dport= smtp
seq= 0
ack= 0
dataofs= None
reserved= 0
flags= S
window= 8192
chksum= None
urgptr= 0
options= {}
Send Packets
>>> pkt = IP(dst = 'google.com')/ICMP()/'Welcome to
PyCon'
>>> pkt
<IP frag=0 proto=icmp dst=Net('google.com') |<ICMP
|<Raw load='Welcome to PyCon' |>>>
>>>
>>> pkt.show()
###[ IP ]###
version= 4
ihl= None
tos= 0x0
len= None
id= 1
flags=
frag= 0
ttl= 64
proto= icmp
chksum= None
src= 192.168.1.2
dst= Net('google.com')
options
###[ ICMP ]###
type= echo-request
code= 0
chksum= None
id= 0x0
seq= 0x0
###[ Raw ]###
load= 'Welcome to PyCon'
>>>send(pkt)
.
send 1 packets.
Send and Recive
>>> resp = sr(pkt)
Begin emission:
Finished to send 1 packets.
*
Received 1 packets, got 1 answers, remaining 0 packets
>>> resp
(<Results: TCP:0 UDP:0 ICMP:1 Other:0>, <Unanswered: TCP:0
UDP:0 ICMP:0 Other:0>)
>>> resp[0][0]
(<IP frag=0 proto=icmp dst=216.239.32.20 |<ICMP |<Raw
load='Welcome to PyCon' |>>>, <IP version=4L ihl=5L tos=0x0
len=44 id=0 flags= frag=0L ttl=33 proto=icmp chksum=0xdf23
src=216.239.32.20 dst=192.168.1.2 options=[] |<ICMP type=echoreply code=0 chksum=0xea37 id=0x0 seq=0x0 |<Raw load='Welcome
to PyCon' |<Padding load='x00x00' |>>>>)
>>>
>>> '?'
‫ﺣﺪود ۰۵۷ ﻣﯿﻠﯿﻮن ﻧﻔﺮ ﮔﺮﺳﻨﻪ در ﺟﻬﺎن وﺟﻮد دارد!‬
‫ﮏ ﻧﻔﺮ از ﻫﺮ ۸ ﻧﻔﺮ‬

‫ﺑـﺮﻧـﺎﻣـﻪ ﺟـﻬـﺎﻧـﯽ ﻏـﺬا‬
‫ﻣﺒﺎرزه ﺟﻬﺎﻧﯽ ﺑﺎ ﮔﺮﺳﻨﮕﯽ‬

‫‪fa.wfp.org‬‬
>>> '?'
>>> print contact_me
>>> ?
>>> print contact_me
Mohammad Reza Kamalifard
Kamalifard@datasec.ir
http://www.linkedin.com/in/itmard
My Python Courses :
http://www.webamooz.ir/home/courses/python-for-ethicalhackers-1/
http://www.webamooz.ir/home/courses/python-for-ethicalhackers-2/
This work is product of DataSec Middle East(Ammniat Dadehaa Khavare miane) and licensed
under the Creative Commons Attribution-NoDerivs 3.0 Unported License.
Copyright 2013 Mohammad Reza Kamalifard
All rights reserved.

http://kamalifard.ir
http://www.webamooz.ir/home/courses/python-for-ethical-hackers-1/
http://www.webamooz.ir/home/courses/python-for-ethical-hackers-2/

Más contenido relacionado

La actualidad más candente

服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript
Qiangning Hong
 
Tornado Web Server Internals
Tornado Web Server InternalsTornado Web Server Internals
Tornado Web Server Internals
Praveen Gollakota
 
Socket programming with php
Socket programming with phpSocket programming with php
Socket programming with php
Elizabeth Smith
 

La actualidad más candente (20)

Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUN
 
OWASP Proxy
OWASP ProxyOWASP Proxy
OWASP Proxy
 
Why and How Powershell will rule the Command Line - Barcamp LA 4
Why and How Powershell will rule the Command Line - Barcamp LA 4Why and How Powershell will rule the Command Line - Barcamp LA 4
Why and How Powershell will rule the Command Line - Barcamp LA 4
 
Powershell Demo Presentation
Powershell Demo PresentationPowershell Demo Presentation
Powershell Demo Presentation
 
Securing Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp VaultSecuring Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp Vault
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stack
 
服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript
 
Learning Dtrace
Learning DtraceLearning Dtrace
Learning Dtrace
 
Python RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutionsPython RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutions
 
Zephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensionsZephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensions
 
Tornado Web Server Internals
Tornado Web Server InternalsTornado Web Server Internals
Tornado Web Server Internals
 
Tornado web
Tornado webTornado web
Tornado web
 
Information security programming in ruby
Information security programming in rubyInformation security programming in ruby
Information security programming in ruby
 
Socket programming with php
Socket programming with phpSocket programming with php
Socket programming with php
 
Beyond Phoenix
Beyond PhoenixBeyond Phoenix
Beyond Phoenix
 
How to discover 1352 Wordpress plugin 0days in one hour (not really)
How to discover 1352 Wordpress plugin 0days in one hour (not really)How to discover 1352 Wordpress plugin 0days in one hour (not really)
How to discover 1352 Wordpress plugin 0days in one hour (not really)
 
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
 
Nginx + Tornado = 17k req/s
Nginx + Tornado = 17k req/sNginx + Tornado = 17k req/s
Nginx + Tornado = 17k req/s
 
On UnQLite
On UnQLiteOn UnQLite
On UnQLite
 
LibreSSL, one year later
LibreSSL, one year laterLibreSSL, one year later
LibreSSL, one year later
 

Similar a Pycon - Python for ethical hackers

us-17-Tsai-A-New-Era-Of-SSRF-Exploiting-URL-Parser-In-Trending-Programming-La...
us-17-Tsai-A-New-Era-Of-SSRF-Exploiting-URL-Parser-In-Trending-Programming-La...us-17-Tsai-A-New-Era-Of-SSRF-Exploiting-URL-Parser-In-Trending-Programming-La...
us-17-Tsai-A-New-Era-Of-SSRF-Exploiting-URL-Parser-In-Trending-Programming-La...
sonjeku1
 
05 module managing your network enviornment
05  module managing your network enviornment05  module managing your network enviornment
05 module managing your network enviornment
Asif
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
Wesley Beary
 
Socket Programming Tutorial 1227317798640739 8
Socket Programming Tutorial 1227317798640739 8Socket Programming Tutorial 1227317798640739 8
Socket Programming Tutorial 1227317798640739 8
shanmuga priya
 

Similar a Pycon - Python for ethical hackers (20)

us-17-Tsai-A-New-Era-Of-SSRF-Exploiting-URL-Parser-In-Trending-Programming-La...
us-17-Tsai-A-New-Era-Of-SSRF-Exploiting-URL-Parser-In-Trending-Programming-La...us-17-Tsai-A-New-Era-Of-SSRF-Exploiting-URL-Parser-In-Trending-Programming-La...
us-17-Tsai-A-New-Era-Of-SSRF-Exploiting-URL-Parser-In-Trending-Programming-La...
 
Socket programming-tutorial-sk
Socket programming-tutorial-skSocket programming-tutorial-sk
Socket programming-tutorial-sk
 
WebRTC 101 - How to get started building your first WebRTC application
WebRTC 101 - How to get started building your first WebRTC applicationWebRTC 101 - How to get started building your first WebRTC application
WebRTC 101 - How to get started building your first WebRTC application
 
05 module managing your network enviornment
05  module managing your network enviornment05  module managing your network enviornment
05 module managing your network enviornment
 
اسلاید اول جلسه یازدهم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه یازدهم کلاس پایتون برای هکرهای قانونیاسلاید اول جلسه یازدهم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه یازدهم کلاس پایتون برای هکرهای قانونی
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.js
 
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
 
Reverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemReverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande Modem
 
Memcache as udp traffic reflector
Memcache as udp traffic reflectorMemcache as udp traffic reflector
Memcache as udp traffic reflector
 
Osol Pgsql
Osol PgsqlOsol Pgsql
Osol Pgsql
 
Practical non blocking microservices in java 8
Practical non blocking microservices in java 8Practical non blocking microservices in java 8
Practical non blocking microservices in java 8
 
Network Test Automation - Net Ops Coding 2015
Network Test Automation - Net Ops Coding 2015Network Test Automation - Net Ops Coding 2015
Network Test Automation - Net Ops Coding 2015
 
Handy Networking Tools and How to Use Them
Handy Networking Tools and How to Use ThemHandy Networking Tools and How to Use Them
Handy Networking Tools and How to Use Them
 
Capturing NIC and Kernel TX and RX Timestamps for Packets in Go
Capturing NIC and Kernel TX and RX Timestamps for Packets in GoCapturing NIC and Kernel TX and RX Timestamps for Packets in Go
Capturing NIC and Kernel TX and RX Timestamps for Packets in Go
 
CEPH中的QOS技术
CEPH中的QOS技术CEPH中的QOS技术
CEPH中的QOS技术
 
CGI.ppt
CGI.pptCGI.ppt
CGI.ppt
 
Socket Programming Tutorial 1227317798640739 8
Socket Programming Tutorial 1227317798640739 8Socket Programming Tutorial 1227317798640739 8
Socket Programming Tutorial 1227317798640739 8
 

Más de Mohammad Reza Kamalifard

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

Más de Mohammad Reza Kamalifard (20)

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
 
جلسه دوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه دوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲جلسه دوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه دوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
 
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
 
جلسه چهارم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه چهارم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲جلسه چهارم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه چهارم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
 
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
 
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
 
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
 
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
 
جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
 
جلسه اول پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه اول پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲جلسه اول پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه اول پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
 
اسلاید اول جلسه اول دوره پاییز کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه اول دوره پاییز کلاس پایتون برای هکرهای قانونیاسلاید اول جلسه اول دوره پاییز کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه اول دوره پاییز کلاس پایتون برای هکرهای قانونی
 
اسلاید دوم جلسه یازدهم کلاس پایتون برای هکر های قانونی
اسلاید دوم جلسه یازدهم کلاس پایتون برای هکر های قانونیاسلاید دوم جلسه یازدهم کلاس پایتون برای هکر های قانونی
اسلاید دوم جلسه یازدهم کلاس پایتون برای هکر های قانونی
 
اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
 
اسلاید ارائه اول جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه اول جلسه ۱۰ کلاس پایتون برای هکر های قانونی اسلاید ارائه اول جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه اول جلسه ۱۰ کلاس پایتون برای هکر های قانونی
 
اسلاید ارائه سوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه سوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی اسلاید ارائه سوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
اسلاید ارائه سوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی
 
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونیاسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
 
اسلاید اول جلسه هشتم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه هشتم کلاس پایتون برای هکرهای قانونیاسلاید اول جلسه هشتم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه هشتم کلاس پایتون برای هکرهای قانونی
 
اسلاید سوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید سوم جلسه هفتم کلاس پایتون برای هکرهای قانونیاسلاید سوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید سوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
 
اسلاید دوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه هفتم کلاس پایتون برای هکرهای قانونیاسلاید دوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه هفتم کلاس پایتون برای هکرهای قانونی
 

Último

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 

Último (20)

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 

Pycon - Python for ethical hackers

  • 1. Python For Ethical Hackers Mohammad reza Kamalifard
  • 4. Ethical Hacker Penetration Tester Ethical Hacker = Penetration Tester
  • 5. Why Python? Easy to learn Easy to use Clean syntax and code readability Rich set of libraries Tons of tools already written Rapid prototyping – POC ( proof on concept )
  • 6. Why Python? Easy to learn Easy to use Clean syntax and code readability Rich set of libraries Tons of tools already written Rapid prototyping – POC ( proof on concept )
  • 7. Why Python? Easy to learn Easy to use Clean syntax and code readability Rich set of libraries Tons of tools already written Rapid prototyping – POC ( proof on concept )
  • 8. Why Python? Easy to learn Easy to use Clean syntax and code readability Rich set of libraries Tons of tools already written Rapid prototyping – POC ( proof on concept )
  • 9. Why Python? Easy to learn Easy to use Clean syntax and code readability Rich set of libraries Tons of tools already written Rapid prototyping – POC ( proof on concept )
  • 10. Why Python? Easy to learn Easy to use Clean syntax and code readability Rich set of libraries Tons of tools already written Rapid prototyping – POC ( proof on concept )
  • 11. Who is using Python Core Impact – Comprehensive penetration testing solution Immunity CANVAS – Exploit development framework W3AF – Web Application Attack and Audit Framework Sqlmap – Automatic SQL injection tool Immunity Debugger – Powerful Debugger Peach – Fuzzer Sulley – Fully automated and unattended fuzzing framework Paimei – Reverse engineering framework Scapy – Packet manipulation tool
  • 12. Easy File Handling >>> >>> >>> >>> file_add = 'c:/users/reza/desktop/passwords.txt' file_dis = open(file_add, 'r') emails = file_dis.readlines() for email in emails: print email shahed_soltani@yahoo.com sir1_kabir@ymail.com peyman_dabir@yahoo.com sanaz808@iran.ir gity_hashemi@yahoo.com zeuos63@yahoo.com seyedali_rezaie@datasec.ir . . .
  • 13. Requests Library to deal with HTTP : HTTP for Humans >>> import requests >>> requests.get('http://kamalifard.ir') <Response [200]> >>> r = _ >>> r.headers CaseInsensitiveDict({'content-length': '771', 'contentencoding': 'gzip', 'accept-ranges': 'bytes', 'vary': 'AcceptEncoding', 'server': 'Apache/2.2.16 (Debian)', 'last-modified': 'Sat, 21 Sep 2013 05:19:57 GMT', 'etag': '"15b565-62b4e6ddf0165940"', 'date': 'Sun, 27 Oct 2013 14:23:54 GMT', 'content-type': 'text/html'}) >>> r.text u'<!doctype html>n<html lang="en">n<head>nt<meta charset="UTF-8">nt<title>Mohammad reza Kamalifard</title>nt<link rel="stylesheet" href="style.css" />nn</head>n<body>nt<div class="wrap">ntt<h1>Mohammad reza Kamalifard</h1>ntt<p>Software
  • 14. Basic fuzzer import requests as req >>> >>> >>> >>> >>> ... ... url = 'http://kamalifard.ir/' file_add = 'c:/users/reza/desktop/dirss.txt' file_dis = open(file_add, 'r') dirs= file_dis.readlines() for x in dirs: resp = req.get(url + x) html = resp.text
  • 15. hashlib >>> import hashlib >>> hashlib.algorithms ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512') >>> m = hashlib.md5() >>> m.update('reza') >>> m.digest() 'xbbx98xb1xd0xb5#xd5xe7x83xf91Urwx02xb6' >>> m.hexdigest() 'bb98b1d0b523d5e783f931550d7702b6' >>>
  • 16. Sockets • TCP and UDP Sockets • Regular Servers and Clients • Raw Sockets • Sniffing and Injection
  • 17. Port Scanner import socket def connScan(tgtHost, tgtPort): try: tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) tcp_socket.connect((tgtHost, tgtPort)) tcp_socket.send(‘PyCon2013rn') results = tcp_socket.recv(100) print '%d/tcp open' % tgtPort print str(results) except: print '%d/tcp closed' % tgtPort finally: tcp_socket.close()
  • 18. ECHO Server import socket tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) tcp_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) tcp_socket.bind(('127.0.0.1', 8000)) tcp_socket.listen(2) print 'Waiting for client ...' (client, (ip, port)) = tcp_socket.accept() print 'Revived connection from : ', ip print 'Starting ECHO output...' data = 'dummy' while len(data): data = client.recv(2048) print 'Client send : ', data client.send(data) client.close()
  • 19. Client import socket import sys if len(sys.argv) < 3 : print 'Please Enter address and port' sys.exit() tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) tcp_socket.connect((sys.argv[1], int(sys.argv[2]))) while True: userInput = raw_input('Please Enter a Message! : ') tcp_socket.send(userInput) print 'Server Send back : ' + str(tcp_socket.recv(2048)) tcp_socket.close()
  • 20. -----Client----python client.py 127.0.0.1 8000 Please Enter a Message! : Salam Server Send back : Salam Please Enter a Message! : WELCOME TO PYCON 2013! Server Send back : WELCOME TO PYCON 2013! Please Enter a Message! : -----Server----Waiting for client ... Revived connection from : 127.0.0.1 Starting ECHO output... Client send : Salam Client send : WELCOME TO PYCON 2013! Client send : Closing Connection
  • 21. SocketServer Framework • Framework in Python to create TCP and UDP servers • Does all the basic steps for you in the background • Comes in handy if you want to create a server to lure a client and • analyze its behavior
  • 22. SocketServer Framework import SocketServer class EchoHandler(SocketServer.BaseRequestHandler): def handle(self): print 'Got Connection from : ', self.client_address data = 'dummy' while len(data): data = self.request.recv(1024) print 'Client sent :' + data self.request.send(data) print 'client left‘ server_address = ('127.0.0.1', 9050) server = SocketServer.TCPServer(server_address, EchoHandler) server.serve_forever()
  • 23. Nmap import nmap tgtHost = '192.168.1.254' tgtPort = '80' nmapScan = nmap.PortScanner() nmapScan.scan(tgtHost, tgtPort) state=nmapScan[tgtHost]['tcp'][int(tgtPort)]['state'] print tgtHost + ' tcp/' +tgtPort + ' ' +state
  • 24. Simple HTTP Server import SocketServer import SimpleHTTPServer httpServer = SocketServer.TCPServer(('', 8080), SimpleHTTPServer.SimpleHTTPRequestHandler) httpServer.serve_forever()
  • 25. Raw Sockets import struct, socket, binascii rawSocket = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, socket.htons(0x800)) pkt = rawSocket.recvfrom(2048) ethernetHeader = pkt[0][0:14] eth_hdr = struct.unpack('!6s6s2s', ethernetHeader) binascii.hexlify(eth_hdr[0]) binascii.hexlify(eth_hdr[1]) binascii.hexlify(eth_hdr[2]) ipHeader = pkt[0][14:34] ip_hdr = struct.unpack('!12s4s4s', ipHeader) print 'Source IP address : ' + socket.inet_ntoa(ip_hdr[1]) print 'Destination IP address : ' + socket.inet_ntoa(ip_hdr[2]) tcpHeader = pkt[0][34:54] tcp_hdr = struct.unpack('!HH16s', tcpHeader)
  • 26. Packet Injection with Raw Sockets import socket import struct rawSocket = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, socket.htons(0x800)) rawSocket.bind(('wlan0', socket.htons(0x800))) packet = struct.pack('!6s6s2s', 'xaaxaaxaaxaaxaaxaa', 'xbbxbbxbbxbbxbbxbb' , 'x08x00') rawSocket.send(packet + 'Welcome to PYCON')
  • 27. Scapy • Interactive packet manipulation tool • Forge or decode packets • Wide number of protocols • Send Packet on the wire • Capture Packet • Match requests and replies
  • 28. Scapy reza@kamalifard$ sudo scapy WARNING: No route found for IPv6 destination :: (no default route?) Welcome to Scapy (2.2.0) >>>ls() ARP : ARP DHCP : DHCP options DNS : DNS GPRS : GPRSdummy L2TP : None PPPoE : PPP over Ethernet [...]
  • 29. Sniff >>> p = sniff(count = 5) >>> p <Sniffed: TCP:5 UDP:0 ICMP:0 Other:0> >>> p.show() 0000 0001 0002 0003 0004 >>> Ether Ether Ether Ether Ether / / / / / IP IP IP IP IP / / / / / TCP TCP TCP TCP TCP 46.165.248.173:4948 > 192.168.1.2:47981 PA/ Raw 192.168.1.2:47981 > 46.165.248.173:4948 A 127.0.0.1:mmcc > 127.0.0.1:48852 PA / Raw 127.0.0.1:mmcc > 127.0.0.1:48852 PA / Raw 127.0.0.1:48852 > 127.0.0.1:mmcc A
  • 30. Create Packet >>> pkt = IP(dst ='192.168.1.254')/TCP(dport = 25) >>> pkt <IP frag=0 proto=tcp dst=192.168.1.254 |<TCP dport=smtp |>> >>> print pkt E(@�~�����P e >>> str(pkt) 'Ex00x00(x00x01x00x00@x06xf6~xc0xa8x01x02 xc0xa8x01xfex00x14x00x19x00x00x00x00x00 x00x00x00Px02 x00x0bex00x00'
  • 31. >>> pkt.show() ###[ IP ]### version= 4 ihl= None tos= 0x0 len= None id= 1 flags= frag= 0 ttl= 64 proto= tcp chksum= None src= 192.168.1.2 dst= 192.168.1.254 options ###[ TCP ]### sport= ftp_data dport= smtp seq= 0 ack= 0 dataofs= None reserved= 0 flags= S window= 8192 chksum= None urgptr= 0 options= {} >>>
  • 32. ###[ IP ]### version= 4 ihl= None tos= 0x0 len= None id= 1 flags= frag= 0 ttl= 64 proto= tcp chksum= None src= 192.168.1.2 dst= 192.168.1.254 options
  • 33. ###[ TCP ]### sport= ftp_data dport= smtp seq= 0 ack= 0 dataofs= None reserved= 0 flags= S window= 8192 chksum= None urgptr= 0 options= {}
  • 34. Send Packets >>> pkt = IP(dst = 'google.com')/ICMP()/'Welcome to PyCon' >>> pkt <IP frag=0 proto=icmp dst=Net('google.com') |<ICMP |<Raw load='Welcome to PyCon' |>>> >>> >>> pkt.show()
  • 35. ###[ IP ]### version= 4 ihl= None tos= 0x0 len= None id= 1 flags= frag= 0 ttl= 64 proto= icmp chksum= None src= 192.168.1.2 dst= Net('google.com') options
  • 36. ###[ ICMP ]### type= echo-request code= 0 chksum= None id= 0x0 seq= 0x0 ###[ Raw ]### load= 'Welcome to PyCon' >>>send(pkt) . send 1 packets.
  • 37. Send and Recive >>> resp = sr(pkt) Begin emission: Finished to send 1 packets. * Received 1 packets, got 1 answers, remaining 0 packets >>> resp (<Results: TCP:0 UDP:0 ICMP:1 Other:0>, <Unanswered: TCP:0 UDP:0 ICMP:0 Other:0>) >>> resp[0][0] (<IP frag=0 proto=icmp dst=216.239.32.20 |<ICMP |<Raw load='Welcome to PyCon' |>>>, <IP version=4L ihl=5L tos=0x0 len=44 id=0 flags= frag=0L ttl=33 proto=icmp chksum=0xdf23 src=216.239.32.20 dst=192.168.1.2 options=[] |<ICMP type=echoreply code=0 chksum=0xea37 id=0x0 seq=0x0 |<Raw load='Welcome to PyCon' |<Padding load='x00x00' |>>>>) >>>
  • 39. ‫ﺣﺪود ۰۵۷ ﻣﯿﻠﯿﻮن ﻧﻔﺮ ﮔﺮﺳﻨﻪ در ﺟﻬﺎن وﺟﻮد دارد!‬ ‫ﮏ ﻧﻔﺮ از ﻫﺮ ۸ ﻧﻔﺮ‬ ‫ﺑـﺮﻧـﺎﻣـﻪ ﺟـﻬـﺎﻧـﯽ ﻏـﺬا‬ ‫ﻣﺒﺎرزه ﺟﻬﺎﻧﯽ ﺑﺎ ﮔﺮﺳﻨﮕﯽ‬ ‫‪fa.wfp.org‬‬
  • 40. >>> '?' >>> print contact_me
  • 41. >>> ? >>> print contact_me Mohammad Reza Kamalifard Kamalifard@datasec.ir http://www.linkedin.com/in/itmard My Python Courses : http://www.webamooz.ir/home/courses/python-for-ethicalhackers-1/ http://www.webamooz.ir/home/courses/python-for-ethicalhackers-2/
  • 42. This work is product of DataSec Middle East(Ammniat Dadehaa Khavare miane) and licensed under the Creative Commons Attribution-NoDerivs 3.0 Unported License. Copyright 2013 Mohammad Reza Kamalifard All rights reserved. http://kamalifard.ir http://www.webamooz.ir/home/courses/python-for-ethical-hackers-1/ http://www.webamooz.ir/home/courses/python-for-ethical-hackers-2/