Commit Graph

563 Commits

Author SHA1 Message Date
terrafrost
f300e825b0 SSH2: replace user_error's with exceptions 2015-08-01 08:01:43 -05:00
Andreas Fischer
fe5671fef7 SSH2: Remove all static variables as loadable classes may change at runtime. 2015-07-28 12:05:19 +02:00
Andreas Fischer
4244576104 [2.0] Add _encryption_algorithm_to_crypt_instance method. 2015-07-28 11:44:39 +02:00
Andreas Fischer
58f8affcad SSH2: Add support for curve25519-sha256@libssh.org.txt via libsodium-php. 2015-07-27 22:58:59 +02:00
Andreas Fischer
27be192189 Merge branch '1.0' into 2.0
* 1.0:
  Add encryption_algorithm_to_key_size method.
2015-07-27 22:08:06 +02:00
Andreas Fischer
65010d08e6 Add encryption_algorithm_to_key_size method. 2015-07-24 12:31:50 +02:00
Andreas Fischer
650a4ce266 Merge pull request #748 from terrafrost/ssh-custom-socket-2.0
SSH2: make it so you can connect using open sockets / 2.0 branch

* terrafrost/ssh-custom-socket-2.0:
  SSH2: move where $host is defined
  SSH2: make it so you can connect using open sockets
2015-07-21 12:53:32 +02:00
Andreas Fischer
06ec04e3fe Merge pull request #746 from terrafrost/ssh-custom-socket-1.0
SSH2: make it so you can connect using open sockets / 1.0 branch

* terrafrost/ssh-custom-socket-1.0:
  SSH2: move where $host is defined
  SSH2: make it so you can connect using open sockets
2015-07-21 12:53:24 +02:00
Andreas Fischer
713a9c7ccf Merge branch '1.0' into 2.0
* 1.0:
  SSH2: Introduce _array_intersect_first function.

Conflicts:
	phpseclib/Net/SSH2.php
2015-07-18 01:06:09 +02:00
Andreas Fischer
1473da35e6 SSH2: Introduce _array_intersect_first function.
+ No more empty for-loop bodies
+ No more counting variables $i leaked into outer context
+ No more unintuitive $i == count(...) comparisons
+ No more array / hash table access of the form $kex_algorithms[$i]
- Function call overhead; not in the performance critical path, though.
2015-07-17 22:28:32 +02:00
terrafrost
690704d36e Merge branch 'ssh-custom-socket-1.0' into ssh-custom-socket-2.0
Conflicts:
	phpseclib/Net/SSH2.php
2015-07-17 13:11:57 -05:00
terrafrost
a19e2a0d21 SSH2: move where $host is defined 2015-07-17 13:08:24 -05:00
terrafrost
4d086bee86 Merge branch 'ssh-custom-socket-1.0' into ssh-custom-socket-2.0
Conflicts:
	phpseclib/Net/SSH2.php
2015-07-17 12:43:50 -05:00
terrafrost
33a97391bc SSH2: make it so you can connect using open sockets 2015-07-17 12:30:44 -05:00
Andreas Fischer
d9e9504fba Merge branch 'PSR2-1.0' into PSR2-2.0
* PSR2-1.0:
  Fix indentation phpcbf did not fix.
  Remove PSR2.Methods.FunctionCallSignature.SpaceAfterOpenBracket exception.
  Use phpcbf to fix PHP code to ruleset.
  Ignore coding guidelines in ANSI switch block.
  Base code sniffer ruleset on PSR2 rather than PEAR.
  Update PHP Code Sniffer to 2.3.3

Conflicts:
	build/code-sniffer-ruleset-tests.xml
	build/code-sniffer-ruleset.xml
	composer.lock
	phpseclib/Crypt/DES.php
	phpseclib/Crypt/Hash.php
	phpseclib/Crypt/RSA.php
	phpseclib/File/X509.php
	phpseclib/Math/BigInteger.php
	phpseclib/Net/SFTP.php
	phpseclib/Net/SSH1.php
	phpseclib/Net/SSH2.php
	tests/Functional/Net/SFTPUserStoryTest.php
	tests/Unit/Crypt/TwofishTest.php
2015-07-17 13:41:59 +02:00
Andreas Fischer
2013a31ecd Use phpcbf to fix PHP code to ruleset. 2015-07-17 12:57:41 +02:00
Andreas Fischer
6cbe537ba6 Merge branch '1.0' into 2.0
* 1.0:
  SSH2: limit the size of data that expect() looks at

Conflicts:
	phpseclib/Net/SSH2.php
2015-07-17 11:17:32 +02:00
terrafrost
4dc79b96ed SSH2: limit the size of data that expect() looks at 2015-07-14 19:05:52 -05:00
Andreas Fischer
f2773847a2 Merge branch '1.0' into 2.0
* 1.0:
  Add support for RFC 4419: diffie-hellman-group-exchange-sha{1,256}

Conflicts:
	phpseclib/Net/SSH2.php
2015-07-08 15:45:53 +02:00
Andreas Fischer
cdda621903 Merge pull request #714 from bantu/diffie-hellman-group-exchange-sha256
Add support for RFC 4419: diffie-hellman-group-exchange-sha{1,256}

* bantu/diffie-hellman-group-exchange-sha256:
  Add support for RFC 4419: diffie-hellman-group-exchange-sha{1,256}
2015-07-08 15:43:46 +02:00
Andreas Fischer
abeda5237f Add support for RFC 4419: diffie-hellman-group-exchange-sha{1,256} 2015-07-08 00:00:40 +02:00
Andreas Fischer
89cf423c58 Merge branch '1.0' into 2.0
* 1.0:
  SSH2: fix for window sizes > 2,147,483,648
2015-06-27 21:58:45 +02:00
terrafrost
c0555581e7 SSH2: fix for window sizes > 2,147,483,648 2015-06-24 23:45:14 -05:00
Andreas Fischer
8e2f694129 Merge branch '1.0' into 2.0
* 1.0:
  SSH2: string shift by 4 instead of by 1
  SSH2: fix E_NOTICE involving global requests
2015-05-05 16:14:12 +02:00
Andreas Fischer
5bd7a73a71 Merge pull request #674 from terrafrost/ssh2-global-request
fix E_NOTICE with SSH2 global requests

