corelan / mona

Corelan Repository for mona.py
BSD 3-Clause "New" or "Revised" License
1.7k stars 564 forks source link

Read files from workingfolder when path is not absolute. #52

Closed saladpanda closed 3 years ago

saladpanda commented 3 years ago

This is an attempt at fixing #51.

You should consider this untested. I'm only using a very limited set of monas features but I tested this change with !mona compare and it worked as intended. If you have a testsuite you should run it before merging this.

The code duplication is not elegant but the best solution I found for the moment.

I searched for -f to find positions where to apply the new function. I hope I found all relevant positions.

corelanc0d3r commented 3 years ago

cool, I'll merge and I'll check if I can de-dup the code - thanks!

saladpanda commented 3 years ago

No Problem. But I think merging this without thorough testing wasn't a good idea.

I just ran into the first problem with it. When trying to generate an egghunter without specifying a file with -f I get: Unable to read file C:\mona\_no_name\

This is caused by this line: https://github.com/corelan/mona/blob/60d98eb8a5b38c67389c68298e556565cbcef338/mona.py#L13744

Other instances of filename != "" and filename == "" will probably lead to similar problems.

saladpanda commented 3 years ago

I just pushed a fix to my branch. Can you re-merge this or should I open another PR?

corelanc0d3r commented 3 years ago

a new PR would be great, thanks!