Langsung ke konten utama

Install Bitcrack di linux POP OS

 Popos install Bitcrack

sumber : https://github.com/brichard19/BitCrack.git


Karna di Documentasi install tidak langsung jadi kita harus menyesuaikan beberapa perbuhan sedikit.


Saya menggunakan ncvv untuk persaratan kompilasi

nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2025 NVIDIA Corporation
Built on Wed_Jan_15_19:20:09_PST_2025
Cuda compilation tools, release 12.8, V12.8.61
Build cuda_12.8.r12.8/compiler.35404655_0



Ini adalah contoh kode makefile yang dirubah 


CUR_DIR=$(shell pwd)
DIRS=util AddressUtil CmdParse CryptoUtil KeyFinderLib CLKeySearchDevice CudaKeySearchDevice cudaMath clUtil cudaUtil secp256k1lib Logger embedcl

INCLUDE = $(foreach d, $(DIRS), -I$(CUR_DIR)/$d)

LIBDIR=$(CUR_DIR)/lib
BINDIR=$(CUR_DIR)/bin
LIBS+=-L$(LIBDIR)

# C++ options
CXX=g++
CXXFLAGS=-O2 -std=c++11

# CUDA variables
COMPUTE_CAP=50
NVCC=nvcc
NVCCFLAGS=-std=c++11 -gencode=arch=compute_${COMPUTE_CAP},code=\"sm_${COMPUTE_CAP}\" -Xptxas="-v" -Xcompiler "${CXXFLAGS}"
CUDA_HOME=/usr/local/cuda
CUDA_LIB=${CUDA_HOME}/lib64
CUDA_INCLUDE=${CUDA_HOME}/include
CUDA_MATH=$(CUR_DIR)/cudaMath

# OpenCL variables
OPENCL_LIB=${CUDA_LIB}
OPENCL_INCLUDE=${CUDA_INCLUDE}
OPENCL_VERSION=110

export INCLUDE
export LIBDIR
export BINDIR
export NVCC
export NVCCFLAGS
export LIBS
export CXX
export CXXFLAGS
export CUDA_LIB
export CUDA_INCLUDE
export CUDA_MATH
export OPENCL_LIB
export OPENCL_INCLUDE
export BUILD_OPENCL
export BUILD_CUDA

TARGETS=dir_addressutil dir_cmdparse dir_cryptoutil dir_keyfinderlib dir_keyfinder dir_secp256k1lib dir_util dir_logger dir_addrgen

ifeq ($(BUILD_CUDA),1)
    TARGETS:=${TARGETS} dir_cudaKeySearchDevice dir_cudautil
endif

ifeq ($(BUILD_OPENCL),1)
    TARGETS:=${TARGETS} dir_embedcl dir_clKeySearchDevice dir_clutil dir_clunittest
    CXXFLAGS:=${CXXFLAGS} -DCL_TARGET_OPENCL_VERSION=${OPENCL_VERSION}
endif

all:    ${TARGETS}

dir_cudaKeySearchDevice: dir_keyfinderlib dir_cudautil dir_logger
    make --directory CudaKeySearchDevice

dir_clKeySearchDevice: dir_embedcl dir_keyfinderlib dir_clutil dir_logger
    make --directory CLKeySearchDevice

dir_embedcl:
    make --directory embedcl

dir_addressutil:    dir_util dir_secp256k1lib dir_cryptoutil
    make --directory AddressUtil

dir_cmdparse:
    make --directory CmdParse

dir_cryptoutil:
    make --directory CryptoUtil

dir_keyfinderlib:    dir_util dir_secp256k1lib dir_cryptoutil dir_addressutil dir_logger
    make --directory KeyFinderLib

KEYFINDER_DEPS=dir_keyfinderlib

ifeq ($(BUILD_CUDA), 1)
    KEYFINDER_DEPS:=$(KEYFINDER_DEPS) dir_cudaKeySearchDevice
endif

ifeq ($(BUILD_OPENCL),1)
    KEYFINDER_DEPS:=$(KEYFINDER_DEPS) dir_clKeySearchDevice
endif

dir_keyfinder:    $(KEYFINDER_DEPS)
    make --directory KeyFinder

dir_cudautil:
    make --directory cudaUtil

dir_clutil:
    make --directory clUtil

dir_secp256k1lib:    dir_cryptoutil
    make --directory secp256k1lib

