Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoIT Overlay #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# AutoIt-Ripper

FORK UPDATE

* Noticed that the previous implementation didn't take into account that compiled scripts could be stored in the overlay
of a PE so this fork will implement that change.


## What is this
This is a short python script that allows for extraction of "compiled" AutoIt scripts from PE executables.

Expand Down
29 changes: 27 additions & 2 deletions autoit_ripper/autoit_unpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,38 @@ def unpack_ea06(binary_data: bytes) -> Optional[List[Tuple[str, bytes]]]:

pe.parse_data_directories()
if not pe.DIRECTORY_ENTRY_RESOURCE:

log.error("The input file has no resources")
return None
log.info("Checking overlay")

data = pe.get_overlay()
if data is None:
log.error("No overlay")
return None

data = ByteStream(bytes(data)[0x18:])
parsed_data = parse_all(data, AutoItVersion.EA06)
if not parsed_data:
log.error("Couldn't decode the autoit script")
return None
return parsed_data

script_resource = get_script_resource(pe)
if script_resource is None:
log.error("Couldn't find the script resource")
return None
log.info("Checking overlay")

data = pe.get_overlay()
if data is None:
log.error("No overlay")
return None

data = ByteStream(bytes(data)[0x18:])
parsed_data = parse_all(data, AutoItVersion.EA06)
if not parsed_data:
log.error("Couldn't decode the autoit script")
return None
return parsed_data

data_rva = script_resource.OffsetToData
data_size = script_resource.Size
Expand Down