对于那些喜欢幽默的人,可以通过添加下面的行(使用命令,而不是手动编辑!)sudo
配置为打印随机或多或少侮辱或有趣的短语而不是中性短语:Sorry, try again.
/etc/sudoers
sudo visudo
Defaults insults
这里有些例子:
[sudo] password for bytecommander:
The more you drive -- the dumber you get.
[sudo] password for bytecommander:
I've seen penguins that can type better than that.
[sudo] password for bytecommander:
This mission is too important for me to allow you to jeopardize it.
[sudo] password for bytecommander:
He has fallen in the water!
[sudo] password for bytecommander:
Hold it up to the light --- not a brain in sight!
现在只是为了好玩,我想把它们全部读一遍,但整天输入错误的密码并不是最好的方法(每次尝试后延迟,每 3 次尝试只发送 2 条消息,3 次尝试后中止,...)。
那么……这些侮辱性的内容究竟存储在哪里?有我可以直接读取的纯文本文件吗?还是源代码中的硬编码字符串?
sudo
我如何才能获得所有可用的侮辱信息的列表?
答案1
它们位于二进制文件中
/usr/lib/sudo/sudoers.so
(发现者:find /usr/lib/sudo -type f | xargs grep "fallen in the water"
)
如果你启用源下载并
apt source sudo
您可以在以下源目录中找到侮辱文件
plugins/sudoers
这些文件是
ins_2001.h
ins_classic.h
ins_csops.h
ins_goons.h
insults.h
这些文件的示例如下:
#ifndef SUDOERS_INS_GOONS_H
#define SUDOERS_INS_GOONS_H
/*
* Insults from the "Goon Show."
*/
"You silly, twisted boy you.",
"He has fallen in the water!",
"We'll all be murdered in our beds!",
"You can't come in. Our tiger has got flu",
等等...它们非常易读。
答案2
自己制造侮辱
您可以更改 sudo 侮辱,而无需重新编译 sudo。
带有侮辱内容的头文件
当我们查看所有侮辱性言论时,我们发现了一个有趣的事实:说 Broccoli 是政治正确的,但说 Burrito 则不正确。所有侮辱性言论都列在下面。
ins_2001.h
(2001 太空漫游侮辱):
.
/*
* HAL insults (paraphrased) from 2001.
*/
"Just what do you think you're doing Dave?",
"It can only be attributed to human error.",
"That's something I cannot allow to happen.",
"My mind is going. I can feel it.",
"Sorry about this, I know it's a bit silly.",
"Take a stress pill and think things over.",
"This mission is too important for me to allow you to jeopardize it.",
"I feel much better now.",
ins_classic.h
(原文中 Sudo 8 的辱骂):
/*
* Insults from the original sudo(8).
*/
"Wrong! You cheating scum!",
#ifdef PC_INSULTS
"And you call yourself a Rocket Scientist!",
#else
"No soap, honkie-lips.",
#endif
"Where did you learn to type?",
"Are you on drugs?",
"My pet ferret can type better than you!",
"You type like i drive.",
"Do you think like you type?",
"Your mind just hasn't been the same since the electro-shock, has it?",
ins_csops.h
(CSOps 侮辱):
/*
* CSOps insults (may be site dependent).
*/
"Maybe if you used more than just two fingers...",
"BOB says: You seem to have forgotten your passwd, enter another!",
"stty: unknown mode: doofus",
"I can't hear you -- I'm using the scrambler.",
"The more you drive -- the dumber you get.",
#ifdef PC_INSULTS
"Listen, broccoli brains, I don't have time to listen to this trash.",
#else
"Listen, burrito brains, I don't have time to listen to this trash.",
#endif
"I've seen penguins that can type better than that.",
"Have you considered trying to match wits with a rutabaga?",
"You speak an infinite deal of nothing",
ins_goons.h
(Goon Show侮辱):
.
/*
* Insults from the "Goon Show."
*/
"You silly, twisted boy you.",
"He has fallen in the water!",
"We'll all be murdered in our beds!",
"You can't come in. Our tiger has got flu",
"I don't wish to know that.",
"What, what, what, what, what, what, what, what, what, what?",
"You can't get the wood, you know.",
"You'll starve!",
"... and it used to be so popular...",
"Pauses for audience applause, not a sausage",
"Hold it up to the light --- not a brain in sight!",
"Have a gorilla...",
"There must be cure for it!",
"There's a lot of it about, you know.",
"You do that again and see what happens...",
"Ying Tong Iddle I Po",
"Harm can come to a young lad like that!",
"And with that remarks folks, the case of the Crown vs yourself was proven.",
"Speak English you fool --- there are no subtitles in this scene.",
"You gotta go owwwww!",
"I have been called worse.",
"It's only your word against mine.",
"I think ... err ... I think ... I think I'll go home",
该文件insults.h
包含编译器指令,指示在编译的 sudo 程序中包含上述哪些侮辱性语句。事实上,您可以创建自己的侮辱性语句文件,将名称添加到 insults.h 并重新编译,以便显示诸如“什么,您是 ArchLinux 用户吗?”或“这不是 Windows,错误很常见!”等消息。
请注意#ifdef PC_INSULTS
一些侮辱性文件中的。这并不意味着“如果你有一台个人电脑”,而是“如果你想政治正确”。
列出所有对你的终端的侮辱
对于 Ubuntu 16.04.6 LTS 你可以使用以下命令:
strings /usr/lib/sudo/sudoers.so | head -n1670 | tail -n49
对于其他 Ubuntu 版本,传递给命令的行号head
可能会发生变化。希望其他人可以验证他们的版本。
答案3
和
dpkg -L sudo | xargs grep dumber
我们可以搜索包中哪些文件sudo
包含单词dumber
。
唯一匹配的是文件/usr/lib/sudo/sudoers.so
。这是一个二进制文件,所以我们使用命令strings
只获取看起来可读的内容。由于内容很多,我们将结果输入到less
:
strings /usr/lib/sudo/sudoers.so | less
我们less
可以使用
/dumber
再次搜索单词“dumber”。这样我们就能直接看到辱骂的内容。使用光标键上下滚动,然后使用q
答案4
除了其他答案之外,侮辱似乎出现在.rodata
sudoers.so 部分。您可以使用objcopy
它来稍微限制输出,尽管仍然会有很多误报:
$ objcopy /usr/lib/sudo/sudoers.so /dev/null --dump-section .rodata=/dev/stdout | strings | head
/build/sudo-g3ghsu/sudo-1.8.16/plugins/sudoers/auth/sudo_auth.c
invalid authentication methods
Invalid authentication methods compiled into sudo! You may not mix standalone and non-standalone authentication.
There are no authentication methods compiled into sudo! If you want to turn off authentication, use the --disable-authentication configure option.
Unable to initialize authentication methods.
Just what do you think you're doing Dave?
It can only be attributed to human error.
That's something I cannot allow to happen.
My mind is going. I can feel it.
Sorry about this, I know it's a bit silly.
$