Stoormz'log
Rockyou2024.txt :  Téléchargement et consultation du fichier

Rockyou2024.txt : Téléchargement et consultation du fichier


Après Rockyou2021, une nouvelle version Rockyou2024.txt vient de voir le jour, une compilation de presque 10 milliards de mots de passe, cette liste est le fruit du piratage de plus de 4 000 bases de données sur plus de vingt ans.
Okay, c'est bien beau tout ça, mais comment je peux consulter cette liste ? vérifier si mes mots de passe sont dessus ?

Pré-requis

Tu dois avoir au moins 160Go d’espace libre sur ton disque - oui ça pèse très lourd cette merde  - Le zip contenant le fichier texte pèse environ 50 Go compressé sous format zip, environ 150 Go  une fois  décompressé. 

Téléchargement de la liste Rockyou2024.txt 

Un lien Magnet est déjà dispo sur github:  https://github.com/hkphh/rockyou2024.txt 

magnet:?xt=urn:btih:4e3915a8ecf6bc174687533d93975b1ff0bde38a

Pour ma part j'ai utilisé mon client préféré webtorrent-cli (https://github.com/webtorrent/webtorrent-cli) pour le télécharger.

Rockyou2024 Magnet Torrent

 

Consulter la liste

Une fois téléchargé, il faut décompresser le fichier (merci moustache), ça prend pas mal de temps selon la puissance de ta machine... 

stoorm@zone:/tmp$ ls -lah rockyou2024.txt
-rw-r--r-- 1 stoorm users 146G Jun 25 19:20 rockyou2024.txt
stoorm@zone:/tmp$ file rockyou2024.txt 
rockyou2024.txt: data
stoorm@zone:/tmp$ hexdump -C rockyou2024.txt | head -n 16
00000000  0a 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000030  00 00 00 00 00 00 0a 00  00 00 00 00 00 00 00 00  |................|
00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00800030  00 00 00 00 00 00 00 35  63 31 36 33 66 61 37 36  |.......5c163fa76|
00800040  30 64 36 66 66 66 64 38  65 62 66 34 0a 00 13 3e  |0d6fffd8ebf4...>|
00800050  23 25 6d 18 12 5b 56 7d  22 42 0a 00 19 40 10 72  |#%m..[V}"B...@.r|
00800060  15 0a 00 1f 0a 00 1f 31  0a 00 1f 31 5e 0a 00 1f  |.......1...1^...|
00800070  33 0b 3b 0a 00 1f 33 0b  c5 8f 37 0a 00 1f 37 5f  |3.;...3...7...7_|
00800080  5c 1e 2f 53 0a 00 1f 37  cb 93 0a 00 1f 37 cb 93  |\./S...7.....7..|
00800090  28 0a 00 1f 43 0a 00 1f  43 00 51 35 0a 00 1f 43  |(...C...C.Q5...C|
008000a0  14 41 0a 00 1f 43 14 64  0a 00 1f 43 32 0a 00 1f  |.A...C.d...C2...|
008000b0  43 32 2e 0a 00 1f 43 32  6a 25 69 0a 00 1f 43 c7  |C2....C2j%i...C.|
008000c0  b2 0a 00 1f 45 04 0a 00  1f 45 04 28 0a 00 1f 45  |....E....E.(...E|

Le résultat est un fichier de type data, il s'agit visiblement d'un binaire custom contenant des mot de passes hashés, je m'attendais à un fichier Plain text comme l'édition précédente, mais surtout il pèse dans les ~150Go !  bon courage pour le lire/parcourir ;)

Heureusement, une âme charitable a créé un outil sur mesure : RockYou2024_Reader , il s'agit d'un outil, écrit en c++, très optimisé, pour chercher les occurrences d'une chaîne de caractères dans cette db ,  cerise sur le gâteau,  la personne a fournis le checksum de type b3sum  (BLAKE3 hash) pour vérifier l’intégrité du fichier qu'on vient de télécharger :) 

Rockyou2024 Reader

Voyons voir si on ce qu'on téléchargé n'est pas une grosse daube, pour vérifier le b3sum, il faut d'abord récupérer l'outil a adéquat depuis le site du projet BLAKE3 , un outil similaire est disponible sure CRATES: https://crates.io/crates/b3sum:

stoorm@zone:/tmp$ ./b3sum_linux_x64_bin  rockyou2024.zip --num-threads=1
686e618a9e099f97f61d9e4973b78135f3197a90788b813f5e15b5bb1b7fd7b5  rockyou2024.zip

Youpi, on voit qu'il s'agit du bon fichier.
Passons à la lecture du fichier, après clonage du repo RockYou2024_Reader , il faut builder l'outil, la procédure est bien décrite sur le site du projet:

