- 
        Список говнокодов пользователя danilissimusВсего: 40 
- 
        
        
                +132         
                            - 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
 int LoadFunctions() {
    HINSTANCE kernel;
    decrypt(krn);
    if((kernel = LoadLibraryA(decb)) == NULL) {
        return 1;
    } else {
        decrypt(crf);
        if((CreateFile = (CreateFileP) GetProcAddress(kernel, decb)) == NULL) return 1;
        decrypt(sfpe);
        if((SetFilePointerEx = (SetFilePointerExP) GetProcAddress(kernel, decb)) == NULL) return 1;
        decrypt(wf);
        if((WriteFile = (WriteFileP) GetProcAddress(kernel, decb)) == NULL) return 1;
        decrypt(ch);
        if((CloseHandle = (CloseHandleP) GetProcAddress(kernel, decb)) == NULL) return 1;
        decrypt(ffb);
        if((FlushFileBuffers = (FlushFileBuffersP) GetProcAddress(kernel, decb)) == NULL) return 1;
    }
    HANDLE user;
    decrypt(us);
    if((user = LoadLibraryA(decb)) == NULL) {
        return 1;
    } else {
        decrypt(mba);
        if((MessageBoxA = (MessageBoxAP) GetProcAddress(user, decb)) == NULL) {
            return 1; // ну зачем?
        }
    }
    return 0;
}
 
 
            Бида-бида, MessageBox не загрузилась - повод завершить выполнение. Хотя все важнейшие функции уже на месте.
         
             danilissimus,
            28 Октября 2011 danilissimus,
            28 Октября 2011
 
- 
        
        
                +146         
                            - 1
- 2
- 3
- 4
- 5
- 6
 vec->elements = realloc(vec->elements, sizeof(struct _vector_element)*newcapacity);
            if(vec->elements == NULL) {
                // Lol. All your data is lost.
                vc_set_error("Unable to allocate space for elements.");
                return 1;
            }
 
 
            Автор не догадался сохранить старый указатель.
         
             danilissimus,
            24 Октября 2011 danilissimus,
            24 Октября 2011
 
- 
        
        
                +136         
                            - 1
- 2
- 3
- 4
 /* My favorite names for boolean values */
#define  No	0
#define  Yes	1
#define  Maybe	2		/* tri-state boolean, actually */
 
 
            Исходный код юниксовой утилиты top. Файл boolean.h.
         
             danilissimus,
            29 Августа 2011 danilissimus,
            29 Августа 2011
 
- 
        
        
                +148         
                            - 1
- 2
- 3
- 4
 if((s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) die("socket creating.");
if(bind(s, (struct sockaddr*) &local, sizeof(struct sockaddr_in)) == SOCKET_ERROR) die("bind...");
if(ioctlsocket(s, FIONBIO, &on) != 0) die("IOCTL!!!");
if(listen(s, 16) != 0) die("WHYYYYY?!?!!!!!");
 
 
            No hard feelings.
         
             danilissimus,
            29 Мая 2011 danilissimus,
            29 Мая 2011
 
- 
        
        
                +141         
                            - 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
 char *toScan;
    unsigned int IP1, IP2, IP3, IP4, IPMask;
    if(argc > 1) {
        toScan = argv[1];
        if(sscanf(toScan, "%u.%u.%u.%u/%u", &IP1, &IP2, &IP3, &IP4, &IPMask) != 5) {
            puts("Error parsing arguments.");
            return -1;
        } else {
            if(IP1 > 255 || IP2 > 255 || IP3 > 255 || IP4 > 255 || IPMask > 32) {
                puts("Incorrect values specified.");
                return -2;
            } else {
                baseIP |= IP1 & 0xFF;
                baseIP |= ((IP2 << 8) & 0xFF00);
                baseIP |= ((IP3 << 16) & 0xFF0000);
                baseIP |= ((IP4 << 24) & 0xFF000000);
                baseIP = ntohl(baseIP);
                intCountIP = (unsigned long) pow(2, 32-IPMask);
                //printf("Total IP's: %u\n", countIP());
            }
        }
    } else {
        return -1;
    }
 
 
            Парсинг аргументов из одного сетевого сканера. Программа выявляет выключенные хосты в указанной подсети.
 Несмотря на *это*, сканер работает весьма резво (350 IP в секунду)
 
             danilissimus,
            31 Марта 2011 danilissimus,
            31 Марта 2011
 
- 
        
        
                +126         
                            - 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
 format MS COFF
public fuckHighLevel as '_fuckHighLevel@4'
fuckHighLevel:
        pop ebx
            pop eax
            add eax, 1
        jmp ebx
 
 
            Вызываем ассемблерную процедуру из Си.
 Вместо retn используем безусловыный переход на адрес возврата.
 Но работает же!
 
             danilissimus,
            19 Марта 2011 danilissimus,
            19 Марта 2011
 
- 
        
        
                +105         
                            - 1
 int c = ((i-(i%(int)pow(10,p)))/(int)pow(10,p))%10;
 
 
            Выделение из числа I цифры, стоящей на месте P с конца.
 =>
 i = 1234, p = 2, c => 2
 
             danilissimus,
            16 Марта 2011 danilissimus,
            16 Марта 2011
 
- 
        
        
                +135         
                            - 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
 //глубоко в коде
char output[1024];
//еще глубже
struct sockaddr_in outputa;
//...
if(sendto(s, output, 512, 0, (struct sockaddr *) &output, rsize) == SOCKET_ERROR) {
    printf("Socket error: %i.\n", WSAGetLastError());
}
 
 
            Долго-же я думал, почему оно вываливается с ошибкой 10047.
         
             danilissimus,
            12 Марта 2011 danilissimus,
            12 Марта 2011
 
- 
        
        
                +109         
                            - 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
 while(1) {
    :cycle
    goto cycleCode;
}
// ...
:cycleCode
//код
goto cycle;
 
 
            
         
             danilissimus,
            08 Марта 2011 danilissimus,
            08 Марта 2011
 
- 
        
        
                +77         
                            - 1
- 2
- 3
- 4
- 5
- 6
- 7
 function formatSpeedBits(speed) {
	// format speed in bits/sec, input: bytes/sec
	if (speed < 125000) return Math.round(speed / 125) + " Kbps";
	if (speed < 125000000) return Math.round(speed / 1250)/100 + " Mbps";
	// else
	return Math.round(speed / 1250000)/100 + " Gbps";  // wow!
}
 
 
            JS в интерфейсе прошивки dd-wrt. Не совсе говнокод.
         
             danilissimus,
            04 Марта 2011 danilissimus,
            04 Марта 2011