Storyyeller / Krakatau

Java decompiler, assembler, and disassembler
GNU General Public License v3.0
1.97k stars 220 forks source link

Cannot decompile (obfuscation?) #153

Closed lab313ru closed 6 years ago

lab313ru commented 6 years ago

I have a class file that cannot be decompiled by Krakatau (and all other decompilers).

ConfigurationService.zip

If you look at the bytecode you will see the next thing at the start of every method ( many nops with (or without) few catches):

.method public <init> : ()V 
    .code stack 5 locals 1 
L0:     nop 
L1:     nop 
L2:     nop 
L3:     nop 
L4:     nop 
L5:     nop 
L6:     nop 
L7:     nop 
L8:     nop 
L9:     nop 
L10:    nop 
L11:    nop 
L12:    nop 
L13:    nop 
L14:    nop 
L15:    nop 
L16:    nop 
L17:    nop 
L18:    nop 
L19:    nop 
L20:    nop 
L21:    nop 
L22:    nop 
L23:    nop 
L24:    nop 
L25:    nop 
L26:    nop 
L27:    nop 
L28:    nop 
L29:    nop 
L30:    nop 
L31:    nop 
L32:    nop 
L33:    nop 
L34:    nop 
L35:    nop 
L36:    nop 
L37:    nop 
L38:    nop 
L39:    nop 
L40:    nop 
L41:    nop 
L42:    nop 
L43:    nop 
L44:    nop 
L45:    nop 
L46:    nop 
L47:    nop 
L48:    nop 
L49:    nop 
L50:    nop 
L51:    nop 
L52:    nop 
L53:    nop 
L54:    nop 
L55:    nop 
L56:    nop 
L57:    nop 
L58:    nop 
L59:    nop 
L60:    nop 
L61:    nop 
L62:    nop 
L63:    nop 
L64:    nop 
L65:    nop 
L66:    nop 
L67:    nop 
L68:    nop 
L69:    nop 
L70:    nop 
L71:    nop 
L72:    nop 
L73:    nop 
L74:    nop 
L75:    nop 
L76:    nop 
L77:    nop 
L78:    nop 
L79:    nop 
L80:    nop 
L81:    nop 
L82:    nop 
L83:    nop 
L84:    nop 
L85:    nop 
L86:    nop 
L87:    nop 
L88:    nop 
L89:    nop 
L90:    nop 
L91:    nop 
L92:    nop 
L93:    nop 
L94:    nop 
L95:    nop 
L96:    nop 
L97:    nop 
L98:    nop 
L99:    nop 
L100:   nop 
L101:   nop 
L102:   nop 
L103:   nop 
L104:   nop 
L105:   nop 
L106:   nop 
L107:   nop 
L108:   nop 
L109:   nop 
L110:   nop 
L111:   nop 
L112:   nop 
L113:   nop 
L114:   nop 
L115:   nop 
L116:   nop 
L117:   nop 
L118:   nop 
L119:   nop 
L120:   nop 
L121:   nop 
L122:   nop 
L123:   nop 
L124:   nop 
L125:   nop 
L126:   nop 
L127:   nop 
L128:   nop 
L129:   nop 
L130:   nop 
L131:   nop 
L132:   nop 
L133:   nop 
L134:   nop 
L135:   nop 
L136:   nop 
L137:   nop 
L138:   nop 
L139:   nop 
L140:   nop 
L141:   nop 
L142:   nop 
L143:   nop 
L144:   nop 
L145:   nop 
L146:   nop 
L147:   nop 
L148:   nop 
L149:   nop 
L150:   nop 
L151:   nop 
L152:   nop 
L153:   
        .localvariabletable 
            0 is this Lcom/pg/orion/protocols/cs275/ConfigurationService; from L0 to L153 
        .end localvariabletable 
        .linenumbertable 
            L0 124 
            L4 73 
            L10 75 
            L16 97 
            L31 100 
            L38 102 
            L45 104 
            L52 107 
            L59 114 
            L65 117 
            L70 125 
            L81 126 
            L92 127 
            L103 128 
            L114 129 
            L125 130 
            L136 131 
            L141 132 
            L152 133 
        .end linenumbertable 
    .end code 
    .attribute 'perc.pxl.CPUses' b'\x00\x1d\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\t\x00\n\x00\x0b\x00\x0c\x00\r\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x011\x011\x011\x011\x011' 
    .attribute 'perc.pxl.LineNumberTable' b'\x00&\x00\x00\x00|\x00\x04\x00I\x00\n\x00K\x00\x10\x00a\x00\x1f\x00d\x00&\x00f\x00-\x00h\x004\x00k\x00;\x00r\x00A\x00u\x00F\x00}\x00Y\x00~\x00l\x00\x7f\x00\x7f\x00\x80\x00\x92\x00\x81\x00\xa5\x00\x82\x00\xb0\x00\x83\x00\xb5\x00\x84\x00\xc0\x00\x85' 
    .attribute 'perc.pxl.CompiledAugment' b"\x00\x03\x00\x02\x00\x02\x00\x00\x07\x00\x01\x00\x00\x00\x04/\xc7\xc1,\x00\x00\x00\xc7\xc2\x14\x00\x00\x00\xe8\x00\x00l\x001\xd2\x89V \x89V\x1c\x89V\x18\x89V\x14\x89V\x10\x89V\x0c\x89V\x08\x89V$h\x00\x00\x00\x00\x89g\x08\x8b\x0e\x8bQ\x08\x8bRD\x89V\x04\xf6\x053\x00\x1c\x00\xfft\x05\xe8\x08\x00`\x00\x8bF(\xc7\xc1p\x11\x01\x00\x8bP\xfc\x89J$\x89J(\x89\xc1\x89N \xc7\xc3\x02\x00\x00\x00\xc7\xc2\n\x00\x00\x00\x89\xd8\xe8*\x004\x011\xc9\x8bP\xfc;J\xec\x0f\x83\xa0\x03\x00\x00\xc7\x02\x00\x00\x00\x00\xc7\xc1\x01\x00\x00\x00;J\xec\x0f\x83\x8b\x03\x00\x00\xc7B\x04\x00\x00\x00\x00\x8bN \x8bQ\xfc\xff\xf0\x89V\x1c\xe8:\x00\\\x00Y\x8bN\x1c\xc7F\x1c\x00\x00\x00\x00\x89AD\xc7\xc0 N\x00\x00\x8bN \x8bQ\xfc\x89BH\xc7\xc0p\x17\x00\x00\x89BL\xc7BP\xb4\x00\x00\x00\xc7\xc0\x00\x00\x00\x00\xc7\xc3\x10'\x00\x00\x89ZX\x89B\\\xc7Bd\x14\x00\x00\x00\xc7Bh\x00\x00\x00\x00\x89\xc8\x89N\x1c\x8b^\x04\x8b[,\xe8]\x00,\x01\x89F\x18\x8bH\xfc\x89\xc8\x89N\x18\x89F$\xc7\xc2\n\x00\x00\x00\x89W\xfc\x89F\xfc\x8bX\xfc\x89\xd9\x89^\x18\x8bF\xfc\x8d-\x00\x00\x00\x00\xffU\x10\xc7F$\x00\x00\x00\x00\x8bF\x1c\x8bH\xfc\x8bV\x18\xc7F\x18\x00\x00\x00\x00\xff\xf2\x89N\x18\xe8O\x00\\\x00Y\x8bN\x18\xc7F\x18\x00\x00\x00\x00\x89A\x10\x8bF\x1c\x89\xc1\x89N\x18\x8b^\x04\x8b[,\xe8!\x00,\x01\x89F\x14\x8bH\xfc\x89\xc8\x89N\x14\x89F$\xc7\xc2\n\x00\x00\x00\x89W\xfc\x89F\xfc\x8bX\xfc\x89\xd9\x89^\x14\x8bF\xfc\x8d-\x00\x00\x00\x00\xffU\x10\xc7F$\x00\x00\x00\x00\x8bF(\x8bH\xfc\x8bV\x14\xc7F\x14\x00\x00\x00\x00\xff\xf2\x89N\x14\xe8O\x00\\\x00Y\x8bN\x14\xc7F\x14\x00\x00\x00\x00\x89A\x08\x8bF(\x89\xc1\x89F\x14\x8b^\x04\x8b[,\xe8!\x00,\x01\x89F\x10\x8bH\xfc\x89\xc8\x89N\x10\x89F$\xc7\xc2\n\x00\x00\x00\x89W\xfc\x89F\xfc\x8bX\xfc\x89\xd9\x89^\x10\x8bF\xfc\x8d-\x00\x00\x00\x00\xffU\x10\xc7F$\x00\x00\x00\x00\x8bF(\x8bH\xfc\x8bV\x10\xc7F\x10\x00\x00\x00\x00\xff\xf2\x89N\x10\xe8O\x00\\\x00Y\x8bN\x10\xc7F\x10\x00\x00\x00\x00\x89A\x0c\x8bF(\x89\xc1\x89F\x10\x8b^\x04\x8b[,\xe8!\x00,\x01\x89F\x0c\x8bH\xfc\x89\xc8\x89N\x0c\x89F$\xc7\xc2\n\x00\x00\x00\x89W\xfc\x89F\xfc\x8bX\xfc\x89\xd9\x89^\x0c\x8bF\xfc\x8d-\x00\x00\x00\x00\xffU\x10\xc7F$\x00\x00\x00\x00\x8bF(\x8bH\xfc\x8bV\x0c\xc7F\x0c\x00\x00\x00\x00\xff\xf2\x89N\x0c\xe8O\x00\\\x00Y\x8bN\x0c\xc7F\x0c\x00\x00\x00\x00\x89A\x18\x8bF(\x89\xc1\x89F\x0c\x8b^\x04\x8b[,\xe8!\x00,\x01\x89F\x08\x8bH\xfc\x89\xc8\x89N\x08\x89F$\xc7\xc2\n\x00\x00\x00\x89W\xfc\x89F\xfc\x8bX\xfc\x89\xd9\x89^\x08\x8bF\xfc\x8d-\x00\x00\x00\x00\xffU\x10\xc7F$\x00\x00\x00\x00\x8bF(\x8bH\xfc\x8bV\x08\xc7F\x08\x00\x00\x00\x00\xff\xf2\x89N\x08\xe8O\x00\\\x00Y\x8bN\x08\xc7F\x08\x00\x00\x00\x00\x89A\x1c\x8bF(\xc7F \x00\x00\x00\x00\xc7F\x18\x00\x00\x00\x00\xc7F\x10\x00\x00\x00\x00\xc7F\x1c\x00\x00\x00\x00\xc7F\x14\x00\x00\x00\x00\xc7F\x0c\x00\x00\x00\x00\x89\xc1\x89F \x8b^\x04\x8b[H\xe8K\x00,\x01\x89\xc1\x89N\x18\x89F\xfc\x8bX\xfc\x89\xd9\x89^\x18\x8bF\xfc\x8d-\x00\x00\x00\x00\xffU\x10\x8bN \xc7F \x00\x00\x00\x00\x8bY\xfc\x8bn\x18\xc7F\x18\x00\x00\x00\x00\xff\xf5\x89^ \xe8=\x00\\\x00Y\x8bN \xc7F \x00\x00\x00\x00\x89A@\x8bN(\x8bY\xfc\xc7C \x01\x00\x00\x00\x89\xcb\x89^ \x8b^\x04\x8b[X\xe8+\x00,\x01\x89\xc1\x89N\x18\x89F\xfc\x8bX\xfc\x89\xd9\x89^\x18\x8bF\xfc\x8d-\x00\x00\x00\x00\xffU\x10\x8bN \xc7F \x00\x00\x00\x00\x8bY\xfc\x8bn\x18\xc7F\x18\x00\x00\x00\x00\xff\xf5\x89^ \xe8=\x00\\\x00Y\x8bN \xc7F \x00\x00\x00\x00\x89A`\x83\xc6,\x83\xc7\x14\x83\xc4\x04\xc3\x89\xc8\xe8\x1f\x00X\x00\x04\x00|\x00" 
    .attribute 'perc.pxl.StaticRef' b'\x07\x00\x01\x00\x00\x00\x07\x00\x00\x011\x00 \x00\x00\x00\x00\x014\x00\x00\x011\x00 \x00\x00\x00\x00\x01\xa4\x00\x00\x011\x00 \x00\x00\x00\x00\x02\x14\x00\x00\x011\x00 \x00\x00\x00\x00\x02\x84\x00\x00\x011\x00 \x00\x00\x00\x00\x02\xf4\x00\x00\x00\x13\x00 \x00\x00\x00\x00\x03|\x00\x00\x00\x17\x00 \x00\x00\x00\x00\x03\xe4' 
    .attribute 'perc.pxl.Augment' b'\x00\x03\x00\x02\x00\x02\x00\x00\x01\x00\x00\x00\x00\xc1*\xe8\x00\x00*\x12\x00\xb5\x02\x00*\x12\x00\xb5\x03\x00*\x05\xbc\n\xe5\x03\x03O\xe5\x04\x03O\xb5\x04\x00*\x11 N\xb5\x05\x00*\x11p\x17\xb5\x06\x00*\x11\xb4\x00\xb5\x07\x00*\x14\x01\x00\xb5\x08\x00*\x10\x14\xb5\t\x00*\x03\xb5\n\x00*\xbb\x0b\x00\xe5\xd8\x01L+\x10\n\xb71\x01\x01L\xb5\r\x00*\xbb\x0b\x00\xe5\xd8\x01L+\x10\n\xb71\x01\x01L\xb5\x0e\x00*\xbb\x0b\x00\xe5\xd8\x01L+\x10\n\xb71\x01\x01L\xb5\x0f\x00*\xbb\x0b\x00\xe5\xd8\x01L+\x10\n\xb71\x01\x01L\xb5\x10\x00*\xbb\x0b\x00\xe5\xd8\x01L+\x10\n\xb71\x01\x01L\xb5\x11\x00*\xbb\x12\x00\xe5\xb7\x13\x00\xb5\x14\x00*\x04\xb5\x15\x00*\xbb\x16\x00\xe5\xb7\x17\x00\xb5\x18\x00\xb1' 
.end method 
Storyyeller commented 6 years ago

I'll take a look later.

Storyyeller commented 6 years ago

The classfile is not valid bytecode as is. As you noticed, a lot of the bytecode appears to have been overwritten with null bytes. My guess is that the application you are looking at has some method to patch the classfiles before loading them. At any rate, there's nothing I can do. You obviously can't decompile what's not there. If you want to get the code, you'll have to reverse engineer the obfuscation yourself to figure out what it is doing.