How to play a sound and/or use discord webhook when a password is cracked - working!
#1
step 1) download a new hashcat copy

Code:
$ git clone https://github.com/hashcat/hashcat.git

cd hashcat/src

nano potfile.c

step2) edit the potfile.c

Look for around line 249 for this:
void potfile_write_append (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int out_len, u8 *plain_ptr, unsigned int plain_len)

before it ends } I added this:

Code:
// Test Audio Playback
  int audio_status = system("ffplay -nodisp -autoexit /opt/hashcatcracked.mp3 > /tmp/audio_log.txt 2>&1");

  // Test Discord Notification
  char webhook_url[] = "https://discord.com/api/webhooks/get_this_from_discord";

  char message[512];
  snprintf(message, sizeof(message),
          "{\"content\": \"Hashcat cracked a hash!\"}",
          out_buf, plain_ptr);

  char curl_command[1024];
  snprintf(curl_command, sizeof(curl_command),
          "curl -H \"Content-Type: application/json\" -d '%s' %s > /tmp/discord_log.txt 2>&1",
          message, webhook_url);

  int curl_status = system(curl_command);

  // Log system call statuses
  FILE *log_fp = fopen("/tmp/system_calls.log", "a");
  if (log_fp != NULL)
  {
    fprintf(log_fp, "Audio status: %d\n", audio_status);
    fprintf(log_fp, "Discord status: %d\n", curl_status);
    fclose(log_fp);
  }

remember to change the audio clip to something you want to hear.

step 3) build the binary

Code:
make clean
make
./hashcat -a3 hash.txt ?a?a?a?a?a 


you will hear audio and get a discord webhook notification
Reply