Beispiel #1
0
        private void parseStatus(string statusOutput)
        {
            WPACrackStatus tempStatus = new WPACrackStatus();
            string         statusBlock;

            if (!statusOutput.Contains("STATUS") || !statusOutput.Contains("ENDSTATUS"))
            {
                return;
            }

            statusBlock = statusOutput.Remove(0, statusOutput.IndexOf("STATUS")); //remove leading garbage
            statusBlock = statusBlock.Remove(statusBlock.IndexOf("ENDSTATUS"));   // remove trailing garbage
            hcOutput.Clear();
            foreach (string line in new LineReader(() => new StringReader(statusBlock)))
            {
                if (line.Contains("Status."))
                {
                    var tmp = line.Split(':');
                    tempStatus.Condition = (WPAcrackCondition)Enum.Parse(typeof(WPAcrackCondition), tmp[1]);
                }
                else if (line.Contains("Progress."))
                {
                    var tmp      = line.Split(':');
                    var progress = tmp[1].Remove(0, tmp[1].IndexOf("(") + 1);     // remove leading garbage
                    progress            = progress.Remove(progress.IndexOf("%")); // remove trailing garbarge
                    tempStatus.Progress = float.Parse(progress);
                }
                else if (line.Contains("HWMon.GPU."))
                {
                    var tmp         = line.Split(':');
                    var id          = int.Parse(tmp[0].Split('#')[1].TrimEnd('.', ':'));
                    var values      = tmp[1].Split(',');
                    var load        = int.Parse(values[0].Split('%')[0]);
                    var temperature = int.Parse(values[1].Split('c')[0]);
                    var speed       = int.Parse(values[2].Split('%')[0]);

                    tempStatus.GPUs.Add(new GPUStatus {
                        Id = id, Load = load, Temperature = temperature, Speed = speed
                    });
                }
            }
            this.Status = tempStatus;
        }
Beispiel #2
0
        public void Stop()
        {
            if (this.Status.Condition == WPAcrackCondition.Stopped)
            {
                return;
            }

            if (ProcessExtensions.IsRunning(hcBruteForceProcess))
            {
                hcBruteForceProcess.Kill();
                hcBruteForceProcess.WaitForExit();
                hcBruteForceProcess.Close();
            }

            //stopped.WaitOne();

            //refresh status
            this.Status = new WPACrackStatus();
        }
Beispiel #3
0
 public WPAcrack()
 {
     status   = new WPACrackStatus();
     hcOutput = new StringBuilder("");
 }