├── IMG └── jadx.png ├── README.md └── manifestGuard.py /IMG/jadx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sp1keeeee/manifestGuard/1730a96007d25cfb33895fcacf79cd5aaa021acc/IMG/jadx.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # manifestGuard 2 | 3 | - A script to make AndroidManifest.xml can not be decompiled by jadx or apktool but can run on Android system. 4 | 5 | - like this: 6 | 7 | ![image](https://github.com/Sp1keeeee/manifestGuard/blob/main/IMG/jadx.png) 8 | 9 | - [https://bbs.pediy.com/thread-275427.htm#msg_header_h2_0](https://bbs.pediy.com/thread-275427.htm#msg_header_h2_0) 10 | 11 | ## useage 12 | 13 | - guard mode: 14 | 15 | ``` 16 | python .\manifestGuard.py -g -s ./AndroidManifestori.xml -o ./AndroidManifest.xml 17 | ``` 18 | 19 | - fixed mode: 20 | 21 | ``` 22 | python .\manifestGuard.py -f -s ./AndroidManifestori.xml -o ./AndroidManifestnew.xml 23 | ``` -------------------------------------------------------------------------------- /manifestGuard.py: -------------------------------------------------------------------------------- 1 | import struct 2 | import argparse 3 | 4 | def parse_args(): 5 | parser = argparse.ArgumentParser(description='manifestGuard:对Androidmanifest文件进行简单加固和相关修复') 6 | parser.add_argument('-g','--guard', action='store_true',default=False, help='guard mode') 7 | parser.add_argument('-f','--fixed', action='store_true',default=False, help='fix mode') 8 | parser.add_argument('-s','--source', type=str,required=True, help='source file') 9 | parser.add_argument('-o','--out', type=str,required=True, help='target file') 10 | 11 | args = parser.parse_args() 12 | sourceFile = args.source 13 | outFile = args.out 14 | if args.guard == True: 15 | manifestGuard(sourceFile,outFile) 16 | elif args.fixed == True: 17 | fixManifest(sourceFile,outFile) 18 | else: 19 | print("One of the two parameters(-g and -f) must be set!") 20 | 21 | 22 | 23 | def insert(oldBytes,offset,newBytes): 24 | rtnBytes = oldBytes[0:offset] + newBytes + oldBytes[offset:] 25 | return rtnBytes 26 | 27 | def delete(oldBytes,offset,size): 28 | rtnBytes = oldBytes[0:offset] + oldBytes[offset + size:] 29 | return rtnBytes 30 | 31 | def change(oldBytes,offset,newContent): 32 | newContentSize = len(newContent) 33 | rtnBytes = oldBytes[0:offset] + newContent + oldBytes[offset + newContentSize:] 34 | return rtnBytes 35 | 36 | def getFileSize(fileContents): 37 | size = struct.unpack_from('