Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

decrypt.sh 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. +-----------------------------------------------------------------------+
  5. | bin/decrypt.sh |
  6. | |
  7. | This file is part of the Roundcube Webmail client |
  8. | Copyright (C) 2005-2009, The Roundcube Dev Team |
  9. | |
  10. | Licensed under the GNU General Public License version 3 or |
  11. | any later version with exceptions for skins & plugins. |
  12. | See the README file for a full license statement. |
  13. | |
  14. | PURPOSE: |
  15. | Decrypt the encrypted parts of the HTTP Received: headers |
  16. | |
  17. +-----------------------------------------------------------------------+
  18. | Author: Tomas Tevesz <ice@extreme.hu> |
  19. +-----------------------------------------------------------------------+
  20. */
  21. /**
  22. * If http_received_header_encrypt is configured, the IP address and the
  23. * host name of the added Received: header is encrypted with 3DES, to
  24. * protect information that some could consider sensitve, yet their
  25. * availability is a must in some circumstances.
  26. *
  27. * Such an encrypted Received: header might look like:
  28. *
  29. * Received: from DzgkvJBO5+bw+oje5JACeNIa/uSI4mRw2cy5YoPBba73eyBmjtyHnQ==
  30. * [my0nUbjZXKtl7KVBZcsvWOxxtyVFxza4]
  31. * with HTTP/1.1 (POST); Thu, 14 May 2009 19:17:28 +0200
  32. *
  33. * In this example, the two encrypted components are the sender host name
  34. * (DzgkvJBO5+bw+oje5JACeNIa/uSI4mRw2cy5YoPBba73eyBmjtyHnQ==) and the IP
  35. * address (my0nUbjZXKtl7KVBZcsvWOxxtyVFxza4).
  36. *
  37. * Using this tool, they can be decrypted into plain text:
  38. *
  39. * $ bin/decrypt.sh 'my0nUbjZXKtl7KVBZcsvWOxxtyVFxza4' \
  40. * > 'DzgkvJBO5+bw+oje5JACeNIa/uSI4mRw2cy5YoPBba73eyBmjtyHnQ=='
  41. * 84.3.187.208
  42. * 5403BBD0.catv.pool.telekom.hu
  43. * $
  44. *
  45. * Thus it is known that this particular message was sent by 84.3.187.208,
  46. * having, at the time of sending, the name of 5403BBD0.catv.pool.telekom.hu.
  47. *
  48. * If (most likely binary) junk is shown, then
  49. * - either the encryption password has, between the time the mail was sent
  50. * and 'now', changed, or
  51. * - you are dealing with counterfeit header data.
  52. */
  53. define('INSTALL_PATH', realpath(__DIR__ .'/..') . '/');
  54. require INSTALL_PATH . 'program/include/clisetup.php';
  55. if ($argc < 2) {
  56. die("Usage: " . basename($argv[0]) . " encrypted-hdr-part [encrypted-hdr-part ...]\n");
  57. }
  58. $RCMAIL = rcube::get_instance();
  59. for ($i = 1; $i < $argc; $i++) {
  60. printf("%s\n", $RCMAIL->decrypt($argv[$i]));
  61. };