From 30aa4ccaafb10707c8da72e734d1f59f2c528ce8 Mon Sep 17 00:00:00 2001 From: alecpl Date: Tue, 18 May 2010 10:32:39 +0000 Subject: - Renamed all php-cli scripts to use .sh extension --- bin/decrypt.sh | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 bin/decrypt.sh (limited to 'bin/decrypt.sh') diff --git a/bin/decrypt.sh b/bin/decrypt.sh new file mode 100755 index 000000000..51a89e903 --- /dev/null +++ b/bin/decrypt.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env php + | + +-----------------------------------------------------------------------+ + + $Id$ +*/ + +/*- + * If http_received_header_encrypt is configured, the IP address and the + * host name of the added Received: header is encrypted with 3DES, to + * protect information that some could consider sensitve, yet their + * availability is a must in some circumstances. + * + * Such an encrypted Received: header might look like: + * + * Received: from DzgkvJBO5+bw+oje5JACeNIa/uSI4mRw2cy5YoPBba73eyBmjtyHnQ== + * [my0nUbjZXKtl7KVBZcsvWOxxtyVFxza4] + * with HTTP/1.1 (POST); Thu, 14 May 2009 19:17:28 +0200 + * + * In this example, the two encrypted components are the sender host name + * (DzgkvJBO5+bw+oje5JACeNIa/uSI4mRw2cy5YoPBba73eyBmjtyHnQ==) and the IP + * address (my0nUbjZXKtl7KVBZcsvWOxxtyVFxza4). + * + * Using this tool, they can be decrypted into plain text: + * + * $ bin/decrypt.sh 'my0nUbjZXKtl7KVBZcsvWOxxtyVFxza4' \ + * > 'DzgkvJBO5+bw+oje5JACeNIa/uSI4mRw2cy5YoPBba73eyBmjtyHnQ==' + * 84.3.187.208 + * 5403BBD0.catv.pool.telekom.hu + * $ + * + * Thus it is known that this particular message was sent by 84.3.187.208, + * having, at the time of sending, the name of 5403BBD0.catv.pool.telekom.hu. + * + * If (most likely binary) junk is shown, then + * - either the encryption password has, between the time the mail was sent + * and `now', changed, or + * - you are dealing with counterfeit header data. + */ + +if (php_sapi_name() != 'cli') { + die("Not on the 'shell' (php-cli).\n"); +} + +define('INSTALL_PATH', realpath(dirname(__FILE__).'/..') . '/'); +require INSTALL_PATH . 'program/include/iniset.php'; + +if ($argc < 2) { + die("Usage: " . basename($argv[0]) . " encrypted-hdr-part [encrypted-hdr-part ...]\n"); +} + +$RCMAIL = rcmail::get_instance(); + +for ($i = 1; $i < $argc; $i++) { + printf("%s\n", $RCMAIL->decrypt($argv[$i])); +}; -- cgit v1.2.3