void ConsoleWindow::on_OkButton_clicked() { this->ui->userframe->hide(); if (CC) { if (this->method == (char *)"MD5") { CC->SendMessageNoWait("%CLIENT", MSG_MESSAGE_LOGIN, "MD5", AnsiString((long)RESPONSE_OK)); CC->SendMessageNoWait("%CLIENT", MSG_MESSAGE_LOGIN, this->GetUsername(), do_md5(CC->POST_TARGET + do_md5(this->GetPassword()))); } else if (this->method == (char *)"SHA1") { CC->SendMessageNoWait("%CLIENT", MSG_MESSAGE_LOGIN, "SHA1", AnsiString((long)RESPONSE_OK)); CC->SendMessageNoWait("%CLIENT", MSG_MESSAGE_LOGIN, this->GetUsername(), do_sha1(CC->POST_TARGET + do_sha1(this->GetPassword()))); } else if (this->method == (char *)"SHA256") { CC->SendMessageNoWait("%CLIENT", MSG_MESSAGE_LOGIN, "SHA256", AnsiString((long)RESPONSE_OK)); CC->SendMessageNoWait("%CLIENT", MSG_MESSAGE_LOGIN, this->GetUsername(), do_sha256(CC->POST_TARGET + do_sha256(this->GetPassword()))); } else if (this->method == (char *)"PLAIN") { CC->SendMessageNoWait("%CLIENT", MSG_MESSAGE_LOGIN, "PLAIN", AnsiString((long)RESPONSE_OK)); CC->SendMessageNoWait("%CLIENT", MSG_MESSAGE_LOGIN, this->GetUsername(), this->GetPassword()); } else { // fallback to SHA1 CC->SendMessageNoWait("%CLIENT", MSG_MESSAGE_LOGIN, "SHA1", AnsiString((long)RESPONSE_OK)); CC->SendMessageNoWait("%CLIENT", MSG_MESSAGE_LOGIN, this->GetUsername(), do_sha1(CC->POST_TARGET + do_sha1(this->GetPassword()))); } if (hashsum.Length()) SetCachedLogin(this->GetUsername(), this->GetPassword(), this->remember(), &hashsum); } adjustSize(); }
static int testFile(char *relative_path, char *md5) { char full_path[MAX_PATH]; sprintf(full_path, MOUNT_POINT"%s", relative_path); char file_md5[MD5_DIGEST_LENGTH * 2 + 1]; if(do_md5(full_path, file_md5) == 0){ return strcmp(file_md5, md5) == 0; } return 0; }
//--------------------------------------------------------------------------- void __fastcall TMainForm::b_fhashClick(TObject *Sender) { char* data; FILE* in = fopen(AnsiString(e_fpath->Text).c_str(), "rb"); if (in == 0) {ShowMessage("File not found or can't be accessed for reading."); return;} fseek(in, 0, SEEK_END); unsigned long int size = ftell(in); fclose(in); data = new char[size+1]; DumpFile(data, AnsiString(e_fpath->Text).c_str()); e_fhash->Text = UnicodeString(do_md5(data, size)); delete[] data; }
void __fastcall TMainForm::b_mhashClick(TObject *Sender) { if (MainForm->clb_sec->Items->Count != 0) { unsigned int i = 0; DWORD size = 0; DWORD last_sz = 0; for (i = 0; i < MainForm->clb_sec->Items->Count; i++) { if (MainForm->clb_sec->Checked[i] == true) {size = size + sec_list[i];} } if (size == 0) {ShowMessage("No memory blocks selected."); return;} HANDLE hProc = OpenProcess(PROCESS_VM_READ, false, pid_list[MainForm->lb_proc->ItemIndex]); if (!hProc) {ShowMessage("Could not open handle to the process."); return;} char* data = new char[size]; unsigned long int dwRead; for (i = 0; i < MainForm->clb_sec->Items->Count; i++) { if (MainForm->clb_sec->Checked[i] == true) { ReadProcessMemory(hProc, (LPCVOID)(mod_list[MainForm->lb_mod->ItemIndex] + sec_ra_list[i]), (void*)(data + last_sz), sec_list[i], &dwRead); last_sz = sec_list[i]; } } MainForm->e_mhash->Text = UnicodeString(do_md5(data, size)); delete[] data; } }