Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- from random import *
- import os as os
- def add_headers():
- # Add headers to headerstring with \n after each one.
- headerstring = "User-Agent: Mozilla/4.0\nAccept-Language: en-us\nProxy-Connection: Keep-Alive"
- lines = headerstring.split('\n')
- c = ""
- for a in lines:
- if len(a) > 0:
- b = '-H "'+a+'" '
- c += b
- return c
- def execute_unix(inputcommand):
- # Coded by lola69 on 20th June 2013
- p = subprocess.Popen(inputcommand, stdout=subprocess.PIPE, shell=True)
- (output, err) = p.communicate()
- return output
- def get_request(url):
- try:
- c = add_headers()
- inputcommand = "curl -v "+c+url
- print inputcommand
- execute_unix(inputcommand)
- except: pass
- def delete_request(url):
- try:
- c = add_headers()
- inputcommand = "curl -X DELETE -v "+c+url
- execute_unix(inputcommand)
- except: pass
- def head_request(url):
- try:
- c = add_headers()
- inputcommand = "curl -I -v "+c+url
- execute_unix(inputcommand)
- except: pass
- def katy_request(url):
- try:
- c = add_headers()
- inputcommand = "curl -v -X KATY "+c+url
- execute_unix(inputcommand)
- except: pass
- def options_request(url):
- try:
- c = add_headers()
- inputcommand = "curl -v -X OPTIONS "+c+url
- execute_unix(inputcommand)
- except: pass
- def post_request_nodata(url):
- try:
- c = add_headers()
- inputcommand = "curl -v -X POST "+c+url
- execute_unix(inputcommand)
- except: pass
- def put_request_nodata(url):
- try:
- c = add_headers()
- inputcommand = "curl -v -X PUT "+c+url
- execute_unix(inputcommand)
- except: pass
- def put_request_upload(url):
- try:
- c = add_headers()
- inputcommand = 'curl -v -T "README.txt" '+c+url
- execute_unix(inputcommand)
- except: pass
- def trace_request(url):
- try:
- c = add_headers()
- inputcommand = "curl -v -X TRACE "+c+url
- execute_unix(inputcommand)
- except: pass
- def track_request(url):
- try:
- c = add_headers()
- inputcommand = "curl -v -X TRACK "+c+url
- execute_unix(inputcommand)
- except: pass
- def write_README():
- readmestring = "Examples for Developers\nhttp://drupal.org/project/examples\n\n\nThis set of modules is intended to provide small working examples of Drupal's\nfeatures and APIs. The modules strive to be simple, well documented and\nmodification friendly to help developers quickly learn their inner workings,\nwith a little reading and hands on experience.\n\nYou can have a quick glimpse at the current Examples in the demo site: \nhttp://d7.drupalexamples.info/\n\nSuggestions, corrections and new examples are welcome. Don't be shy if you're\njust starting, as precisely because of that you will know the questions and\nproblems of a newcomer better than a seasoned developer!\n\nSetup\n\n1. Install Examples for Developers (unpacking it to your Drupal\n sites/all/modules directory if you're installing by hand, for example).\n2. Enable any Example modules in Admin menu > Site building > Modules.\n3. Rebuild access permissions if you are prompted to.\n4. Profit! The examples will appear in your Navigation menu (on the left\n sidebar by default; you'll need to reenable it if you removed it).\n\nNow you can read the code and its comments and see the result, experiment with\nit, and hopefully quickly grasp how things work.\n\nIf you find a problem, incorrect comment, obsolete or unproper code or such,\nplease let us know by creating a new issue at\nhttp://drupal.org/project/issues/examples\n"
- out = open('README.txt', 'w')
- out.write(readmestring)
- out.close
- def main():
- os.system('clear')
- ch = """
- ###################################
- # HTTP request methods #
- ###################################
- # 1 GET #
- # 2 HEAD #
- # 3 PUT #
- # 4 POST #
- # 5 TRACE #
- # 6 TRACK #
- # 7 OPTIONS #
- # 8 DELETE #
- # 9 KATY #
- # 0 PUT with README.txt #
- ###################################
- """
- url = str(raw_input('Enter first part of url >')) # eg http://frooooooooooogtits.com/?test=
- endstring = str(raw_input('Enter end part of url >')) # eg &me=alon
- n = int(raw_input('enter increment rate >'))
- os.system('clear')
- again = ''
- overflowstring = ''
- count = n
- print ch
- themethod = str(raw_input('Choose a request method >'))
- if themethod == '0':
- print "Do you have a README.txt prepared in this folder"
- doyougot = str(raw_input('Type 2 for yes, Type 3 to prepare one >'))
- if doyougot == '3':
- write_README()
- d = raw_input('Keep pressing <enter> to continue or enter <quit> to quit')
- os.system('clear')
- while again == '':
- overflowstring = ""
- for a in range(count):
- overflowstring+=str(randint(0,9))
- url1 = str(url+(overflowstring)+endstring).strip()
- print "length of string =",count
- if themethod == '1':
- get_request(url1)
- elif themethod == '2':
- head_request(url1)
- elif themethod == '3':
- put_request_nodata(url1)
- elif themethod == '4':
- post_request_nodata(url1)
- elif themethod == '5':
- trace_request(url1)
- elif themethod == '6':
- track_request(url1)
- elif themethod == '7':
- options_request(url1)
- elif themethod == '8':
- delete_request(url1)
- elif themethod == '9':
- katy_request(url1)
- elif themethod == '0':
- put_request_upload(url1)
- else:
- again = 'tits'
- print 'You dun goofed'
- continue
- count += n
- again = raw_input('again >')
- main()
- """ ############################
- # Lola69's BufferOverflow #
- # A simple pentest-tool #
- ############################
- What is this?
- A simple Buffer Overflow Utility
- 1 enter first part of url
- 2 enter second part of url
- 3 enter increment rate
- 4 choose the HTTP request method
- 5 press enter to continue to begin
- 6 enter any letter to exit
- to add or remove http headers change headerstring in add_headers()
- #########
- # To do #
- #########
- Add rotating headers option?
- """
Advertisement
Add Comment
Please, Sign In to add comment