Esempio n. 1
0
def auth() -> Tuple[str, Dict[str, str]]:
    # check if salt and/or encrypted password file are corrupt
    if not secure.salt_and_pwds_store_ok():
        logr.alert(f"""
Salt or password store appear to be corrupt. There isn't much we can do.
If you have a backup of those files, fetch it and replace both of them, if not,
please run `pwds launch`.

On your computer salt and passwords are stored here:
{config.SALT_FILE}
{config.PWDS_STORE_FILE}
""")
        sys.exit(1)

    mpwd: str
    pwds: Optional[Dict[str, str]]

    while True:
        mpwd = getpass.getpass('Master Password: '******'Master Password incorrect. Try again.')

    return mpwd, pwds
Esempio n. 2
0
def parse_ipList(inputFile):
    targets = []
    try:
        # open file and read ip on each line, add to targets list
        f = open(inputFile, "r")
        line = f.readline().strip('\n')
        while line:
            targets.append(line)
            line = f.readline().strip('\n')
    except Exception as e:
        logger.fail('{bred} could not process target list:{rst} {e} ')
    return targets
Esempio n. 3
0
def new_password(pwd_name: str) -> str:
    pwd: str

    while True:
        pwd1: str = getpass.getpass(f'{pwd_name}: ').strip()
        pwd2: str = getpass.getpass(f'Confirm {pwd_name}: ').strip()

        if pwd1 != pwd2:
            logr.fail('Confirmation failed. Passwords differ')

        else:
            pwd = pwd1
            break

    return pwd
Esempio n. 4
0
def conspirology(subject="Hey there!", message="Something just happenned"):
    sender = '*****@*****.**'
    receivers = ['*****@*****.**']

    message = (
        """From: John <*****@*****.**>\r\nTo: LrpTraffic <*****@*****.**>\r\nSubject: %s\r\n

	%s
	""" % (subject, message))

    try:
        smtpObj = smtplib.SMTP('mail.gmx.com', 587)
        smtpObj.starttls()
        smtpObj.login("*****@*****.**", "astadaparola1")
        smtpObj.sendmail(sender, receivers, message)
        #print "Successfully sent email"
        smtpObj.quit()
    except Exception, e:
        logger.fail("Error: unable to send email: " + str(e))
Esempio n. 5
0
def routine(subject="Heartbeat", message="Null"):
    sender = '*****@*****.**'
    receivers = ['*****@*****.**']

    message = (
        """From: Heartbeat <*****@*****.**>\r\nTo: Me <*****@*****.**>\r\nSubject: %s\r\n

	%s
	""" % (subject, message))

    try:
        smtpObj = smtplib.SMTP('mail.gmx.com', 587)
        smtpObj.starttls()
        smtpObj.login("*****@*****.**", "astadaparola1")
        smtpObj.sendmail(sender, receivers, message)
        logger.info("Successfully sent email")
        smtpObj.quit()
    except Exception:
        logger.fail("Error: unable to send email")
Esempio n. 6
0
def create_folders(ip):
    # checks if folders are already in place, if not makes them
    # if already there, move scan folder to backup folder and make new empty scan folder
    # make the directory structure
    #   ip
    #      - exploit
    #      - scans              -- most recent scans
    #      - scans_02123...     -- previous scans
    try:
        logger.info('creating folder structure for {byellow}{ip}{rst}')
        # get current date + time
        now = datetime.now()
        # create the classes path for each directory
        path_workdir = Path.cwd()
        path_ip = path_workdir / f"{ip}"
        path_ip_scan = path_ip / "scans"
        path_ip_exploit = path_ip / "exploit"
        path_ip_loot = path_ip / "loot"
        now = now.strftime("%d.%m.%Y..%H.%M")
        path_ip_scan_now = path_ip / f"scans_{now}"
        # if ip directory already exists
        if path_ip.exists():
            # if scans folder exists in ip folder, move to backup folder and make new scans folder
            logger.debug(
                'IP folder already exists for {byellow}{ip}{rst}, creating backup'
            )
            if path_ip_scan.exists():
                shutil.move(str(path_ip_scan), str(path_ip_scan_now))
                path_ip_scan.mkdir()
            else:
                path_ip_scan.mkdir()
        else:
            # ip folder does not exist so make the folders
            logger.debug('IP folder made for {byellow}{ip}{rst}')
            path_ip.mkdir()
            path_ip_scan.mkdir()
            path_ip_exploit.mkdir()
            path_ip_loot.mkdir()

    except Exception as e:
        logger.fail(f'{bred} Failed to make folder structure: {e}')
Esempio n. 7
0
def loop(project:dict):
    driver = webdriver.Chrome(executable_path="./chromedriver.exe", chrome_options=chrome_options)
    driver.get(project["url"])

    try:
        driver.find_element_by_class_name("confirmVote").click()
        WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.CLASS_NAME, "voteComplete")))
        logger.success(project)
    except:
        logger.fail(project)

    driver.close()

    #TODO: count successes on file copy (so write acces wont fail in logs_counter)
    counted_successes = count_check.get_success_num(project["url"])
    print(counted_successes, "/", project["num_iter"])

    if counted_successes < project["num_iter"]:
        loop(project)
    else:
        print("Finished!")
