public static void init() { HashTracker.hashesFromTextFile = new Dictionary <uint, string>(); HashTracker.guessesFromTextFile = new Dictionary <uint, string>(); string hashFile = Path.Combine((new FileInfo(Application.ExecutablePath)).Directory.FullName, "hashes.txt"); if (File.Exists(hashFile)) { HashTracker.loadHashes(hashFile); } }
private void consoleCommandHandler(string cmd) { // TODO: impl string[] array = cmd.Split(new char[] { ' ' }, 2); string text = array[0]; bool noArgs = true; string text2 = null; if (array.Length > 1) { noArgs = false; text2 = array[1]; text2.Split(new char[] { ' ' }); } try { switch (text) { case "quit": case "exit": this.exit(); break; case "open": case "load": if (noArgs) { this.openFile(); break; } FileInfo fileInfo = new FileInfo(text2); if (!fileInfo.Exists) { this.writeToConsole("Non existant file: " + fileInfo.FullName); break; } if (!this.loadFile(fileInfo.FullName, true)) { this.writeToConsole("Failed to load file: " + fileInfo.FullName); } break; case "unload": if (noArgs) { this.writeToConsole("Error in command."); break; } string[] filesToUnload = { text2 }; this.unloadFiles(new List <string>(filesToUnload)); break; case "unloadall": if (!noArgs) { this.writeToConsole("Error in command."); break; } this.unloadFiles(); break; case "reparse": this.writeToConsole("Reparsing all VLTs..."); this.d(); this.tvRefresh(); break; case "cls": case "clear": this.txtConsole.Text = ""; break; case "hex": if (noArgs) { this.writeToConsole("Error in command."); break; } this.writeToConsole(string.Format("hex({0})=0x{1:x}", ulong.Parse(text2), ulong.Parse(text2))); break; case "hash": case "hash32": if (noArgs) { this.writeToConsole("Error in command."); break; } this.writeToConsole(string.Format("hash({0})=0x{1:x}", text2, JenkinsHash.getHash32(text2))); break; case "hash64": if (noArgs) { this.writeToConsole("Error in command."); break; } this.writeToConsole(string.Format("hash64({0})=0x{1:x}", text2, JenkinsHash.getHash64(text2))); break; case "hs": case "hsearch": if (noArgs) { this.writeToConsole("Error in command."); } else if (this.au.Count <= 0) // No loaded files { this.writeToConsole("No files loaded to search!"); break; } else { this.search(text2); } if (text == "hs") { this.txtConsoleInput.Text = "hs "; this.txtConsoleInput.SelectionStart = this.txtConsoleInput.Text.Length; } break; case "savehash": if (noArgs) { this.writeToConsole("Error in command."); break; } FileInfo fileInfo2 = new FileInfo(text2); HashTracker.dumpUsedHashes(fileInfo2.FullName); this.writeToConsole("Saved used hashes list to: " + fileInfo2.FullName); break; case "loadhash": if (File.Exists(text2)) { HashTracker.loadHashes(text2); break; } this.writeToConsole("File does not exist."); break; case "reloadhashes": HashTracker.init(); this.writeToConsole("Hashes reloaded."); break; case "help": this.writeToConsole("Common commands:"); this.writeToConsole("\thash, hash64 <string>: returns the hash(64) of the given string."); this.writeToConsole("\ths, hsearch <string/0xHASH>: searches for VLT entries of the given string or hash."); this.writeToConsole("\thex <int>: returns the hexadecimal representation of the given decimal."); this.writeToConsole("\tcls, clear: clear the console."); break; case "debug": frmMain maintest = new frmMain(); maintest.Show(); this.WindowState = FormWindowState.Minimized; break; case "": break; default: this.writeToConsole("Unknown command."); break; } } catch (Exception ex2) { this.writeToConsole("Exception: " + ex2.ToString()); this.writeToConsole("Error while executing: " + cmd); } }