dir_util:
    make --directory util

dir_cudainfo:
    make --directory cudaInfo

dir_logger:
    make --directory Logger

dir_addrgen:    dir_cmdparse dir_addressutil dir_secp256k1lib
    make --directory AddrGen
dir_clunittest:    dir_clutil
    make --directory CLUnitTests

clean:
    make --directory AddressUtil clean
    make --directory CmdParse clean
    make --directory CryptoUtil clean
    make --directory KeyFinderLib clean
    make --directory KeyFinder clean
    make --directory cudaUtil clean
    make --directory secp256k1lib clean
    make --directory util clean
    make --directory cudaInfo clean
    make --directory Logger clean
    make --directory clUtil clean
    make --directory CLKeySearchDevice clean
    make --directory CudaKeySearchDevice clean
    make --directory embedcl clean
    make --directory CLUnitTests clean
    rm -rf ${LIBDIR}
    rm -rf ${BINDIR}


dan kita juga harus merubah util.cpp cari di folder download BitCrack dibagian Utils

contoh code :

#include<stdio.h>
#include<string>
#include<fstream>
#include<vector>
#include<set>
#include<algorithm>

#include"util.h"

#ifdef _WIN32
#include<windows.h>
#else
#include<unistd.h>
#include<sys/stat.h>
#include<sys/time.h>
#include<libgen.h>
#endif

namespace util {

    uint64_t getSystemTime()
    {
#ifdef _WIN32
        return GetTickCount64();
#else
        struct timeval t;
        gettimeofday(&t, NULL);
        return (uint64_t)t.tv_sec * 1000 + t.tv_usec / 1000;
#endif
    }

    Timer::Timer()
    {
        _startTime = 0;
    }

    void Timer::start()
    {
        _startTime = getSystemTime();
    }

    uint64_t Timer::getTime()
    {
        return getSystemTime() - _startTime;
    }

    void sleep(int seconds)
    {
#ifdef _WIN32
        Sleep(seconds * 1000);
#else
        sleep(seconds);
#endif
    }

    std::string formatThousands(uint64_t x)
    {
        char buf[32] = "";

        sprintf(buf, "%llu", x);  // Use %llu for uint64_t

        std::string s(buf);

        int len = (int)s.length();

        int numCommas = (len - 1) / 3;

        if(numCommas == 0) {
            return s;
        }

        std::string result = "";

        int count = ((len % 3) == 0) ? 0 : (3 - (len % 3));

        for(int i = 0; i < len; i++) {
            result += s[i];

            if(count++ == 2 && i < len - 1) {
                result += ",";
                count = 0;
            }
        }

        return result;
    }

    uint32_t parseUInt32(std::string s)
    {
        return (uint32_t)parseUInt64(s);
    }

    uint64_t parseUInt64(std::string s)
    {
        uint64_t val = 0;
        bool isHex = false;

        if(s[0] == '0' && s[1] == 'x') {
            isHex = true;
            s = s.substr(2);
        }
        
        if(s[s.length() - 1] == 'h') {
            isHex = true;
            s = s.substr(0, s.length() - 1);
        }

        if(isHex) {
            if(sscanf(s.c_str(), "%lx", &val) != 1) {  // Ganti %llx dengan %lx // Use %llx for uint64_t
                throw std::string("Expected an integer");
            }
        } else {
            if(sscanf(s.c_str(), "%lx", &val) != 1) {  // Ganti %llx dengan %lx
  // Use %llu for uint64_t
                throw std::string("Expected an integer");
            }
        }

        return val;
    }