Esempio n. 8
0
def cFlare(hostname):
    # Initialize
    email = "*****@*****.**"
    key = "109da6ce9eb354c49fff3b55ab6f152721e5a"
    ip = hostname

    cf = CloudFlare(email, key)
    pages = cf.apiCall('/zones')['result_info']['total_pages']

    for page in xrange(0, pages + 1):
        zones = cf.apiCall('/zones', 'GET', {'page': page})['result']

        for zone in zones:
            zone_id = zone['id']

            records = cf.apiCall("/zones/" + zone_id + "/dns_records",
                                 "GET")['result']

            for record in records:
                if record['type'] == 'A':
                    identifier = record['id']

                    data = {
                        'type': 'A',
                        'name': record['name'],
                        'content': ip,
                        'proxied': record['proxied'],
                        'ttl': record['ttl']
                    }

                    res = cf.apiCall(
                        "/zones/" + zone_id + "/dns_records/" + identifier,
                        "PUT", data)['result']

                    if res != None:
                        logger.success(res['name'])
                    else:
                        logger.fail(record['name'])
Esempio n. 9
0
def error():
    logger.fail("Пусто!")
Esempio n. 10
0
if user_id > 0:

    block = 200
    offset = 0
    result = api_call(
        "photos.getAll", {
            "owner_id": user_id,
            "version": "5.63",
            "count": block,
            "access_token": access_token
        })

    totalCount = result[0]
    if totalCount == 0:
        logger.fail("Фото не найдены!")
        sys.exit()
    tId = 0
    for x in range(0, int(totalCount / block) + 1):
        offset = block * x
        result = api_call(
            "photos.getAll", {
                "owner_id": user_id,
                "version": "5.63",
                "count": block,
                "offset": offset,
                "access_token": access_token
            })
        thread = Thread(target=erasePhotos, args=(
            result,
            tId,
Esempio n. 11
0
                             data=json.dumps(data))
        else:
            if data == None:
                r = requests.get(apiUrl + method, headers=self.getHeader())
            else:
                r = requests.get(apiUrl + method + '?' +
                                 urllib.urlencode(data),
                                 headers=self.getHeader())

        return json.loads(r.text)


# Initialize
email = raw_input('Enter email: ')
if len(email) < 4:
    logger.fail('Invalid email address')
    sys.exit()
key = raw_input('Enter global key: ')
if len(key) < 32:
    logger.fail('Invalid global key')
    sys.exit()
ip = raw_input('Enter new IP address: ')
if not re.match('([\d]{1,3}\.){3}[\d]{1,3}', ip):
    logger.fail('Invalid IP address')
    sys.exit()

cf = CloudFlare(email, key)
pages = cf.apiCall('/zones')['result_info']['total_pages']

for page in xrange(0, pages):
    zones = cf.apiCall('/zones', 'GET', {'page': page})['result']
Esempio n. 12
0
    # initiates the pool to queue the different workers
    max_workers = options.threads
    procPool = pool.Pool(max_workers, "xrecon_pool")

    #processes the targets
    targets = []
    # if ip addresses are entered manually
    if (options.input):
        targets = parse_ip(options.input)
        startEnum(targets)
    # if ip addresses are provided in file
    elif (options.inputList):
        targets = parse_ipList(options.inputList)
        startEnum(targets)
    else:
        logger.fail('{bred}No targets specified!{rst}')

    # wait for all the processes in the queue to be finished
    # TODO: add heartbeat instead of inefficient while loop

    while (procPool.get_workers_in_queue() > 0):
        #sleep to avoid last minute workers added queues after the time stop
        time.sleep(2)
        pass

    # check for exceptions occured in the async_jobs
    # placed here otherwise program waits on the async process to finish, -> kills the asynchronity
    # async_job=[future,func_name,ip,port]
    for async_job in async_jobs:
        future = async_job[0]
        func = async_job[1]
Esempio n. 13
0
def main():
    proxies = readProxies("proxies.txt")
    currentProxy = proxies[0]
    while True:
        hostname = proxies[0]
        response = os.system("ping -c 1 -w2 " + hostname + " > /dev/null 2>&1")

        #and then check the response...
        if response == 0:
            erMsg = hostname + ' is up!'
            #logger.success(erMsg)
        else:
            erMsg = hostname + ' is down! wait for 30 seconds'
            logger.warning(erMsg)
            #routine(hostname + " is down! wait for 30 seconds") ## Too many emails
            sleep(30)
            response = os.system("ping -c 1 -w2 " + hostname +
                                 " > /dev/null 2>&1")
            if response == 0:
                erMsg = hostname + ' is up!'
                logger.success(erMsg)
            else:
                #print hostname, "is down x2! checking it again"
                erMsg = hostname + ' is down x2! checking it again'
                logger.fail(erMsg)
                routine("WARN: " + hostname + " is down",
                        hostname + " is down x2! checking it again"
                        )  ## Something really happened
                conspirology(
                    "Something really happened")  ## Something really happened
                sleep(30)
                response = os.system("ping -c 1 -w2 " + hostname +
                                     " > /dev/null 2>&1")
                if response == 0:
                    erMsg = hostname + ' is up!'
                    logger.success(erMsg)
                else:
                    #print hostname, "is down x3! checking it again"
                    erMsg = hostname + ' is down x3! checking it again'
                    logger.fail(erMsg)
                    routine("CRIT: " + hostname + " is down", hostname +
                            " is down x3! checking it again")  ## WTF??!
                    conspirology("WTF??!")
                    sleep(30)
                    response = os.system("ping -c 1 -w2 " + hostname +
                                         " > /dev/null 2>&1")
                    if response == 0:
                        erMsg = hostname + ' is up!'
                        logger.success(erMsg)
                    else:
                        #print hostname, "is down x4! starting cloudflare routine"
                        erMsg = hostname + ' is down x4! starting cloudflare routine'
                        logger.fail(erMsg)
                        routine("PANIC: " + hostname + " is down",
                                hostname + " is down x4! starting cf routine"
                                )  ## PANIC AT THE DISCO!
                        conspirology("PANIC AT THE DISCO!")
                        proxies.pop(0)
                        if len(proxies) == 0:
                            proxies = readProxies("proxies.txt")
                        cFlare(proxies[0])
        sleep(5)