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

    Всего: 126

  2. Go / Говнокод #28110

    +1

    1. 1
    2. 2
    math.Min(float64, float64) float64
    math.Max(float64, float64) float64

    В goвне нету math.Min для integer. Даже в анскильном "Си" это есть.

    https://www.pixelstech.net/article/1559993656-Why-no-max-min-function-for-integer-in-GoLang

    3_dar, 05 Апреля 2022

    Комментарии (39)
  3. Java / Говнокод #28107

    +1

    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
    import org.springframework.core.Ordered;
       import org.springframework.core.annotation.Order;
       import org.springframework.web.bind.WebDataBinder;
       import org.springframework.web.bind.annotation.ControllerAdvice;
       import org.springframework.web.bind.annotation.InitBinder;
    
       @ControllerAdvice
       @Order(10000)
       public class BinderControllerAdvice {
          @InitBinder
          public void setAllowedFields(WebDataBinder dataBinder) {
    
              String[] denylist = new String[]{"class.", "Class.", ".class.", ".Class."};
    
              dataBinder.setDisallowedFields(denylist);
          }
       }

    Критическая 0-day уязвимость в Spring Framework, применяемом во многих Java-проектах

    Работа эксплоита сводится к отправке запроса с параметрами "class.module.classLoader.resources.cont ext.parent.pipeline.first.*", обработка которых при использовании "WebappClassLoaderBase" приводит к обращению к классу AccessLogValve. Указанный класс позволяет настроить логгер для создания произвольного jsp-файла в корневом окружении Apache Tomcat и записи в этот файл указанного атакующим кода. Созданный файл становится доступным для прямых запросов и может использоваться в качестве web shell. Для атаки на уязвимое приложение в окружении Apache Tomcat достаточно отправить запрос с определёнными параметрами при помощи утилиты curl.

    curl -v -d "class.module.classLoader.resources.context.parent.pipeline
    .first.pattern=код_для_вставки_в_файл
    &class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp
    &class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT
    &class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar
    &class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat="
    http://localhost:8080/springmvc5-helloworld-exmaple-0.0.1-SNAPSHOT/rapid7

    3_dar, 04 Апреля 2022

    Комментарии (4)
  4. Си / Говнокод #28096

    0

    1. 1
    #exclude <conio.h>

    конио

    3_dar, 29 Марта 2022

    Комментарии (13)
  5. Си / Говнокод #28088

    0

    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
    /*
     *  libcaca       Colour ASCII-Art library
     *  Copyright (c) 2002-2010 Sam Hocevar <[email protected]>
     *                All Rights Reserved
     *
     *  This library is free software. It comes without any warranty, to
     *  the extent permitted by applicable law. You can redistribute it
     *  and/or modify it under the terms of the Do What The Fuck You Want
     *  To Public License, Version 2, as published by Sam Hocevar. See
     *  http://sam.zoy.org/wtfpl/COPYING for more details.
     */
    
    /*
     *  This header contains a conio.h reimplementation.
     */
    
    #ifndef __CACA_CONIO_H__
    #define __CACA_CONIO_H__
    
    /* Since we're going to redefine standard functions, include these
     * headers first to avoid errors upon later inclusion. */
    #if !defined(__KERNEL__)
    #   include <stdio.h>
    #endif
    
    #include <caca.h>
    
    #if !defined _DOXYGEN_SKIP_ME && !defined __LIBCACA__
    #   undef BLINK
    #   define BLINK CACA_CONIO_BLINK
    #   undef BLACK
    #   define BLACK CACA_CONIO_BLACK
    #   undef BLUE
    #   define BLUE CACA_CONIO_BLUE
    #   undef GREEN
    #   define GREEN CACA_CONIO_GREEN
    #   undef CYAN
    #   define CYAN CACA_CONIO_CYAN
    #   undef RED
    #   define RED CACA_CONIO_RED
    #   undef MAGENTA
    #   define MAGENTA CACA_CONIO_MAGENTA
    #   undef BROWN
    #   define BROWN CACA_CONIO_BROWN
    #   undef LIGHTGRAY
    #   define LIGHTGRAY CACA_CONIO_LIGHTGRAY
    #   undef DARKGRAY
    #   define DARKGRAY CACA_CONIO_DARKGRAY
    #   undef LIGHTBLUE
    #   define LIGHTBLUE CACA_CONIO_LIGHTBLUE
    #   undef LIGHTGREEN
    #   define LIGHTGREEN CACA_CONIO_LIGHTGREEN
    #   undef LIGHTCYAN
    #   define LIGHTCYAN CACA_CONIO_LIGHTCYAN
    #   undef LIGHTRED
    #   define LIGHTRED CACA_CONIO_LIGHTRED
    #   undef LIGHTMAGENTA
    #   define LIGHTMAGENTA CACA_CONIO_LIGHTMAGENTA
    #   undef YELLOW
    #   define YELLOW CACA_CONIO_YELLOW
    #   undef WHITE
    #   define WHITE CACA_CONIO_WHITE
    #endif

    3_dar, 22 Марта 2022

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

    0

    1. 1
    https://pvs-studio.com/ru/blog/posts/cpp/0094/

    3_dar, 17 Марта 2022

    Комментарии (28)
  7. Си / Говнокод #28071

    0

    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
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    /*
       xdrv_96_blacklist.ino - Blacklist for Tasmota
    
       SPDX-FileCopyrightText: 2022 Theo Arends
    
       SPDX-License-Identifier: GPL-3.0-only
     */
     #define USE_BLACKLIST
    
     #ifdef USE_BLACKLIST
     /*********************************************************************************************\
      * Blacklist support
      *
      * Check language and user set latitude/longitude against blacklist table
     \*********************************************************************************************/
     #define XDRV_96            96
    
     typedef struct {
       int16_t latitude_tl;    // - 8999 to 8999
       int16_t longitude_tl;   // -17999 to 17999
       int16_t latitude_br;
       int16_t longitude_br;
       uint16_t lcid;
     } tBlArray;
    
     //const char BlacklistText[] PROGMEM = "Stop war - Free Ukrain|Stop war - Free Ukrain|";
     const char BlacklistText[] PROGMEM = "Stop war, Free Ukrain";
    
     //                   lat_tl lon_tl lat_br lon_br lcid
     tBlArray BlArray[] {  5900,  3200,  5300,  4400, 1049,     // Around Moscow
                           5450,  2633,  5280,  2900, 1049      // Around Minsk
                        };
    
     uint8_t blist_show = 0;
    
     void BListEverySecond(void) {
       if (Rtc.utc_time < 1648771200) {                         // Only until 2022-04-01
         if (0 == (TasmotaGlobal.uptime % 20)) {                // Only every 20 seconds
           if (TasmotaGlobal.power) {                           // Only if any power on
             uint32_t latitude = Settings->latitude / 10000;
             uint32_t longitude = Settings->longitude / 10000;
             uint32_t count = sizeof(BlArray) / sizeof(tBlArray);
             for (uint32_t i = 0; i < count; i++) {
               // Currently only supports top-right quarter of the earth
               if ((LANGUAGE_LCID == BlArray[i].lcid) &&        // Check language id
                   (latitude < BlArray[i].latitude_tl) &&       // Check user set latitude and longitude against table
                   (latitude > BlArray[i].latitude_br) &&
                   (longitude > BlArray[i].longitude_tl) &&
                   (longitude < BlArray[i].longitude_br)) {
    
     //            char bl_text[100];
     //            snprintf_P(bl_text, sizeof(bl_text), PSTR("Power0 0"));   // Turn all power off - annoying
     //            snprintf_P(bl_text, sizeof(bl_text), PSTR("Restart 1"));  // Restart - more annoying
     //            snprintf_P(bl_text, sizeof(bl_text), PSTR("Reset 1"));    // Reset - disastrous
     //            ExecuteCommand(bl_text, SRC_IGNORE);
    
     //            char bl_text[100];
     //            AddLog(LOG_LEVEL_NONE, PSTR("**** %s ****"), GetTextIndexed(bl_text, sizeof(bl_text), i, BlacklistText));
                 AddLog(LOG_LEVEL_NONE, PSTR("**** %s ****"), BlacklistText);
                 blist_show = i +1;                             // Set GUI message id
                 break;
               }
             }
           }
         } else if (0 == (TasmotaGlobal.uptime % 10)) {         // Only every 10 seconds
           blist_show = 0;                                      // Reset GUI message id after 10 seconds
         }
       }
     }
    
     void BListShow(bool json) {
       if (blist_show) {
     //    char bl_text[100];
     //    WSContentSend_PD(PSTR("{s}**** %s ****{m}{e}"), GetTextIndexed(bl_text, sizeof(bl_text), blist_show -1, BlacklistText));
         WSContentSend_P(PSTR("{s}**** %s ****{m}{e}"), BlacklistText);
       }
     }
    
     /*********************************************************************************************\
      * Interface
     \*********************************************************************************************/
    
     bool Xdrv96(uint8_t function) {
       bool result = false;
    
       switch (function) {
         case FUNC_EVERY_SECOND:
           BListEverySecond();
           break;
     #ifdef USE_WEBSERVER
         case FUNC_WEB_SENSOR:
           BListShow(0);
           break;
     #endif  // USE_WEBSERVER
       }
    
       return result;
     }

    https://github.com/arendst/Tasmota/commit/98cbf2587a1a914bbd16996ebb48dd451d3da448

    3_dar, 05 Марта 2022

    Комментарии (9)
  8. PHP / Говнокод #28046

    0

    1. 1
    Путин признал "PHP".

    3_dar, 22 Февраля 2022

    Комментарии (150)
  9. JavaScript / Говнокод #27989

    0

    1. 1
    http://motherfuckingwebsite.com

    <!-- yes, I know...wanna fight about it? -->
    <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-45956659-1', 'motherfuckingwebsite.com');
    ga('send', 'pageview');
    </script>


    Лол кек чебурек

    3_dar, 04 Февраля 2022

    Комментарии (8)
  10. Python / Говнокод #27985

    0

    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
    # Python 2.7
    import cgi
    print(cgi.parse_qs('a=bagor;+kakoi'))
    # {'a': ['bagor']}
    
    # Python 3.7.3
    import urllib.parse
    print(urllib.parse.parse_qs('a=bagor;+kakoi'))
    # {'a': ['bagor']}
    
    # Python 3.9.10
    import urllib.parse
    print(urllib.parse.parse_qs('a=bagor;+kakoi'))
    # {'a': ['bagor; kakoi']}

    Что, блядь, это за хуета???
    Переводил программу на Python3 и пол дня потратил в попытках понять почему блядь тесты сломались.
    Какой-то петух завязался, на ';' сепаратор, который обрезается.

    https://docs.python.org/3/library/urllib.parse.html
    Changed in version 3.10: Added separator parameter with the default value of &. Python versions earlier than Python 3.10 allowed using both ; and & as query parameter separator. This has been changed to allow only a single separator key, with & as the default separator.

    И у меня не 3.10, но да похуй.
    Как мне теперь закостылять это говно, не меняя данные?

    3_dar, 03 Февраля 2022

    Комментарии (295)
  11. Куча / Говнокод #27944

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    location ~ ^/(pituh|kurochka) {
        alias "static/pituh.gif";
        default_type image/gif;
    }
    
    curl "http://localhost/pituh" - OK
    curl "http://localhost/pituh123" - OK
    curl "http://localhost/pituh/1/2/3" - OK
    curl "http://localhost/pituh/1/2/3/" - INTERNAL SERVER ERROR: static/pituh.gifindex.html" is not a directory

    Что это, блядь, за багор и как можно исправить?

    3_dar, 11 Января 2022

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