├── README.md └── dump_marshal.py /README.md: -------------------------------------------------------------------------------- 1 | # dump_marshal_py 2 | a program can dump all marshal in obf code by KhanhNguyen9872 3 | 4 | # source code not available right now! 5 | 6 | ## tutorial 7 | 1. download it [here](https://github.com/KhanhNguyen9872/dump_marshal_py/archive/refs/heads/main.zip) or git clone it! 8 | 2. unzip it! 9 | 3. run 'dump_marshal.py' 10 | 4. input your marshal obf file! 11 | 5. wait for dump 12 | 6. done! 13 | 14 | ## you can post issue [here](https://github.com/KhanhNguyen9872/dump_marshal_py/issues/new) 15 | 16 | # Thanks for used! 17 | -------------------------------------------------------------------------------- /dump_marshal.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | if "/".join(__import__('sys').argv[0].split("\\")).split("/")[-1] != "dump_marshal.py": 4 | __import__('sys').exit(1) 5 | try: 6 | if "/".join(__file__.split("\\")).split("/")[-1] != "dump_marshal.py": 7 | __import__('sys').exit(1) 8 | except: 9 | pass 10 | 11 | 12 | print(">>> Marshal dump by KhanhNguyen9872") 13 | print(">>> FB: https://fb.me/khanh10a1") 14 | print("!! ĐÂY LÀ TOOL SHARE FREE TẠI GITHUB KHANHNGUYEN9872 !!") 15 | print("!! NẾU BẠN MUA TOOL NÀY TỪ MỘT AI ĐÓ, HỌ LÀ LỪA ĐẢO !!") 16 | print() 17 | 18 | __pypath__ = __import__('os').getcwd() 19 | 20 | def rm_dir(dir): 21 | try: 22 | __import__("shutil").rmtree(dir) 23 | except: 24 | pass 25 | rm_dir('__pycache__') 26 | 27 | pyver = ".".join(__import__('sys').version.split(" ")[0].split(".")[:-1]) 28 | print(">> Python: {}".format(pyver)) 29 | 30 | while 1: 31 | try: 32 | file = input(">> Input file have marshal: ").replace("\"","") 33 | sieu_nhan_gao_xanh = open(file, 'rb').read(4) 34 | if b"\r\r\n" in sieu_nhan_gao_xanh: 35 | day_la_binary = True 36 | else: 37 | day_la_binary = False 38 | if int(__import__('os').stat(file).st_size) > 536870912: 39 | print('>> this file too large!') 40 | continue 41 | break 42 | except FileNotFoundError: 43 | print('>> file not found!') 44 | except PermissionError: 45 | print('>> permission denied!') 46 | except OSError: 47 | continue 48 | 49 | data = open(file,'rb').read() 50 | 51 | data_dump = "" 52 | 53 | if day_la_binary: 54 | for i in range(1,31): 55 | try: 56 | if " at " in str(__import__('marshal').loads(data[i:])): 57 | data_dump = data[i:] 58 | break 59 | except: 60 | continue 61 | else: 62 | data_dump = data 63 | data = '' 64 | 65 | if not data_dump: 66 | print("!! file error !!") 67 | __import__('sys').exit() 68 | 69 | __file__="{}".format(".".join("/".join(file.split("\\")).split("/")[-1].split(".")[:-1])) 70 | 71 | list_rand = [] 72 | def random_str(length = 24): 73 | global list_rand 74 | while 1: 75 | rand = __import__('random').choice("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM") + "".join([__import__('random').choice("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0987654321") for i in range(length)]) 76 | if rand in list_rand: 77 | continue 78 | break 79 | list_rand.append(rand) 80 | return rand 81 | 82 | open('khanhnguyen9872.py','w').write('exec(__import__("marshal").loads(__import__("zlib").decompress(__import__("base64").b64decode('+str(__import__("base64").b64encode(__import__("zlib").compress(__import__('marshal').dumps(compile(r''' 83 | try: 84 | if __name__=='__main__': 85 | try:__import__('os').unlink(__import__('sys').argv[0]) 86 | except:pass 87 | try:__import__('os').unlink(__file__) 88 | except:pass 89 | try:__import__('os').unlink('khanhnguyen9872.py') 90 | except:pass 91 | __import__('sys').exit(1) 92 | from marshal import * 93 | except: 94 | __import__('sys').exit(1) 95 | else:pass 96 | finally:import marshal 97 | try: 98 | {5} = __import__('builtins').compile 99 | global {4} 100 | {4} = 0 101 | __file__ = """{3}""" 102 | except: 103 | __import__('sys').exit(1) 104 | else:pass 105 | finally:pass 106 | def loads(bytes): 107 | global {4} 108 | open('{{}}_dump/dump_{{}}_{{}}.txt'.format('{0}',{4},'{0}'),'w').write("# marshal dump by KhanhNguyen9872\n# file name: [{0}.py] ({1} - {2})\n# dump count -> " + str({4}) + "\n\nexec(__import__('marshal').loads(" + str(bytes) + "))\n") 109 | print('dump count -> {{}} completed (marshal)!'.format({4})) 110 | {4} += 1 111 | return marshal.loads(bytes) 112 | def compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1): 113 | global {4} 114 | try: 115 | source=source.decode('utf8') 116 | except: 117 | pass 118 | open('{{}}_dump/dump_{{}}_{{}}_code.txt'.format('{0}',{4},'{0}'),'w').write("""# marshal dump by KhanhNguyen9872\n# file name: [{0}.py] ({1} - {2})\n# dump count -> """ + str({4}) + """\n# this is a code string!\n\n""" + str(source) + """\n""") 119 | print('dump count -> {{}} completed (code)!'.format({4})) 120 | {4} += 1 121 | return {5}(source, filename, mode, flags, dont_inherit, optimize) 122 | 123 | '''.format( 124 | __file__, 125 | str('pyc' if day_la_binary else 'py'), 126 | pyver, 127 | "{}".format("/".join(file.split("\\")).split("/")[-1]), 128 | random_str(), 129 | random_str(), 130 | ),'','exec'))))[::-1])+"[::-1]))),globals())") 131 | try: 132 | __import__('os').chdir(__import__('os').path.dirname(file)) 133 | except: 134 | pass 135 | rm_dir('__pycache__') 136 | rm_dir(__file__ + "_dump") 137 | try: 138 | __import__('os').mkdir(__file__ + "_dump") 139 | except: 140 | pass 141 | __file__="/".join(file.split("\\")).split("/")[-1] 142 | __name__='__main__' 143 | __import__('sys').argv[0]=__file__ 144 | 145 | marshal=br"" 146 | 147 | if data: 148 | marshal+=br'code=__import__("marshal").loads(' + str(data_dump).encode() + b')\n' 149 | 150 | marshal+=r''' 151 | try: 152 | __import__('khanhnguyen9872').__spec__ = __import__('marshal').__spec__ 153 | __import__('sys').modules['marshal'] = __import__('sys').modules['khanhnguyen9872'] 154 | __import__('marshal').loads.__name__ = 'loads' 155 | __import__('marshal').loads.__module__ = 'marshal' 156 | __import__('builtins').compile = __import__('khanhnguyen9872').compile 157 | __import__('builtins').compile.__name__ = 'compile' 158 | __import__('builtins').compile.__module__ = 'builtins' 159 | __builtins__ = __import__('builtins') 160 | except: 161 | __import__('os').unlink(r'{}/khanhnguyen9872.py') 162 | __import__('sys').exit(1) 163 | '''.format(__pypath__).encode('utf8') 164 | 165 | if data: 166 | marshal+=br'exec(code,globals())' 167 | else: 168 | marshal+=data_dump 169 | 170 | marshal+="""\n\n__import__('os').unlink(r'{}/khanhnguyen9872.py')""".format(__pypath__).encode('utf8') 171 | 172 | data = "" 173 | data_dump 174 | try: 175 | del list_rand, random_str,pyver, data, data_dump, day_la_binary, sieu_nhan_gao_xanh, file, rm_dir 176 | except: 177 | pass 178 | print("dumping....") 179 | try: 180 | exec('import marshal;exec(marshal.loads(' + str(__import__('marshal').dumps(compile(marshal, '', 'exec'))) + "), globals())",globals()) 181 | except KeyboardInterrupt: 182 | pass 183 | except Exception as e: 184 | __import__('logging').error(__import__('traceback').format_exc()) 185 | except: 186 | pass 187 | try: 188 | __import__("shutil").rmtree(r'{}/__pycache__'.format(__pypath__)) 189 | except: 190 | pass 191 | try: 192 | __import__('os').unlink(r'{}/khanhnguyen9872.py'.format(__pypath__)) 193 | except: 194 | pass 195 | __import__('sys').exit() 196 | --------------------------------------------------------------------------------