Ethical Hacking With Python Tools
Ethical Hacking With Python Tools
Ethical Hacking With Python Tools
Python tools
JOSE MANUEL ORTEGA
@JMORTEGAC
https://speakerdeck.com/jmortega
INDEX
Introduction Python pentesting
Modules(Sockets,Requests,BeautifulSoup,Shodan)
Analysis metadata
Python Pentesting
Multi platform
Prototypes and proofs of concept(POC)
Many tools and libraries focused on security
OSINT and Pentesting tools
Very good documentation
Python Pentesting
http://sparta.secforce.com/
The Harvester
The Harvester
W3AF
Tools
Scapy
Capturing
FiMap
Detecting
RFI/LFI vulnerabilites
XSScrapy
Detecting
XSS vulnerabilites
result = sock.connect_ex(('127.0.0.1',80))
if result == 0:
print "Port is open"
else:
print "Port is filtered"
Banner server
Banner server
Requests
Checking headers
Checking headers
Requests
import requests
http_proxy = "http://10.10.10.10:3000"
https_proxy = "https://10.10.10.10:3000"
proxyDict = {
"http" : http_proxy,
"https" : https_proxy
}
r = requests.get(url,proxies=proxyDict)
Requests Authentication
BeautifulSoup
Internal/external links
Internal/external links
Scrapy
Web Scraping
Shodan
https://developer.shodan.io
Shodan
import shodan
SHODAN_API_KEY = "insert your API key here"
api = shodan.Shodan(SHODAN_API_KEY)
Shodan
https://www.shodan.io/host/136.243.32.71
Shodan
Shodan
BuiltWith
pip install builtwith
builtwith.parse(https://ep2016.europython.eu)
Analysis metadata
Analysis metadata
Analysis metadata
Port Scanning
Python-nmap
Automating port scanning
Synchronous and asynchronous modes
import nmap
# Synchronous
nm = nmap.PortScanner()
# nm.scan(ip/range,port_list)
results = nm.scan('127.0.0.1', '22,25,80,443')
NmapScanner
NmapScanner
for port in port_list:
NmapScanner().nmapScan(ip, port)
NmapScanner Async
#Asynchronous
nm_async = nmap.PortScannerAsync()
def callback_result(host, scan_result):
print '------------------'
print host, scan_result
nm_async.scan(hosts='192.168.1.0/30', arguments='-sP',
callback=callback_result)
while nm_async .still_scanning():
print("Waiting >>>")
nm_async.wait(2)
NmapScanner Async
Scripts Nmap
Scripts Nmap
Programming routines allow to find potential
https://github.com/disassembler/pywebfuzz
PyWebFuzz
from pywebfuzz import fuzzdb
import requests
logins = fuzzdb.Discovery.PredictableRes.Logins
domain = "http://192.168.56.101"
for login in logins:
print Checking... "+ domain + login
response = requests.get(domain + login)
if response.status_code == 200:
print "Login Resource: " +login
PyWebFuzz
Heartbleed
Vulnerability in OpenSSL V1.0.1
Multi-threaded tool for scanning hosts for CVE-
2014-0160.
https://github.com/musalbas/heartbleed-masstest
https://filippo.io/Heartbleed
Heartbleed
Heartbleed
Advanced tools
Metasploit
python-msfrpc
Nexpose
Tool developed by Rapid7 for scanning
Nexpose
Pentesting tool
https://github.com/jmortega/python-pentesting
https://github.com/jmortega/europython_ethical_hacking
penetration-testers%E2%80%8B/
https://github.com/PacktPublishing/Effective-PythonPenetration-Testing
Books
Books
THANK YOU!