theGuildHall / pwnbox

Instructions on how to create your very own Pwnbox, originally created by HTB
382 stars 71 forks source link

Tmux misinterpret special characters #11

Closed yash-saini275 closed 4 years ago

yash-saini275 commented 4 years ago

I tried this customization on latest version of parrot os. It works fine on bash shell. But when I open the tmux session ┌── this is misinterpreted as ____(4 dashes).

theGuildHall commented 4 years ago

Hi there,

Basically tmux is using a different PS1 variable from your .bashrc file.

In your .bashrc file, look for this line:

if [ "$color_prompt" = yes ]; then
    PS1="\[\033[1;32m\]\342\224\214\342\224\200$([[ $(/opt/vpnbash.sh) == *"10."* ]] && echo "[\[\033[1;34m\]$(/opt/vpnserver.sh)\[\033[1;32m\]]\342\224\200[\[\033[1;37m\]$(/opt/vpnbash.sh)\[\033[1;32m\]]\342\224\200")[\[\033[1;37m\]\u\[\033[01;32m\]@\[\033[01;34m\]\h\[\033[1;32m\]]\342\224\200[\[\033[1;37m\]\w\[\033[1;32m\]]\n\[\033[1;32m\]\342\224\224\342\224\200\342\224\200\342\225\274 [\[\e[01;33m\]??\[\e[01;32m\]]\\$ \[\e[0m\]"
else
    PS1='┌──[\u@\h]─[\w]\n└──╼ \$ '
fi

And what you need to do is update both PS1 variables. This is where your terminal prompt gets its style from, so you can put almost anything there. Replace those lines with this:

if [ "$color_prompt" = yes ]; then
    PS1="\[\033[1;32m\]\342\224\200$([[ $(/opt/vpnbash.sh) == *"10."* ]] && echo "[\[\033[1;34m\]$(/opt/vpnserver.sh)\[\033[1;32m\]]\342\224\200[\[\033[1;37m\]$(/opt/vpnbash.sh)\[\033[1;32m\]]\342\224\200")[\[\033[1;37m\]\u\[\033[01;32m\]@\[\033[01;34m\]\h\[\033[1;32m\]]\342\224\200[\[\033[1;37m\]\w\[\033[1;32m\]]\$\[\e[0m\]"
else
    PS1="\[\033[1;32m\]\342\224\200$([[ $(/opt/vpnbash.sh) == *"10."* ]] && echo "[\[\033[1;34m\]$(/opt/vpnserver.sh)\[\033[1;32m\]]\342\224\200[\[\033[1;37m\]$(/opt/vpnbash.sh)\[\033[1;32m\]]\342\224\200")[\[\033[1;37m\]\u\[\033[01;32m\]@\[\033[01;34m\]\h\[\033[1;32m\]]\342\224\200[\[\033[1;37m\]\w\[\033[1;32m\]]\$\[\e[0m\]"

That should work for you

yash-saini275 commented 4 years ago

No it still persists. I guess its related to some character encoding. I am using 3.1b version of tmux and they have done something with character encoding. tmux_config

And if i open tmux in vscode it works fine there is no misinterpretation of characters. So I think definitely it is related to characters.

yash-saini275 commented 4 years ago

I finally got the solution run tmux with -u flag. and it works fine. Or better create an alias as: alias tmux='tmux -u'.

theGuildHall commented 4 years ago

awesome! glad you figured it out. I'll keep note of it and see if anyone else has that issue