loadlib.cna 961 B

12345678910111213141516171819202122232425262728293031323334
  1. # author REDMED-X
  2. beacon_command_register(
  3. "loadlib", "Load DLL from disk in remote process via RPC call.",
  4. "INFO:\nLoad a on disk present DLL via RtlRemoteCall API in a remote process.\nDepending on the process from which you run this tool, it may or may not work.\n\nOPTIONS:\n[pid]: target process to load the DLL into\n[path]: full path to the on disk present DLL\n\n" .
  5. "USAGE:\nloadlib <pid> <path to dll>\n\n");
  6. alias loadlib {
  7. $bid = $1;
  8. $pid = $2;
  9. $path = $3;
  10. if ($pid eq "" || $path eq "") {
  11. berror($bid, "Please make sure that both the PID and PATH are specified.");
  12. return;
  13. }
  14. # Read in the right BOF file
  15. $handle = openf(script_resource("loadlib.o"));
  16. $data = readb($handle, -1);
  17. closef($handle);
  18. # Pack our arguments
  19. $arg_data = bof_pack($bid, "iz", $pid, $path);
  20. blog($bid, "Tasked to load DLL in remote process..");
  21. beacon_inline_execute($bid, $data, "go", $arg_data);
  22. }