//------------------------------------------------------------------------------------------------- inline void_t SmtpClient::login() { //------------------------------------- //RFC /* C: AUTH LOGIN\r\n S: 334 VXNlcm5hbWU6 C: base64_encode(MYLOGIN)\r\n C: base64_encode(MYPASS)\r\n S: 235 Authentication succeeded */ std::tstring_t sRv; //------------------------------------- //[AUTH\r\n] std::ctstring_t authLoginCmd = xT("AUTH LOGIN\r\n"); _command(authLoginCmd, xT("\r\n"), /*ref*/sRv); //------------------------------------- //[mylogin\r\n] std::ctstring_t loginCmd = xS2TS( Base64().encode( xTS2S(_user) ) ) + xT("\r\n"); _command(loginCmd, xT("\r\n"), /*ref*/sRv); //------------------------------------- //[mypassword\r\n] std::ctstring_t passwordCmd = xS2TS( Base64().encode( xTS2S(_password) ) ) + xT("\r\n"); _command(passwordCmd, xT("\r\n"), /*ref*/sRv); }
void Fuzzer::WriteUnitToFileWithPrefix(const Unit &U, const char *Prefix) { if (!Options.SaveArtifacts) return; std::string Path = Options.ArtifactPrefix + Prefix + Hash(U); if (!Options.ExactArtifactPath.empty()) Path = Options.ExactArtifactPath; // Overrides ArtifactPrefix. WriteToFile(U, Path); Printf("artifact_prefix='%s'; Test unit written to %s\n", Options.ArtifactPrefix.c_str(), Path.c_str()); if (U.size() <= kMaxUnitSizeToPrint) Printf("Base64: %s\n", Base64(U).c_str()); }
int CHHashFileSaltedSSHA::OutputFoundHashesToFile(){ uint64_t i; int j; unsigned char buffer[1024]; unsigned char hexbuffer[1024]; if (this->outputFoundHashesToFile && this->outputFile) { for (i = 0; i < this->TotalHashes; i++) { if ((this->HashList[i]->passwordFound) && (!this->HashList[i]->passwordOutputToFile)) { memset(buffer, 0, 1024); memset(hexbuffer, 0, 1024); for (j = 0; j < 20; j++) { hexbuffer[j] = this->HashList[i]->hash[j]; } for (j = 0; j < this->HashList[i]->saltLength; j++) { hexbuffer[j + 20] = this->HashList[i]->salt[j]; } Base64(hexbuffer, buffer, 20 + this->HashList[i]->saltLength); fprintf(this->outputFile, "{SSHA}"); for (j = 0; j < strlen((const char *)buffer); j++) { fprintf(this->outputFile, "%c", buffer[j]); } fprintf(this->outputFile, ":"); for (j = 0; j < strlen((const char *)this->HashList[i]->password); j++) { fprintf(this->outputFile, "%c", this->HashList[i]->password[j]); } if (this->AddHexOutput) { fprintf(this->outputFile,":0x"); for (j = 0; j < strlen((const char *)this->HashList[i]->password); j++) { fprintf(this->outputFile,"%02x", this->HashList[i]->password[j]); } } fprintf(this->outputFile, "\n"); this->HashList[i]->passwordOutputToFile = 1; fflush(this->outputFile); } } return 1; } return 0; }
int CHHashFileSaltedSSHA::OutputUnfoundHashesToFile(char *filename) { uint64_t i; int j; FILE *UnfoundHashes; unsigned char buffer[1024]; unsigned char hexbuffer[1024]; // If we can't open it... oh well? UnfoundHashes = fopen(filename, "w"); if (!UnfoundHashes) { return 0; } for (i = 0; i < this->TotalHashes; i++) { if (!this->HashList[i]->passwordFound) { memset(buffer, 0, 1024); memset(hexbuffer, 0, 1024); for (j = 0; j < 20; j++) { hexbuffer[j] = this->HashList[i]->hash[j]; } for (j = 0; j < this->HashList[i]->saltLength; j++) { hexbuffer[j + 20] = this->HashList[i]->salt[j]; } Base64(hexbuffer, buffer, 20 + this->HashList[i]->saltLength); fprintf(UnfoundHashes, "{SSHA}"); for (j = 0; j < strlen((const char *)buffer); j++) { fprintf(UnfoundHashes, "%c", buffer[j]); } fprintf(UnfoundHashes, ":"); for (j = 0; j < strlen((const char *)this->HashList[i]->password); j++) { fprintf(UnfoundHashes, "%c", this->HashList[i]->password[j]); } fprintf(UnfoundHashes, "\n"); } } // We can do this at the end for speed. fflush(UnfoundHashes); return 1; }
void CHHashFileSaltedSSHA::PrintNewFoundHashes(){ uint64_t i; int j; unsigned char hexbuffer[1024]; unsigned char buffer[1024]; for (i = 0; i < this->TotalHashes; i++) { if ((this->HashList[i]->passwordFound) && (!this->HashList[i]->passwordReported)) { memset(buffer, 0, 1024); memset(hexbuffer, 0, 1024); for (j = 0; j < 20; j++) { hexbuffer[j] = this->HashList[i]->hash[j]; } for (j = 0; j < this->HashList[i]->saltLength; j++) { hexbuffer[j + 20] = this->HashList[i]->salt[j]; } Base64(hexbuffer, buffer, 20 + this->HashList[i]->saltLength); printf("{SSHA}"); for (j = 0; j < strlen((const char *)buffer); j++) { printf("%c", buffer[j]); } printf(":"); for (j = 0; j < strlen((const char *)this->HashList[i]->password); j++) { printf("%c", this->HashList[i]->password[j]); } if (this->AddHexOutput) { printf(":0x"); for (j = 0; j < strlen((const char *)this->HashList[i]->password); j++) { printf("%02x", this->HashList[i]->password[j]); } } printf("\n"); this->HashList[i]->passwordReported = 1; } } }
String XQuestResultXMLFile::getxQuestBase64EncodedSpectrum_(const PeakSpectrum& spec, String header) { std::vector<String> in_strings; StringList sl; double precursor_mz = 0; double precursor_z = 0; if (spec.getPrecursors().size() > 0) { precursor_mz = Math::roundDecimal(spec.getPrecursors()[0].getMZ(), -9); precursor_z = spec.getPrecursors()[0].getCharge(); } // header lines if (!header.empty()) // common or xlinker spectrum will be reported { sl.push_back(header + "\n"); // e.g. GUA1372-S14-A-LRRK2_DSS_1A3.03873.03873.3.dta,GUA1372-S14-A-LRRK2_DSS_1A3.03863.03863.3.dta sl.push_back(String(precursor_mz) + "\n"); sl.push_back(String(precursor_z) + "\n"); } else // light or heavy spectrum will be reported { sl.push_back(String(precursor_mz) + "\t" + String(precursor_z) + "\n"); } PeakSpectrum::IntegerDataArray charges; if (spec.getIntegerDataArrays().size() > 0) { charges = spec.getIntegerDataArrays()[0]; } // write peaks for (Size i = 0; i != spec.size(); ++i) { String s; s += String(Math::roundDecimal(spec[i].getMZ(), -9)) + "\t"; s += String(spec[i].getIntensity()) + "\t"; if (charges.size() > 0) { s += String(charges[i]); } else { s += "0"; } s += "\n"; sl.push_back(s); } String out; out.concatenate(sl.begin(), sl.end(), ""); in_strings.push_back(out); String out_encoded; Base64().encodeStrings(in_strings, out_encoded, false, false); String out_wrapped; wrap_(out_encoded, 76, out_wrapped); return out_wrapped; }