login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Beveiliging > Bugmenot.com accounts blokkeren

Bugmenot.com accounts blokkeren

Auteur: Rik - 25 juni 2009 - 22:17 - Gekeurd door: Koen - Hits: 5028 - Aantal punten: (0 stemmen)




Bugmenot.com is een website waarop inloggegevens van vele websites worden verzameld om zo de registratie te omzeilen. Voor beheerders is het meestal ongewenst als de gegevens van een account daarop bekend worden. Zo'n "anoniem" account kan bijvoorbeeld heel makkelijk door spammers worden misbruikt.

Er is de mogelijkheid om je website te blokkeren bij bugmenot (net als Sima ), maar voor diegenen die dat niet hebben gedaan is dit script misschien nuttig. Het leest de pagina met ingevoerde accounts uit. Daarbij maakt het de belachelijk simpele beveiliging ongedaan.

Ook zit er een kleine functie bij om te kijken of jouw website überhaupt bekend is bij bugmenot, of er een user bekend is, of dat er een bepaalde user + password combinatie bekend is.

Een voorbeeld van gebruik:
  1. <?php
  2. if (getExists('sitemasters.be', 'Rik')) {
  3. die('[ACCESS DENIED] Jij gebruikt een bij bugmenot.com bekend account.');
  4. }
  5. ?>

Code:
  1. <?php
  2. /** Decoderen **/
  3. function decode($sInput, $iKey) {
  4. $sInput = base64_decode($sInput);
  5. $iOffset = ($iKey + 112) / 12;
  6. $sOutput = '';
  7. for ($i = 4; $i < strlen($sInput); ++$i) {
  8. $sOutput .= chr(ord($sInput[$i]) - $iOffset);
  9. }
  10. return $sOutput;
  11. }
  12.  
  13. /** Accounts van bugmenot ophalen **/
  14. function getAccounts($sUrl) {
  15. /* Bugmenot pagina ophalen */
  16. if (($sContents = @file_get_contents('http://www.bugmenot.com/view/' . $sUrl)) === false) {
  17. return false;
  18. }
  19.  
  20. /* Codesleutel opzoeken */
  21. preg_match('#var key = (-?\d+);#', $sContents, $aMatch);
  22. $iKey = $aMatch[1];
  23.  
  24. /* Accounts filteren */
  25. preg_match_all('#<tr><th>Username </th><td><script>d\(\'([a-z0-9+=/]+)\'\);<\/script></td></tr>\s*<tr><th>Password </th><td><script>d\(\'([a-z0-9+=/]+)\'\);<\/script></td></tr>#si', $sContents, $aMatches, PREG_SET_ORDER);
  26. foreach ($aMatches as $aAccount) {
  27. /* Decoderen */
  28. $aAccounts[decode($aAccount[1], $iKey)] = decode($aAccount[2], $iKey);
  29. }
  30. return $aAccounts;
  31. }
  32.  
  33. /** Voorkomen van accounts controleren **/
  34. function getExists($sUrl, $sUser = null, $sPassword = null) {
  35. if (($aAccounts = getAccounts($sUrl)) === false) {
  36. /* Website is handmatig geblokkeerd of komt niet voor */
  37. return false;
  38. }
  39. if ($sUser === null) {
  40. /* Er zijn accounts bekend */
  41. return true;
  42. }
  43. if ($sPassword === null) {
  44. /* Bepaal of de username bekend is */
  45. return isset($aAccounts[$sUser]);
  46. }
  47. /* Bepaal of username en password combinatie bekend is */
  48. return isset($aAccounts[$sUser]) && $aAccounts[$sUser] === $sPassword;
  49.  
  50. }
  51. ?>

Download code! Download code (.txt)

 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (2)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.033s