* terrafrost/ssh2-global-request:
  SSH2: string shift by 4 instead of by 1
  SSH2: fix E_NOTICE involving global requests
2015-05-05 16:14:12 +02:00
terrafrost
684d6eed0e SSH2: string shift by 4 instead of by 1 2015-05-04 08:22:27 -05:00
Andreas Fischer
661f3ce3b9 Merge branch '1.0' into 2.0
* 1.0:
  Replace ; with : in case statement.

Conflicts:
	phpseclib/Net/SFTP.php
	phpseclib/Net/SSH2.php
2015-05-03 14:13:56 +02:00
Andreas Fischer
5d2590feb0 Replace ; with : in case statement. 2015-05-03 13:18:23 +02:00
terrafrost
b59d821bbe SSH2: fix E_NOTICE involving global requests 2015-04-30 21:34:07 -05:00
terrafrost
047a75a636 Merge branch '2.0' of https://github.com/phpseclib/phpseclib into openssl-support-2.0 2015-04-10 23:08:08 -05:00
terrafrost
0b1d3aa7e9 SSH2: NET_SSH2_MASK_* -> self::MASK_* 2015-04-10 17:48:58 -05:00
terrafrost
d75f703c0a rm PHP v4 compatability claim 2015-04-02 05:57:52 -05:00
terrafrost
e510dc878b Merge branch '1.0' of https://github.com/phpseclib/phpseclib into openssl-support
Conflicts:
	phpseclib/Net/SSH2.php
2015-04-02 05:40:14 -05:00
terrafrost
023fef8d8b Merge branch '2.0' of https://github.com/phpseclib/phpseclib into openssl-support-2.0
Conflicts:
	phpseclib/Net/SSH2.php
2015-04-02 05:37:04 -05:00
terrafrost
ebcb3130b7 Merge branch 'openssl-support' into 2.0
Conflicts:
	phpseclib/Crypt/AES.php
	phpseclib/Crypt/Base.php
	phpseclib/Crypt/Blowfish.php
	phpseclib/Crypt/DES.php
	phpseclib/Crypt/RC2.php
	phpseclib/Crypt/RC4.php
	phpseclib/Crypt/Rijndael.php
	phpseclib/Crypt/TripleDES.php
	phpseclib/Crypt/Twofish.php
	phpseclib/Net/SSH2.php
	tests/Functional/Net/SFTPLargeFileTest.php
	tests/Unit/Crypt/AES/InternalTest.php
	tests/Unit/Crypt/AES/McryptTest.php
	tests/Unit/Crypt/AES/TestCase.php
2015-04-02 05:32:31 -05:00
Andreas Fischer
8101772ab4 Merge branch '1.0' into 2.0
* 1.0:
  SSH2: rm unused $connectionTimeout variable
  SSH2: rm redundant code and make php4 compatable
  SSH2: timeout improvements

Conflicts:
	phpseclib/Net/SSH2.php
2015-03-30 12:46:54 +02:00
Andreas Fischer
c0370ee91d Merge pull request #639 from terrafrost/banner-timeout
improve error handling with protocol version exchange

* terrafrost/banner-timeout:
  SSH2: rm unused $connectionTimeout variable
  SSH2: rm redundant code and make php4 compatable
  SSH2: timeout improvements
2015-03-30 12:37:46 +02:00
terrafrost
33645f5297 SSH2: missed a file in the merge 2015-03-29 10:58:05 -05:00
terrafrost
a8e702b34f Merge branch 'agentforwarding-1.0' into agentforwarding-2.0
Conflicts:
	phpseclib/Net/SSH2.php
	phpseclib/System/SSH/Agent.php
2015-03-29 10:32:30 -05:00
terrafrost
bb01002233 Merge remote-tracking branch 'agentforwarding/feature/ssh_agent_forwarding' into agentforwarding-1.0 2015-03-28 21:03:17 -05:00
terrafrost
1294b08675 SSH2: rm unused $connectionTimeout variable 2015-03-27 22:32:38 -05:00
montdidier
9723acc885 preference isset over array_key_exists, return false on failure, break after return channel opened 2015-03-24 13:38:56 +08:00
terrafrost
dfd57dfb89 SSH2: rm redundant code and make php4 compatable 2015-03-19 22:39:43 -05:00
terrafrost
23c65c3839 SSH2: timeout improvements
make it so that the timeout in the constructor behaves in the same
way that timeout's set via setTimeout() do. eg. isTimeout() tells
you if a timeout was thrown etc.
2015-03-19 07:53:19 -05:00
montdidier
1803bcac0b moved agent forwarding channel handling to filter method and reusing existing open channels to request forwarding 2015-02-06 11:28:23 +08:00
terrafrost
009d883d4c Merge branch 'master' of https://github.com/phpseclib/phpseclib into openssl-support 2015-01-14 20:13:08 -06:00
montdidier
dd0b3e6bd5 addresses low hanging fruit comments from terrafrost and bantu 2015-01-12 17:13:33 +08:00
Andreas Fischer
3c99773184 Merge pull request #588 from terrafrost/disconnect-fix
SSH2: update conditions under which _disconnect's code is executed

* terrafrost/disconnect-fix:
  SSH2: update conditions under which _disconnect's code is executed
2015-01-04 11:57:52 +01:00
Andreas Fischer
1c923576c6 NET_SSH2_ -> self:: 2015-01-04 11:38:03 +01:00
Andreas Fischer
ec21aa23f1 Merge pull request #588 from terrafrost/disconnect-fix
SSH2: update conditions under which _disconnect's code is executed

* terrafrost/disconnect-fix:
  SSH2: update conditions under which _disconnect's code is executed
