Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <Windows.h>
- typedef INT64 (__cdecl* fnde)(LPCSTR url, LPCSTR path, int noExec);
- int main(int argc, char** argv) {
- //Load relevant library
- HINSTANCE LibInseng = LoadLibrary(L"C:\\WINDOWS\\system32\\inseng.dll");
- //DEBUG
- //printf("%p", LibInseng);
- //Declare our function
- LPVOID fn = (LPVOID)GetProcAddress(LibInseng, "DownloadFile");
- const char* url = "https://www.google.com";
- const char* path = "robots.txt_downloaded.txt";
- INT64 result = 0;
- //And we store the ESP value for future reference. No RSP beause inseng.dll is 32bit anyway. Just keep it optimized.
- int espValue;
- __asm mov espValue, esp;
- printf("ESP: 0x%x\n", espValue);
- //Some inline ASM...
- __asm {
- push esp;
- push 1;
- push path;
- push url;
- call fn;
- push 0;
- }
- //And the new (old) ESP value to make sure function executed successfully...
- __asm mov espValue, esp;
- printf("ESP: 0x%x\n", espValue);
- system("PAUSE");
- return 0;
- }
Add Comment
Please, Sign In to add comment