// enche a piscina kkkkk piscina *Dig_TombPool( int NumThread ) { no_write_coredump(); piscina* dados; int count = 0,test=0; if( NumThread < 1 ) NumThread = 1; // usamos a heap para criar a pool dados = xmalloc ( sizeof( piscina ) ); // alocamos apra ID agora dados->threads = xmalloc ( NumThread * sizeof(pthread_t) ); dados->NumThread = NumThread; // iniciamos tarefa de fila piscina_fila_init( dados ); // alocamos para o semaforo dados->TarefaFila->filaSemaforo = xmalloc ( sizeof( sem_t ) ); sem_init( dados->TarefaFila->filaSemaforo , 0, 0 ); // damos create com pthread do{ test=pthread_create ( & ( dados->threads[count] ), NULL , (void *) poolWheel , (void *) dados ); if(test) { DEBUG("Error \n"); th_error(test,"error here!"); } count++; }while( count < NumThread ); return dados; }
int main(int argc, char ** argv) { char c; char *pack[4]; short y=3; no_write_coredump (); load_signal_alarm (); if(argc < 3) { init_banner_mask(); DEBUG(" Need more arguments.\n"); exit(0); } while(y>-1) { pack[y]=NULL; y--; } opterr = 0; while((c = getopt_long(argc, argv, "p:o:t:",long_options,NULL)) != -1) switch(c) { // payload list case 'p': if ( strnlen(optarg,256)<= 128 ) { pack[0] = optarg; printf("Payloads: %s \n",optarg); } else { DEBUG("Error \nArgument Payloads is very large \n"); exit(1); } break; // output case 'o': if ( strnlen(optarg,256)<= 128 ) { pack[1] = optarg; printf("Custom output: %s \n",optarg); } else { DEBUG("Error \nArgument output is very large \n"); exit(1); } break; case 't': if ( strnlen(optarg,256)<= 128 ) { pack[2] = optarg; printf("Tamper type: %s \n",optarg); } else { DEBUG("Error \nArgument tamper type is very large \n"); exit(1); } break; case '?': if(optopt == 'p' || optopt == 'o' || optopt == 't') { init_banner_mask(); puts(RED); DEBUG("Option -%c requires an argument.\n", optopt); puts(LAST); exit(1); } break; } if(pack[1]==NULL) { DEBUG("need use argument output file"); exit(1); } if(pack[0]==NULL) { DEBUG("need use argument payload"); exit(1); } if(pack[2]==NULL) { DEBUG("need use argument tamper"); exit(1); } convert_payload(pack[0],pack[1],pack[2]); fprintf(stdout,"%s Look file %s%s\n%s",RED,GREEN,pack[1],LAST); exit(0); }