2015-01-04 11:36:14 +01:00
terrafrost
be168e262f Crypt/Base: stream ciphers cannot be run in continuous mode with OpenSSL 2014-12-31 14:10:53 -06:00
terrafrost
5a91539148 SSH2: rm unsupported algorithms if OpenSSL is being used 2014-12-29 22:10:26 -06:00
montdidier
aca4ba3286 SSH agent forwarding implementation 2014-12-30 10:44:31 +08:00
terrafrost
472e006b6c SSH2: update conditions under which _disconnect's code is executed 2014-12-29 08:37:44 -06:00
Clint Nelissen
f3565346fa Replaced get_class() calls with instanceof operators 2014-12-24 13:07:14 -08:00
Clint Nelissen
fe742e18d7 Namespaced Crypt Package 2014-12-16 16:16:54 -08:00
Clint Nelissen
dfb8d52806 Temporary constant fix 2014-12-15 14:29:34 -08:00
Clint Nelissen
628949fb73 Namespaced classes 2014-12-15 14:29:20 -08:00
Clint Nelissen
fddf20f89c Namespaced classes 2014-12-15 09:25:46 -08:00
terrafrost
c5f74eb3a3 Merge branch 'master' of https://github.com/phpseclib/phpseclib into openssl-support 2014-12-13 14:15:34 -06:00
Andreas Fischer
c4b103468c Merge pull request #549 from bantu/fix-547
Change copyright years from roman numeral to decimal numbers.

* bantu/fix-547:
  Change copyright years from roman numeral to decimal numbers.

Conflicts:
	phpseclib/System/SSH_Agent.php
2014-12-10 00:06:08 +01:00
Andreas Fischer
0efae5a91e Change copyright years from roman numeral to decimal numbers. 2014-12-10 00:04:08 +01:00
Clint Nelissen
0305a4827c Moved globally defined constants to class constants 2014-12-09 10:46:30 -08:00
Clint Nelissen
ecb9c32f02 Merge branch 'php5' of https://github.com/phpseclib/phpseclib into NetPackageConstantsFix
Conflicts:
	phpseclib/Net/SSH2.php
2014-12-08 10:40:57 -08:00
Andreas Fischer
e52a3aff5a Merge branch 'master' into php5
* master:
  SSH2: simplify _send_channel_packet
2014-12-06 12:25:16 +01:00
terrafrost
96eb1f3797 SSH2: simplify _send_channel_packet
the last _send_channel_packet was unnecessarily complex. this lead
to a number of problems. for example,

the window size was checked for adjustments in two places. in the
second place it receives a window adjustment packet and just assumes
that the window adjustment packet was big enough for the rest of the
data.

(thanks, pixall!)
2014-12-05 22:01:39 -06:00
Clint Nelissen
99b9cc477d Moved global constants to class constants 2014-12-04 13:45:13 -08:00
Andreas Fischer
638e62d60a Remove LICENSE text from source code files. 2014-12-03 18:49:33 +01:00
Clint Nelissen
d6029bdb6a Removed includes for Random.php and fixed up user_error message 2014-12-02 09:34:15 -08:00
Clint Nelissen
f5ed86e385 Renamed Random::crypt_random_string to Random::string 2014-12-02 09:20:40 -08:00
Clint Nelissen
c70702afbb Namespaced Crypt\Random 2014-12-02 08:41:30 -08:00
Clint Nelissen
9c0c3faeb7 Initial commit 2014-12-01 18:54:44 -08:00
terrafrost
8fc4f4b70c Merge branch 'master' of https://github.com/phpseclib/phpseclib into openssl-support 2014-11-29 07:46:06 -06:00
Andreas Fischer
43d2e9ef68 Merge branch 'master' into php5
* master:
  SSH2: clarify exec() docblock comment
2014-11-20 10:58:33 +01:00
terrafrost
b1e6643032 SSH2: clarify exec() docblock comment 2014-11-19 22:38:19 -06:00
Andreas Fischer
10e5653324 Merge branch 'master' into php5
* master:
  SSH2: fix issues with RSA key verification

Conflicts:
	phpseclib/Net/SSH2.php
2014-11-07 13:13:38 +01:00
terrafrost
3eac2582d6 SSH2: fix issues with RSA key verification
Sometimes SSH servers will null pad their RSA keys. this null padding
broke Net/SSH2.php's RSA implementation (Crypt/RSA.php's implementation
works just fine). Also, the -3 was counting the initial "\0" of $h
twice so adjust it to -2.
2014-11-06 11:58:03 -06:00
terrafrost
361b59fff9 SSH2: make setCryptoEngine() less cumbersome 2014-10-11 23:40:56 -05:00
terrafrost
959c0cefae SSH2: add setCryptoEngine() function 2014-10-11 23:26:46 -05:00
terrafrost
ff4d563f4f SSH2: CS adjustments 2014-10-11 23:20:44 -05:00
Andreas Fischer
92c3127448 Merge branch 'master' into php5
* master:
  SSH2: removed redundant rtrim
2014-09-28 12:43:54 +02:00
Cezary Kluczyński
0692a1ea7d SSH2: removed redundant rtrim 2014-09-28 12:39:54 +02:00
Andreas Fischer
cf921a347a Merge branch 'master' into php5
* master:
  SSH2: rm unused constant
2014-09-07 12:43:27 +02:00
terrafrost
67279d7811 SSH2: rm unused constant
it doesn't need to be defined since the strlen($this->last_interactive_response)
check in _login_helper serves the same purpose that NET_SSH_MASK_LOGIN_INTERACTIVE
was intended to serve
2014-09-06 20:30:01 -05:00
Andreas Fischer
42e05a6714 Merge branch 'master' into php5
* master:
  SSH2: don't count data length against window size
2014-09-03 20:44:53 +02:00
terrafrost
9e71e0bce8 SSH2: don't count data length against window size
it is my hope that the issues 8c9e7a890e
and ccb1c3e2bd sought to resolve were
fixed 9f8d8a7bf6 and
7a2c7a414c.
2014-08-30 15:26:23 -05:00
Andreas Fischer
9dc92a82a4 Merge branch 'master' into php5
* master:
  SSH2: white space adjustment
  SSH: update getServerPublicHostKey() to use new _connect() method
  SSH2: fix if statement for conditional _connect() call
  simplify calls to $this->_connect()
  SSH2: make it so negotiated algorithms can be seen before login
2014-08-10 12:10:11 +02:00
Andreas Fischer
1de939fb4a Merge pull request #427 from terrafrost/ssh2-show-methods-before-login
SSH2: make it so negotiated algorithms can be seen before login

* terrafrost/ssh2-show-methods-before-login:
  SSH2: white space adjustment
  SSH: update getServerPublicHostKey() to use new _connect() method
  SSH2: fix if statement for conditional _connect() call
  simplify calls to $this->_connect()
  SSH2: make it so negotiated algorithms can be seen before login
2014-08-10 12:10:04 +02:00
terrafrost
04e263bb8c SSH2: white space adjustment 2014-08-10 02:09:28 -05:00
terrafrost
085fb0ebb8 SSH: update getServerPublicHostKey() to use new _connect() method 2014-08-06 14:42:08 -05:00
terrafrost
5b019b22d9 SSH2: fix if statement for conditional _connect() call 2014-08-05 19:30:14 -05:00
terrafrost
dffef50838 simplify calls to $this->_connect() 2014-08-04 20:11:34 -05:00
Andreas Fischer
e4516fb453 Merge branch 'master' into php5
* master:
  Add some test cases for SHA512.
  Use toBits() as there is no bits property.
  SSH2: Disallow the none MAC.
2014-07-26 17:20:09 +02:00
Andreas Fischer
2ccb301c4c Merge pull request #425 from bantu/ssh-remove-none-mac
SSH2: Disallow the none MAC.

* bantu/ssh-remove-none-mac:
  SSH2: Disallow the none MAC.
2014-07-26 13:14:39 +02:00
Andreas Fischer
fed60fe8ac Merge branch 'master' into php5
* master:
  ssh-hmac-sha2-256: Remove whitespace at end of line.
  Added RFC6668
  Add hmac-sha2-256 MAC support
2014-07-26 13:11:29 +02:00
Andreas Fischer
4be4533a6e ssh-hmac-sha2-256: Remove whitespace at end of line. 2014-07-26 13:02:52 +02:00
terrafrost
49079fa1b4 SSH2: make it so negotiated algorithms can be seen before login 2014-07-25 10:03:31 -05:00
Dag Wieers
1a330b68e2 Added RFC6668
Added the requested changed.
2014-07-25 14:10:01 +02:00
Dag Wieers
86d17c6989 Add hmac-sha2-256 MAC support
This small patch adds hmac-sha2-256 support separately as requested in #423.

Some security standards now recommend to disable MD5 and SHA1, and use SHA2 instead. This change was tested using SHA2 against RHEL6's OpenSSH v5.3p1 and Solaris 11. And was also tested with RHEL5's OpenSSH 4.3p2 which doesn't include SHA2.
2014-07-25 12:28:08 +02:00
Andreas Fischer
1aecc5e3d8 SSH2: Disallow the none MAC. 2014-07-25 12:18:11 +02:00
Andreas Fischer
f0d0158c2b Merge branch 'master' into php5
* master:
  Comment out (potentially) insecure ciphers arcfour and none.
2014-07-22 16:09:16 +02:00
Andreas Fischer
a0a23cbaf1 Merge pull request #406 from bantu/remove-ssh-arcfour
Remove the arcfour and none ciphers from SSH2.

* bantu/remove-ssh-arcfour:
  Comment out (potentially) insecure ciphers arcfour and none.
2014-07-22 16:09:14 +02:00
Andreas Fischer
ae913d64c3 Merge branch 'master' into php5
* master:
  SSH2: don't remove old $this->bitmap values
2014-07-21 23:53:34 +02:00
terrafrost
9dd3db4a49 SSH2: don't remove old $this->bitmap values 2014-07-21 16:41:39 -05:00
Andreas Fischer
84ac305704 Comment out (potentially) insecure ciphers arcfour and none. 2014-07-21 12:16:49 +02:00
Andreas Fischer
025a637053 Merge branch 'master' into php5
* master:
  Make Net_SSH2::isConnected() return a boolean instead of int.
2014-07-20 23:31:30 +02:00
Andreas Fischer
678d0cc792 Make Net_SSH2::isConnected() return a boolean instead of int. 2014-07-20 23:03:06 +02:00
Andreas Fischer
c2f2f4a764 Merge branch 'master' into php5
* master:
  SSH2: make isConnected return true if even if we're not logged in
2014-07-20 23:00:32 +02:00
terrafrost
ac2fc96263 SSH2: make isConnected return true if even if we're not logged in 2014-07-20 11:24:16 -05:00
Andreas Fischer
ca4f6a21eb Merge branch 'master' into php5
* master:
  Removed white-spaces from line ends
  Allow setting the terminal window size
2014-06-23 16:36:23 +02:00
liutec
10597aed64 Removed white-spaces from line ends 2014-06-22 22:30:52 +03:00
liutec
8e1df6e3c3 Allow setting the terminal window size 2014-06-20 13:04:17 +03:00
Andreas Fischer
b50ef2dc64 Replace phpseclib_resolve_include_path with stream_resolve_include_path. 2014-06-19 16:14:15 +02:00
Andreas Fischer
f85d333912 Merge branch 'master' into php5
* master:
  phpseclib_is_includable() -> phpseclib_resolve_include_path()
  Drop Net_SSH2::_is_includable() method.
  Random: a few changes to the stream_resolve_include_path_function
  Replace stream_resolve_include_path with phpseclib_is_includable.
  Random: add explanatory comment
  SSH2: replace _is_includable() with stream_resolve_include_path
  Random: include the Crypt_* classes if they're available

Conflicts:
	tests/bootstrap.php
2014-06-19 16:09:23 +02:00
Andreas Fischer
709c7c4d48 Merge pull request #385 from bantu/a-random-change
Random: include the Crypt_* classes if they're available

* bantu/a-random-change:
  phpseclib_is_includable() -> phpseclib_resolve_include_path()
  Drop Net_SSH2::_is_includable() method.
  Random: a few changes to the stream_resolve_include_path_function
  Replace stream_resolve_include_path with phpseclib_is_includable.
  Random: add explanatory comment
  SSH2: replace _is_includable() with stream_resolve_include_path
  Random: include the Crypt_* classes if they're available
2014-06-19 16:08:59 +02:00
Andreas Fischer
fd65c55720 phpseclib_is_includable() -> phpseclib_resolve_include_path() 2014-06-19 14:57:09 +02:00
Andreas Fischer
1afbea613d Drop Net_SSH2::_is_includable() method. 2014-06-18 23:41:26 +02:00
Andreas Fischer
9c90beaf82 Replace stream_resolve_include_path with phpseclib_is_includable. 2014-06-17 14:38:24 +02:00
Andreas Fischer
563b8af6ce Merge branch 'master' into php5
* master:
  SSH2: rm redundant part of SSH2 unit test
  SSH2: add unit test for getServerPublicHostKey
  SSH2: make it so you can verify server public host key without logging on
2014-06-17 11:37:37 +02:00
terrafrost
5f56781261 SSH2: make it so you can verify server public host key without logging on 2014-06-16 10:19:34 -05:00
Andreas Fischer
67aedc240b Change constructors from class name to __construct().
This has been produced as follows:
<?php
$replace = $files = [];
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($argv[1]));
foreach ($it as $fileinfo) {
    if ($fileinfo->getExtension() === 'php') {
        $file = $fileinfo->getPathname();
        $content = file_get_contents($file);
        $files[$file] = $content;
        $tokens = token_get_all($content);
        foreach ($tokens as $key => $value) {
            if ($value[0] === T_CLASS) {
                $class = $tokens[$key + 2][1];
                $replace += array(
                    "$class::$class(" => "$class::__construct(",
                    "parent::$class(" => "parent::__construct(",
                    "function $class(" => "function __construct(",
                );
            }
        }
    }
}
foreach ($files as $file => $content) {
    file_put_contents(
        $file,
        str_replace(
            array_keys($replace),
            array_values($replace),
            $content
        )
    );
}
2014-06-16 17:06:34 +02:00
terrafrost
4401b7e21e SSH2: replace _is_includable() with stream_resolve_include_path 2014-06-16 09:47:13 -05:00
Andreas Fischer
14ba37c539 Merge branch 'master' into php5
* master:
  SSH2: make $mac_algorithms non-static
2014-06-11 07:49:02 +02:00
terrafrost
246e9e154f SSH2: make $mac_algorithms non-static
none of the other statically defined variables have the potential
to change as multiple Net_SSH2 objects are created but this one does.

ie. if you connect to one SSH-2.0-SSHD server then no subsequent server
will use hmac-sha1-96 even if it could
2014-06-10 23:08:56 -05:00
Andreas Fischer
f2f5fcd70a Update users of Math_BigInteger. 2014-06-02 20:19:00 +02:00
Andreas Fischer
6f4a873cad Merge branch 'master' into php5
* master:
  Adjust documentation to coding guidelines: No () around include.
2014-06-02 12:51:24 +02:00
Andreas Fischer
e6f87318f5 Adjust documentation to coding guidelines: No () around include. 2014-06-01 23:28:49 +02:00
Andreas Fischer
712f820a26 Merge branch 'master' into php5
* master:
  SSH2: 0x7FFFFFFF -> $this->window_size in one more place
  SSH2: make it so callback functions can make exec() return early
2014-05-28 00:39:40 +02:00
terrafrost
db32efb276 SSH2: 0x7FFFFFFF -> $this->window_size in one more place 2014-05-26 17:57:14 -05:00
terrafrost
0dd929341b SSH2: make it so callback functions can make exec() return early 2014-05-26 17:37:32 -05:00
Andreas Fischer
b3081f2a61 Merge branch 'master' into php5
* master:
  SSH2: improve handling of incomplete packets
2014-04-19 15:46:56 +02:00
terrafrost
efd3b96dc8 SSH2: improve handling of incomplete packets 2014-04-18 16:58:00 -05:00
Andreas Fischer
a7da467819 Merge branch 'master' into php5
* master:
  Added some simple Net_SSH2 tests
2014-04-18 16:55:42 +02:00
Andreas Fischer
b676cc2690 Merge pull request #241 from mpscholten/ssh2-tests
Added some simple Net_SSH2 tests

* mpscholten/ssh2-tests:
  Added some simple Net_SSH2 tests

Conflicts:
	tests/Net/SSH2Test.php
2014-04-18 16:54:24 +02:00
Andreas Fischer
58cdf692f8 Merge branch 'master' into php5
* master:
  SSH2: move _connect() call to _login() from login()
  SSH2: phpdoc updates
  SSH: clarify role of constructor / connection timeout
  SSH1: do fsockopen() call when login has been called
  SSH2: != -> |=
  SSH2: phpdoc changes
  SSH2: syntax error
  SSH2: timeout set in constructor != timeout set by setTimeout()
  SSH2: add phpdoc header
  SSH2: connect to server in login() function

Conflicts:
	phpseclib/Net/SSH2.php
2014-04-10 18:00:38 +02:00
terrafrost
79719e8f74 SSH2: move _connect() call to _login() from login()
Per bantu, this is required for it to work with Net/SFTP.php
2014-04-08 08:48:12 -05:00
terrafrost
0ad0bb4c37 SSH2: phpdoc updates 2014-04-07 15:43:31 -05:00
terrafrost
677a291cb3 SSH: clarify role of constructor / connection timeout
Also, in Net_SSH2::_connect() $host is used in multiple places. Rather than changing all references to {$this->host}:{$this->port} preserve existing $host reference and update it accordingly
2014-04-07 10:26:46 -05:00
terrafrost
6fcfe5c885 SSH2: != -> |= 2014-04-07 00:25:38 -05:00
terrafrost
8f08301744 SSH2: phpdoc changes 2014-04-07 00:19:35 -05:00
terrafrost
ab341df973 SSH2: syntax error 2014-04-07 00:16:54 -05:00
terrafrost
f27a49299e SSH2: timeout set in constructor != timeout set by setTimeout() 2014-04-07 00:02:03 -05:00
terrafrost
fc748346fc SSH2: add phpdoc header 2014-04-06 23:56:21 -05:00
terrafrost
a14e71f38b SSH2: connect to server in login() function
this change will make it so some parameters can be set after the
Net_SSH2 object has been created. eg. instead of doing
define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX) one can now do
$ssh->setLogging(...) or something.
2014-04-06 23:45:25 -05:00
Andreas Fischer
483b8a7d3c Merge branch 'master' into php5
* master:
  fix more ssh channel issues
2014-03-21 18:27:13 +01:00
terrafrost
7a2c7a414c fix more ssh channel issues
In logs that were provided to me phpseclib sent a packet that was 2536 bytes long (excluding the bytes denoting the channel and data length) but the length packet said it was 32764 bytes long (ie. $max_size).

So when $max_size is less than the data being sent and has to be adjusted by a new window adjust message from the server and the adjustment makes $max_Size bigger than the data being sent over problems arise.

SSH's window size has caused issues before. Overall I don't think the SSH specs really explain the window size very well. I opened up an errata on SSH's RFC a while back about the issue.
2014-03-21 02:53:43 -05:00
Andreas Fischer
aecf89c031 Merge branch 'master' into php5
* master:
  Drop meaningless, outdated, inconsistent version tags in doc blocks.
2014-03-13 00:03:38 +01:00
Andreas Fischer
fb1296bbec Drop meaningless, outdated, inconsistent version tags in doc blocks.
find phpseclib -type f -name "*.php" -exec sed -i '/@version/d' {} \;
2014-03-11 15:58:33 +01:00
Andreas Fischer
cb56e676dc Merge branch 'master' into php5
* master:
  Tests for bug280.
  Also replace this with call_user_func
  Use call_user_func, as this will work on PHP < 5.4, whereas $callback() does not
2014-03-06 12:05:17 +01:00
Nicky Gerritsen
97d1e75a51 Use call_user_func, as this will work on PHP < 5.4, whereas $callback() does not 2014-03-05 15:44:17 +01:00
Andreas Fischer
88e6eef90f Merge branch 'master' into php5
* master:
  Add newline at EOF to phpseclib/System/SSH_Agent.php.
  SSH_Agent: phpdoc updates
  SSH_Agent: misc updates
  SSH2: add ssh-agent support
2014-02-21 19:42:36 +01:00
terrafrost
e90648c7a5 SSH2: add ssh-agent support 2014-02-10 00:04:16 -06:00
Andreas Fischer
addd2ac320 Merge branch 'master' into php5
* master:
  SSH2: ignore exit_status channel requests
2014-02-03 16:56:46 +01:00
terrafrost
cd9801db8a SSH2: ignore exit_status channel requests
Fixes #258
2014-02-02 23:42:06 -06:00
Marc Philip Scholten
b7092ebc21 Added some simple Net_SSH2 tests
Placed helper at top again in my test

Removed a whitespace
2013-12-28 21:29:52 +01:00
terrafrost
05077cf0f3 Merge branch 'ssh2-identifier' into php5 2013-12-28 13:50:05 -06:00
terrafrost
268ec2e5d1 Merge branch 'ssh2-identifier' 2013-12-28 13:49:05 -06:00
terrafrost
0ccac2c998 SSH2: add new line in docblock comment 2013-12-28 13:47:24 -06:00
Marc Philip Scholten
19be15c4c4 Fixed typos 2013-12-28 18:16:09 +01:00
terrafrost
a1b749a0a0 Merge branch 'master' into php5 2013-12-27 10:25:19 -06:00
Marc Philip Scholten
ad0c7c52bd Fixed cs 2013-12-26 21:02:18 +01:00
Marc Philip Scholten
b0de383f95 Replaced else { if ()...} with elseif() {} 2013-12-26 21:02:17 +01:00
Marc Philip Scholten
357d4253ee Fixed typo 2013-12-26 21:00:58 +01:00
Marc Philip Scholten
4817d28a54 Refactored Net_SSH2::$identifier and added unit tests
Added return tag
2013-12-26 21:00:58 +01:00
Andreas Fischer
f63798b923 Merge pull request #233 from terrafrost/phar-fix
SSH2: better accomodate Phar's

* terrafrost/phar-fix:
  SSH2: better accomodate Phar's
2013-12-26 19:43:26 +01:00
Andreas Fischer
0f69d35584 Fix indentation of _append_log in SSH1 and SSH2. 2013-12-26 11:45:24 +01:00
Andreas Fischer
0dd5a9ba9f Merge pull request #228 from bantu/cs-whitespace
CS: Add useful whitespace CodeSniffer rules.

* bantu/cs-whitespace:
  CS: Add useful whitespace CodeSniffer rules.
2013-12-26 11:38:17 +01:00
terrafrost
70b9a69c46 SSH2: better accomodate Phar's 2013-12-26 01:55:05 -06:00
Andreas Fischer
8bb80b3df0 CS: Add useful whitespace CodeSniffer rules. 2013-12-26 00:33:08 +01:00
terrafrost
8424a464a6 SSH2: typos in last commit 2013-12-22 18:25:00 -06:00
terrafrost
0f5b3ea416 Compatibility fixes
- PHP4 doesn't allow method chaining
- $_SESSION isn't always defined
- on PHP5.1 and earlier using 0x100000000 instead of 4294967296 gives E_NOTICE
- array('Net_SSH2', 'func_name') doesn't work so we fix this by passing $this to it.
  to make that work on PHP4 pass by call-time reference. normally this would result
  in a fatal error on PHP5.4+ but doesn't seem to in this case. the following URL
  elaborates:

  http://stackoverflow.com/q/20732563/569976
2013-12-22 18:14:49 -06:00
terrafrost
4bd9a546ab Merge branch 'master' of https://github.com/phpseclib/phpseclib 2013-12-22 11:53:35 -06:00
terrafrost
c26594ba08 Merge remote-tracking branch 'upstream/php5' into php5 2013-12-22 11:50:11 -06:00
Andreas Fischer
d311698340 Merge branch 'master' into php5
* master:
  SSH2: fix E_DEPRECATED on PHP5.5
2013-12-17 20:56:06 +01:00
terrafrost
6ac922726d SSH2: fix E_DEPRECATED on PHP5.5 2013-12-16 11:27:12 -06:00
terrafrost
c01b8fc4ed SCP: Tweaks
sending the close channel packet right after the eof seems to make some scp transfers terminate prematurely.

unfortunately, sometimes this behavior is undesirable as it is in this case:

http://www.frostjedi.com/phpbb3/viewtopic.php?f=46&t=29457

hence the $want_reply parameter

also, this commit makes the scp packet length account for the length portion
2013-12-15 00:43:20 -06:00
Andreas Fischer
03b08ceaa0 Merge branch 'master' into php5
* master:
  CS: Fix "PEAR.Commenting.ClassComment.WrongTagOrder" sniff.
2013-12-11 23:30:19 +01:00
Andreas Fischer
f0f029b2c1 CS: Fix "PEAR.Commenting.ClassComment.WrongTagOrder" sniff. 2013-12-11 18:33:18 +01:00
Andreas Fischer
3729ba3e44 Merge branch 'master' into php5
* master:
  CS: Fix "PEAR.Commenting.FileComment.TagIndent" sniff.
