Comments (1)
I make checks for the cases which are the most casual.
So, it is gonna be a common error to supply a bad path to the PE file - that's why I make checks around opening file and reading from file (the access may be denied for whatever reasons). I don't do checks for the the things which are less casual, or corner cases (such as attempt to load big files which size cannot be retrieved by GetFileSize).
I do check for failure in relocating the PE - because some PEs has no relocation table, and in such case they will not be loadable by this way (as we cannot guarantee at which base we will be able to load them). Relocation will fail also if we try to load a PE of different bitness than a loader. Those are common cases the user of this tool will encounter while playing around with this code.
I want this code to be as simple as possible, so apart from those common things, I don't want to litter it by too many checks. Otherwise it may be difficult for the reader to sieve out what part of code is about processing the PE, and what is about error checking. I also wrote about it in the comment on the top of the file to make the purpose of this code clear.
/*
A demo PE-loader for the training: https://github.com/hasherezade/malware_training_vol1
WARNING: This is a basic example. For the sake of simplicity, some checks have been omitted.
*/
from malware_training_vol1.
Related Issues (20)
- Vol1-Mod1-Slide12-WyWiWyG HOT 2
- Vol1-Mod1.3Process-Slide14 - Suggestion HOT 1
- Vol1-Mod1_3- Slide 23 - Typo HOT 1
- Vol1-Mod1.1 compilation - Suggestions HOT 2
- Vol1-Mod1.4WoW64-Slide3 - Emulator vs Subsystem HOT 1
- Vol1-Mod1.4WoW64-Slide14 - Heaven's gate and CFG HOT 1
- Vol1-Mod1.5Shellcode-Slide3 - "caves between sections" question HOT 2
- Vol1-Mod1.5Shellcode-Slide12 - /FA flag
- Vol1-Mod1.6PELoaders-Slide9 - Clarify Section concept
- Vol1-Mod1.2PE-Slide10 - Typo
- Vol1-Mod1-Slide18-Typo
- vol1-Mod1.2PE-S44 - Suggestion DUMPBIN & EDITBIN
- Vol1-Mod1.3Process-Slide29 - Wording HOT 1
- Additional start up location (Malware Training Vol. 1 - Module 2.3 Persistence - Slide 6)
- Small typos HOT 2
- Exercises-Setup-README.md Typos
- Exercices-Mod1-L2PE-PeSelfLoad-Main.cpp - useless code detected HOT 1
- Exercices-Mod1-L2PE-PeSelfLoad-Main.cpp - logical bug
- Vol1-Mod1.2PE-Slide3 - Typo + Driver remark HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from malware_training_vol1.