Kaki Master Of Time
Kaki Master Of Time

Reputation: 1614

clGetPlatformIDs(): CL_PLATFORM_NOT_FOUND_KHR Hashcat

i am trying to run hashcat on my Zen Archlinux i am on the 4.15.4-1-zen kernel version. I have an NVIDIA geforce 920MX and an intel i6189DU. i installed the latest nvidia-dkms drivers and as well as the opencl-nvidia package. I also installed the latest Hashcat version.

When i run the hashcat command i get this error :clGetPlatformIDs(): CL_PLATFORM_NOT_FOUND_KHR. I used a tool to determin the openCL platforms available clinfo and the output only shows my CPU platform not my GPU yet the hashcat command still outputs the same erro.

Any help ?

Upvotes: 6

Views: 12474

Answers (4)

agent0
agent0

Reputation: 1

After installing the pocl package I can see. The cpu but I am unable to see the my GPU. I can see Nvidia drivers working fine in the output of nvidia-smi

Upvotes: 0

SOMDEB SAR
SOMDEB SAR

Reputation: 131

import binascii, hashlib
import sys


def generate_ntlm_hash(text):
    ntlm_hash = binascii.hexlify(hashlib.new('md4', text.encode('utf-16le')).digest())
    return ntlm_hash


min_distance = float('inf')
closest_hash = ""
closest_word = ""
def read_hashes_from_file(filename):
    hashes = []
    with open(filename, 'r') as file:
        for line in file:
            line = line.strip()
            if line:
                hashes.append(line)
    return hashes

def hamming_distance(hash1, hash2):
    bin_hash1 = bin(int(hash1, 16))[2:].zfill(32)
    bin_hash2 = bin(int(hash2, 16))[2:].zfill(32)
    distance = sum(bit1 != bit2 for bit1, bit2 in zip(bin_hash1, bin_hash2))
    return distance

def find_closest_hash(target_hash, hash_list, word):
    global min_distance
    global closest_hash
    global closest_word
    for hash_value in hash_list:
        distance = hamming_distance(target_hash, hash_value)
        if distance < min_distance:
            min_distance = distance
            closest_hash = hash_value
            closest_word = word
    return



def main():
    dictionary_file = input("Enter the name of the dictionary file (e.g., michael.txt): ")
    hash_file = input("Enter the name of the hashes file (e.g., hashes.txt): ")
    try:
        with open(dictionary_file, 'r') as file:
            words = [word.strip() for word in file]
    except FileNotFoundError:
        print("Dictionary file not found.")
        return

    known_hashes = read_hashes_from_file(hash_file)
    total_words = len(words)
    current_word = 0

    for word in words:
        ntlm_hash = generate_ntlm_hash(word)
        if ntlm_hash in known_hashes:
            print(f"Word: {word}, NTLM Hash: {ntlm_hash}, Status: Cracked!")
        else:
            find_closest_hash(ntlm_hash, known_hashes,word)
            completion_percentage = (current_word / total_words) * 100
            sys.stdout.write(f"\rProcessing: {completion_percentage:.2f}% closest_word: {closest_word}, Min_distance: {min_distance:.2f}")
            sys.stdout.flush()
        current_word += 1

    print(f"Word: {closest_word}, Closest Hash: {closest_hash}")
    print("\nProcessing completed.")

if __name__ == "__main__":
    main()

Now it does show the percentage of cracking and finds the closest Hamming distance of all the password texts that you have tried, and it also prints the closest word along with it.

Upvotes: 0

mzalazar
mzalazar

Reputation: 6586

Linuxmint 22.1:

sudo apt-get install pocl-opencl-icd

Upvotes: 6

binarytrails
binarytrails

Reputation: 645

Fellow Archer here, I found a way to fix the broken hashcat as you can see:

    $ hashcat -b
    hashcat (...) starting in benchmark mode...

    clGetPlatformIDs(): CL_PLATFORM_NOT_FOUND_KHR

    ATTENTION! No OpenCL-compatible or CUDA-compatible platform found.
    You are probably missing the OpenCL or CUDA runtime installation.

    $ pacman -S clinfo
    $ clinfo 
    Number of platforms                               0

One way to fix it is to install pocl (Portable OpenCL is an open-source implementation of OpenCL):

    $ pacman -S pocl
    $ clinfo
    Number of platforms                               1
      Platform Name                                   Portable Computing Language
      Platform Vendor                                 The pocl project
      ...

    $ hashcat -b
    hashcat (...) starting in benchmark mode...

    OpenCL API (...) - Platform #1 [The pocl project]
    =========================================================================================================================
    * Device #1: pthread-Intel(R) ...

    Benchmark relevant options:
    ===========================
    * --optimized-kernel-enable

    Hashmode: 0 - MD5

    Speed.#1.........:   ...
    ...

Happy cracking! ( ͡° ͜ʖ ͡°)

Upvotes: 12

Related Questions