@@ -97,11 +97,11 @@ discard block |
||
| 97 | 97 | public function queueMessage(Swift_Mime_Message $message) |
| 98 | 98 | { |
| 99 | 99 | $ser = serialize($message); |
| 100 | - $fileName = $this->_path . '/' . $this->getRandomString(); |
|
| 100 | + $fileName = $this->_path.'/'.$this->getRandomString(); |
|
| 101 | 101 | for ($i = 0; $i < $this->_retryLimit; ++$i) { |
| 102 | 102 | /* We try an exclusive creation of the file. This is an atomic operation, it avoid locking mechanism */ |
| 103 | 103 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 104 | - $fp = @fopen($fileName . '.message', 'xb'); |
|
| 104 | + $fp = @fopen($fileName.'.message', 'xb'); |
|
| 105 | 105 | if (false !== $fp) { |
| 106 | 106 | if (false === fwrite($fp, $ser)) { |
| 107 | 107 | return false; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - $failedRecipients = (array)$failedRecipients; |
|
| 160 | + $failedRecipients = (array) $failedRecipients; |
|
| 161 | 161 | $count = 0; |
| 162 | 162 | $time = time(); |
| 163 | 163 | foreach ($directoryIterator as $file) { |
@@ -168,13 +168,13 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /* We try a rename, it's an atomic operation, and avoid locking the file */ |
| 171 | - if (rename($file, $file . '.sending')) { |
|
| 171 | + if (rename($file, $file.'.sending')) { |
|
| 172 | 172 | // TODO: -> SECURITY | Perhaps it's possible to exploit the unserialize via: file_get_contents(...) |
| 173 | - $message = unserialize(file_get_contents($file . '.sending')); |
|
| 173 | + $message = unserialize(file_get_contents($file.'.sending')); |
|
| 174 | 174 | |
| 175 | 175 | $count += $transport->send($message, $failedRecipients); |
| 176 | 176 | |
| 177 | - unlink($file . '.sending'); |
|
| 177 | + unlink($file.'.sending'); |
|
| 178 | 178 | } else { |
| 179 | 179 | /* This message has just been catched by another process */ |
| 180 | 180 | continue; |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | foreach ($this->_params as $name => $value) { |
| 137 | 137 | if (null !== $value) { |
| 138 | 138 | // Add the parameter |
| 139 | - $body .= '; ' . $this->_createParameter($name, $value); |
|
| 139 | + $body .= '; '.$this->_createParameter($name, $value); |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $tokens[count($tokens) - 1] .= ';'; |
| 165 | 165 | $tokens = array_merge( |
| 166 | 166 | $tokens, |
| 167 | - $this->generateTokenLines(' ' . $this->_createParameter($name, $value)) |
|
| 167 | + $this->generateTokenLines(' '.$this->_createParameter($name, $value)) |
|
| 168 | 168 | ); |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -186,13 +186,13 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | $encoded = false; |
| 188 | 188 | // Allow room for parameter name, indices, "=" and DQUOTEs |
| 189 | - $maxValueLength = $this->getMaxLineLength() - strlen($name . '=*N"";') - 1; |
|
| 189 | + $maxValueLength = $this->getMaxLineLength() - strlen($name.'=*N"";') - 1; |
|
| 190 | 190 | $firstLineOffset = 0; |
| 191 | 191 | |
| 192 | 192 | |
| 193 | 193 | if ( |
| 194 | 194 | // If it's not already a valid parameter value ... |
| 195 | - !preg_match('/^' . self::TOKEN_REGEX . '$/D', $value) |
|
| 195 | + !preg_match('/^'.self::TOKEN_REGEX.'$/D', $value) |
|
| 196 | 196 | && |
| 197 | 197 | // ... and it's not ascii |
| 198 | 198 | !UTF8::is_ascii($value) |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | $encoded = true; |
| 201 | 201 | |
| 202 | 202 | // Allow space for the indices, charset and language. |
| 203 | - $maxValueLength = $this->getMaxLineLength() - strlen($name . '*N*="";') - 1; |
|
| 204 | - $firstLineOffset = strlen($this->getCharset() . "'" . $this->getLanguage() . "'"); |
|
| 203 | + $maxValueLength = $this->getMaxLineLength() - strlen($name.'*N*="";') - 1; |
|
| 204 | + $firstLineOffset = strlen($this->getCharset()."'".$this->getLanguage()."'"); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | // Encode if we need to ... |
@@ -230,13 +230,13 @@ discard block |
||
| 230 | 230 | if (count($valueLines) > 1) { |
| 231 | 231 | $paramLines = array(); |
| 232 | 232 | foreach ($valueLines as $i => $line) { |
| 233 | - $paramLines[] = $name . '*' . $i . $this->_getEndOfParameterValue($line, true, $i === 0); |
|
| 233 | + $paramLines[] = $name.'*'.$i.$this->_getEndOfParameterValue($line, true, $i === 0); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | return implode(";\r\n ", $paramLines); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - return $name . $this->_getEndOfParameterValue( |
|
| 239 | + return $name.$this->_getEndOfParameterValue( |
|
| 240 | 240 | $valueLines[0], |
| 241 | 241 | $encoded, |
| 242 | 242 | true |
@@ -254,18 +254,18 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | private function _getEndOfParameterValue($value, $encoded = false, $firstLine = false) |
| 256 | 256 | { |
| 257 | - if (!preg_match('/^' . self::TOKEN_REGEX . '$/D', $value)) { |
|
| 258 | - $value = '"' . $value . '"'; |
|
| 257 | + if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) { |
|
| 258 | + $value = '"'.$value.'"'; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | $prepend = '='; |
| 262 | 262 | if ($encoded) { |
| 263 | 263 | $prepend = '*='; |
| 264 | 264 | if ($firstLine) { |
| 265 | - $prepend = '*=' . $this->getCharset() . "'" . $this->getLanguage() . "'"; |
|
| 265 | + $prepend = '*='.$this->getCharset()."'".$this->getLanguage()."'"; |
|
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - return $prepend . $value; |
|
| 269 | + return $prepend.$value; |
|
| 270 | 270 | } |
| 271 | 271 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | // pad to $bits bit |
| 86 | 86 | $bin_length = strlen($bin); |
| 87 | 87 | if ($bin_length < $bits) { |
| 88 | - $bin = str_repeat('0', $bits - $bin_length) . $bin; |
|
| 88 | + $bin = str_repeat('0', $bits - $bin_length).$bin; |
|
| 89 | 89 | } |
| 90 | 90 | } else { |
| 91 | 91 | // negative |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $bin = base_convert($si, 10, 2); |
| 94 | 94 | $bin_length = strlen($bin); |
| 95 | 95 | if ($bin_length > $bits) { |
| 96 | - $bin = str_repeat('1', $bits - $bin_length) . $bin; |
|
| 96 | + $bin = str_repeat('1', $bits - $bin_length).$bin; |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | { |
| 199 | 199 | list($domain, $username) = $this->getDomainAndUsername($username); |
| 200 | 200 | //$challenge, $context, $targetInfoH, $targetName, $domainName, $workstation, $DNSDomainName, $DNSServerName, $blob, $ter |
| 201 | - list($challenge, , , , , $workstation, , , $blob) = $this->parseMessage2($response); |
|
| 201 | + list($challenge,,,,, $workstation,,, $blob) = $this->parseMessage2($response); |
|
| 202 | 202 | |
| 203 | 203 | if (!$v2) { |
| 204 | 204 | // LMv1 |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $desKey1 = $this->createDesKey($key1); |
| 330 | 330 | $desKey2 = $this->createDesKey($key2); |
| 331 | 331 | |
| 332 | - $constantDecrypt = $this->createByte($this->desEncrypt(self::DESCONST, $desKey1) . $this->desEncrypt(self::DESCONST, $desKey2), 21, false); |
|
| 332 | + $constantDecrypt = $this->createByte($this->desEncrypt(self::DESCONST, $desKey1).$this->desEncrypt(self::DESCONST, $desKey2), 21, false); |
|
| 333 | 333 | |
| 334 | 334 | // SECOND PART |
| 335 | 335 | list($key1, $key2, $key3) = str_split($constantDecrypt, 7); |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | $desKey2 = $this->createDesKey($key2); |
| 339 | 339 | $desKey3 = $this->createDesKey($key3); |
| 340 | 340 | |
| 341 | - return $this->desEncrypt($challenge, $desKey1) . $this->desEncrypt($challenge, $desKey2) . $this->desEncrypt($challenge, $desKey3); |
|
| 341 | + return $this->desEncrypt($challenge, $desKey1).$this->desEncrypt($challenge, $desKey2).$this->desEncrypt($challenge, $desKey3); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | $desKey2 = $this->createDesKey($key2); |
| 360 | 360 | $desKey3 = $this->createDesKey($key3); |
| 361 | 361 | |
| 362 | - return $this->desEncrypt($challenge, $desKey1) . $this->desEncrypt($challenge, $desKey2) . $this->desEncrypt($challenge, $desKey3); |
|
| 362 | + return $this->desEncrypt($challenge, $desKey1).$this->desEncrypt($challenge, $desKey2).$this->desEncrypt($challenge, $desKey3); |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | /** |
@@ -402,9 +402,9 @@ discard block |
||
| 402 | 402 | // if $password > 15 than we can't use this method |
| 403 | 403 | if (strlen($password) <= 15) { |
| 404 | 404 | $ntlmHash = $this->md4Encrypt($password); |
| 405 | - $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username) . $domain)); |
|
| 405 | + $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username).$domain)); |
|
| 406 | 406 | |
| 407 | - $lmPass = bin2hex($this->md5Encrypt($ntml2Hash, $challenge . $client) . $client); |
|
| 407 | + $lmPass = bin2hex($this->md5Encrypt($ntml2Hash, $challenge.$client).$client); |
|
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | return $this->createByte($lmPass, 24); |
@@ -428,14 +428,14 @@ discard block |
||
| 428 | 428 | protected function createNTLMv2Hash($password, $username, $domain, $challenge, $targetInfo, $timestamp, $client) |
| 429 | 429 | { |
| 430 | 430 | $ntlmHash = $this->md4Encrypt($password); |
| 431 | - $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username) . $domain)); |
|
| 431 | + $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username).$domain)); |
|
| 432 | 432 | |
| 433 | 433 | // create blob |
| 434 | 434 | $blob = $this->createBlob($timestamp, $client, $targetInfo); |
| 435 | 435 | |
| 436 | - $ntlmv2Response = $this->md5Encrypt($ntml2Hash, $challenge . $blob); |
|
| 436 | + $ntlmv2Response = $this->md5Encrypt($ntml2Hash, $challenge.$blob); |
|
| 437 | 437 | |
| 438 | - return $ntlmv2Response . $blob; |
|
| 438 | + return $ntlmv2Response.$blob; |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | protected function createDesKey($key) |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | $len = strlen($key); |
| 445 | 445 | for ($i = 1; $i < $len; ++$i) { |
| 446 | 446 | list($high, $low) = str_split(bin2hex($key[$i])); |
| 447 | - $v = $this->castToByte(ord($key[$i - 1]) << (7 + 1 - $i) | $this->uRShift(hexdec(dechex(hexdec($high) & 0xf) . dechex(hexdec($low) & 0xf)), $i)); |
|
| 447 | + $v = $this->castToByte(ord($key[$i - 1]) << (7 + 1 - $i) | $this->uRShift(hexdec(dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xf)), $i)); |
|
| 448 | 448 | $material[] = str_pad(substr(dechex($v), -2), 2, '0', STR_PAD_LEFT); // cast to byte |
| 449 | 449 | } |
| 450 | 450 | $material[] = str_pad(substr(dechex($this->castToByte(ord($key[6]) << 1)), -2), 2, '0'); |
@@ -467,9 +467,9 @@ discard block |
||
| 467 | 467 | list($high, $low) = str_split($v); |
| 468 | 468 | |
| 469 | 469 | if ($needsParity) { |
| 470 | - $material[$k] = dechex(hexdec($high) | 0x0) . dechex(hexdec($low) | 0x1); |
|
| 470 | + $material[$k] = dechex(hexdec($high) | 0x0).dechex(hexdec($low) | 0x1); |
|
| 471 | 471 | } else { |
| 472 | - $material[$k] = dechex(hexdec($high) & 0xf) . dechex(hexdec($low) & 0xe); |
|
| 472 | + $material[$k] = dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xe); |
|
| 473 | 473 | } |
| 474 | 474 | } |
| 475 | 475 | |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | $length = $is16 ? $length / 2 : $length; |
| 494 | 494 | $length = $this->createByte(str_pad(dechex($length), 2, '0', STR_PAD_LEFT), 2); |
| 495 | 495 | |
| 496 | - return $length . $length . $this->createByte(dechex($offset), 4); |
|
| 496 | + return $length.$length.$this->createByte(dechex($offset), 4); |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | /** |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | $ipadk = $key ^ str_repeat("\x36", $blocksize); |
| 597 | 597 | $opadk = $key ^ str_repeat("\x5c", $blocksize); |
| 598 | 598 | |
| 599 | - return pack('H*', md5($opadk . pack('H*', md5($ipadk . $msg)))); |
|
| 599 | + return pack('H*', md5($opadk.pack('H*', md5($ipadk.$msg)))); |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | /** |
@@ -634,8 +634,8 @@ discard block |
||
| 634 | 634 | { |
| 635 | 635 | $message = bin2hex($message); |
| 636 | 636 | $messageId = substr($message, 16, 8); |
| 637 | - echo substr($message, 0, 16) . " NTLMSSP Signature<br />\n"; |
|
| 638 | - echo $messageId . " Type Indicator<br />\n"; |
|
| 637 | + echo substr($message, 0, 16)." NTLMSSP Signature<br />\n"; |
|
| 638 | + echo $messageId." Type Indicator<br />\n"; |
|
| 639 | 639 | |
| 640 | 640 | if ($messageId === '02000000') { |
| 641 | 641 | $map = array( |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | $data = $this->parseMessage2(\hex2bin($message)); |
| 655 | 655 | |
| 656 | 656 | foreach ($map as $key => $value) { |
| 657 | - echo bin2hex($data[$key]) . ' - ' . $data[$key] . ' ||| ' . $value . "<br />\n"; |
|
| 657 | + echo bin2hex($data[$key]).' - '.$data[$key].' ||| '.$value."<br />\n"; |
|
| 658 | 658 | } |
| 659 | 659 | } elseif ($messageId === '03000000') { |
| 660 | 660 | $i = 0; |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | ); |
| 698 | 698 | |
| 699 | 699 | foreach ($map as $key => $value) { |
| 700 | - echo $data[$key] . ' - ' . \hex2bin($data[$key]) . ' ||| ' . $value . "<br />\n"; |
|
| 700 | + echo $data[$key].' - '.\hex2bin($data[$key]).' ||| '.$value."<br />\n"; |
|
| 701 | 701 | } |
| 702 | 702 | } |
| 703 | 703 | |