Skip to content

Commit

Permalink
Some parsing fixes and resume error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmcatee committed Sep 26, 2019
1 parent f068922 commit bde42f0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
6 changes: 6 additions & 0 deletions common/queue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,12 @@ func (q *Queue) updateQueue() {
"JobID": retJob.UUID,
"PurgeTime": retJob.PurgeTime,
}).Debug("Updated PurgeTime value")

err := q.pool[jobs[i].ResAssigned].Client.Call("Queue.TaskDone", jobStatus, &retJob)
// we care about the errors, but only from a logging perspective
if err != nil {
log.WithField("rpc error", err.Error()).Error("Error during RPC call.")
}
}

err = q.db.UpdateJob(retJob)
Expand Down
2 changes: 1 addition & 1 deletion plugins/tools/hashcat5/output-parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var StatusTable = map[string]string{

// ParseMachineOutput returns a Status for a given status line
func ParseMachineOutput(out string) (Status, error) {
log.WithField("status2Parse", out).Debug("Parsing machine output")
//log.WithField("status2Parse", out).Debug("Parsing machine output")

if len(out) < 6 {
// Empty stdout so return empty status
Expand Down
18 changes: 10 additions & 8 deletions plugins/tools/hashcat5/tasker.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ func (t *Tasker) Status() common.Job {

t.job.PerformanceData[fmt.Sprintf("%d", time.Now().Unix())] = fmt.Sprintf("%f", totalSpeed/t.speedMag)

t.job.CrackedHashes = status.RecoveredHashes
if status.RecoveredHashes > t.job.CrackedHashes {
t.job.CrackedHashes = status.RecoveredHashes
}
t.job.TotalHashes = status.TotalHashes
} else {
log.Debug(err.Error())
Expand Down Expand Up @@ -222,8 +224,13 @@ func (t *Tasker) Run() error {
t.job.TotalHashes = leftCount + potCount
t.job.CrackedHashes = potCount

// We need to check for a restore file. If it does not exist we have to start over and not give the --restore command
hashcatBinFolder := filepath.Dir(config.BinPath)
_, err = os.Stat(filepath.Join(hashcatBinFolder, t.job.UUID+".restore"))
log.WithField("error", err).Debug("Stat of restore file returned error")

// Set commands for restore or start
if t.job.Status == common.STATUS_CREATED {
if t.job.Status == common.STATUS_CREATED || os.IsNotExist(err) {
t.exec = *exec.Command(config.BinPath, t.start...)
} else {
t.exec = *exec.Command(config.BinPath, t.resume...)
Expand Down Expand Up @@ -288,13 +295,8 @@ func (t *Tasker) Run() error {
t.job.Status = common.STATUS_QUIT
}

//log.WithField("task", t.job.UUID).Debug("Unlocked job after setting done.")

// Get the status now because we need the last output of hashes
//log.WithField("task", t.job.UUID).Debug("Calling final status call for the job.")
//t.Status()
t.returnStatus = ""

//log.WithField("task", t.job.UUID).Debug("Releasing wait group.")
t.doneWG.Done()
t.mux.Unlock()
}()
Expand Down

0 comments on commit bde42f0

Please sign in to comment.