Example #1
0
def crackhashfromfile():
    timetocrack = 0
    value, string, finalV = "", "", []
    word_dict = None
    if request.method == 'POST':
        f = request.files['hashfile']
        filepath = os.path.join(app.config['UPLOAD_FOLDER'], f.filename)
        f.save(filepath)

        option = request.form['options']
        if option == "custom":
            wordlist = request.files['wordlist']
            wordpath = os.path.join(app.config['UPLOAD_FOLDER'], "wordlists",
                                    wordlist.filename)
            wordlist.save(wordpath)
            word_dict = encrypt_all(wordpath)

        start_time = time.time()
        value = crackfile(filepath, word_dict)
        for row in value:
            finalV.append([row[0], hash_type(row[0]), row[1]])

        timetocrack = (time.time() - start_time)
        for row in value:
            for column in row:
                string += column + " "
            string += "\n"
        if 'logged_in' in session:
            username = session["username"]
            filepath = os.path.join(app.config['UPLOAD_FOLDER'], "logs",
                                    username + '.txt')
            with open(filepath, "a") as userfile:
                st = ""
                for row in value:
                    st += datetime.datetime.today().strftime(
                        "%d/%m/%Y %H:%M:%S") + " CF " + f.filename + " "
                    st += row[0] + " " + hash_type(row[0]) + " " + row[1]
                    st += "\n"
                userfile.write(st)
    if 'logged_in' in session:
        return render_template("crackhashfromfile.html",
                               rows=finalV,
                               download=string,
                               time=timetocrack,
                               logged_in=True,
                               username=session['username'])
    return render_template("crackhashfromfile.html",
                           rows=finalV,
                           download=string,
                           time=timetocrack,
                           logged_in=False)
Example #2
0
def concurrentthread():
    global filethread
    global threads
    global done
    timetocrack = 0
    value, string = "", ""
    source = ""
    if request.method == 'POST':
        source = "/progress"
        f = request.files['hashfile']
        t = request.form['threads']
        filepath = os.path.join(app.config['UPLOAD_FOLDER'], f.filename)
        f.save(filepath)
        start_time = time.time()
        filethread = filepath
        threads = t
        minerthread()
        res = returnResult()
        value = []
        for hashvalue, cracked in res.items():
            value.append([hashvalue, cracked.strip("\n")])

        timetocrack = (time.time() - start_time)
        for row in value:
            for column in row:
                string += column + " "
            string += "\n"
        if 'logged_in' in session:
            username = session["username"]
            filepath = os.path.join(app.config['UPLOAD_FOLDER'], "logs",
                                    username + '.txt')
            with open(filepath, "a") as userfile:
                st = ""
                for row in value:
                    st += datetime.datetime.today().strftime(
                        "%d/%m/%Y %H:%M:%S") + " CF " + f.filename + " "
                    st += row[0] + " " + hash_type(row[0]) + " " + row[1]
                    st += "\n"
                userfile.write(st)
    if 'logged_in' in session:
        return render_template("concurrentthread.html",
                               source=source,
                               rows=value,
                               download=string,
                               time=timetocrack,
                               logged_in=True,
                               username=session['username'])
    return render_template("concurrentthread.html",
                           source=source,
                           rows=value,
                           download=string,
                           time=timetocrack,
                           logged_in=False)
Example #3
0
def identifyhash():
    hash = "empty"
    if request.method == 'POST':
        hashvalue = request.form['hashvalue']
        hash = hash_type(hashvalue)
        if 'logged_in' in session:
            username = session["username"]
            filepath = os.path.join(app.config['UPLOAD_FOLDER'], "logs",
                                    username + '.txt')
            with open(filepath, "a") as userfile:
                userfile.write(
                    datetime.datetime.today().strftime("%d/%m/%Y %H:%M:%S") +
                    " IH - " + hashvalue + " " + hash + " -\n")
    if 'logged_in' in session:
        return render_template("identifyhash.html",
                               value=hash,
                               logged_in=True,
                               username=session['username'])
    return render_template("identifyhash.html", value=hash, logged_in=False)
Example #4
0
def crackhash():
    value, hash = "", ""
    timetocrack = 0
    word_dict = None
    if request.method == 'POST':
        hashvalue = request.form['hashvalue']
        option = request.form['options']
        if option == "custom":
            wordlist = request.files['wordlist']
            wordpath = os.path.join(app.config['UPLOAD_FOLDER'], "wordlists",
                                    wordlist.filename)
            wordlist.save(wordpath)
            word_dict = encrypt_all(wordpath)
        start_time = time.time()
        value = cracksingle(hashvalue, word_dict)
        hash = hash_type(hashvalue)
        timetocrack = (time.time() - start_time)
        if 'logged_in' in session:
            username = session["username"]
            filepath = os.path.join(app.config['UPLOAD_FOLDER'], "logs",
                                    username + '.txt')
            with open(filepath, "a") as userfile:
                userfile.write(
                    datetime.datetime.today().strftime("%d/%m/%Y %H:%M:%S") +
                    " CH - " + hashvalue + " " + hash + " " + value)
    if 'logged_in' in session:
        return render_template("crackhash.html",
                               value=value,
                               time=timetocrack,
                               logged_in=True,
                               username=session['username'],
                               hashtype=hash)
    return render_template("crackhash.html",
                           value=value,
                           time=timetocrack,
                           logged_in=False,
                           hashtype=hash)
Example #5
0
def crackhashfromdir():
    timetocrack = 0
    value = []
    string = ""
    fnames = []
    word_dict = None
    if request.method == 'POST':
        st = ""
        files = request.files.getlist("hashdir")
        option = request.form['options']
        if option == "custom":
            wordlist = request.files['wordlist']
            wordpath = os.path.join(app.config['UPLOAD_FOLDER'], "wordlists",
                                    wordlist.filename)
            wordlist.save(wordpath)
            word_dict = encrypt_all(wordpath)
        start_time = time.time()
        for file in files:
            fname = file.filename.replace("/", "-")
            if fname[-4:] == ".txt":
                finalV = []
                file.save(os.path.join(app.config['UPLOAD_FOLDER'], fname))
                fnames.append(file.filename)
                string += file.filename + "\n"
                table = crackfile(
                    os.path.join(app.config['UPLOAD_FOLDER'], fname),
                    word_dict)
                for row in table:
                    finalV.append([row[0], hash_type(row[0]), row[1]])
                timetocrack = (time.time() - start_time)
                value.append(finalV)

                for row in table:
                    st += datetime.datetime.today().strftime(
                        "%d/%m/%Y %H:%M:%S") + " CD " + file.filename + " "
                    for column in row:
                        string += column + " "
                    st += row[0] + " " + hash_type(
                        row[0]) + " " + row[1] + "\n"
                    string += "\n"

        if 'logged_in' in session:
            username = session["username"]
            filepath = os.path.join(app.config['UPLOAD_FOLDER'], "logs",
                                    username + '.txt')
            with open(filepath, "a") as userfile:
                userfile.write(st)
    if 'logged_in' in session:
        return render_template("crackhashfromdir.html",
                               tables=value,
                               download=string,
                               fnames=fnames,
                               time=timetocrack,
                               logged_in=True,
                               username=session['username'])
    return render_template("crackhashfromdir.html",
                           tables=value,
                           download=string,
                           fnames=fnames,
                           time=timetocrack,
                           logged_in=False)