chickenbutt Posted May 20, 2011 Posted May 20, 2011 Can someone give me some code or the API calls that save people from having to write PE code? Like say I wanted to modify existing PE's code section and rebuild? Without all the binary searches and operations.I believe you can do it with virtual map calls and the IMAGE structs, but I'm not sure. Thanks. Any language is fine.
Killboy Posted May 20, 2011 Posted May 20, 2011 (edited) There are frameworks like TitanEngine (has SDK bindings for C/C++/Delphi/LUA/MASM/Python). It's a nobrainer to add a new section to an existing binary, it's also able to realign the PE (if that's what youre referring to by 'rebuild')Other libs include:PeLib (C++)pefile (Python)yzpelib (MASM)There is no Windows API for this, if you want to go about this manually, this is the one and only doc you'll need:Microsoft PE and COFF SpecificationAlso, The Art of Disassembly might be interesting, as it explains the PE specs with more erotic illustration.All the mentioned libraries only abstract from the parsing, I think it's always better to know what is done behind the curtains and write a few tools like that myself and then switch to those kind of libs to save time (and not knowledge!) Edited May 20, 2011 by Killboy
chickenbutt Posted May 20, 2011 Author Posted May 20, 2011 Thanks. I know the spec, I just want to do it for the x86 non-MSIL PE. I think I'll use one off those libs.
Aguila Posted May 21, 2011 Posted May 21, 2011 There are a few windows APIs for PE modifying. But they are not enough for most operations:/>http://msdn.microsoft.com/en-us/library/ms680181%28v=VS.85%29.aspxCheckSumMappedFile is useful
chickenbutt Posted May 21, 2011 Author Posted May 21, 2011 There are a few windows APIs for PE modifying. But they are not enough for most operations: />http://msdn.microsoft.com/en-us/library/ms680181%28v=VS.85%29.aspx CheckSumMappedFile is useful Yeah I think you use these libs or image structs to get PE data, section data is all binary work, and you gotta mind byte endianness. That sucks because it takes a long time unless you have people working on a SVN or something..Then you still gotta generate VM data and debug your stubs and stuff
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now