hidefile.cna 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # author REDMED-X
  2. beacon_command_register(
  3. "hidefile", "Hide file or directory by setting it's attributes to systemfile + hidden.",
  4. "INFO:\nHide a directory or file from plain sight by modifying the attributes and set them to systemfile + hidden.\n\nOPTIONS:\n[dir]: set this option if you want to modify the attributes of a directory.\n[file]: set this option if you want to modify the attributes of a file.\n[<path to dir/file>]: path to the directory or file that you want to hide.\n\n" .
  5. "USAGE:\nhidefile <dir | file> <path to dir/file>\n\n");
  6. alias hidefile {
  7. $bid = $1;
  8. $option = $2;
  9. $path = $3;
  10. if ($option eq "") {
  11. berror($bid, "Please specify one of the following options: dir | file\n");
  12. return;
  13. }
  14. if ($option eq "dir" || $option eq "file") {
  15. if ($path eq "") {
  16. berror($bid, "Please specify the correct path to the target directory or file.\n");
  17. return;
  18. }
  19. }
  20. else {
  21. berror($bid, "This option isn't supported. Please specify one of the following options: dir | file\n");
  22. return;
  23. }
  24. # Read in the right BOF file
  25. $handle = openf(script_resource("hidefile.o"));
  26. $data = readb($handle, -1);
  27. closef($handle);
  28. # Pack our arguments
  29. $arg_data = bof_pack($bid, "zZ", $option, $path);
  30. blog($bid, "Tasked to hide directory or file..");
  31. beacon_inline_execute($bid, $data, "go", $arg_data);
  32. }