squirrelmail-webmail  1.4.22
About: SquirrelMail is a standards-based webmail package with strong MIME support, address books, and folder manipulation (written in PHP4).
  Fossies Dox: squirrelmail-webmail-1.4.22.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

decrypt_headers.php
Go to the documentation of this file.
1 <?php
2 
16 define('SM_PATH','../');
17 
23 include_once(SM_PATH.'functions/global.php');
24 include_once(SM_PATH.'functions/strings.php');
25 
33 function hex2ip($hex) {
34  if (strlen($hex)==8) {
35  $ret=hexdec(substr($hex,0,2)).'.'
36  .hexdec(substr($hex,2,2)).'.'
37  .hexdec(substr($hex,4,2)).'.'
38  .hexdec(substr($hex,6,2));
39  } elseif (strlen($hex)==32) {
40  $ret=substr($hex,0,4).':'
41  .substr($hex,4,4).':'
42  .substr($hex,8,4).':'
43  .substr($hex,12,4).':'
44  .substr($hex,16,4).':'
45  .substr($hex,20,4).':'
46  .substr($hex,24,4).':'
47  .substr($hex,28,4);
48  } else {
49  $ret=$hex;
50  }
51  return $ret;
52 }
53 
55 header('Content-Type: text/html');
56 
57 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'
58  ."\n<head>\n<meta name=\"robots\" content=\"noindex,nofollow\">\n"
59  ."</head><body>";
60 
61 if (sqgetGlobalVar('submit',$submit,SQ_POST)) {
62  $continue = TRUE;
63  if (! sqgetGlobalVar('secret',$secret,SQ_POST) ||
64  empty($secret)) {
65  $continue = FALSE;
66  echo "<p>You must enter an encryption key.</p>\n";
67  }
68  if (! sqgetGlobalVar('enc_string',$enc_string,SQ_POST) ||
69  empty($enc_string)) {
70  $continue = FALSE;
71  echo "<p>You must enter an encrypted string.</p>\n";
72  }
73 
74  if ($continue) {
75  if (isset($enc_string) && ! base64_decode($enc_string)) {
76  echo "<p>Encrypted string should be BASE64 encoded.<br />\n"
77  ."Please enter all characters that are listed after header name.</p>\n";
78  } elseif (isset($secret)) {
79  $string=OneTimePadDecrypt($enc_string,base64_encode($secret));
80 
81  if (sqgetGlobalVar('ip_addr',$is_addr,SQ_POST)) {
82  $string=hex2ip($string);
83  }
84  echo "<p>Decoded string: ".htmlspecialchars($string)."</p>\n";
85  }
86  }
87  echo "<hr />";
88 }
89 ?>
90 <form action="<?php echo $PHP_SELF ?>" method="post" >
91 <p>
92 Secret key: <input type="password" name="secret"><br />
93 Encrypted string: <input type="text" name="enc_string"><br />
94 <label for="ip_addr">Check here if you are decoding an address string (FromHash/ProxyHash): </label><input type="checkbox" name="ip_addr" id="ip_addr" /><br />
95 <button type="submit" name="submit" value="submit">Submit</button>
96 </p>
97 </form>
98 </body></html>
elseif
if(! sqgetGlobalVar('sound', $sound, SQ_GET)) elseif($sound=='(none)')
Definition: testsound.php:25
sqgetGlobalVar
sqgetGlobalVar($name, &$value, $search=SQ_INORDER)
Definition: global.php:344
$ret
$ret
Definition: webmail.php:172
html
Definition: html.class.php:18
OneTimePadDecrypt
OneTimePadDecrypt($string, $epad)
Definition: strings.php:460
SQ_POST
const SQ_POST
Definition: global.php:17
hex2ip
hex2ip($hex)
Definition: decrypt_headers.php:33
SM_PATH
const SM_PATH
Definition: decrypt_headers.php:16