Где оскорбления sudo хранятся?

Для тех, кому нравится юмор, 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!

Теперь только для забавы я хотел бы прочитать всех их, но вводящий неправильные пароли весь день не действительно лучший метод (задержка после каждой попытки, только 2 сообщений на 3 попытки, аварийное прекращение работы после 3 попыток...).

Так..., где эти оскорбления на самом деле хранятся? Какой-либо файл простого текста я могу непосредственно читать? Или трудно кодированные строки в исходном коде?

Как я могу получить список всех доступных sudo сообщения оскорбления?

236
задан 15 October 2016 в 11:25

5 ответов

Они находятся в двоичном файле

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

и так далее... они довольно читаемы.

183
ответ дан 22 November 2019 в 22:41

С

dpkg -L sudo | xargs grep dumber

мы можем искать, какие файлы от пакета sudo содержат Word dumber.

, единственное соответствие находится в файле /usr/lib/sudo/sudoers.so. Это - двоичный файл, таким образом, мы используем эти strings команда, чтобы только получить вещи, который похож на то, чтобы быть человекочитаемым. Поскольку это много, мы передаем результат по каналу в less:

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

В less мы можем использовать

/dumber

для поиска снова "более немое" слово. Это разбирается в нас в оскорбления. Прокрутите вверх и вниз с клавишами управления курсором и выходом с q

77
ответ дан 22 November 2019 в 22:41

Список всех Оскорблений

, Когда мы смотрим на все оскорбления, мы обнаруживаем интересный лакомый кусочек: высказывание Брокколи политкорректно, но высказывание Буррито не. Все оскорбления упоминаются ниже.

ins_2001.h (2 001 оскорбление Космической одиссеи):

.
    /*
     * 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 (Выставочные оскорбления жлоба):

.
    /*
     * 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.h и перекомпилировать, чтобы иметь сообщения как, "Что, действительно ли Вы - пользователь ArchLinux?" или "Это не Windows, где ошибки распространены!", и т.д.

Уведомление #ifdef PC_INSULTS в некоторых файлах оскорбления. Это не означает, "если у Вас есть персональный компьютер", это означает, "если Вы хотите быть политкорректными".

79
ответ дан 22 November 2019 в 22:41

Вышеупомянутые ответы являются большими для офлайнового поиска. Но мы онлайн. Поэтому откройте Debian поиск кода и попробуйте одно из оскорблений здесь . Это немедленно говорит Вам, что находится в sudo_1.8.12-1/plugins/sudoers/ins_csops.h. Это имеет преимущество нахождения его везде быть им конфигурационный файл, который будет развернут в /etc или что бы то ни было. И так как это-.h файл, это видимо, это находится в источнике и не чем-то, что можно изменить.

11
ответ дан 22 November 2019 в 22:41

Для добавления к другим ответам оскорбления, кажется, находятся в .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.
$ 
7
ответ дан 22 November 2019 в 22:41

Другие вопросы по тегам:

Похожие вопросы: