From c3ef93a99a7ffea0e3314c5672a5031187301ab9 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Fri, 18 Nov 2022 16:41:24 +0330 Subject: tsocks and zsh prompt update --- .zshrc | 12 +++++++++++- devi.zsh-theme | 38 ++++++++++++++++++++++++++------------ tsocks/tsocks.conf | 7 +++++++ 3 files changed, 44 insertions(+), 13 deletions(-) create mode 100644 tsocks/tsocks.conf diff --git a/.zshrc b/.zshrc index ff0fae0..732386f 100644 --- a/.zshrc +++ b/.zshrc @@ -23,6 +23,8 @@ eval `dircolors ~/.dir_colors` unalias dr alias gd="git diff --color-words" +# enable aliases with sudo in the alias +alias sudo="sudo " alias w3m="proxychains4 -q -f ~/proxies/ice/proxychains.conf /home/devi/w3m/w3m -o auto_image=FALSE -graph" alias rm="rm -I --one-file-system --preserve-root=all" alias vv="vim" @@ -104,6 +106,7 @@ alias vpn2="proxychains4 -q -f ~/proxies/ice/proxychains.conf ssh 145.239.165.13 alias vpn3="proxychains4 -q -f ~/proxies/ice/proxychains.conf ssh root@185.112.147.110 -p 2022" alias vpn6="proxychains4 -q -f ~/proxies/ice/proxychains.conf ssh -p 3333 ubuntu@185.130.45.46" alias vpn7="proxychains4 -q -f ~/proxies/ice/proxychains.conf ssh -p 3333 ubuntu@185.130.47.81" +alias vpn8="proxychains4 -q -f ~/proxies/ice/proxychains.conf ssh -p 3333 ubuntu@185.130.47.208" alias vms="proxychains4 -q -f ~/proxies/ice/proxychains.conf ssh 185.126.202.69 -l ubuntu -p 1022" alias cloud_one="proxychains4 -q -f ~/proxies/ice/proxychains.conf ssh 130.185.121.80 -l ubuntu -p 1022" alias pytags="ctags --fields=+l --languages=python --python-kinds=-iv -R ." @@ -175,7 +178,8 @@ alias wincmd="/mnt/c/Windows/System32/runas.exe /profile /user:administrator cmd alias xonshrc="vim ~/scripts/.xonshrc" alias fixxonshrc="cp ~/scripts/.xonshrc ~/.xonshrc" alias deviphone="ssh u0_a601@deviphone.lan -p 8022" -alias rpiz2="ssh 192.168.1.116 -l pi" +alias rpiz2="ssh 192.168.1.205 -l pi" +alias rpiz13="ssh 192.168.1.101 -l root" alias moshvpn="mosh rooot@192.99.102.52 --ssh='ssh -p 1022'" alias moshvps="mosh ubuntu@terminaldweller.com --ssh='ssh -p 1022'" alias proxychainsrc="vim ~/scripts/.proxychains/proxychains.conf" @@ -193,6 +197,7 @@ alias socks5vpn4="autossh -M 0 -N -D 9994 -o ServerAliveInterval=180 -o ServerAl alias socks5vpn5="autossh -M 0 -N -D 0.0.0.0:9990 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l ubuntu -p 3333 185.130.45.46" alias socks5vpn6="autossh -M 0 -N -D 9993 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -6 -l ubuntu -p 3333 2a07:e01:3:204::1" alias socks5vpn7="autossh -M 0 -N -D 9992 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l ubuntu -p 3333 130.185.47.81" +alias socks5vpn8="autossh -M 0 -N -D 0.0.0.0:9989 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l ubuntu -p 3333 185.130.47.208" alias k9sskin="vim ~/scripts/.k9s/skin.yml" alias k9sconfig="vim ~/scripts/.k9s/config.yml" alias fixk9sskin="cp ~/scripts/.k9s/skin.yml ~/.config/k9s/skin.yml" @@ -279,11 +284,16 @@ alias hive_node_1="ssh ubuntu@95.217.143.98" alias ca_proxy="proxychains4 -q -f ~/proxies/ca/proxychains.conf" alias fr_proxy="proxychains4 -q -f ~/proxies/fr/proxychains.conf" alias nd_proxy="proxychains4 -q -f ~/proxies/nd/proxychains.conf" +alias nd2_proxy="proxychains4 -q -f ~/proxies/nd2/proxychains.conf" alias swe_proxy="proxychains4 -q -f ~/proxies/swe/proxychains.conf" alias ir_proxy="proxychains4 -q -f ~/proxies/ir/proxychains.conf" alias ice_proxy="proxychains4 -q -f ~/proxies/ice/proxychains.conf" +alias tor_carrier_proxy="proxychains4 -q -f ~/proxies/tor_carrier/proxychains.conf" alias glow="glow -s ~/.config/glow/dark.json -p" alias nmap="grc nmap" +alias fdisk="grc fdisk" +alias blkid="grc blkid" +alias b="buku --suggest" # change the 4th terminal color to #0000ff # echo -e '\e]P40000ff' diff --git a/devi.zsh-theme b/devi.zsh-theme index 5d4507e..49d50db 100644 --- a/devi.zsh-theme +++ b/devi.zsh-theme @@ -37,6 +37,7 @@ if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then muckgreen="%F{29}" batgreen="%F{76}" batred="%F{88}" + tsocks="%F{132}" purblue="%F{69}" swampgreen="%F{64}" purple4="%F{54}" @@ -156,6 +157,25 @@ add-zsh-hook precmd steeef_precmd # } # add-zsh-hook precmd guess_who +tsocks_on() { + if echo $LD_PRELOAD | grep libtsocks > /dev/null 2>&1; then + # echo -ne "\x1b[38;5;0m\x1b[48;5;22m$reset_color\x1b[38;5;22m" + echo "%K{22}%F{0}$reset_color%F{22}" + else + echo "$reset_color" + ; + fi +} + +sudo_query() { + if sudo -nv > /dev/null 2>&1; then + echo "%K{33}%F{0}%K{0}%F{33} " + else + echo "$reset_color" + fi +} + + time_function() { date | gawk '{print $2" "$3" "$4}' } @@ -170,20 +190,14 @@ ruby_version() { echo " <$version>" } -sudo_query() { - sudo -nv > /dev/null 2>&1 - if [[ $? == 0 ]]; then - #echo  - echo " " +dir_writeable() { + if [ -w $(pwd) ]; then + echo "$reset_color" else - ; + echo " %K{196}%F{0}$reset_color%F{196}" fi } -dir_writeable() { - if [ -w $(pwd) ]; then :;else echo " ";fi -} - sneaky() { if [[ $! -ne 0 ]]; then echo " $!" @@ -272,9 +286,9 @@ getterminal() { rbq_info_msg="" -PS1=$'%{$new2%}$(sudo_query)%{$reset_color%}%{$yablue%}%n@%M:$(getterminal)%{$reset_color%} %{$yagreen%}$(pwd_shortened)%{$reset_color%} %{$muckgreen%}$(time_function)%{$reset_color%}$vcs_info_msg_0_%{$limblue%}%{$gnew%}$(gitadditions)%{$gnew2%}$(gitdeletions)%{$reset_color%}%{$deeppink%}$(virtualenv_info)%{$reset_color%}%{$teal%}$(node_version)%{$reset_color%}%{$gover%}$(goversion)%{$reset_color%}%{$rust%}$(rustversion)%{$reset_color%}%{$babyblue%}$(ruby_version)%{$reset_color%}%{$sneakyc%}$(sneaky)%{$reset_color%}%{$new%}$rbq_info_msg%{$reset_color%} $(getkubernetesinfo)%{$batred%}$(dir_writeable)%{$reset_color%}' +PS1=$'%{$reset_color%}$(dir_writeable)$(tsocks_on)$(sudo_query)%{$reset_color%} %{$yablue%}%n@%M:$(getterminal)%{$reset_color%} %{$yagreen%}$(pwd_shortened)%{$reset_color%} %{$muckgreen%}$(time_function)%{$reset_color%}$vcs_info_msg_0_%{$limblue%}%{$gnew%}$(gitadditions)%{$gnew2%}$(gitdeletions)%{$reset_color%}%{$deeppink%}$(virtualenv_info)%{$reset_color%}%{$teal%}$(node_version)%{$reset_color%}%{$gover%}$(goversion)%{$reset_color%}%{$rust%}$(rustversion)%{$reset_color%}%{$babyblue%}$(ruby_version)%{$reset_color%}%{$sneakyc%}$(sneaky)%{$reset_color%}%{$new%}$rbq_info_msg%{$reset_color%} $(getkubernetesinfo)%{$reset_color%}' PS2=$'' -PS3=$'\n%{$randomblue%}--➜%{$reset_color%}' +PS3=$'\n%{$randomblue%}--➜%{$reset_color%} ' get_prompt_len() { local zero='%([BSUbfksu]|([FK]|){*})' local FOOLENGTH=${#${(S%%)PS1//$~zero/}} diff --git a/tsocks/tsocks.conf b/tsocks/tsocks.conf new file mode 100644 index 0000000..06ddaf8 --- /dev/null +++ b/tsocks/tsocks.conf @@ -0,0 +1,7 @@ + +server = 127.0.0.1 +server_port = 9995 +server_type = 5 +local = 192.168.0.0/255.255.0.0 +local = 10.0.0.0/255.0.0.0 +local = 172.16.0.0/255.240.0.0 -- cgit v1.2.3