偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

命令行樂(lè)趣:嘲諷輸錯(cuò)Bash命令的用戶(hù)

系統(tǒng) Linux
你可以通過(guò)配置 sudo 命令去嘲諷輸入錯(cuò)誤密碼的用戶(hù)。但是現(xiàn)在,當(dāng)用戶(hù)在 shell 輸錯(cuò)命令時(shí),就能嘲諷他了(濫用?)。

[[224460]]

你可以通過(guò)配置 sudo 命令去嘲諷輸入錯(cuò)誤密碼的用戶(hù)。但是現(xiàn)在,當(dāng)用戶(hù)在 shell 輸錯(cuò)命令時(shí),就能嘲諷他了(濫用?)。

 

你好 bash-insulter

來(lái)自 Github 頁(yè)面:

當(dāng)用戶(hù)鍵入錯(cuò)誤命令,隨機(jī)嘲諷。它使用了一個(gè) bash4.x. 版本的全新內(nèi)置錯(cuò)誤處理函數(shù),叫 command_not_found_handle

 

安裝

鍵入下列 git 命令克隆一個(gè)倉(cāng)庫(kù):

  1. git clone https://github.com/hkbakke/bash-insulter.git bash-insulter

示例輸出:

  1. Cloning into 'bash-insulter'...
  2. remote: Counting objects: 52, done.
  3. remote: Compressing objects: 100% (49/49), done.
  4. remote: Total 52 (delta 12), reused 12 (delta 2), pack-reused 0
  5. Unpacking objects: 100% (52/52), done.

用文本編輯器,比如說(shuō)使用 vi,編輯你的 ~/.bashrc 或者 /etc/bash.bashrc 文件:

  1. $ vi ~/.bashrc

在其后追加這一行(具體了解請(qǐng)查看 if..else..fi 聲明source 命令):

  1. if [ -f $HOME/bash-insulter/src/bash.command-not-found ]; then
  2. source $HOME/bash-insulter/src/bash.command-not-found
  3. fi

保存并關(guān)閉文件。重新登錄,如果不想退出賬號(hào)也可以手動(dòng)運(yùn)行它:

  1. $ . $HOME/bash-insulter/src/bash.command-not-found

 

如何使用它?

嘗試鍵入一些無(wú)效命令:

  1. $ ifconfigs
  2. $ dates

示例輸出:

一個(gè)有趣的 bash 鉤子功能,嘲諷輸入了錯(cuò)誤命令的你。

一個(gè)有趣的 bash 鉤子功能,嘲諷輸入了錯(cuò)誤命令的你。

 

自定義

你需要編輯 $HOME/bash-insulter/src/bash.command-not-found

  1. $ vi $HOME/bash-insulter/src/bash.command-not-found

示例代碼:

  1. command_not_found_handle () {
  2. local INSULTS=(
  3. "Boooo!"
  4. "Don't you know anything?"
  5. "RTFM!"
  6. "Hahaha, n00b!"
  7. "Wow! That was impressively wrong!"
  8. "What are you doing??"
  9. "Pathetic"
  10. "...and this is the best you can do??"
  11. "The worst one today!"
  12. "n00b alert!"
  13. "Your application for reduced salary has been sent!"
  14. "lol"
  15. "u suk"
  16. "lol... plz"
  17. "plz uninstall"
  18. "And the Darwin Award goes to.... ${USER}!"
  19. "ERROR_INCOMPETENT_USER"
  20. "Incompetence is also competence"
  21. "Bad."
  22. "Fake it till you make it!"
  23. "What is this...? Amateur hour!?"
  24. "Come on! You can do it!"
  25. "Nice try."
  26. "What if... you type an actual command the next time!"
  27. "What if I told you... it is possible to type valid commands."
  28. "Y u no speak computer???"
  29. "This is not Windows"
  30. "Perhaps you should leave the command line alone..."
  31. "Please step away from the keyboard!"
  32. "error code: 1D10T"
  33. "ACHTUNG! ALLES TURISTEN UND NONTEKNISCHEN LOOKENPEEPERS! DAS KOMPUTERMASCHINE IST NICHT FÜR DER GEFINGERPOKEN UND MITTENGRABEN! ODERWISE IST EASY TO SCHNAPPEN DER SPRINGENWERK, BLOWENFUSEN UND POPPENCORKEN MIT SPITZENSPARKEN. IST NICHT FÜR GEWERKEN BEI DUMMKOPFEN. DER RUBBERNECKEN SIGHTSEEREN KEEPEN DAS COTTONPICKEN HÄNDER IN DAS POCKETS MUSS. ZO RELAXEN UND WATSCHEN DER BLINKENLICHTEN."
  34. "Pro tip: type a valid command!"
  35. )
  36.  
  37. # 設(shè)置“隨機(jī)”種子發(fā)生器
  38. RANDOM=$(date +%s%N)
  39. VALUE=$((${RANDOM}%2))
  40.  
  41. if [[ ${VALUE} -lt 1 ]]; then
  42. printf "\n $(tput bold)$(tput setaf 1)$(shuf -n 1 -e "${INSULTS[@]}")$(tput sgr0)\n\n"
  43. fi
  44.  
  45. echo "-bash: $1: command not found"
  46.  
  47. # 無(wú)效命令,常規(guī)返回已存在的代碼
  48. return 127
  49. }

 

