Linux iad1-shared-b7-18 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
Apache
: 67.205.6.31 | : 216.73.216.47
Cant Read [ /etc/named.conf ]
8.2.29
fernandoquevedo
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
share /
doc /
zsh-common /
examples /
[ HOME SHELL ]
Name
Size
Permission
Action
Functions
[ DIR ]
drwxr-xr-x
Misc
[ DIR ]
drwxr-xr-x
old
[ DIR ]
drwxr-xr-x
carstenh.zshrc
14.89
KB
-rw-r--r--
reporter
10.33
KB
-rw-r--r--
ssh_completion
2.52
KB
-rw-r--r--
ssh_completion2
1.41
KB
-rw-r--r--
zlogin
581
B
-rw-r--r--
zshenv
1.53
KB
-rw-r--r--
zshrc
5.23
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : ssh_completion
NOTE: In order for this to work with newer versions of ssh, you must insure that "HashKnownHosts" is set to "no". This will set the variable $hosts to an array containing all the hosts in ~/.ssh/known_hosts and ~/.ssh/known_hosts2 that do not start with a digit. hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts <$HOME/.ssh/known_hosts2)"}:#[0-9]*}%%\ *}%%,*}) This will set the variable $hosts to an array containing all the hosts in ~/.ssh/known_hosts that do not start with a digit. hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*}) If you are using the new completion system, you can then place zstyle ':completion:*:hosts' hosts $hosts after compinit is autoloaded to use those anywhere hosts would be completed, or zstyle ':completion:*:complete:ssh:*:hosts' hosts $hosts to use those hosts to complete only ssh. An explanation of the $hosts assignment, written by Peter Stephenson, follows. $(<$HOME/.ssh/known_hosts) is a standard substitution: it simply takes the file and sticks it onto the command line at that point. "$(<$HOME/.ssh/known_hosts)" Now it's quoted, it doesn't do word splitting; we have the complete file as one word. From now on, we do nested substitutions: you just have to remember that ${${...}}, or ${${...}}, essentially does nothing but an ordinary parameter expansion --- the whole point is the extra bits tacked on with each extra set of braces. For example, we're now going to do ${(f)"$(<$HOME/.ssh/known_hosts)"} so we get the same answer, but with the effect of putting the (f) flag at the start, which splits the result of that into lines. So we now have the entire file as an array, one line per element. ${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*} (Clint says the ^ shouldn't be there) says take the array elements (= lines of the original file) which completely match [0-9]*, i.e. elements beginning with a digit, and remove them, which is what ${...:#...} is for. ${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *} takes the result of that, and strips off from the end the largest pattern matching ' *', i.e. a space followed by anything else, in other words it leaves the largest initial string with no whitespace, which is a hostname (this is a standard ${...%%...} which even ordinary shells do, although not nested). ${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*} does another strip at the end, this time for everything from the first comma on. If there wasn't a comma, nothing changes. You could have combined the last two as ${...%%[[:blank:],]*}, or something.
Close