Created
February 16, 2016 03:03
-
-
Save levisre/6ddebd47c1a26bba6b8f to your computer and use it in GitHub Desktop.
Launch4j Unpacker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pefile | |
import sys | |
def main(argv): | |
try: | |
fileNameInput = argv | |
print "Parsing file : " + argv | |
FileHandle = open(fileNameInput,"rb") | |
inputStream = FileHandle.read() | |
peHandle = pefile.PE(fileNameInput) | |
overlayOffset = peHandle.get_overlay_data_start_offset() | |
if(overlayOffset): | |
print "Found overlay Data at offset " + hex(overlayOffset) + ", extracting..." | |
fileOutput = open(fileNameInput+"-extracted.jar", "wb") | |
fileOutput.write(inputStream[overlayOffset:]) | |
peHandle.close() | |
fileOutput.close() | |
FileHandle.close() | |
print "file saved to " + fileNameInput + "-extracted.jar" | |
except: | |
print "Error: %s" % sys.exc_info()[0] | |
print "Could not extract embeded JAR file. Existing..." | |
if __name__=="__main__": | |
main(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment