diff --git a/hpc/torque/parse-output.py b/hpc/torque/parse-output.py new file mode 100755 index 0000000000000000000000000000000000000000..12a50fbfefb26e8784ad04ed1843753e2f4293dc --- /dev/null +++ b/hpc/torque/parse-output.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python2 + +import sys +import re + + +if len(sys.argv) < 3: + print("USAGE: {} codebreaker.out codebreaker.found".format(sys.argv[0])) + sys.exit(1) +with open(sys.argv[1], "r") as f: + raw = f.read() + +start, filtered, end = re.findall(r"End of prologue: \w+ \w+ (\d+ \d+:\d+:\d+)([\n\w\W\d\D\s\S]+)Starting epilogue... \w+ \w+ (\d+ \d+:\d+:\d+)", raw, re.MULTILINE)[0] + +s_day, s_time = start.split(' ') +s_day = int(s_day) +s_hour, s_min, s_sec = map(int, s_time.split(':')) + +e_day, e_time = end.split(' ') +e_day = int(e_day) +e_hour, e_min, e_sec = map(int, e_time.split(':')) + +time_diff = (e_day-s_day)*24*3600 + (e_hour-s_hour)*3600 + (e_min-s_min)*60 + (e_sec-s_sec) + +result = '' +total = 0 +for line in filtered.split('\n')[1:-1]: + try: + salt, pwd, _hash = re.findall(r"NODE\[\d+\]: \|(.*)\|(.*)\|(.*)\|", line)[0] + except IndexError: + continue + result += "|SALT='{}'|PWD='{}'|HASH={}|\n".format(salt, pwd, _hash) + total += 1 + +header = 'Codebreaker recovered {} passwords in {} seconds:\n'.format(total, time_diff) + +with open(sys.argv[2], "w") as f: + f.write(header) + f.write(result) diff --git a/hpc/torque/start.sh b/hpc/torque/start.sh index daac0169cf7c12cdfd3faa018547664c4106bfe6..755391d692d8dde2ac7311070a390000d55dfe63 100755 --- a/hpc/torque/start.sh +++ b/hpc/torque/start.sh @@ -1,3 +1,28 @@ #!/bin/bash -qsub -l nodes=2:ppn=40 -M moritz.eckert@fau.de torque.sh +rm codebreaker.out codebreaker.err + +echo "Starting codebreaker..." +qsub -l nodes=2:ppn=40 -M moritz.eckert@fau.de torque.sh > job.id + +echo -n "Running..." +ready=0 +while [ $ready -eq 0 ]; +do + qstat `cat job.id` > /dev/null 2>&1 + ready=$? + echo -n '.' + sleep 1 +done + +echo "" +echo "Done!" +echo -n "Waiting for results..." + +while [ ! -f codebreaker.out ]; do + echo -n "." + sleep 1 +done + +./parse-output.py codebreaker.out codebreaker.found +cat codebreaker.found diff --git a/src/mpi/mpi-layer.c b/src/mpi/mpi-layer.c index 2ade6405b62157374d6c94ea396ff03c75df636e..d59f4e76e9a2a9ad43dcf9c48d7179d2c592cff2 100644 --- a/src/mpi/mpi-layer.c +++ b/src/mpi/mpi-layer.c @@ -49,7 +49,7 @@ void node_logic (int rank, int size, char *wlist, char *plist) { } if (check_pass (&hashes[h].ctx, get_vector(&words_dist, w), hashes[h].salt, hashes[h].hash)) { hashes[h].done = 1; - printf("PID[%d]: (%s)%s == %s.\n", rank, hashes[h].salt, get_vector(&words_dist, w), hashes[h].hash); + printf("NODE[%d]: |%s|%s|%s|\n", rank, hashes[h].salt, get_vector(&words_dist, w), hashes[h].hash); } } }