int main (int argc, char* argv[]) { int t; unsigned long long size, v1, v2, max; int g1, g2, res, i; max = 5000000000LLU; size = max / GROUP_SIZE; scanf ("%d", &t); while (t--) { scanf ("%llu %llu", &v1, &v2); g1 = v1 / size; g2 = v2 / size; if (g1 == g2) res = brute (v1, v2); else { res = brute (v1, size * (g1+1)); for (i = g1+1; i < g2; i++) res += groups[i]; res += brute (size * g2, v2); } printf ("%d\n", res); } return 0; }
int main(){ CERCLE vraiC; //Solution universelle pour les 3 tests vraiC.x = 10; vraiC.y=10; vraiC.d=10.0; // Test 1 : Points cocirculaires POINT tab1[] = {{10,15},{10,5},{5,10},{15,10}}; printf("\n** Test 1 : Points cocirculaires **\n\n"); int nbPoints = sizeof(tab1) / sizeof (tab1[0]); printf("Nombre de points: %d\n",nbPoints); CERCLE c1 = brute(tab1,nbPoints); printf("Cercle solution brute: Coordonnées x=%d, y=%d, diamètre=%lf.\n",c1.x,c1.y,c1.d); printf("Le résultat devrait être x=10, y=10, d=10\n"); // Test 2 : Points alignés POINT tab2[] = {{10,15},{10,14},{10,5},{10,7}}; printf("\n** Test 2 : Points alignés **\n\n"); nbPoints = sizeof(tab2) / sizeof (tab2[0]); printf("Nombre de points: %d\n",nbPoints); CERCLE c2 = brute(tab2,nbPoints); printf("Cercle solution brute: Coordonnées x=%d, y=%d, diamètre=%lf.\n",c2.x,c2.y,c2.d); printf("Le résultat devrait être x=10, y=10, d=10\n"); // Test 3 : Points confondus POINT tab3[] = {{10,10},{10,10},{10,10},{10,15},{10,5}}; printf("\n** Test 3 : Points confondus **\n\n"); nbPoints = sizeof(tab3) / sizeof (tab3[0]); printf("Nombre de points: %d\n",nbPoints); CERCLE c3 = brute(tab3,nbPoints); printf("Cercle solution brute: Coordonnées x=%d, y=%d, diamètre=%lf.\n",c3.x,c3.y,c3.d); printf("Le résultat devrait être x=10, y=10, d=10\n"); // Résultat if ( estEgal(c1, vraiC) && estEgal(c2, vraiC) && estEgal(c3, vraiC) ){ printf(" \n\n => Résultat CONFORME! \n\n"); return 0; } else { printf(" \n\n => Résultat NON CONFORME! \n\n"); return 1; } return 0; }
void solve() { static int caseno=1; int i; scanf("%d",&N); for(i=0;i<N;i++) scanf("%d %d",&px[i],&py[i]); printf("Case #%d:\n",caseno++); for(i=0;i<N;i++) brute(i); }
/* * 第三种是用后缀数组 * 例如str[] = abcdabcda,后缀数组为 * abcdabcda * bcdabcda * cdabcda * dabcda * abcda * bcda * cda * cd * a * * 然后对后缀数组进行排序 * abcdabcda * abcda * a * * bcdabcda * bcda * * cdabcda * cda * cd * * dabcda * 最后求最大复杂子串 */ int main() { char str[] = "abcdabcda"; printf("%d\n", brute(str)); printf("%d\n", kmp_repeated(str)); return 0; }
void testRoot(){ printf("\nRoot finding and minimisation\n"); golden(functionTest3,0,2); golden(functionTest1,3,7); golden(functionTest2,5,7); golden(poly,-0.5,1.0); brute (poly,-1.0,1.0, 0.0001); brute (functionTest1,3,7, 0.0001); secant(poly,0.0,1.0); newton(poly, dpoly, 0.0); regulaFalsi(poly,-1.0,1.0); bisect(poly,-1.0,1.0); fixedPointIteration(cosine,1.0); squareRoot(20); }
int found(char * host, char * folder, int user_id, int min, int max, int pos, int * res) { int i; int sr = (max - ((max-min)/2)); if( (max-min) < 6 ) { i=(brute(host,folder,user_id,min,max,pos)); *res = i; } else if( (check(host,folder,pos,'>',sr,user_id)) == 1 ) { found(host,folder,user_id,sr,max,pos,res); } else { found(host,folder,user_id,min,sr,pos,res); } return 0; }
void DLL_EXPORT BruteStart(int alg, hash_list* list, unsigned long from, unsigned long to, unsigned long* param) { time_t start; start = time(NULL); unsigned long to_ = to; if(alg == 6 or alg == 7 or alg == 8) to_ = 100000000u; std::sort(&list->hash[0], &list->hash[list->count]); brute(alg, list, from, to_, (unsigned int*)param, &start, &stop, &callbacks); stop = 0; }
void execute(int variation) { switch (variation) { case 0: case -1: brute(); break; default: std::cout << "NOOP!" << std::endl; break; } }
int main(int argc, char *argv[]) { postHeader = malloc(8192 * sizeof(char)); memset(postHeader, 0, 8192 * sizeof(char)); strcpy(postHeader, "POST /test.php HTTP/1.0\r\n"); strcat(postHeader, "Accept-Charset: UTF-8\r\n"); strcat(postHeader, "Content-Type: application/x-www-form-urlencoded;charset=UTF-8\r\n"); strcat(postHeader, "Content-Length: "); postBody = malloc(8192 * sizeof(char)); memset(postBody, 0, 8192 * sizeof(char)); strcpy(postBody, "user=admin&pass="); fillArray(); brute(6); return 0; }
int main(int argc, char *argv[]) { int t; unsigned long long v1, v2; scanf ("%d", &t); while (t--) { scanf ("%llu %llu", &v1, &v2); printf ("%d\n", brute (v1, v2)); } return 0; }
vl conv(vl a, vl b) { int s = sz(a)+sz(b)-1, L = get(s), n = 1<<L; if (s <= 0) return {}; if (s <= 200) return brute(a,b); a.resize(n); a = ntt(a); b.resize(n); b = ntt(b); F0R(i,n) a[i] = a[i]*b[i] % mod; a = ntt_rev(a); a.resize(s); return a; }
int main(int argc, char * argv[]) { printf("Bruteforcer alpha\n\n"); global_data_t global_data = { .hash = argv[argc - 1], .result_founded = 0, .alph = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890", .alph_len = 62, .pass_len = 6, .n_thrds = (int) sysconf(_SC_NPROCESSORS_ONLN), .run_mode = RM_MULTI, .brute_mode = BM_ITER }; if (get_options(&global_data, argc, argv) == EXIT_FAILURE) { printf("No hash detected or corrupter options\nRestart program with MD5 hash to brute as an argument\n"); return EXIT_FAILURE; } printf("Captured threads amount: %d\nPassword maximum length: %d\nAlphabet: %s\nBrute mode: %s\nRun mode: %s\nHash: %s\n\n", global_data.n_thrds, global_data.pass_len, global_data.alph, global_data.brute_mode == BM_ITER ? "iterative" : global_data.brute_mode == BM_REC ? "recursive" : "unknown", global_data.run_mode == RM_MULTI ? "multi-threaded" : global_data.run_mode == RM_SINGLE ? "single-threaded" : "unknown", global_data.hash); global_data.brute_func = (global_data.brute_mode == BM_ITER) ? iter : (global_data.brute_mode == BM_REC ? rec : NULL); switch (global_data.run_mode) { case RM_MULTI: run_multi (&global_data); break; case RM_SINGLE: brute(&global_data, check_crypt); break; default: printf("Smth went wrong\n"); } printf("\nThanks for using, hope you liked it\n"); return (EXIT_SUCCESS); }
std::string execute(int variation) { switch (variation) { case 0: return to_string(brute()); case 1: return to_string(closedFormItr()); case 2: case -1: return to_string(closedForm()); default: return std::string("unavailable"); } return NULL; }
struct PointPair closestpair(struct Point p[],int n) { if(n<=3) return brute(p,n); int mid=n/2; struct Point midp=p[mid]; struct PointPair dl = closestpair(p,mid); struct PointPair dr = closestpair(p+mid,n-mid); struct PointPair d = minpp(dl,dr); struct Point strip[n]; int i=0,j = 0; for (i = 0; i < n; i++) if (abs(p[i].x - midp.x) < d.dist) strip[j] = p[i], j++; return minpp(d,stripClosest(strip,j,d)); }
//Dessine les points et le cercle dans le SVG void ecritureSVG(POINT tab[], FILE* file , int N){ //On dessine tous les points dans le SVG for(i=0; i<N; i++){ dessinerPoint(file,(tab[i]).x, tab[i].y, TAILLEPOINT); } //On calcul la solution brute puis on la dessine dans le SVG CERCLE CercleSolution=brute(tab , N); /*CERCLE CercleSolution; CercleSolution.x = 250; CercleSolution.y=250; CercleSolution.d = 250;*/ dessinerCercle(file, CercleSolution.x, CercleSolution.y, CercleSolution.d); printf(" \n*** CERCLE SOLUTION PAR METHODE BRUTE: posX = %lf , posY = %lf , diamètre = %lf ***\n", CercleSolution.x, CercleSolution.y, CercleSolution.d ); }
void run_multi(global_data_t * global_data) { init(&global_data->queue); pthread_t consumers[global_data->n_thrds]; init_consumers(global_data, consumers); global_data->pass_len -= POSTFIX_LEN; brute(global_data, do_stuff); if (!global_data->result_founded) { task_t task = FINAL_TASK; push(&global_data->queue, &task); } int i; for (i = 0; i < global_data->n_thrds; i++) pthread_join(consumers[i], NULL); }
int main(void) { int select; do { head(); printf("\t\t\t"ANSI_COLOR_CYAN"Select your choice"ANSI_COLOR_RESET"\n" "\t\t"ANSI_COLOR_GREEN"[1]"ANSI_COLOR_RESET ANSI_COLOR_RED" BruteForce Attack (no passlist)"ANSI_COLOR_RESET"\n" "\t\t"ANSI_COLOR_GREEN"[2]"ANSI_COLOR_RESET ANSI_COLOR_RED" Dictionary Attack (need passlist)"ANSI_COLOR_RESET"\n" "\t\t"ANSI_COLOR_GREEN"[3]"ANSI_COLOR_RESET ANSI_COLOR_RED" EvilTwin Attack (Advance)"ANSI_COLOR_RESET"\n" "\t\t"ANSI_COLOR_GREEN"[0]"ANSI_COLOR_RESET ANSI_COLOR_RED" Exit"ANSI_COLOR_RESET"\n\n" "\t\t"ANSI_COLOR_YELLOW"Endic3 > "ANSI_COLOR_RESET); scanf("%d",&select); if (select == 1) brute(); else if (select == 2) dict(); else if (select == 3) linset(); else {printf("\t\t"ANSI_COLOR_RED"Ending.........../"ANSI_COLOR_RESET"\n"); select = 0;} }while(select != 0); return 0; }
/* More or less like the algorithm in the paper by Herz and de Werra */ void tabucol( /* Note the presence of global targetK in partition.c */ int nbmax, /* maximum iterations before improvement */ int rep, /* number of representative neighbors */ int minrep, /* minimum nbrs to generate before quitting on new min fnc*/ int tabusize, /* size of tabu list */ int steps) /* number of increments to target color to make if failure */ { tabuinfotype infolist[MAXTABULIST]; colortype j; int i,tabunext,nbiter,min,lim; int maxTarget; int bestiter,bestfnc; int brutefail; tabunext = 0; nbiter = 0; for(i=0; i<tabusize; i++) key[i] = 0; for(i=0; i<MAXHASH; i++) hash[i] = 0; maxTarget = targetK + steps; bestfnc = cedges; bestiter = 0; brutefail = 0; while ((cedges >0) && (targetK <= maxTarget)) { printf("Trying for target %d\n",targetK); printf("bestiter %d bestfnc %d\n",bestiter,bestfnc); while ((cedges>0) && ( (nbiter - bestiter) < nbmax) ) { /* generate neighbors */ lim = rep; for(i=0; i<rep; i++) { selectrand(&infolist[i]); /* immediate selection */ if (infolist[i].cedges < cedges) { if (i >= minrep) { lim = i+1; break; } } } /* record best */ min = 0; for(i=1; i<lim; i++) if (infolist[i].cedges < infolist[min].cedges) min = i; /* update tabu list */ /* - remove old conflict */ tabunext = (1+tabunext) % tabusize; hash[key[tabunext]] = 0; hash[(key[tabunext] = HASH((infolist[min].vertex), (vertexlist[infolist[min].vertex].part)))] = 1; /* make the move */ movevertex(infolist[min].vertex, infolist[min].to); if (numInConflict == 2) { if (1== brute(2,3)) cedges = 0; else brutefail++; } else if ((numInConflict == 3) && (cedges == 2)) { if (1 == brute(2,3)) cedges = 0; else brutefail++; } nbiter++; if (cedges < bestfnc) { bestfnc = cedges; bestiter = nbiter; printf("bestiter = %d bestfnc = %d\n", bestiter,bestfnc); fflush(stdout); } if (0==nbiter%1000) { printf("nbiter %d cedges %ld nbconf %ld\n", nbiter,cedges, numInConflict); fflush(stdout); } } if (cedges > 0) { partlist[targetK].first = ENDLIST; targetK++; printf("Brute failed %d times\n",brutefail); brutefail = 0; nbiter = 0; } } if (cedges == 0) printf("Success nbiter = %d brutefail = %d\n", nbiter,brutefail); else printf("Failure nbiter = %d brutefail = %d\n",nbiter,brutefail); /* Create a special partition for all of the conflicting vertices */ /* this will be used by reorder */ j = targetK; targetK++; partlist[j].first = ENDLIST; for(i=0; i<numInConflict; i++) movevertex(conflictList[i],j); }