void commandLoop(RainbowTable_t * rainbowTable, char * password) { char line[MAX_LINE_LEN] = {0}; byte_t hash[MAX_LINE_LEN] = {0}; /* The hash is never longer than its string representation */ uint_t hashLen = 0; /* Treat the user's submitted requests until told to quit */ for(;;) { bool_t found = FALSE; if (!readPrompt(line) || (0 == strcmp(line, "quit"))) { return; } hashLen = (uint_t) hexa2binary(line, hash, sizeof(hash)); if (-1 == hashLen) { fprintf(stderr, "Non hexa\n"); continue; } if (!queryExaustiveTable(rainbowTable, hash, hashLen, &found)) { /* An error has occured and a message has already been printed */ return; } if (found) { printf("Try to login with password \"%s\"\n", password); } else { printf("Sorry but this hash doesn't appears in pre-processing\n"); } } }
bool GPRS::sendSMS(Stream* stream, char* number, char* msg) { /* AT+CMGF=1 AT+CMGS="15921272576" > HELLO9527<ctrl-z > +CMGS: 36 OK */ if (!configureSMS(stream)) { #ifdef GPRS_DEBUG Serial.println("\nCould not configure"); #endif return false; } #ifdef GPRS_DEBUG Serial.println("\nSend phone number"); #endif stream->print("AT+CMGS=\""); stream->print(number); stream->println("\""); #ifdef GPRS_DEBUG Serial.println("\nWait for prompt"); #endif if (!readPrompt(stream)) { #ifdef GPRS_DEBUG Serial.println("No Prompt"); #endif return false; } stream->print(msg); stream->print(26, BYTE); int buflen = 100; char buffer[buflen]; #ifdef GPRS_DEBUG Serial.println("\nWait for response"); #endif if (!matchChars(stream, "+CMGS:")) { #ifdef GPRS_DEBUG Serial.println("No +CMGS:"); #endif return false; } if (!readUntil(stream, buffer, buflen, '\n')) { #ifdef GPRS_DEBUG Serial.println("No new line"); #endif return false; } #ifdef GPRS_DEBUG Serial.println("\nWait for OK"); #endif if (!readOK(stream)) { #ifdef GPRS_DEBUG Serial.println("No OK 2"); #endif return false; } return true; }