Foro de elhacker.net

Programación => Scripting => Mensaje iniciado por: BigBear en 3 Diciembre 2011, 16:34 pm



Título: [Perl] USB Manager 0.2
Publicado por: BigBear en 3 Diciembre 2011, 16:34 pm
Simple manager para usb

Código
  1. #!usr/bin/perl
  2. #USB Manager 0.2
  3. #Coded By Doddy H
  4.  
  5. use Cwd;
  6.  
  7. head();
  8.  
  9. print "\n\n[+] USB : ";
  10. chomp(my $usb=<stdin>);
  11. chdir($usb);
  12. print "\n";
  13. nave:
  14. print "\n".getcwd().">";
  15. chomp(my $rta = <stdin>);
  16. print "\n\n";
  17. if ($rta=~/list/) {
  18. my @files = coleccionar(getcwd());
  19. for(@files) {
  20. if (-f $_) {
  21. print "[File] : ".$_."\n";
  22. } else {
  23. print "[Directory] : ".$_."\n";
  24. }}}
  25. if ($rta=~/show (.*)/) {
  26. my $fu = $1;
  27. chomp $fu;
  28. if (-f $fu or -d $fu) {
  29. hideit($fu,"show");
  30. print "\n\n[+] Attributes changed\n\n";
  31. }
  32. }
  33. if ($rta=~/hide (.*)/) {
  34. my $fua = $1;
  35. chomp $fua;
  36. if (-f $fua or -d $fua) {
  37. hideit($fua,"hide");
  38. print "\n\n[+] Attributes changed\n\n";
  39. }
  40. }
  41. if ($rta=~/cd (.*)/) {
  42. my $dir = $1;
  43. if (chdir($dir)) {
  44. print "\n[+] Directory changed\n";
  45. } else {
  46. print "\n[-] Error\n";
  47. }}
  48. if ($rta=~/del (.*)/) {
  49. my $file = getcwd()."/".$1;
  50. if (-f $file) {
  51. if (unlink($file)) {
  52. print "\n[+] File Deleted\n";
  53. } else {
  54. print "\n[-] Error\n";
  55. }
  56. } else {
  57. if (rmdir($file)) {
  58. print "\n[+] Directory Deleted\n";
  59. } else {
  60. print "\n[-] Error\n";
  61. }}}
  62. if ($rta=~/rename (.*) (.*)/) {
  63. if (rename(getcwd()."/".$1,getcwd()."/".$2)) {
  64. print "\n[+] File Changed\n";
  65. } else {
  66. print "\n[-] Error\n";
  67. }}
  68. if ($rta=~/open (.*)/) {
  69. my $file = $1;
  70. chomp $file;
  71. system($file);
  72. #system(getcwd()."/".$file);
  73. }
  74. if ($rta=~/help/) {
  75. print "\nCommands : help cd list del rename open hide show exit\n\n";
  76. }
  77. if ($rta=~/exit/) {
  78. copyright();
  79. exit(1);
  80. }
  81. print "\n\n";
  82. goto nave;
  83.  
  84. sub coleccionar {
  85. opendir DIR,$_[0];
  86. my @archivos = readdir DIR;
  87. close DIR;
  88. return @archivos;
  89. }
  90.  
  91. sub hideit {
  92. use Win32::File;
  93. if ($_[1] eq "show") {
  94. Win32::File::SetAttributes($_[0],NORMAL);
  95. }
  96. elsif ($_[1] eq "hide") {
  97. Win32::File::SetAttributes($_[0],HIDDEN);
  98. }
  99. else {
  100. print "\n[-] error\n";
  101. }
  102. }
  103.  
  104. sub head {
  105. print "\n\n-- == USB Manager == --\n";
  106. }
  107.  
  108. sub copyright {
  109. print "\n\n(C) Doddy Hackman 2011\n\n";
  110. }
  111.  
  112. # The End ?
  113.