Example #1
0
def subdomainfile():
    subdomainAllFile = "{}-all.txt".format(output_base)
    names = ["sublist3r", "knock", "enumall", "massdns", "amass", "subfinder"]

    for name in names:
        writeFiles(name)

    debug("\nCombining Domains Lists\n")
    with open(subdomainAllFile, "r") as domainList:
        uniqueDomains = set(domainList)
        domainList.close()
        subdomainUniqueFile = "{}-unique.txt".format(output_base)
        uniqueDomainsOut = open(subdomainUniqueFile, "w")
        for domains in uniqueDomains:
            domains = domains.replace("\n", "")
            if domains.endswith(domain):
                uniqueDomainsOut.writelines("https://{}\n".format(domains))
                if ports is not False:
                    uniqueDomainsOut.writelines(
                        "https://{}:8443\n".format(domains))
                if secure is False:
                    uniqueDomainsOut.writelines("http://{}\n".format(domains))
                    if ports is not False:
                        uniqueDomainsOut.writelines(
                            "http://{}:8080\n".format(domains))
    time.sleep(1)
    rootdomainStrip = domain.replace(".", "_")
    info("\nCleaning Up Old Files\n")
    try:
        os.system("rm {}*".format(domain))
        os.system("rm {}*".format(rootdomainStrip))
    except:
        error("\nError Removing Files!\n")
    if not noeyewitness:
        eyewitness(subdomainUniqueFile)
Example #2
0
def knockpy():
    info("\n\nRunning Knock \n")
    knockpyCmd = "python {} -c {}".format(
        os.path.join(script_path, "bin/knockpy/knockpy/knockpy.py"), domain)
    debug("\nRunning Command:  {}".format(knockpyCmd))
    os.system(knockpyCmd)
    rootdomainStrip = domain.replace(".", "_")
    knockpyFilenameInit = "{}_knock.csv".format(output_base)
    os.system("mv {}* {}".format(rootdomainStrip, knockpyFilenameInit))
    time.sleep(1)
    knockpySubs = []
    try:
        with open(knockpyFilenameInit, "rt") as f:
            reader = csv.reader(f, delimiter=",")
            for row in reader:
                knockpySubs.append(row[3])
        filenameKnocktxt = "{}.txt".format(knockpyFilenameInit)
        f1 = open(filenameKnocktxt, "w")
        for hosts in knockpySubs:
            hosts = "".join(hosts)
            f1.writelines("\n" + hosts)
        f1.close()
    except:
        error("\nKnock File Error\n")
    time.sleep(1)
Example #3
0
def writeFiles(name):
    """Writes info of all hosts from subhosts
    """
    subdomainCounter = 0
    subdomainAllFile = "{}-all.txt".format(output_base)
    fileExt = {
        "sublist3r": ".txt",
        "knock": ".csv.txt",
        "enumall": ".lst",
        "massdns": ".txt",
        "amass": ".txt",
        "subfinder": ".txt",
    }
    fileName = output_base + "_" + name + fileExt[name]

    debug("\n Opening %s File" % name)
    try:
        with open(fileName, "r") as f:
            SubHosts = f.read().splitlines()

        with open(subdomainAllFile, "a") as f:
            f.writelines("\n\n" + name)
            for hosts in SubHosts:
                hosts = "".join(hosts)
                f.writelines("\n" + hosts)
                subdomainCounter = subdomainCounter + 1
        os.remove(fileName)
        info("\n{} Subdomains discovered by {}".format(subdomainCounter, name))
    except:
        error("\nError Opening %s File!\n" % name)
    return subdomainCounter
Example #4
0
def uninstallPackage(flags, paths, args):

    color.isDebug = flags.debug
    
    args[0] = args[0].lower()

    if not os.path.exists(f"{paths[2]}/R2Boyo25"):
        downloadMainRepo(paths[2])

    if isInMainRepo(args[0], paths) and not isAvalonPackage(args[0], paths[0], args[0]):
        color.note("Package is not an Avalon package, but it is in the main repository... uninstalling from there.....")
        moveMainRepoToAvalonFolder(paths[2], args[0], paths[0], paths)

    checkReqs(paths, args[0])

    pkg = getPackageInfo(paths, args[0])
    color.note("Uninstalling.....")
    if not pkg['uninstallScript']:

        color.warn("Uninstall script not found... Assuming uninstall not required and deleting files.....")
        deletePackage(paths[0], paths[1], args[0], paths)

    else:

        color.note("Uninstall script found, running.....")

        os.chdir(paths[1])
        if runScript(paths[0] + "/" + args[0] + '/' + pkg['uninstallScript'], paths[0], paths[1], args[0], pkg['binname'], paths[4]+args[0]):
            
            color.error("Uninstall script failed! Deleting files anyways.....")

        deletePackage(paths[0], paths[1], args[0], paths)
    
    color.success("Successfully uninstalled package!")