2013-12-10 22:29:11 +01:00
Andreas Fischer
3db1fbb072 CS: Fix "PEAR.Commenting.FileComment.TagIndent" sniff. 2013-12-10 20:10:37 +01:00
Andreas Fischer
452d3dc359 Merge branch 'master' into php5
* master:
  CS: Fix "PEAR.Files.IncludingFile.UseIncludeOnce" sniff.
2013-12-06 12:20:42 +01:00
Andreas Fischer
6d1fb9f7db CS: Fix "PEAR.Files.IncludingFile.UseIncludeOnce" sniff. 2013-12-06 01:03:34 +01:00
Andreas Fischer
64691f2aec Merge branch 'master' into php5
* master:
  Fix "PEAR.Files.IncludingFile.BracketsNotRequired" sniff.
2013-12-06 00:58:00 +01:00
Andreas Fischer
bc6ff96292 Fix "PEAR.Files.IncludingFile.BracketsNotRequired" sniff. 2013-12-05 23:17:40 +01:00
Andreas Fischer
d696f22b89 Merge pull request #201 from mpscholten/php5-ssh2-microtime
Replaced php4 hack for microtime(true) with real microtime(true)

* mpscholten/php5-ssh2-microtime:
  Replaced php4 hack for microtime(true) with real microtime(true)
2013-12-05 20:54:11 +01:00
Marc Philip Scholten
d6c70a76d9 Replaced php4 hack for microtime(true) with real microtime(true) 2013-12-05 18:46:46 +01:00
Andreas Fischer
e09f1b730e CodeSniffer: Fix PEAR.Classes.ClassDeclaration.OpenBraceNewLine sniff. 2013-12-03 19:34:41 +01:00
Andreas Fischer
ca9c8b107b CodeSniffer: Fix Generic.PHP.LowerCaseConstant.Found sniff. 2013-12-03 18:54:43 +01:00
Andreas Fischer
399308f98a Merge pull request #180 from mpscholten/removed-vim-comments
Removed vim comments

* mpscholten/removed-vim-comments:
  Removed vim comments
2013-11-23 21:16:25 +01:00
Marc Philip Scholten
3bfd884813 Removed vim comments
Reformated files
2013-11-23 19:42:26 +01:00
phonzie
3afa655f57 SSH2: Continue Subsystem Implementation.
Removed unused piece of code @2352.
Added $this->_get_interactive_channel() to reset(). Unless we don't want to close the subsystem channel?? Leaving that decision up to you.
2013-11-20 16:17:23 -05:00
phonzie
eb3bffaa00 Update SSH2.php
Use of undefined property: "$this->bitmask".