    bool isHex(const std::string &s)
    {
        int len = s.length();  // Declare len properly
        for(int i = 0; i < len; i++) {
            char c = s[i];

            if(!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))) {
                return false;
            }
        }

        return true;
    }

    std::string formatSeconds(unsigned int seconds)
    {
        char s[128] = { 0 };

        unsigned int days = seconds / 86400;
        unsigned int hours = (seconds % 86400) / 3600;
        unsigned int minutes = (seconds % 3600) / 60;
        unsigned int sec = seconds % 60;

        if(days > 0) {
            sprintf(s, "%d:%02d:%02d:%02d", days, hours, minutes, sec);
        } else {
            sprintf(s, "%02d:%02d:%02d", hours, minutes, sec);
        }
        

        return std::string(s);
    }

    long getFileSize(const std::string &fileName)
    {
        FILE *fp = fopen(fileName.c_str(), "rb");
        if(fp == NULL) {
            return -1;
        }

        fseek(fp, 0, SEEK_END);

        long pos = ftell(fp);

        fclose(fp);

        return pos;
    }

    bool readLinesFromStream(const std::string &fileName, std::vector<std::string> &lines)
    {
        std::ifstream inFile(fileName.c_str());

        if(!inFile.is_open()) {
            return false;
        }

        return readLinesFromStream(inFile, lines);
    }

    bool readLinesFromStream(std::istream &in, std::vector<std::string> &lines)
    {
        std::string line;

        while(std::getline(in, line)) {
            if(line.length() > 0) {
                lines.push_back(line);
            }
        }

        return true;
    }

    bool appendToFile(const std::string &fileName, const std::string &s)
    {
        std::ofstream outFile;
        bool newline = false;

        if(getFileSize(fileName) > 0) {
            newline = true;
        }

        outFile.open(fileName.c_str(), std::ios::app);

        if(!outFile.is_open()) {
            return false;
        }

        // Add newline following previous line
        if(newline) {
            outFile << std::endl;
        }

        outFile << s;

        return true;
    }

    std::string format(const char *formatStr, double value)
    {
        char buf[100] = { 0 };

        sprintf(buf, formatStr, value);

        return std::string(buf);
    }

    std::string format(uint32_t value)
    {
        char buf[100] = { 0 };

        sprintf(buf, "%u", value);

        return std::string(buf);
    }

    std::string format(uint64_t value)
    {
        char buf[100] = { 0 };

        sprintf(buf, "%llu", value);  // Use %llu for uint64_t

        return std::string(buf);
    }

    std::string format(int value)
    {
        char buf[100] = { 0 };

        sprintf(buf, "%d", value);

        return std::string(buf);
    }

    void removeNewline(std::string &s)
    {
        size_t len = s.length();

        int toRemove = 0;

        if(len >= 2) {
            if(s[len - 2] == '\r' || s[len - 2] == '\n') {
                toRemove++;
            }
        }
        if(len >= 1) {
            if(s[len - 1] == '\r' || s[len - 1] == '\n') {
                toRemove++;
            }
        }

        if(toRemove) {
            s.erase(len - toRemove);
        }
    }

    unsigned int endian(unsigned int x)
    {
        return (x << 24) | ((x << 8) & 0x00ff0000) | ((x >> 8) & 0x0000ff00) | (x >> 24);
    }

    std::string toLower(const std::string &s)
    {
        std::string lowerCase = s;
        std::transform(lowerCase.begin(), lowerCase.end(), lowerCase.begin(), ::tolower);

        return lowerCase;
    }

    std::string trim(const std::string &s, char c)
    {
        size_t left = s.find_first_not_of(c);
        size_t right = s.find_last_not_of(c);

        return s.substr(left, right - left + 1);
    }
}



jika sudah kita bisa jalankan:

>

Building in Linux

Using make:

Build CUDA:

>make BUILD_CUDA=1

Build OpenCL:

>make BUILD_OPENCL=1

Or build both:

>make BUILD_CUDA=1 BUILD_OPENCL=1 

kalian bisa memilih salah satunya kalau saya menggukan

>make BUILD_OPENCL=1 

jika compile build berhasil nanti akan muncul folder seperti ini

nah kita bisa jalankan misalanya

>./clBitCrack



BitCrack OPTIONS [TARGETS]
Where TARGETS is one or more addresses

--help                  Display this message
-c, --compressed        Use compressed points
-u, --uncompressed      Use Uncompressed points
--compression  MODE     Specify compression where MODE is
                          COMPRESSED or UNCOMPRESSED or BOTH
-d, --device ID         Use device ID
-b, --blocks N          N blocks
-t, --threads N         N threads per block
-p, --points N          N points per thread
-i, --in FILE           Read addresses from FILE, one per line
-o, --out FILE          Write keys to FILE
-f, --follow            Follow text output
--list-devices          List available devices
--keyspace KEYSPACE     Specify the keyspace:
                          START:END
                          START:+COUNT
                          START
                          :END
                          :+COUNT
                        Where START, END, COUNT are in hex format
--stride N              Increment by N keys at a time
--share M/N             Divide the keyspace into N equal shares, process the Mth share
--continue FILE         Save/load progress from FILE



Okey selesai bro



Komentar