Dictionary attack simulation.

This is a discussion on Dictionary attack simulation. within the C++ Programming forums, part of the General Programming Boards category; I am trying to create a program to run a simulation of a dictionary attack. But I want it to ...

  1. #1
    Registered Abuser Loic's Avatar
    Join Date
    Mar 2007
    Location
    Sydney
    Posts
    115

    Dictionary attack simulation.

    I am trying to create a program to run a simulation of a dictionary attack. But I want it to not only use the words as it is… but also use different combinations on the word… such as:
    Word
    WOrd
    wORd
    etc etc
    And
    Word
    Word1
    Word99
    The fallowing code is the best I can come up with, but its still not right… and I cant for the life of me work out why… Please help
    Code:
    #include <cstdlib>
    #include <iostream>
    #include <string>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    {
        string word = "word";
        string wordTemp = word;
        
        int pos = word.length();
        do
        {
            wordTemp[pos] = toupper(wordTemp[pos]);
            for (int i=0; i<word.length(); i++)
            {
                wordTemp[i] = toupper(wordTemp[i]);
                for (int i=0; i<100; i++)
                {
                    char data[99];
                    itoa(i, data, 10);
                    wordTemp.replace(4, 2, data);
                    cout << wordTemp << endl;
                }
                if (i < pos) continue;
                wordTemp[i] = tolower(wordTemp[i]);
            }
            pos--;
        } while (pos >= 0);
        system("PAUSE");
        return EXIT_SUCCESS;
    }

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,344
    I would make all the characters uppercase in both strings, then see if the first string is equal to the beginning of the second string. To find that, you can simply make sure the second string length is at least as long as the first string, then use second_str.substr(0, first_str.length()) and compare that to the first string.

    If you need to handle matches where the first string is just somewhere inside the second, but not in the front, then you might want to use find.

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    903
    I would use boost::regex for this.

  4. #4
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Well for the dictionary attack bit, you're going to need to download a text-file perhaps with ALL the words in it, i know these are available somewhere, i was referred to a site one time but i cannot remember where it was.
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  5. #5
    Registered Abuser Loic's Avatar
    Join Date
    Mar 2007
    Location
    Sydney
    Posts
    115
    Quote Originally Posted by Junior89 View Post
    Well for the dictionary attack bit, you're going to need to download a text-file perhaps with ALL the words in it, i know these are available somewhere, i was referred to a site one time but i cannot remember where it was.
    I am going to use the Cain & Abel wordlist file, which i have found to be quite good... that is the easy part, and Daved, i think i am going to give your method a try, its just taking me a bit of time to wrap my head around it... lol

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Running a Brute Force Attack Simulation...
    By Junior89 in forum C++ Programming
    Replies: 31
    Last Post: 02-13-2011, 08:52 PM
  2. Dictionary Attack
    By xddxogm3 in forum Tech Board
    Replies: 1
    Last Post: 12-02-2008, 08:06 AM
  3. memory footprint of Dictionary
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 05-17-2008, 09:39 AM
  4. I'm not THAT good am I?
    By indigo0086 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 10-19-2006, 11:08 AM
  5. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21