Bug 153487 - app-crypt/rainbowcrack default charset.txt file path in code
Bug#: 153487 Product:  Gentoo Linux Version: 2006.1 Platform: All
OS/Version: Linux Status: RESOLVED Severity: enhancement Priority: P2
Resolution: FIXED Assigned To: dragonheart@gentoo.org Reported By: rogerw@gmail.com
Component: Unspecified
URL: 
Summary: app-crypt/rainbowcrack default charset.txt file path in code
Keywords:  
Status Whiteboard: 
Opened: 2006-10-30 15:43 0000
Description:   Opened: 2006-10-30 15:43 0000
rainbowcrack, a password hash algorithm, has no default charset.txt path in its
code.  In Gentoo, the charset.txt file gets installed to
/usr/share/rainbowcrack/charset.txt, but this file is never (automatically)
chosen - it fails if one is not found in the local path (i.e. where the code is
executed from).  While this is normal for most uses of the program, it is
somewhat expected  that programs will try and use a set of "Defaults"
especially when first running a program and before customizations begin.  

Some uses might not even require this patch - but it would help usability, in
general.

I'm sure there is a standard way to patch this, but here's the patch I came up
with that makes it work (tm) :).

Please respond with patch format questions, mainly because I'd like to fix the
patch even if its not accepted into Gentoo, to know how to do it in the future.

-Roger Ward


-- 
rainbowcrack-1.2-src-charsetpath.patch
--
diff -rU9 rainbowcrack-1.2-src/src/ChainWalkContext.cpp
rainbowcrack-1.2-src.orig/src/ChainWalkContext.cpp
--- rainbowcrack-1.2-src/src/ChainWalkContext.cpp       2006-10-30
18:39:55.000000000 -0500
+++ rainbowcrack-1.2-src.orig/src/ChainWalkContext.cpp  2003-11-23
00:33:44.000000000 -0500
@@ -52,25 +52,19 @@
                for (i = 0x00; i <= 0xff; i++)

                        m_PlainCharset[i] = i;

                m_nPlainCharsetLen = 256;

                m_sPlainCharsetName = sName;

                m_sPlainCharsetContent = "0x00, 0x01, ... 0xff";

                return true;

        }



        vector<string> vLine;

-       if (!ReadLinesFromFile("charset.txt", vLine))

-       {

-               ReadLinesFromFile("/usr/share/rainbowcrack/charset.txt",
vLine);

-               if  (vLine.size()>0)

-                       printf("Read charset.txt from default
/usr/share/rainbowcrack/\n");

-       }

-       if (vLine.size()>0)

+       if (ReadLinesFromFile("charset.txt", vLine))

        {

                int i;

                for (i = 0; i < vLine.size(); i++)

                {

                        // Filter comment

                        if (vLine[i][0] == '#')

                                continue;



                        vector<string> vPart;

------- Comment #1 From Roger Ward 2006-10-30 15:46:55 0000 -------
Created an attachment (id=100834) [details]
Patch to hardcode the default path of charset.txt as an *alternative* into
rtgen and rtdump

------- Comment #2 From Alon Bar-Lev (RETIRED) 2006-11-01 11:26:30 0000 -------
Thanks!
Added rainbowcrack-1.2-r1.
Fixed somewhat differently, please check it out.