AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 837558
Accepted
Byte Commander
Byte Commander
Asked: 2016-10-16 10:25:30 +0800 CST2016-10-16 10:25:30 +0800 CST 2016-10-16 10:25:30 +0800 CST

sudo 的侮辱存储在哪里?

  • 772

对于那些喜欢幽默的人,可以通过添加以下行(使用命令,而不是手动编辑!)sudo来配置打印随机或多或少的侮辱性或有趣的短语而不是中性短语:Sorry, try again./etc/sudoerssudo 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侮辱消息的列表?

sudo
  • 5 5 个回答
  • 48488 Views

5 个回答

  • Voted
  1. Best Answer
    Zanna
    2016-10-16T10:34:17+08:002016-10-16T10:34:17+08:00

    它们在二进制文件中

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

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

    • 209
  2. WinEunuuchs2Unix
    2016-10-16T12:22:01+08:002016-10-16T12:22:01+08:00

    制造自己的侮辱

    您可以在不重新编译 sudo 的情况下更改 sudo 侮辱。

    请参阅:添加新的 sudo 侮辱


    带有侮辱性的头文件

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

    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(原须藤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 程序中包含上述哪些侮辱。实际上,您可以创建自己的侮辱文件,将名称添加到侮辱.h 并重新编译以显示诸如“什么,您是 ArchLinux 用户吗?”之类的消息。或“这不是错误司空见惯的 Windows!”等。

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


    列出对您的终端的所有侮辱

    对于 Ubuntu 16.04.6 LTS,您可以使用:

    strings /usr/lib/sudo/sudoers.so | head -n1670 | tail -n49
    

    对于其他 Ubuntu 版本,传递给headcommand 的行号可能会更改。希望其他人可以验证他们的版本。

    • 88
  3. Florian Diesch
    2016-10-16T10:55:21+08:002016-10-16T10:55:21+08:00

    和

    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

    • 85
  4. chx
    2016-10-19T15:49:47+08:002016-10-19T15:49:47+08:00

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

    • 13
  5. Digital Trauma
    2016-10-18T15:48:28+08:002016-10-18T15:48:28+08:00

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

相关问题

  • GUI sudo 不工作?

  • 如何在 sudo 下只运行一次桌面图形应用程序?

  • 如何将用户添加到“sudo”组?

  • Nautilus 自动以 root 身份浏览

  • 为什么我需要 root 权限才能在命令行中卸载驱动器,而不是在 Nautilus 中?如何改变它?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve