delexclusion.cna 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. # author REDMED-X
  2. beacon_command_register(
  3. "delexclusion", "Delete an exclusion from Windows Defender for a folder, file, process or extension.",
  4. "INFO:\nDelete an exclusion from Windows Defender for a folder, file, process or extension. \n\n" .
  5. "ARGUMENTS:\n[<exclusion type>]: specify one of the following exclusion types you want to delete: path (file/folder), process, extension.\n[<exclusion name>]: specify the exclusion data/name that you want to delete.\n\n" .
  6. "USAGE:\ndelexclusion <exclusion type> <exclusion data>\n\n" .
  7. "EXAMPLES:\ndelexclusion path C:\\Users\\Public\\Downloads\ndelexclusion process C:\\Windows\\System32\\example.exe\n\n");
  8. alias delexclusion {
  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 exclusion data/name that you want to delete.\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("delexclusion.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. }
  35. beacon_command_register(
  36. "delfirewallrule", "Delete a firewall rule.",
  37. "INFO:\nDelete a firewall rule using COM.\n\n" .
  38. "ARGUMENTS:\n[<rule name>]: the name of the firewall rule you want to delete.\n\n" .
  39. "USAGE:\ndelfirewallrule \"<rule name>\"\n\n" .
  40. "EXAMPLES:\ndelfirewallrule \"ExampleRuleName1\"\n\n");
  41. alias delfirewallrule {
  42. $bid = $1;
  43. $name = $2;
  44. if ($name eq "") {
  45. berror($bid, "Please specify the name of the firewall rule you want to delete.\n");
  46. return;
  47. }
  48. # Read in the right BOF file
  49. $handle = openf(script_resource("DelFirewallRule/delfirewallrule.o"));
  50. $data = readb($handle, -1);
  51. closef($handle);
  52. # Pack our arguments
  53. $arg_data = bof_pack($bid, "Z", $name);
  54. blog($bid, "Tasked to delete a new firewall rule..");
  55. beacon_inline_execute($bid, $data, "go", $arg_data);
  56. }
  57. beacon_command_register(
  58. "dellocalcert", "Delete a local computer certificate from a specific store.",
  59. "INFO:\nDelete a local computer certificate from a specified store based on its unique thumbprint.\n\n" .
  60. "ARGUMENTS:\n[<store name>]: the name of the certificate store from which to delete the certificate.\n[<thumbprint>]: the thumbprint of the certificate that you want to delete in format (all caps): AABBCCDDEEFF00112233445566778899AABBCCDD.\n\n" .
  61. "USAGE:\ndellocalcert <store name> <thumbprint>\n\n" .
  62. "EXAMPLES:\ndellocalcert ROOT AABBCCDDEEFF00112233445566778899AABBCCDD\n\n");
  63. alias dellocalcert {
  64. $bid = $1;
  65. $store = $2;
  66. $thumbprint = $3;
  67. if ($store eq "") {
  68. berror($bid, "Please specify a valid local computer certificate store name like ROOT.\n");
  69. return;
  70. }
  71. if ($thumbprint eq "") {
  72. berror($bid, "Please specify the thumbprint for the certificate that you want to delete from the store.\n");
  73. return;
  74. }
  75. # Read in the right BOF file
  76. $handle = openf(script_resource("DelLocalCert/dellocalcert.o"));
  77. $data = readb($handle, -1);
  78. closef($handle);
  79. # Pack our arguments
  80. $arg_data = bof_pack($bid, "Zz", $store, $thumbprint);
  81. blog($bid, "Tasked to delete a certificate..");
  82. beacon_inline_execute($bid, $data, "go", $arg_data);
  83. }