stoorm@zone:/tmp/rockyou2024$ mkdir build
stoorm@zone:/tmp/rockyou2024$ cd build
stoorm@zone:/tmp/rockyou2024/build$ cmake -GNinja -DCMAKE_BUILD_TYPE=Release
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/rockyou2024

stoorm@zone:/tmp/rockyou2024$ ninja
[2/2] Linking CXX executable search
stoorm@zone:/tmp/rockyou2024$ ln -s ../rockyou2024.txt input.txt

On est bon, on a notre outil de prêt, faisons un petit test :

stoorm@zone:/tmp/rockyou2024$ ./search 
Enter the keyword to search: princess12
Enter the filename to search in: input.txt
Occurrences of keyword "princess12": 17338
Search complete. Time taken: 352.551 seconds

Pas mal de de fans de Star Wars dans la nature ;)

Et si on modifiait ce programme ? visiblement le fichier est une sorte de liste, chaque ligne contient le mot de passe hashé puis le mot de passe en clair, bien sûr séparés par espace. 
On peut donc trifouiller notre programme (search.cc) en l'améliorant un peu pour prendre l'input et le keyword comme arguments :

#include <chrono>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <stdexcept>
#include <string>
#include <string_view>
#include <vector>

namespace fs = std::filesystem;

constexpr std::size_t CHUNK_SIZE = 1024 * 1024;  // 1 MB

void search_in_chunk(const std::string_view buffer, const std::string& keyword, std::vector<std::string>& passwords, int& count) {
    std::size_t pos = 0;
    while ((pos = buffer.find(keyword, pos)) != std::string::npos) {
        ++count;
        pos += keyword.length();
        // Find the start and end positions of the password
        std::size_t password_start = buffer.rfind('\n', pos - 1) + 1;
        std::size_t password_end = buffer.find('\n', pos);
        if (password_end == std::string::npos) {
            password_end = buffer.length();
        }
        // Extract and store the password
        std::string password(buffer.substr(password_start, password_end - password_start));
        passwords.push_back(password);
    }
}

void search_in_file(const std::string& filename, const std::string& keyword) {
    std::ifstream file(filename, std::ios::binary);
    if (!file.is_open()) {
        throw std::runtime_error("Error opening file: " + filename);
    }

    // Allocate buffer with extra space for overlapping
    std::vector<char> buffer(CHUNK_SIZE);

    auto start_time = std::chrono::high_resolution_clock::now();

    std::vector<std::string> passwords;
    int count = 0;
    while (file.read(buffer.data(), CHUNK_SIZE)) {
        auto bytes_read = file.gcount();
        search_in_chunk(std::string_view(buffer.data(), bytes_read), keyword, passwords, count);

        // Move the file pointer to adjust for overlapping
        file.seekg(-(std::streamoff)(keyword.size() - 1), std::ios::cur);

        // Print current count on the same line
        std::cout << "\rOccurrences of keyword \"" << keyword << "\": " << count << std::flush;
    }

    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> cpu_time_used = end_time - start_time;
    std::cout << std::endl;  // Move to the next line after completion
    std::cout << "Search complete. Time taken: " << cpu_time_used.count() << " seconds" << std::endl;

    std::cout << "Passwords containing the keyword \"" << keyword << "\":" << std::endl;
    for (const std::string& password : passwords) {
        std::cout << password << std::endl;
    }
    std::cout << "Total occurrences: " << count << std::endl;
}

int main(int argc, char* argv[]) {
    try {
        if (argc != 5) {
            throw std::runtime_error("Invalid number of arguments. Usage: ./search -input <filename> -search <keyword>");
        }

        std::string filename;
        std::string keyword;

        for (int i = 1; i < argc; i += 2) {
            std::string arg = argv[i];
            if (arg == "-input") {
                filename = argv[i + 1];
            } else if (arg == "-search") {
                keyword = argv[i + 1];
            } else {
                throw std::runtime_error("Invalid argument: " + arg);
            }
        }

        if (!fs::exists(filename)) {
            throw std::runtime_error("File does not exist: " + filename);
        }

        search_in_file(filename, keyword);
    } catch (const std::exception& e) {
        std::cerr << e.what() << std::endl;
        return 1;
    }

    return 0;
}

On re-build, et hope !

stoorm@zone:/tmp/rockyou2024$ ./search -input rockyou2024.txt -search princess12
Occurrences of keyword "princess12": 17338
Search complete. Time taken: 357.279 seconds
Passwords containing the keyword "princess12":
!!!!princess123!!!
!princess12
!princess121
!princess1210
!princess123
....
....
zzprincess1233zz
Total occurrences: 17338

Enjoy ! 

0 commentaire(s)