贈(zèng)品:sudo 嘲諷

編輯 sudoers 文件:

  1. $ sudo visudo

追加下面這一行:

  1. Defaults insults

或者像下面尾行增加一句嘲諷語(yǔ):

  1. Defaults !lecture,tty_tickets,!fqdn,insults

這是我的文件:

  1. Defaults env_reset
  2. Defaults mail_badpass
  3. Defaults secure_path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
  4. ## If set, sudo will insult users when they enter an incorrect password. ##
  5. Defaults insults
  6.  
  7. # Host alias specification
  8.  
  9. # User alias specification
  10.  
  11. # Cmnd alias specification
  12.  
  13. # User privilege specification
  14. root ALL = (ALL:ALL) ALL
  15.  
  16. # Members of the admin group may gain root privileges
  17. % admin ALL = (ALL) ALL  
  18.  
  19. # Allow members of group sudo to execute any command
  20. % sudo ALL = (ALL:ALL) ALL  
  21.  
  22. # See sudoers(5) for more information on "#include" directives:
  23.  
  24. #includedir /etc/sudoers.d

試一試:

  1. $ sudo -k # 清除緩存,從頭開(kāi)始
  2. $ sudo ls /root/
  3. $ sudo -i

樣例對(duì)話(huà):

當(dāng)輸入錯(cuò)誤密碼時(shí),你會(huì)被一個(gè)有趣的的 sudo 嘲諷語(yǔ)戲弄。

當(dāng)輸入錯(cuò)誤密碼時(shí),你會(huì)被一個(gè)有趣的的 sudo 嘲諷語(yǔ)戲弄。

 

贈(zèng)品:你好 sl

sl 或是 UNIX 經(jīng)典搗蛋軟件 游戲。當(dāng)你錯(cuò)誤的把 ls 輸入成 sl,將會(huì)有一輛蒸汽機(jī)車(chē)穿過(guò)你的屏幕。

  1. $ sl

Linux / UNIX 桌面樂(lè)趣: 蒸汽機(jī)車(chē)

Linux / UNIX 桌面樂(lè)趣: 蒸汽機(jī)車(chē) 

責(zé)任編輯:龐桂玉 來(lái)源: Linux中國(guó)
相關(guān)推薦

2017-05-25 10:32:40

命令linux系統(tǒng)

2009-12-25 17:05:09

LINUX Bash

2018-08-22 09:40:27

2010-06-23 14:28:23

LINUX Bash

2012-05-14 11:20:13

Hyper-VPowerShell

2014-10-31 10:50:28

Linux命令行工具

2019-10-12 10:12:13

Bash命令行Linux

2014-06-17 10:02:58

Bash Getopt命令行

2015-07-01 09:15:46

linuxQuora命令行

2020-12-20 17:34:50

Linux命令行終端

2023-06-25 12:00:53

2010-11-24 15:16:12

MySQL命令行登陸

2021-08-30 07:50:42

腳本語(yǔ)言命令行

2015-06-16 10:36:45

Linux命令行

2020-12-10 16:16:08

工具代碼開(kāi)發(fā)

2020-12-11 06:44:16

命令行工具開(kāi)發(fā)

2018-03-29 08:30:48

Linux命令BASH

2010-11-16 13:40:52

Oracle命令行

2009-10-26 18:09:31

Oracle用戶(hù)解鎖

2010-10-12 17:08:16

MySQL命令行
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)