Example #5
0
def notified():
    notifySub = "domained Script Finished"
    notifyMsg = "domained Script Finished for {}".format(domain)
    Config = configparser.ConfigParser()
    Config.read(os.path.join(script_path, "ext/notifycfg.ini"))
    if (Config.get("Pushover", "enable")) == "True":
        poToken = Config.get("Pushover", "token")
        poUser = Config.get("Pushover", "user")
        if "device" in Config.options("Pushover"):
            poDevice = Config.get("Pushover", "device")
            poRequestPayload = {
                "token": poToken,
                "user": poUser,
                "device": poDevice,
                "title": notifySub,
                "message": notifyMsg,
            }
        else:
            poRequestPayload = {
                "token": poToken,
                "user": poUser,
                "title": notifySub,
                "message": notifyMsg,
            }
            poValidatePayload = {"token": poToken, "user": poUser}
            poValidate = requests.post(
                "https://api.pushover.net/1/users/validate.json",
                data=(poValidatePayload),
            )
            poJsonV = poValidate.json()
            if poJsonV["status"] == 1:
                info("\nPushover Account Validated\n")
                poRequest = requests.post(
                    "https://api.pushover.net/1/messages.json",
                    data=(poRequestPayload))
                poJsonR = poRequest.json()
                if poJsonV["status"] == 1:
                    info("\nPushover Account Notified\n")
                else:
                    error("\nError - Pushover Account Not Notified\n")
            else:
                error("\nError - Pushover Account Not Validated\n")
    if (Config.get("Email", "enable")) == "True":
        gmailUser = Config.get("Email", "user")
        gmailPass = Config.get("Email", "password")
        try:
            server = smtplib.SMTP("smtp.gmail.com", 587)
            server.starttls()
            server.login(gmailUser, gmailPass)
            subject = "domained Script Complete"
            text = "domained Script Complete for " + domain
            msg = "Subject: {}\n\n{}".format(subject, text)
            server.sendmail(gmailUser, gmailUser, msg)
            server.quit()
            info("\nEmail Notification Sent\n")
        except:
            error("\nError - Email Notification Not Sent\n")
Example #6
0
def main():
    try:
        signal.signal(signal.SIGINT, exit_gracefully)

        if (arg == "setup" and not options.disable_spec) \
           or (arg == "health_check" and (health_args == [] or "checkos" in health_args)):
            system_checking()

        if arg == "health_check":
            handler[arg](" ".join(health_args))
        else:
            handler[arg](options, is_upgrade)
    except Exception as e:
        logger.error(error(str(e) + "\nException Occured, see /tmp/install.log for details" ))
        logger.debug(traceback.format_exc())
        failover(options.chorus_path, options.data_path, is_upgrade)
Example #7
0
def main():
    try:
        signal.signal(signal.SIGINT, exit_gracefully)

        if (arg == "setup" and not options.disable_spec) \
           or (arg == "health_check" and (health_args == [] or "checkos" in health_args)):
            system_checking()

        if arg == "health_check":
            handler[arg](" ".join(health_args))
        else:
            handler[arg](options, is_upgrade)
    except Exception as e:
        logger.error(error(str(e) + "\n" + text.get("error_msg", "exception") % log_path))
        logger.debug(traceback.format_exc())
        failover(options.chorus_path, options.data_path, is_upgrade)
        exit(1)
Example #8
0
def main():
    try:
        signal.signal(signal.SIGINT, exit_gracefully)

        if (arg == "setup" and not options.disable_spec) \
           or (arg == "health_check" and (health_args == [] or "checkos" in health_args)):
            system_checking()

        if arg == "health_check":
            handler[arg](" ".join(health_args))
        else:
            handler[arg](options, is_upgrade)
    except Exception as e:
        logger.error(
            error(
                str(e) + "\n" + text.get("error_msg", "exception") % log_path))
        logger.debug(traceback.format_exc())
        failover(options.chorus_path, options.data_path, is_upgrade)
        exit(1)
Example #9
0
def find_dependencies(dep_infos):
    all_packages = {}
    std_libs = ['std', 'ieee']

    for fi in dep_infos:
        for p in fi.packages:
            all_packages[p] = fi.name

    for fi in dep_infos:
        for u in fi.uses:
            if u[0] in std_libs:
                continue

            lib_name = u[0] + '.' + u[1]
            if lib_name in all_packages:
                dep_name = all_packages[lib_name]
                if dep_name != fi.name:
                    fi.depends.add(dep_name)
            else:
                print(error('ERROR: unsatisfied dependency: {} in {}'.format(\
                    '.'.join(u), fi.name)), file=sys.stderr)
Example #10
0
def find_dependencies(dep_infos):
    all_packages = {}
    std_libs = ['std', 'ieee']

    for fi in dep_infos:
        for p in fi.packages:
            all_packages[p] = fi.name

    for fi in dep_infos:
        for u in fi.uses:
            if u[0] in std_libs:
                continue

            lib_name = u[0] + '.' + u[1]
            if lib_name in all_packages:
                dep_name = all_packages[lib_name]
                if dep_name != fi.name:
                    fi.depends.add(dep_name)
            else:
                print(error('ERROR: unsatisfied dependency: {} in {}'.format(\
                    '.'.join(u), fi.name)), file=sys.stderr)
Example #11
0
def error(*text):
    color.error(*text)
    quit()