CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2011
    Posts
    3

    Joining strings (n00b)

    Hello gurus
    Need some help here. Don't know anything about programming and google pointed me here Heres my story. I found a really old password protected file. I remember that I used certain words but have forgot the capitalization. So I need a custom made dictionary to crack it open.
    I know that my password is a combination of 3 words repeated twice. Lets say its a cat, blue and three numbers/characters eg bluecat666BLUECAT&&& or BlueCat666bLuEcAt666

    I made (my first ever) arrays and added all the combinations
    :
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace ConsoleApplication1
    {
    class Program
    {
    static void Main(string[] args)
    {
    string[] cat = { "cat", "caT", "cAt", "cAT", "Cat", "CaT","CAt","CAT"};
    string[] blue = { "blue", "bluE", "blUe", "blUE", "bLue", "bLuE", "bLUe", "bLUE", "Blue", "BluE", "BlUe", "BlUE", "BLue", "BLuE", "BLUe","BLUE"};
    string[] num = { "666", "&&&"};
    }
    }
    }

    How can I join them and output all the combinations to a text file ? Its something to do with for loop and cat[i]+blue[i]+num[i]+cat[i]+blue[i]+num[i] but thats way over my head.


    Thank you so much !

  2. #2
    Join Date
    Oct 2005
    Location
    Seattle, WA U.S.A.
    Posts
    353

    Re: Joining strings (n00b)

    perhaps something like the following ...
    Code:
                using (StreamWriter writer = new StreamWriter("C:\\256Combinations.txt")) {
                    foreach (string cat in cats)
                        foreach (string color in spectrum)
                            foreach (string other in num) 
                                writer.WriteLine(cat + color + other);
                }// end using StreamWriter 'writer'
    Last edited by ThermoSight; March 24th, 2011 at 06:57 PM.

  3. #3
    Join Date
    Mar 2011
    Posts
    3

    Re: Joining strings (n00b)

    I have no idea what you just wrote
    what is streamwriter ? and where does "spectrum" appear from ?

  4. #4
    Join Date
    Mar 2011
    Posts
    3

    Re: Joining strings (n00b)

    OMG it actually works !
    This is some sort of black magic thank you !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured