sudo的侮辱存放在哪里?


234

对于那些喜欢幽默的人,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侮辱性消息的列表?

Answers:


180

它们在二进制文件中

/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",

等等...它们非常易读。


24
现在Zanna告诉我们它们在sudoers.so中,您还可以使用字符串而不是源代码“读取”它们。运行此: strings /usr/lib/sudo/sudoers.so
斯特凡

3
@Stéphane是的,尽管strings不会告诉您所有侮辱是否相等。阅读实际来源可以揭示某些标准是否会影响侮辱的选择。
kasperd '16

3
@StéphanePlus 在可执行文件上运行字符串会产生大量的误报。
MariusMatutiae


7
直到我看到Goon Show的侮辱时,我才真正打算这样做,这时我无法足够快地进行
击键

77

dpkg -L sudo | xargs grep dumber

我们可以搜索软件包sudo中哪些文件包含单词dumber

唯一的匹配在file中/usr/lib/sudo/sudoers.so。这是一个二进制文件,因此我们使用该strings命令仅获取看起来像人类可读的内容。因为很多,我们将结果传递到less

strings /usr/lib/sudo/sudoers.so | less

less我们可以使用

/dumber

再次搜索单词“ dumber”。这使我们直接受到侮辱。使用光标键上下滚动并使用退出q


6
因展示一种简单的通用技术来发现这些问题的答案而受到赞誉。
200_success

1
使用strings -n10以减少误报。另请参见@DigitalTrauma 的答案,该答案使用objcopy仅将.rodata部分馈入strings,从而再次降低了噪音。
彼得·科德斯

76

所有侮辱名单

当我们查看所有侮辱时,会发现一个有趣的花絮:说西兰花在政治上是正确的,但说墨西哥玉米煎饼不是。下面列出了所有侮辱。

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包含编译器指令,这些指令将上述哪种侮辱包含在编译的内核中。实际上,您可以创建自己的insults文件,将名称添加到insults.h中,然后重新编译以显示诸如“什么,您是ArchLinux用户?”之类的消息。或“这不是Windows上常见的错误!”等。

注意#ifdef PC_INSULTS某些侮辱文件中的。这并不意味着“如果您有一台个人计算机”,而是意味着“如果您想在政治上正确”。


46
我不知道“西兰花”在政治上比“墨西哥卷饼”更正确。
蓬松的

9
@fluffy我认为这是对国民饮食包括墨西哥卷饼的参考。我现在很遗憾没有审查代码。我应该只使用PC_INSULT选项并删除另一半。另一方面,我不喜欢汤姆·索耶(Tom Sawyer)和类似书籍所经历的历史审查。由于这些侮辱来自2004年,如果我删除了#ifdef部分,我将对历史进行审查。
WinEunuuchs2Unix

7
在谈论我们现在应该使用什么术语时,不必太担心“审查历史”。我可以想到40年前我曾使用过许多种族侮辱,性别歧视等词语。我很高兴在他们的历史背景下提及这些词语,但感谢上帝社会在这些词语中的许多方面取得了进步并认识到了危害。是的,如果您愿意,请在政治上大声疾呼。请先在贫穷的少数民族中受言语伤害。
Michael Durrant

4
PC的正确性无止境。任何单词都可以被认为是令人反感的,例如在秘鲁,西兰花就不会是PC。。。墨西哥卷饼显然是种族歧视。
Shautieh

17
美国以外的大多数人,可能还有美国的某些人,不会将其视为“明显的种族侮辱”。对我来说,很有趣的是,谁写了这个故意侮辱性清单(这就是功能名称!)实际上关心的是某些人真的得罪了……这是没有止境的,如果您真的很担心,请不要启用此功能...?!

11

以上答案非常适合离线搜索。但是我们在线。因此,打开Debian代码搜索并尝试此处的一种侮辱 。它会立即告诉您它在sudo_1.8.12-1/plugins/sudoers/ins_csops.h。这样做的好处是,无论是要在其中部署的配置文件,还是在/etc任何地方,都可以找到它。而且由于它是.h文件,因此可以看到它在源代码中,而不是您可以修改的文件。


7

为了增加其他答案,这些侮辱似乎在.rodatasudoers.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.
$ 

如果您可以容忍许多误报,为什么不使用strings代替objcopy?:)
Ruslan

@Ruslan:objcopy | strings仅扫描.rodata文本段的部分已经是。什么降低了误报是从默认的4增加的最小字符串长度可达像10: strings -n10。然后将其less(而不是headIMO)插入。顺便说一句,所有侮辱似乎都是连续的。
彼得·科德斯

啊,我没有滚动代码,看strings已经被使用了。
Ruslan
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.