Open oceans1908 opened 1 year ago
Hi @oceans1908, what shell is being used on the remote machine?
I don’t know, as Cisco is proprietary software. It runs Linux but you don’t have shell access only a command line made by Cisco.On 22 Nov 2022, at 18:00, David Stern @.***> wrote: Hi @oceans1908, what shell is being used on the remote machine?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
If you ssh into it without Warp's SSH wrapper (either by disabling it, using /usr/bin/ssh
directly, or using a different terminal), what is the output of running echo $SHELL
?
rc3core1# echo $SHELL$SHELLrc3core1#There is a option to go to bash-shell from the cisco command prompt, but only after ssh to the cisco command line. The cisco command line is an application that runs on Linux.On 22 Nov 2022, at 21:29, David Stern @.***> wrote: If you ssh into it without Warp's SSH wrapper (either by disabling it, using /usr/bin/ssh directly, or using a different terminal), what is the output of running echo $SHELL?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
If you ssh into it without Warp's SSH wrapper (either by disabling it, using
/usr/bin/ssh
directly, or using a different terminal), what is the output of runningecho $SHELL
?
This question assumes that the OS will run a UNIX-like shell, which is not the case on most (all?) networking equipment. The shell accessed after entering credentials in the SSH session on NX-OS, IOS, ... doesn't resemble bash, zsh or fish. Rather, it will have a fix set of commands mostly related to the networking features of the device ("show version", "show mac address-table", "conf t > interface ethx/y > no shut"...).
Also, most don't have environment variable in the sense used in a UNIX shell.
For example, in vsh (NX-OS):
# echo $SHELL
$SHELL
Warp should fallback to default SSH behaviour when it doesn't get an expected output from "echo $SHELL".
@tdebruyn The comment "you don’t have shell access only a command line made by Cisco" by @oceans1908 clued me into the fact that it wouldn't be a typical Unix shell. I was curious for the output of echo $SHELL
specifically to understand what might be possible with respect to graceful fallback mechanisms.
Given that it is very much not a typical Unix shell - would you be willing to suggest a means by which we could safely perform a comparison between the output of echo $SHELL
and an expected result? What syntax is available (if any) for testing equality between a string literal and the output of a command?
Hi, Just thought I would chime in here. This is a well know issue with Cisco devices and why standard ssh libraries in python like Paramiko have been extended with libraries like Netmiko. The Cisco SSH service doesn't use the typical modern approach to SSH and requires an interactive ssh session in tty style. The trick is to add a -t
when using ssh.
only issue I have now with Cisco is that when I do get my interactive session up and connected, warp throws a bunch of shell commands. I'm new to warp, so there is likely a way to change that behavior? Note that when I ssh using just iterm or terminal on mac or putty in windows, I don't have to supply the -t
option. But it solves the channel being closed in warp terminal when connecting to Cisco devices.
Evidence:
ssh -t asa
ahackney@172.30.4.101's password:
User ahackney logged in to Austin
Logins over the last 33 days: 21. Last login: 23:19:56 UTC Feb 26 2024 from 172.30.3.104
Failed logins since the last login: 0. Last failed login: 20:47:36 UTC Feb 16 2024 from 172.30.3.104
Type help or '?' for a list of available commands.
Austin#
Austin# export TERM_PROGRAM='WarpTerminal'
^
ERROR: % Invalid input detected at '^' marker.
Austin# hook=$(printf "{\"hook\": \"SSH\", \"value\": {\"socket_path\": \"~/.s$
hook=$(printf "{\"hook\": \"SSH\", \"value\": {\"socket_path\": \"~/.ssh/1708989 ^5441723\", \"remote_shell\": \"%s\"}}" "${SHELL##*/}" | command -p od -An -v -tx
1 | command -p tr -d " \n")
ERROR: % Invalid input detected at '^' marker.
Austin# printf '$d%s' $hook
^
ERROR: % Invalid input detected at '^' marker.
Austin# if test "${SHELL##*/}" != "bash" -a "${SHELL##*/}" != "zsh"; then
^
ERROR: % Invalid input detected at '^' marker.
Austin# if test ! -e $HOME/.hushlogin; then
^
ERROR: % Invalid input detected at '^' marker.
Austin# if test -r /etc/motd; then
^
ERROR: % Invalid input detected at '^' marker.
Austin# command -p cat /etc/motd
^
ERROR: % Invalid input detected at '^' marker.
Austin# elif test -r /run/motd; then
^
ERROR: % Invalid input detected at '^' marker.
Austin# command -p cat /run/motd
^
ERROR: % Invalid input detected at '^' marker.
Austin# elif test -r /run/motd.dynamic; then
^
ERROR: % Invalid input detected at '^' marker.
Austin# command -p cat /run/motd.dynamic
^
ERROR: % Invalid input detected at '^' marker.
Austin# elif test -r /usr/lib/motd; then
^
ERROR: % Invalid input detected at '^' marker.
Austin# command -p cat /usr/lib/motd
^
ERROR: % Invalid input detected at '^' marker.
Austin# elif test -r /usr/lib/motd.dynamic; then
^
ERROR: % Invalid input detected at '^' marker.
Austin# command -p cat /usr/lib/motd.dynamic
^
ERROR: % Invalid input detected at '^' marker.
Austin# fi
ERROR: % Incomplete command
Austin# fi
ERROR: % Incomplete command
Austin# if test -r /etc/profile; then
^
ERROR: % Invalid input detected at '^' marker.
Austin# . /etc/profile
^
ERROR: % Invalid input detected at '^' marker.
Austin# fi
ERROR: % Incomplete command
Austin# exec $SHELL
^
ERROR: % Invalid input detected at '^' marker.
Austin# fi
ERROR: % Incomplete command
Austin# case ${SHELL##*/} in
^
ERROR: % Invalid input detected at '^' marker.
Austin# bash)
^
ERROR: % Invalid input detected at '^' marker.
Austin# exec -a bash bash --rcfile <(echo '
^
ERROR: % Invalid input detected at '^' marker.
Austin# command -p stty raw
^
ERROR: % Invalid input detected at '^' marker.
Austin# HISTCONTROL=ignorespace
^
ERROR: % Invalid input detected at '^' marker.
Austin# HISTIGNORE=" *"
^
ERROR: % Invalid input detected at '^' marker.
Austin# WARP_SESSION_ID="$(command -p date +%s)$RANDOM"
^
ERROR: % Invalid input detected at '^' marker.
Austin# WARP_COMBINED_PROMPT_COMMAND_GRID="0"
^
ERROR: % Invalid input detected at '^' marker.
Austin# WARP_HONOR_PS1="0"
^
ERROR: % Invalid input detected at '^' marker.
Austin# _hostname=$(command -pv hostname >/dev/null 2>&1 && command -p hostna$
_hostname=$(command -pv hostname >/dev/null 2>&1 && command -p hostname 2>/dev/ ^null || command -p uname -n)
ERROR: % Invalid input detected at '^' marker.
Austin# _user=$(command -pv whoami >/dev/null 2>&1 && command -p whoami 2>/de$
_user=$(command -pv whoami >/dev/null 2>&1 && command -p whoami 2>/dev/null || ^echo $USER)
ERROR: % Invalid input detected at '^' marker.
Austin# _msg=$(printf "{\"hook\": \"InitShell\", \"value\": {\"session_id\": $
_msg=$(printf "{\"hook\": \"InitShell\", \"value\": {\"session_id\": $WARP_SESS ^ION_ID, \"shell\": \"bash\", \"user\": \"$_user\", \"hostname\": \"$_hostname\"}
}" | command -p od -An -v -tx1 | command -p tr -d " \n")
ERROR: % Invalid input detected at '^' marker.
Austin# printf '\''\eP$d%s\x9c'\'' "$_msg"'
^
ERROR: % Invalid input detected at '^' marker.
Austin# unset _hostname _user _msg
^
ERROR: % Invalid input detected at '^' marker.
Austin# )
^
ERROR: % Invalid input detected at '^' marker.
Austin# ;;
Austin# zsh) WARP_TMP_DIR=$(command -p mktemp -d warptmp.XXXXXX)
^
ERROR: % Invalid input detected at '^' marker.
Austin# $6f6d6d616e64202d70762077686f616d69203e2f6465762f6e756c6c20323e263120
ERROR: Input line size exceeded available buffer (510 characters)
Austin# local WARP_COMBINED_PROMPT_COMMAND_GRID='0'
^
ERROR: % Invalid input detected at '^' marker.
Austin# local WARP_HONOR_PS1='0'
^
ERROR: % Invalid input detected at '^' marker.
Austin# if [[ $?
ERROR: % Unrecognized command
Austin# if [[ $ == 0 ]]; then
^
ERROR: % Invalid input detected at '^' marker.
Austin# if command -pv xxd >/dev/null 2>&1; then
^
ERROR: % Invalid input detected at '^' marker.
Austin# echo $ZSH_ENV_SCRIPT | command -p xxd -p -r > $WARP_TMP_DIR/.zshenv
^
ERROR: % Invalid input detected at '^' marker.
Austin# else
^
ERROR: % Invalid input detected at '^' marker.
Austin# for i in {0..$((${#ZSH_ENV_SCRIPT} - 1))..2}; do
^
ERROR: % Invalid input detected at '^' marker.
Austin# builtin printf "\x${ZSH_ENV_SCRIPT:$i:2}"
^
ERROR: % Invalid input detected at '^' marker.
Austin# done > $WARP_TMP_DIR/.zshenv
^
ERROR: % Invalid input detected at '^' marker.
Austin# fi
ERROR: % Incomplete command
Austin# else
^
ERROR: % Invalid input detected at '^' marker.
Austin# echo "Failed to bootstrap warp. Continuing with a non-bootstrapped sh$
echo "Failed to bootstrap warp. Continuing with a non-bootstrapped shell."
^
ERROR: % Invalid input detected at '^' marker.
Austin# fi
ERROR: % Incomplete command
Austin# TMPPREFIX=$HOME/.zshtmp- WARP_SSH_RCFILES=${ZDOTDIR:-$HOME} WARP_COMB$
TMPPREFIX=$HOME/.zshtmp- WARP_SSH_RCFILES=${ZDOTDIR:-$HOME} WARP_COMBINED_PROMP ^T_COMMAND_GRID=$WARP_COMBINED_PROMPT_COMMAND_GRID WARP_HONOR_PS1=$WARP_HONOR_PS1
ZDOTDIR=$WARP_TMP_DIR exec -l zsh -g
ERROR: % Invalid input detected at '^' marker.
Austin# ;;
Austin# esac
^
ERROR: % Invalid input detected at '^' marker.
Austin#
Austin# show ip
System IP Addresses:
Interface Name IP address Subnet mask Method
GigabitEthernet0/0 outside 172.16.211.101 255.255.255.0 CONFIG
GigabitEthernet0/1 inside 192.168.11.1 255.255.255.0 CONFIG
GigabitEthernet0/2 dmz 192.168.22.1 255.255.255.0 CONFIG
Management0/0 management 172.30.4.101 255.255.255.0 CONFIG
Current IP Addresses:
Interface Name IP address Subnet mask Method
GigabitEthernet0/0 outside 172.16.211.101 255.255.255.0 CONFIG
GigabitEthernet0/1 inside 192.168.11.1 255.255.255.0 CONFIG
GigabitEthernet0/2 dmz 192.168.22.1 255.255.255.0 CONFIG
Management0/0 management 172.30.4.101 255.255.255.0 CONFIG
Austin#
ok, read the docs on disabling the warp shell extras and all working good with Cisco now even without the -t
command ssh asa
ahackney@172.30.4.101's password:
User ahackney logged in to Austin
Logins over the last 33 days: 23. Last login: 01:16:17 UTC Feb 27 2024 from 172.30.3.104
Failed logins since the last login: 0. Last failed login: 20:47:36 UTC Feb 16 2024 from 172.30.3.104
Type help or '?' for a list of available commands.
Austin# show ip
System IP Addresses:
Interface Name IP address Subnet mask Method
GigabitEthernet0/0 outside 172.16.211.101 255.255.255.0 CONFIG
GigabitEthernet0/1 inside 192.168.11.1 255.255.255.0 CONFIG
GigabitEthernet0/2 dmz 192.168.22.1 255.255.255.0 CONFIG
Management0/0 management 172.30.4.101 255.255.255.0 CONFIG
Current IP Addresses:
Interface Name IP address Subnet mask Method
GigabitEthernet0/0 outside 172.16.211.101 255.255.255.0 CONFIG
GigabitEthernet0/1 inside 192.168.11.1 255.255.255.0 CONFIG
GigabitEthernet0/2 dmz 192.168.22.1 255.255.255.0 CONFIG
Management0/0 management 172.30.4.101 255.255.255.0 CONFIG
Austin#
Discord username (optional)
No response
Local Shell and Version
rc3core1# echo $BASH_VERSION $BASH_VERSION rc3core1# echo $ZSH_VERSION $ZSH_VERSION rc3core1#
Remote Shell and Version
rc3core1# echo $BASH_VERSION $BASH_VERSION rc3core1# echo $ZSH_VERSION $ZSH_VERSION rc3core1#
Operating System and Version
Cisco Nexus 6
Warp Version
V0.2022.11.14.14.15.stable_01
I have tried commenting out my system & user rcfiles and warp still will not bootstrap
Screenshots
Syntax error while parsing ' export TERM_PROGRAM='WarpTerminal' hook=$(printf "{\"hook\": \"SSH\", \"value\": {\"socket_path\": \"~/.ssh/166910255717603\", \"user\": \"%s\", \"machine\": \"%s\", \"remote_shell\": \"%s\"}}" $(whoami) $(hostname) ${SHELL##/} | command od -An -v -tx1 | command tr -d " \n") printf '' $hook if test "${SHELL##/}" != "bash" -a "${SHELL##*/}" != "zsh"; then exec $SHELL fi
case ${SHELL##*/} in bash) exec -a bash bash --rcfile <(echo 'set -o vi; set +o vi; HISTCONTROL=ignorespace; printf '\'' defined in the precmd_functions array. __bp_precmd_invoke_cmd() {
Save the returned value from our last command, and from each process in
zsh: command not found: defined bp_precmd_invoke_cmd() { function> # Save the returned value from our last command, and from each process in function> # its pipeline. Note: this MUST be the first thing done in this function. function> bp_last_ret_value="$?" BP_PIPESTATUS=("${PIPESTATUS[@]}") function> function> # Don't invoke precmds if we are inside an execution of an "original function> # prompt command" by another precmd execution loop. This avoids infinite function> # recursion. function> if (( bp_inside_precmd > 0 )); then function then> return function then> fi function> local bp_inside_precmd=1 function> function> # Invoke every function defined in our function array. function> local precmd_function function> for precmd_function in "${precmd_functions[@]}"; do function for> function for> # Only execute this function if it actually exists. function for> # Test existence of functions with: declare -[Ff] function for> if type -t "$precmd_function" 1>/dev/null; then function for then> bp_set_ret_value "$bp_last_ret_value" " __bp_set_ret_value " # Quote our function invocation to prevent issues with IFS function for then> "$precmd_function" function for then> fi function for> done function> }
function> return ${1:-} function> }
function> function> local prompt_command_array function> IFS=$'\n;' read -rd '' -a prompt_command_array <<< "${PROMPT_COMMAND:-}" function> function> local trimmed_arg function> bp_trim_whitespace trimmed_arg "${1:-}" function> function> local command trimmed_command function> for command in "${prompt_command_array[@]:-}"; do function for> bp_trim_whitespace trimmed_command "$command" function for> if [[ "$trimmed_command" == "$trimmed_arg" ]]; then function for then> return 0 function for then> fi function for> done function> function> return 1 function> }
Include shell xtrace output
WARP_DEBUG_MODE=1 ssh xxxxxxx 3
WARNING! You are entering into a system that is owned by iRN! Your IP, Login Time, Username has been noted. This service is restricted to authorized users only. All activities on this system are logged. Unauthorized access will be fully investigated and reported to the appropriate law enforcement agencies. (xxxx@rc3core1.nl.irn) Password: Syntax error while parsing '3'
Cmd exec error.
Warp Internal (ignore) - linear-label:e7dfaa84-5fdb-4a00-b754-d8912da923fa
Ignore