Password Checker at https://gec.im/passwords/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
3.1 KiB

  1. #!/usr/bin/env perl
  2. #
  3. # Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http:#mrgeckosmedia.com/
  4. #
  5. # Permission is hereby granted, free of charge, to any person obtaining a copy
  6. # of this software and associated documentation files (the "Software"), to deal
  7. # in the Software without restriction, including without limitation the rights
  8. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. # copies of the Software, and to permit persons to whom the Software is
  10. # furnished to do so, subject to the following conditions:
  11. #
  12. # The above copyright notice and this permission notice shall be included in
  13. # all copies or substantial portions of the Software.
  14. #
  15. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. # THE SOFTWARE.
  22. #
  23. #DBD::mysql
  24. use DBI;
  25. use POSIX;
  26. use DateTime;
  27. sub trim($) {
  28. my $string = shift;
  29. $string =~ s/^\s+//;
  30. $string =~ s/\s+$//;
  31. $string =~ s/^\t+//;
  32. $string =~ s/\t+$//;
  33. $string =~ s/^\s+//;
  34. $string =~ s/\s+$//;
  35. $string =~ s/^\t+//;
  36. $string =~ s/\t+$//;
  37. $string =~ s/\n//g;
  38. $string =~ s/\r//g;
  39. return $string;
  40. }
  41. $dbHost = "127.0.0.1";
  42. $dbName = "passwords";
  43. $dbUser = "root";
  44. $dbPassword = "password";
  45. $file = "/Users/grmrgecko/Desktop/passwords/Yahoo.txt";
  46. #print localtime(time).": Connecting to DataBase\n";
  47. $dbConnection = DBI->connect("DBI:mysql:$dbName;host=$dbHost", $dbUser, $dbPassword) || die "Could not connect to database: $DBI::errstr";
  48. open(passwords, $file);
  49. my $i=0;
  50. my $count=0;
  51. while (<passwords>) {
  52. chomp;
  53. my $entry = $_;
  54. if ($entry =~ m/[0-9]+:([^:]+):(.*)$/) {
  55. $i++;
  56. my $email = trim($1);
  57. my $password = trim($2);
  58. if ($password eq "") {
  59. next;
  60. }
  61. print "$i Email: $email Password: $password\n";
  62. my $result = $dbConnection->prepare("SELECT * FROM `email` WHERE `email`=? AND `password`=?");
  63. $result->execute($email, $password);
  64. my $exists = $result->fetchrow_hashref();
  65. if ($exists!=undef) {
  66. $result->finish();
  67. next;
  68. }
  69. $result->finish();
  70. my $result = $dbConnection->prepare("INSERT INTO `emailload` (`email`,`password`,`leak`) VALUES (?,?,'Leak')");
  71. $result->execute($email, $password);
  72. $result->finish();
  73. $count++;
  74. if ($count%10000==0) {
  75. my $result = $dbConnection->prepare("INSERT INTO `email` (`email`,`password`,`leak`) SELECT `email`,`password`,`leak` FROM `emailload`");
  76. $result->execute();
  77. $result->finish();
  78. my $result = $dbConnection->prepare("DELETE FROM `emailload`");
  79. $result->execute();
  80. $result->finish();
  81. }
  82. }
  83. }
  84. my $result = $dbConnection->prepare("INSERT INTO `email` (`email`,`password`,`leak`) SELECT `email`,`password`,`leak` FROM `emailload`");
  85. $result->execute();
  86. $result->finish();
  87. my $result = $dbConnection->prepare("DELETE FROM `emailload`");
  88. $result->execute();
  89. $result->finish();
  90. close(passwords);
  91. $dbConnection->disconnect();