In context, it seems that it should reference the "bitmap" property.
2013-11-15 13:34:31 -05:00
terrafrost
c6a52cb1b1 SSH2: add preliminary support for custom SSH subsystems 2013-10-25 12:35:30 -05:00
terrafrost
48b13bc1d7 SSH2: make it so realtime logs filter out password's
"Complex" logs already do this - just not realtime logs
2013-09-12 08:45:13 -05:00
terrafrost
9f8d8a7bf6 SSH2: window size handling adjustments 2013-09-12 08:29:14 -05:00
terrafrost
24a06eeff3 SSH2: neither of the DSA signature values should be 0 2013-08-31 00:22:47 -05:00
terrafrost
df45abcda0 SSH2: try to execute commands via interactive shell even if no pty 2013-08-20 23:52:15 -05:00
terrafrost
093a182904 SSH2: Logging updates 2013-07-26 09:57:20 -05:00
terrafrost
bf6da217c1 Merge branch 'master' of https://github.com/phpseclib/phpseclib 2013-07-22 23:53:45 -05:00
terrafrost
8c9e7a890e SSH2: more window size adjustments 2013-07-22 23:48:28 -05:00
terrafrost
78f9fadd3d SSH2: don't remove first byte from complex logs 2013-07-19 10:34:11 -05:00
terrafrost
415df3bd45 SSH2: attribute newly added comment 2013-07-18 10:35:39 -05:00
terrafrost
ccb1c3e2bd SSH2: include string length in window size adjustments 2013-07-17 23:21:25 -05:00
terrafrost
ffdcf843c1 Merge branch 'master' of https://github.com/phpseclib/phpseclib 2013-07-14 04:10:54 -05:00
terrafrost
0f96fae818 SSH2: channel handling adjustments
- keep track of server -> client window size and look out for NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST packets as appropriate
- send client -> server window size packets based on channel of received packet - not of desired channel
- buffer incoming packets based on received packets channel - not on desired channel
2013-07-14 04:09:16 -05:00
terrafrost
309f79ecea SSH2: attempt to handle case where window size is smaller than packet size 2013-07-07 16:10:12 -05:00
terrafrost
327a3b8bc8 SSH2: Keep track of client -> server window size 2013-07-07 15:57:15 -05:00
terrafrost
a6289036a0 SSH2: fix possible E_NOTICE 2013-07-07 15:49:49 -05:00
terrafrost
76ea505af8 SSH2: use Crypt_Rijndael instead of Crypt_AES
Crypt_AES is pretty much just a wrapper now
2013-06-25 16:44:22 -05:00
terrafrost
a3e6e1578b SSH2: revamp dynamic listing of crypto algorithms 2013-06-25 15:21:43 -05:00
terrafrost
adf8afd4eb SSH2: build supported cipher list off of files that are present 2013-06-20 20:51:50 -05:00
terrafrost
2edc9fc0a9 SSH2: reorder cipher preferences 2013-06-20 17:14:20 -05:00
terrafrost
d79ce65fe3 SSH2: close channel and break after exit-signal
Prior to efdec7b118 exit-signal's would re-use exit-status's channel closing code. after that commit, however, exit-status specific code was added, which meant that falling through, without the break, broke things
2013-06-10 10:57:34 -05:00
terrafrost
2ec8c8c925 Merge pull request #117 from bantu/elliptic-curve-preparation
Preparation for ECDH in SSH
2013-06-07 15:24:24 -07:00
terrafrost
e85f5c7198 SSH2: Update timeout functionality
Make it so Net_SSH2 doesn't close channel upon timeout. only if reset() is closed will channel be closed.
Also add isTimeout() function
2013-06-07 17:21:11 -05:00
Andreas Fischer
61279f1fb6 [feature/elliptic-curve] Add comment for generator 2 and sha1 hash function. 2013-06-07 01:03:03 +02:00
Andreas Fischer
2fcbd77605 [feature/elliptic-curve] Associate the generator (decimal 2) with the prime. 2013-06-07 00:58:09 +02:00
Andreas Fischer
1c63d4b746 [feature/elliptic-curve] Specify prime data to BigInteger directly in base 16. 2013-06-07 00:55:23 +02:00
Andreas Fischer
1a200f8c7b [feature/elliptic-curve] Rename $p -> $prime 2013-06-07 00:53:21 +02:00
Andreas Fischer
7253e77386 [feature/elliptic-curve] Do not instantiate unnecessary $x instance. 2013-06-07 00:47:59 +02:00
Andreas Fischer
97cf60900d [feature/elliptic-curve] Rename $q to $max because that's what it is. 2013-06-07 00:47:37 +02:00
Andreas Fischer
50f5f3f97e [feature/elliptic-curve] Assign a variable to Math_BigInteger(1). 2013-06-07 00:43:40 +02:00
Andreas Fischer
a730ed6e4c [feature/elliptic-curve] Use an instance of Crypt_Hash instead of sha1(). 2013-06-07 00:38:38 +02:00
terrafrost
e25ae8c4f4 Merge pull request #114 from bantu/fix-weak-ssh-dh-keys
Fix weak ssh dh keys
2013-06-05 21:57:15 -07:00
Andreas Fischer
727dba5905 [remove-svn-version-lines] Remove useless @version: $Id$ lines.
These lines served some purpose on SVN, but are now useless on Git. They
actually do harm as they might make people think their files are older
than they actually are.
2013-06-02 18:50:46 +02:00
Andreas Fischer
1733c3366c [fix-weak-ssh-dh-keys] bitwise_leftShift() expects number of bits, not bytes. 2013-06-02 16:55:19 +02:00
Andreas Fischer
252c6ec68d [fix-weak-ssh-dh-keys] $keyLength is in bytes. Do not compare to 160 bits. 2013-06-02 16:54:02 +02:00
terrafrost
dc76cf5b8e SSH2: add $callable parameter to exec() 2013-05-28 17:02:27 -05:00
terrafrost
6fdac04fd1 SSH2: fix broken grammer from next to last commit
Thanks, bantu!
2013-05-14 17:15:23 -05:00
terrafrost
742fbc188f SSH2: return false (without error) on channel failure
Also update error message. SFTP, for example, makes a channel request even though it's not asking to open a pseudo-terminal.
2013-05-14 16:16:06 -05:00
terrafrost
40af708254 Merge pull request #106 from petrich/optimizations
Optimizations
2013-05-14 08:35:31 -07:00
terrafrost
1e2d0ccd9f SSH2: window size is server -> client, not client -> server 2013-05-13 22:37:32 -05:00
Hans-Jürgen Petrich
b242259d17 optimizations 2013-05-13 12:41:52 +07:00
terrafrost
06044e8632 SSH2: 0x7FFFFFFF == 2GB not 4GB 2013-05-10 16:48:10 -05:00
terrafrost
a48871a865 SSH2: realtime_file logging update 2013-05-10 17:45:57 -04:00
terrafrost
aa3e6c1a99 SSH2: rm last commit; _get_channel_packet() takes care of this lol 2013-05-08 15:13:18 -04:00
terrafrost
b440708a7b SSH2: check response in exec() 2013-05-08 11:44:34 -05:00
Hans-Jürgen Petrich
fe0cc95265 SSH2: Blowfish: typo... block_size adjustment
Changed: Blowfish block_size = 8
re: https://github.com/phpseclib/phpseclib/pull/100
2013-05-08 13:52:18 +07:00
terrafrost
e3a2772c30 SSH2: Add Crypt_Blowfish 2013-05-07 23:17:17 -05:00
Hans-Jürgen Petrich
a83166fe48 SSH2: Typo (Twofish related..)
Typo...
2013-05-05 08:59:44 +07:00
terrafrost
5dda3a088f SSH2: Twofish typos 2013-05-04 13:55:51 -05:00
terrafrost
2c43e9151c SSH2: add twofish support 2013-05-03 01:45:09 -05:00
terrafrost
3230a7b1f7 SSH2: Add getBannerMessage() function 2013-04-27 19:58:24 -05:00
terrafrost
8cecaf2d2b SSH2: another CS adjustment 2013-04-27 14:12:59 -05:00
terrafrost
04f5a28bff SSH2: CS adjustments 2013-04-27 14:10:36 -05:00
terrafrost
d6ee41d957 SSH2: fix E_NOTICE in keyboard interactive code
Thanks ravage84!
2013-04-24 01:07:32 -05:00
terrafrost
292340cdd5 SSH2: Improve timeout handling
(thanks, SergeyTsalkov!)
2013-04-20 20:43:05 -05:00
terrafrost
e0abab9bb4 SSH2: keyboard-interactive changes
Let's say your SSH server had a two-part keyboard-interactive auth. One prompt is for "Password" and the other is for "Verification code". Previously you'd have to do this:

$ssh->login($username, 'pass1', 'code1');

It'd try password authentication with pass1, fail, then do keyboard-interactive with pass1 and then keyboard-interacitve with code1.

ie. the order in which it tried stuff was dependent on the order it was past to the Net_SSH2 object.  And it'd always try password auth first.

Now you can go straight to keyboard-interactive and mix the order as follows:

$ssh->login($username, array('Password' => 'pass1'), array('Verification code' => 'code1'));
2013-04-20 14:35:08 -05:00
terrafrost
04c24f6bbc SSH2: More multi-factor authentication changes
Previously to do multi-factor authentication you'd have to do this:

$ssh->login($user, 'pass1');
$ssh->login($user, 'pass2');

Now you can do this too:

$ssh->login($user, 'pass1', 'pass2');
2013-04-20 14:33:07 -05:00
terrafrost
ccd4ce1d19 SSH2: add support for multi-factor authentication 2013-04-19 22:23:06 -05:00