1. Список говнокодов пользователя shinespb

    Всего: 2

  2. bash / Говнокод #17284

    −107

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    #!/usr/bin/env bash
    
    ROOT_UID=0       # root uid is 0
    E_NOTROOT=67     # Non-root exit error
    # define freepbx config file if not alreaddy set
    if [ -z "$FREEPBX_CONF" ]; then
            if [ -e "/etc/freepbx.conf" ]; then
                    FREEPBX_CONF="/etc/freepbx.conf"
            elif [ -e "/etc/asterisk/freepbx.conf" ]; then
                    FREEPBX_CONF="/etc/asterisk/freepbx.conf"
            else
                    FREEPBX_CONF="/etc/freepbx.conf"
            fi
    fi
    
    echo
    # check to see if we are root
    if [ "$UID" -ne "$ROOT_UID" ]
    then
            echo "Sorry, you must be root to run this script."
            echo
            exit $E_NOTROOT
    fi
    
    # get settings from db/config file
    
    if [[ -e $FREEPBX_CONF && -w "/etc/amportal.conf" && -z "$FORCE_AMPORTAL_CONF" ]]; then        # Check if file exists.
    
            php -r > /dev/null 2>&1
            if [ $? -eq 0 ]; then
                    echo "Please wait..."
                    `php -r '
                    $bootstrap_settings["freepbx_auth"] = false;
                    $bootstrap_settings["skip_astman"] = true;
                    $restrict_mods = true;
                    if (!@include_once(getenv("FREEPBX_CONF") ? getenv("FREEPBX_CONF") : "/etc/freepbx.conf")) {
                            include_once("/etc/asterisk/freepbx.conf");
                    }
                    foreach($amp_conf as $key => $val) {
                            if (is_bool($val)) {
                                    echo "export " . trim($key) . "=" . ($val?"TRUE":"FALSE") ."\n";
                            } else {
                                    echo "export " . trim($key) . "=" . escapeshellcmd(trim($val)) ."\n";
                            }
                    }
                    '`
            elif [ -e "/var/lib/asterisk/bin/gen_amp_conf.php" ]; then
                    echo "Fetching FreePBX settings with gen_amp_conf.php.."
                    `/var/lib/asterisk/bin/gen_amp_conf.php`
            elif [ -e "/etc/amportal.conf" ]; then # Check if file exists.
                    echo "Fetching settings from amportal.conf file.."
                    . /etc/amportal.conf
            else
                    echo;
                    echo "FreePBX settings could not be fetched and no backup config file found!";
                    echo "Have you installed FreePBX?";
                    exit;
            fi
    elif [ -e "/etc/amportal.conf" ]; then # Check if file exists.
            . /etc/amportal.conf
    else
            echo;
            echo "FreePBX config file not found!";
            echo "Have you installed FreePBX?";
            exit;
    fi
    
    if [ -x ${AMPBIN}/freepbx_engine ]; then
            ${AMPBIN}/freepbx_engine $@
    elif [ -x ${ASTVARLIBDIR}/bin/freepbx_engine ]; then
            ${ASTVARLIBDIR}/bin/freepbx_engine $@
    elif [ -x /var/lib/asterisk/bin/freepbx_engine ]; then
            /var/lib/asterisk/bin/freepbx_engine $@
    else
            echo "FATAL: can not find freepbx_engine to start Asterisk"
    fi

    Бинарник amportal (freepbx)
    Особое внимание на строки 29 и ниже

    shinespb, 10 Декабря 2014

    Комментарии (6)
  3. Куча / Говнокод #17283

    +127

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    # Path for asterisk
    # Default Value: /usr/sbin/asterisk
    WHICH_asterisk=/usr/sbin/asterisk
    
    # Path for rm
    # Default Value: /bin/rm
    WHICH_rm=/bin/rm
    
    # Path for tail
    # Default Value: /usr/bin/tail
    WHICH_tail=/usr/bin/tail

    Конфигурационный файл amportal.conf в freepbx :)

    shinespb, 10 Декабря 2014

    Комментарии (2)