Fixed MEncrypt for KGunZ & IJJI

Results 1 to 4 of 4
  1. #1
    Apprentice Contradict is offline
    MemberRank
    Jan 2012 Join Date
    11Posts

    Fixed MEncrypt for KGunZ & IJJI

    This isn't Emisand's, since his/her's upload died, I (sort of) fixed it up. The header changed for KGunz, which I didn't think of 'till a few minutes ago.

    EDIT : Oh, use ThievingSix's MRS Decompiler to unpack the .mrs's without damaging the .mef's.

    I attached the compiled MEncrypt.exe w/ PrivateKey.txt & .h

    Yes, I rigged it, oh well.
    Code:
    void RSADecryptFile( const char *privFilename, const char *szFileName, const char *szOutputFileName)
    {
    	// Read private key
    	FileSource privFile( privFilename, true, new HexDecoder);
    	RSAES_PKCS1v15_Decryptor priv( privFile );
    
    	// Get size of 1 block
    	size_t nCipherTextLength = priv.FixedCiphertextLength();
    
    	// Set file source
    	FileSource fileSource( szFileName, false);
    
    	RSAHEADER header = GetHeaderFile( szFileName );
    
    	if( !memcmp( header.byteHeader, gHeaderChecker, sizeof(gHeaderChecker) ) )
    		g_bIsIjji = true;
    
    	// Skip header
    	if( g_bIsIjji )
    		fileSource.Pump( 40 );
    	else
    		fileSource.Pump( 45 );
    
    	// Decrypt
    	string strBuff;
    	StringSink* pOutput = new StringSink( strBuff);
    	PK_DecryptorFilter *pDecryptFilter = new PK_DecryptorFilter( GlobalRNG(), priv, pOutput);
    	fileSource.Attach( pDecryptFilter);
    
    	try
    	{
    		// Pump data
    		lword nPump = 0;
    
    		while ( nPump = fileSource.Pump( nCipherTextLength))
    			pDecryptFilter->MessageEnd();
    	}
    	catch ( CryptoPP::Exception &e)
    	{
    		string str = e.what();
    		assert( 0);
    	}
    
    	pOutput->MessageEnd();
    
    	// Unzip code and save to file
    	StringSource( strBuff, true, new Gunzip( new FileSink( szOutputFileName)));
    
    	strBuff.clear();
    }
    NOTE:
    IJJI's header is 40 bytes long, KGunZ's is 45 bytes long.
    The original header size found in MEncrypt is 40 (sizeof(RSAHEASER)), which is default for IJJI, however; I was being retarded and forgot that I was testing on KGunZ's.

    Usage:
    Open CMD, navigate to directory of MEncrypt, type:
    MEncrypt -d PrivateKey.txt [FILE_TO_DECRYPT] [OUTPUT_FILE_NAME]

    Edit2 : I added support for IJJI's mefs, as well as KGunZ's. Enjoy.
    Attached Files Attached Files
    Last edited by Contradict; 26-02-12 at 03:40 AM.


  2. #2
    Member Miguelbkn is offline
    MemberRank
    Feb 2010 Join Date
    Santiago, ChileLocation
    95Posts

    Re: Fixed MEncrypt for KGunZ & IJJI

    Well done. I like it

  3. #3
    Apprentice Contradict is offline
    MemberRank
    Jan 2012 Join Date
    11Posts

    Re: Fixed MEncrypt for KGunZ & IJJI

    Er, apparently using it in Release mode doesn't work. I can't recall if others can't run debug-built applications on different machines, but as a just in case, I attached the source file in Release2.rar

  4. #4
    Newbie kn95951135 is offline
    MemberRank
    Nov 2005 Join Date
    MalaysiaLocation
    388Posts

    Re: Fixed MEncrypt for KGunZ & IJJI

    ---------------------------
    Microsoft Visual C++ Debug Library
    ---------------------------
    Debug Error!

    Program: F:\GunZ\Tools\MEncrypt.exe

    R6010

    - abort() has been called



    (Press Retry to debug the application)
    I got this error and show

    Assertion failed: 0, file c:\users\travis\desktop\euro\mencrypt\mencrypt.cpp, li
    ne 180
    I using the application from ur attachment. Thanks



Advertisement