File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 4
4
5
5
skip = false
6
6
user = example
7
+ ; remove this options and enter a password in the terminal
7
8
pass = password
8
9
host = example.com
9
10
port = 21
10
11
path = /path/to/installation
11
12
passive = true
12
13
13
14
; If that seemed too long for you, you can specify servers like this:
14
- [ftp://example:password@example.com:21/path/to/installation]
15
+ [ftp://example:password@example.com:21/path/to/installation]
Original file line number Diff line number Diff line change @@ -617,7 +617,6 @@ class Config {
617
617
'host' => '',
618
618
'user' => '',
619
619
'branch' => null,
620
- 'pass' => '',
621
620
'port' => 21,
622
621
'path' => '/',
623
622
'passive' => true,
@@ -626,6 +625,10 @@ class Config {
626
625
'upload_untracked' => array()
627
626
), $options);
628
627
628
+ if (!isset($options['pass'])) {
629
+ $options['pass'] = self::promptPassword();
630
+ }
631
+
629
632
if ($options['skip']) {
630
633
continue;
631
634
} else {
@@ -639,6 +642,24 @@ class Config {
639
642
return $return;
640
643
}
641
644
645
+ public static function promptPassword() {
646
+ $prompt = 'Enter ftp password: ';
647
+
648
+ $command = "/usr/bin/env bash -c 'echo OK'";
649
+ if (rtrim(shell_exec($command)) !== 'OK') {
650
+ trigger_error("Can't invoke bash");
651
+ return;
652
+ }
653
+
654
+ $command = "/usr/bin/env bash -c 'read -s -p \""
655
+ . addslashes($prompt)
656
+ . "\" mypassword && echo \$mypassword'";
657
+ $password = rtrim(shell_exec($command));
658
+ echo "\n";
659
+
660
+ return $password;
661
+ }
662
+
642
663
}
643
664
644
665
#### PHP SEC LIB 0.3.5
@@ -32098,4 +32119,4 @@ class Net_SSH2 {
32098
32119
}
32099
32120
}
32100
32121
32101
- main();
32122
+ main();
You can’t perform that action at this time.
0 commit comments