public static void writeHelp(OS os, int page = 0) { if (Helpfile.LoadedLanguage != Settings.ActiveLocale) { Helpfile.init(); } if (page == 0) { page = 1; } int num = (page - 1) * Helpfile.ITEMS_PER_PAGE; if (num >= Helpfile.help.Count) { num = 0; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(Helpfile.prefix.Replace("[PAGENUM]", string.Concat((object)page)).Replace("[TOTALPAGES]", string.Concat((object)Helpfile.getNumberOfPages())) + "\n"); for (int index = num; index < Helpfile.help.Count && index < num + Helpfile.ITEMS_PER_PAGE; ++index) { stringBuilder.Append((index == 0 ? " " : "") + Helpfile.help[index] + "\n \n "); } os.write(stringBuilder.ToString() + "\n" + Helpfile.postfix); }
public override void Trigger(object os_obj) { if ((double)this.Delay <= 0.0) { OS os = (OS)os_obj; Computer computer = Programs.getComputer(os, this.Target); if (computer != null) { os.netMap.discoverNode(computer); } else if (OS.DEBUG_COMMANDS) { os.write("Error revealing node " + this.Target + " : NODE NOT FOUND"); } } else { Computer computer = Programs.getComputer((OS)os_obj, this.DelayHost); if (computer == null) { throw new NullReferenceException("Computer " + (object)computer + " could not be found as DelayHost for Function"); } float delay = this.Delay; this.Delay = -1f; DelayableActionSystem.FindDelayableActionSystemOnComputer(computer).AddAction((SerializableAction)this, delay); } }
public static void typeOut(string s, OS os, int delay = 50) { os.write(string.Concat(s[0])); Thread.Sleep(delay); for (var index = 1; index < s.Length; ++index) { os.writeSingle(string.Concat(s[index])); Thread.Sleep(Utils.DebugGoFast() ? 1 : delay); } }
public static MemoryDumpDownloader GenerateInstanceOrNullFromArguments(string[] args, Rectangle location, object osObj, Computer target) { OS operatingSystem = (OS)osObj; if (operatingSystem.hasConnectionPermission(true)) { return(new MemoryDumpDownloader(location, operatingSystem)); } operatingSystem.write(LocaleTerms.Loc("Admin access required to generate memory dump")); return((MemoryDumpDownloader)null); }
private IEnumerator <ActionDelayer.Condition> generateOutputPass(int pass, OS os, Computer target) { target.firewallAnalysisInProgress = true; os.write(string.Format(LocaleTerms.Loc("Firewall Analysis Pass {0}"), (object)this.analysisPasses) + "\n"); yield return(ActionDelayer.Wait(0.03)); os.write("--------------------"); yield return(ActionDelayer.Wait(0.03)); string preceedeString = " "; double secondsDelayPerLine = 0.08 + 0.06 * (double)pass + (double)this.additionalDelay; for (int i = 0; i < this.solutionLength; ++i) { os.write(preceedeString + this.generateOutputLine(i)); yield return(ActionDelayer.Wait(secondsDelayPerLine)); } os.write("--------------------\n"); target.firewallAnalysisInProgress = false; }
private IEnumerator <ActionDelayer.Condition> generateOutputPass(int pass, OS os, Computer target) { target.firewallAnalysisInProgress = true; os.write("Firewall Analysis Pass " + analysisPasses + "\n"); yield return(ActionDelayer.Wait(0.03)); os.write("--------------------"); yield return(ActionDelayer.Wait(0.03)); var preceedeString = " "; var secondsDelayPerLine = 0.08 + 0.06 * pass + additionalDelay; for (var i = 0; i < solutionLength; ++i) { os.write(preceedeString + generateOutputLine(i)); yield return(ActionDelayer.Wait(secondsDelayPerLine)); } os.write("--------------------\n"); target.firewallAnalysisInProgress = false; }
public override void Trigger(object os_obj) { OS os = (OS)os_obj; if ((double)this.Delay <= 0.0) { OSTheme result = OSTheme.Custom; if (!Enum.TryParse <OSTheme>(this.ThemePathOrName, out result)) { result = OSTheme.Custom; } try { os.EffectsUpdater.StartThemeSwitch(this.FlickerInDuration, result, (object)os, result == OSTheme.Custom ? this.ThemePathOrName : (string)null); } catch (Exception ex) { os.write(" "); os.write("---------------------- "); os.write("ERROR LOADING X-SERVER"); os.write(ex.ToString()); os.write(ex.Message); string filename = ExtensionLoader.ActiveExtensionInfo.FolderPath + "/xserver_error.txt"; Utils.writeToFile("x-server load error for theme : " + this.ThemePathOrName + "\r\n." + Utils.GenerateReportFromException(ex), filename); os.write("---------------------- "); os.write("Full report saved to " + filename); os.write("---------------------- "); os.write(" "); } } else { Computer computer = Programs.getComputer(os, this.DelayHost); if (computer == null) { throw new NullReferenceException("Computer " + (object)computer + " could not be found as DelayHost for Function"); } float delay = this.Delay; this.Delay = -1f; DelayableActionSystem.FindDelayableActionSystemOnComputer(computer).AddAction((SerializableAction)this, delay); } }
public void writeAnalyzePass(object os_object, object target_object) { Computer target = (Computer)target_object; OS os = (OS)os_object; if (target.firewallAnalysisInProgress) { os.write("-" + LocaleTerms.Loc("Analysis already in Progress") + "-"); } else { os.delayer.PostAnimation(this.generateOutputPass(this.analysisPasses, os, target)); ++this.analysisPasses; } }
public static void writeHelp(OS os, int page = 0) { if (page == 0) page = 1; var num = (page - 1)*ITEMS_PER_PAGE; if (num >= help.Count) num = 0; var stringBuilder = new StringBuilder(); stringBuilder.Append( prefix.Replace("[PAGENUM]", string.Concat(page)) .Replace("[TOTALPAGES]", string.Concat(getNumberOfPages())) + "\n"); for (var index = num; index < help.Count && index < num + ITEMS_PER_PAGE; ++index) stringBuilder.Append((index == 0 ? " " : "") + help[index] + "\n \n "); os.write(stringBuilder.ToString() + "\n" + postfix); }
public static void writeHelp(OS os, int page = 0) { if (page == 0) { page = 1; } var num = (page - 1) * ITEMS_PER_PAGE; if (num >= help.Count) { num = 0; } var stringBuilder = new StringBuilder(); stringBuilder.Append( prefix.Replace("[PAGENUM]", string.Concat(page)) .Replace("[TOTALPAGES]", string.Concat(getNumberOfPages())) + "\n"); for (var index = num; index < help.Count && index < num + ITEMS_PER_PAGE; ++index) { stringBuilder.Append((index == 0 ? " " : "") + help[index] + "\n \n "); } os.write(stringBuilder.ToString() + "\n" + postfix); }
public static void rm2(string[] args, OS os) { var list = new List<FileEntry>(); if (args.Length <= 1) { os.write("Not Enough Arguments\n"); } else { var computer = os.connectedComp != null ? os.connectedComp : os.thisComputer; var str1 = args[1]; var str2 = !(args[1].ToLower() == "-rf") || args.Length < 3 ? args[1] : args[2]; var length = str2.LastIndexOf('/'); var str3 = str2; string path = null; if (length > 0 && length < str2.Length - 1) { str3 = str2.Substring(length + 1); path = str2.Substring(0, length); } var rootFolder = getCurrentFolder(os); if (path != null) { rootFolder = getFolderAtPath(path, os, rootFolder, true); if (rootFolder == null) { os.write("Folder " + path + " Not found!"); return; } } if (str3.Equals("*")) { for (var index = 0; index < rootFolder.files.Count; ++index) list.Add(rootFolder.files[index]); } else { var flag = false; for (var index = 0; index < rootFolder.files.Count; ++index) { if (rootFolder.files[index].name.Equals(str3)) { list.Add(rootFolder.files[index]); break; } if (flag) break; } } if (list.Count == 0) { os.write("File " + str3 + " not found!"); } else { var folderPath = new List<int>(); for (var index = 0; index < os.navigationPath.Count; ++index) folderPath.Add(os.navigationPath[index]); if (path != null) folderPath.AddRange(getNavigationPathAtPath(path, os, getCurrentFolder(os))); for (var index1 = 0; index1 < list.Count; ++index1) { os.write("Deleting " + list[index1].name + "."); for (var index2 = 0; index2 < Math.Min(Math.Max(list[index1].size/1000, 3), 26); ++index2) { Thread.Sleep(200); os.writeSingle("."); } if (!computer.deleteFile(os.thisComputer.ip, list[index1].name, folderPath)) os.writeSingle("Error - Insufficient Privaliges"); else os.writeSingle("Done"); } os.write(""); } } }
public static void replace2(string[] args, OS os) { var currentFolder = getCurrentFolder(os); FileEntry fileEntry = null; var index1 = 2; var strArray = Utils.SplitToTokens(args); if (strArray.Length < 3) { os.write("Not Enough Arguments\n"); os.write("Usage: replace targetFile.txt \"Target String\" \"Replacement String\""); } else { if (strArray.Length <= 3) { if (os.display.command.StartsWith("cat")) { var fileName = os.display.commandArgs[1]; fileEntry = currentFolder.searchForFile(fileName); if (fileEntry != null) { os.write("Assuming active flag file \"" + fileName + "\" For editing"); index1 = 1; } } if (fileEntry == null) os.write("Not Enough Arguments\n"); } if (fileEntry == null) { for (var index2 = 0; index2 < currentFolder.files.Count; ++index2) { if (currentFolder.files[index2].name.Equals(args[1])) fileEntry = currentFolder.files[index2]; } if (fileEntry == null) { os.write("File " + args[1] + " not found."); if (!os.display.command.StartsWith("cat")) return; var fileName = os.display.commandArgs[1]; if (currentFolder.searchForFile(fileName) == null) return; os.write("Assuming active file \"" + fileName + "\" for editing"); return; } } var oldValue = strArray[index1].Replace("\"", ""); var newValue = strArray[index1 + 1].Replace("\"", ""); fileEntry.data = fileEntry.data.Replace(oldValue, newValue); if (!os.display.command.ToLower().Equals("cat")) return; os.displayCache = fileEntry.data; } }
public static void scp(string[] args, OS os) { if (os.connectedComp == null) os.write("Must be Connected to a Non-Local Host\n"); else if (args.Length < 2) { os.write("Not Enough Arguments"); } else { var path = "bin"; var str1 = path; var flag1 = false; if (args.Length > 2) { str1 = args[2]; if (!args[2].Contains('.') || args[2].Contains('/') || args[2].Contains('\\')) { path = args[2]; flag1 = true; } } var currentFolder = getCurrentFolder(os); var flag2 = false; var num1 = 0; var index1 = -1; for (var index2 = 0; index2 < currentFolder.files.Count; ++index2) { if (currentFolder.files[index2].name.ToLower().Equals(args[1].ToLower())) { flag2 = true; num1 = currentFolder.files[index2].size; index1 = index2; break; } } if (!flag2) { os.write("File \"" + args[1] + "\" Does Not Exist\n"); } else { if (!flag1) { var str2 = currentFolder.files[index1].name.ToLower(); path = !str2.EndsWith(".exe") ? (!str2.EndsWith(".sys") ? "home" : "sys") : "bin"; } var str3 = currentFolder.files[index1].name; var strArray = str1.Split(Utils.directorySplitterDelim, StringSplitOptions.RemoveEmptyEntries); if (strArray.Length > 0 && strArray[strArray.Length - 1].Contains(".")) { str3 = strArray[strArray.Length - 1]; var stringBuilder = new StringBuilder(); var num2 = 0; for (var index2 = 0; index2 < strArray.Length - 1; ++index2) { stringBuilder.Append(strArray[index2]); stringBuilder.Append('/'); ++num2; } if (num2 > 0) { path = stringBuilder.ToString(); if (path.Length > 0) path = path.Substring(0, path.Length - 1); } } string likelyFilename = null; var folder = getFolderAtPathAsFarAsPossible(path, os, os.thisComputer.files.root, out likelyFilename); if (likelyFilename != null) str3 = likelyFilename; if (likelyFilename == path && folder == os.thisComputer.files.root) folder = getCurrentFolder(os); if ((os.connectedComp != null ? os.connectedComp : os.thisComputer).canCopyFile(os.thisComputer.ip, args[1])) { os.write("Copying Remote File " + args[1] + "\nto Local Folder /" + path); os.write("."); for (var index2 = 0; index2 < Math.Min(num1/500, 20); ++index2) { os.writeSingle("."); OS.operationProgress = index2/(float) (num1/1000); Thread.Sleep(200); } var nameEntry = str3; var num2 = 0; bool flag3; do { flag3 = true; for (var index2 = 0; index2 < folder.files.Count; ++index2) { if (folder.files[index2].name == nameEntry) { ++num2; nameEntry = string.Concat(str3, "(", num2, ")"); flag3 = false; break; } } } while (!flag3); folder.files.Add(new FileEntry(currentFolder.files[index1].data, nameEntry)); os.write("Transfer Complete\n"); } else os.write("Insufficient Privileges to Perform Operation : This File Requires Admin Access\n"); } } }
public static void ps(string[] args, OS os) { if (os.exes.Count > 0) { os.write("UID : PID : NAME"); Thread.Sleep(100); for (var index = 0; index < os.exes.Count; ++index) { os.write(string.Concat("root : ", os.exes[index].PID, " : ", os.exes[index].IdentifierName)); Thread.Sleep(100); } os.write(""); } else os.write("No Running Processes"); }
public static void cat(string[] args, OS os) { if (os.connectedComp == null || os.connectedComp.adminIP == os.thisComputer.ip) { os.displayCache = ""; var currentFolder = getCurrentFolder(os); if (args.Length < 2) { os.write("Usage: cat [FILENAME]"); } else { for (var index = 0; index < currentFolder.files.Count; ++index) { if (currentFolder.files[index].name.Equals(args[1])) { var flag = false; if (os.connectedComp != null) { if (os.connectedComp.canReadFile(os.thisComputer.ip, currentFolder.files[index], index)) flag = true; } else flag = os.thisComputer.canReadFile(os.thisComputer.ip, currentFolder.files[index], index); if (!flag) return; os.write(currentFolder.files[index].name + " : " + currentFolder.files[index].size/1000.0 + "kb\n" + currentFolder.files[index].data + "\n"); os.displayCache = currentFolder.files[index].data; return; } } os.displayCache = "File Not Found"; os.validCommand = false; os.write("File Not Found\n"); } } else { os.displayCache = "Insufficient Privileges"; os.validCommand = false; os.write("Insufficient Privileges to Perform Operation"); } }
public static bool ExecuteProgram(object os_object, string[] arguments) { OS os = (OS)os_object; string[] strArray = arguments; bool flag1 = true; if (strArray[0].ToLower().Equals("connect")) { Programs.connect(strArray, os); flag1 = false; } else if (strArray[0].Equals("disconnect") || strArray[0].Equals("dc")) { Programs.disconnect(strArray, os); } else if (strArray[0].Equals("ls") || strArray[0].Equals("dir")) { Programs.ls(strArray, os); } else if (strArray[0].Equals("cd")) { Programs.cd(strArray, os); } else if (strArray[0].Equals("cd..")) { strArray = new string[2] { "cd", ".." }; Programs.cd(strArray, os); } else if (strArray[0].Equals("cat") || strArray[0].Equals("more") || strArray[0].Equals("less")) { Programs.cat(strArray, os); } else if (strArray[0].Equals("exe")) { Programs.execute(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("probe") || strArray[0].Equals("nmap")) { Programs.probe(strArray, os); } else if (strArray[0].Equals("scp")) { Programs.scp(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("scan")) { Programs.scan(strArray, os); flag1 = false; } else if (strArray[0].Equals("rm") || strArray[0].Equals("del")) { Programs.rm(strArray, os); flag1 = false; } else if (strArray[0].Equals("mv")) { Programs.mv(strArray, os); flag1 = false; } else if (strArray[0].Equals("ps")) { Programs.ps(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("kill") || strArray[0].Equals("pkill")) { Programs.kill(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("reboot")) { Programs.reboot(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("opencdtray")) { Programs.opCDTray(strArray, os, true); flag1 = false; } else if (strArray[0].ToLower().Equals("closecdtray")) { Programs.opCDTray(strArray, os, false); flag1 = false; } else if (strArray[0].Equals("replace")) { Programs.replace2(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("analyze")) { Programs.analyze(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("solve")) { Programs.solve(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("clear")) { Programs.clear(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("upload") || strArray[0].Equals("up")) { Programs.upload(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("login")) { Programs.login(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("addnote")) { Programs.addNote(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals(":(){:|:&};:")) { ProgramRunner.ExecuteProgram((object)os, new string[1] { "forkbomb" }); } else if (strArray[0].ToLower().Equals("append")) { flag1 = false; string[] quoteSeperatedArgs = Utils.GetQuoteSeperatedArgs(strArray); Folder currentFolder = Programs.getCurrentFolder(os); if (quoteSeperatedArgs.Length > 1) { FileEntry fileEntry1 = currentFolder.searchForFile(quoteSeperatedArgs[1]); int num = 2; if (fileEntry1 == null) { fileEntry1 = currentFolder.searchForFile(os.display.commandArgs[1]); if (fileEntry1 == null) { os.write("Usage: append [FILENAME] [LINE TO APPEND]"); return(flag1); } os.write("No filename provided"); os.write("Assuming active flag file \"" + fileEntry1.name + "\" For editing"); if (strArray.Length == 1) { strArray = new string[2] { "append", fileEntry1.name } } ; else { strArray[1] = fileEntry1.name; } num = 1; } if (fileEntry1 != null) { string str1 = ""; for (int index = num; index < quoteSeperatedArgs.Length; ++index) { str1 = str1 + quoteSeperatedArgs[index] + " "; } FileEntry fileEntry2 = fileEntry1; string str2 = fileEntry2.data + "\n" + str1; fileEntry2.data = str2; flag1 = true; strArray[0] = "cat"; strArray[1] = fileEntry1.name; for (int index = 2; index < strArray.Length; ++index) { strArray[index] = ""; } Programs.cat(strArray, os); } } else { os.write("Usage: append [FILENAME] [LINE TO APPEND]"); return(flag1); } } else if (strArray[0].Equals("remline")) { FileEntry fileEntry = Programs.getCurrentFolder(os).searchForFile(strArray[1]); if (fileEntry != null) { int length = fileEntry.data.LastIndexOf('\n'); if (length < 0) { length = 0; } fileEntry.data = fileEntry.data.Substring(0, length); flag1 = true; strArray[0] = "cat"; for (int index = 2; index < strArray.Length; ++index) { strArray[index] = ""; } Programs.cat(strArray, os); } } else if (strArray[0].Equals("getString")) { Programs.getString(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("reloadtheme")) { FileEntry fileEntry = os.thisComputer.files.root.searchForFolder("sys").searchForFile("x-server.sys"); if (fileEntry != null) { OSTheme themeForDataString = ThemeManager.getThemeForDataString(fileEntry.data); ThemeManager.switchTheme((object)os, themeForDataString); } flag1 = false; } else if (strArray[0].Equals("FirstTimeInitdswhupwnemfdsiuoewnmdsmffdjsklanfeebfjkalnbmsdakj")) { Programs.firstTimeInit(strArray, os, false); flag1 = false; } else if (strArray[0].Equals("chat")) { string message = "chat " + os.username + " "; for (int index = 1; index < strArray.Length; ++index) { message = message + strArray[index] + " "; } if (os.multiplayer) { os.sendMessage(message); } flag1 = false; } else if ((strArray[0].Equals("exitdemo") || strArray[0].Equals("resetdemo")) && Settings.isDemoMode) { MusicManager.transitionToSong("Music/Ambient/AmbientDrone_Clipped"); MainMenu mainMenu = new MainMenu(); os.ScreenManager.AddScreen((GameScreen)mainMenu); MainMenu.resetOS(); os.ExitScreen(); OS.currentInstance = (OS)null; flag1 = false; if (Settings.MultiLingualDemo) { LocaleActivator.ActivateLocale("zh-cn", Game1.getSingleton().Content); } } else if (strArray[0].Equals("fh") && OS.DEBUG_COMMANDS) { Programs.fastHack(strArray, os); flag1 = false; } else if (strArray[0].Equals("ra") && OS.DEBUG_COMMANDS) { Programs.revealAll(strArray, os); flag1 = false; } else if (strArray[0].Equals("deathseq") && OS.DEBUG_COMMANDS) { os.TraceDangerSequence.BeginTraceDangerSequence(); flag1 = false; } else if (strArray[0].Equals("testcredits") && OS.DEBUG_COMMANDS) { os.endingSequence.IsActive = true; flag1 = false; } else if (strArray[0].Equals("addflag") && OS.DEBUG_COMMANDS) { if (strArray.Length < 2) { os.write("\nFlag to add required\n"); } os.Flags.AddFlag(strArray[1]); flag1 = false; } else if (strArray[0].Equals("addTestEmails") && OS.DEBUG_COMMANDS) { for (int index = 0; index < 4; ++index) { ((MailServer)os.netMap.mailServer.getDaemon(typeof(MailServer))).addMail(MailServer.generateEmail("testEmail " + (object)index + " " + Utils.getRandomByte().ToString(), "test", "test"), os.defaultUser.name); } flag1 = false; } else if (strArray[0].Equals("dscan") && OS.DEBUG_COMMANDS) { if (strArray.Length < 2) { os.write("\nNode ID Required\n"); } bool flag2 = false; for (int index = 0; index < os.netMap.nodes.Count; ++index) { if (os.netMap.nodes[index].idName.ToLower().StartsWith(strArray[1].ToLower())) { os.netMap.discoverNode(os.netMap.nodes[index]); os.netMap.nodes[index].highlightFlashTime = 1f; flag2 = true; break; } } if (!flag2) { os.write("Node ID Not found"); } flag1 = false; } else if (strArray[0].Equals("revmany") && OS.DEBUG_COMMANDS) { for (int index1 = 0; index1 < 60; ++index1) { int index2; do { index2 = Utils.random.Next(os.netMap.nodes.Count); }while (os.netMap.nodes[index2].idName == "mainHub" || os.netMap.nodes[index2].idName == "entropy00" || os.netMap.nodes[index2].idName == "entropy01"); os.netMap.discoverNode(os.netMap.nodes[index2]); } os.netMap.lastAddedNode = os.thisComputer; os.homeAssetServerID = "dhsDrop"; os.homeNodeID = "dhs"; os.netMap.discoverNode(Programs.getComputer(os, "dhs")); os.netMap.discoverNode(Programs.getComputer(os, "dhsDrop")); flag1 = false; } else if (strArray[0].ToLower().Equals("reloadext") && OS.DEBUG_COMMANDS) { if (Settings.IsInExtensionMode) { ExtensionLoader.ReloadExtensionNodes((object)os); } flag1 = false; } else if (strArray[0].Equals("testsave") && OS.DEBUG_COMMANDS || strArray[0].Equals("save!(SJN!*SNL8vAewew57WewJdwl89(*4;;;&!)@&(ak'^&#@J3KH@!*")) { os.threadedSaveExecute(false); SettingsLoader.writeStatusFile(); flag1 = false; } else if (strArray[0].Equals("testload") && OS.DEBUG_COMMANDS) { flag1 = false; } else if (strArray[0].Equals("teststrikerhack") && OS.DEBUG_COMMANDS) { os.delayer.Post(ActionDelayer.Wait(3.0), (Action)(() => MissionFunctions.runCommand(1, "triggerDLCHackRevenge"))); flag1 = false; } else if (strArray[0].Equals("linkToCSECPostDLC") && OS.DEBUG_COMMANDS) { os.execute("dscan mainhub"); os.allFactions.setCurrentFaction("hub", os); os.currentFaction.playerValue = 2; os.Flags.AddFlag("dlc_complete"); os.Flags.AddFlag("dlc_csec_end_facval:0"); MissionFunctions.runCommand(1, "addRank"); flag1 = false; } else if (strArray[0].Equals("debug") && OS.DEBUG_COMMANDS) { int num = PortExploits.services.Count; if (strArray.Length > 1) { try { num = Convert.ToInt32(strArray[1]); } catch (Exception ex) { } } for (int index = 0; index < PortExploits.services.Count && index <= num; ++index) { os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[PortExploits.portNums[index]], PortExploits.cracks[PortExploits.portNums[index]])); } os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[9], PortExploits.cracks[9])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[10], PortExploits.cracks[10])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[11], PortExploits.cracks[11])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[12], PortExploits.cracks[12])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[13], PortExploits.cracks[13])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[14], PortExploits.cracks[14])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[15], PortExploits.cracks[15])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[16], PortExploits.cracks[16])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[17], PortExploits.cracks[17])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[31], PortExploits.cracks[31])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[33], PortExploits.cracks[33])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[34], PortExploits.cracks[34])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[35], PortExploits.cracks[35])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[36], PortExploits.cracks[36])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[37], PortExploits.cracks[37])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[38], PortExploits.cracks[38])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[39], PortExploits.cracks[39])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[41], PortExploits.cracks[41])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[554], PortExploits.cracks[554])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[40], PortExploits.cracks[40])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.DangerousPacemakerFirmware, "KBT_TestFirmware.dll")); os.Flags.AddFlag("dechead"); os.Flags.AddFlag("decypher"); os.Flags.AddFlag("csecBitSet01Complete"); os.Flags.AddFlag("csecRankingS2Pass"); os.Flags.AddFlag("CSEC_Member"); os.Flags.AddFlag("bitPathStarted"); flag1 = false; for (int index = 0; index < 4; ++index) { Computer c = new Computer("DebugShell" + (object)index, NetworkMap.generateRandomIP(), os.netMap.getRandomPosition(), 0, (byte)2, os); c.adminIP = os.thisComputer.adminIP; os.netMap.nodes.Add(c); os.netMap.discoverNode(c); } os.netMap.discoverNode("practiceServer"); os.netMap.discoverNode("entropy00"); } else if (strArray[0].Equals("flash") && OS.DEBUG_COMMANDS) { os.traceTracker.start(40f); os.warningFlash(); flag1 = false; os.IncConnectionOverlay.Activate(); } else if (strArray[0].Equals("cycletheme") && OS.DEBUG_COMMANDS) { Action <OSTheme> ctheme = (Action <OSTheme>)(theme => ThemeManager.switchTheme((object)os, theme)); int next = 1; double delay = 1.2; Action cthemeAct = (Action)(() => { ctheme((OSTheme)next); next = (next + 1) % 7; }); cthemeAct += (Action)(() => os.delayer.Post(ActionDelayer.Wait(delay), cthemeAct)); cthemeAct(); } else if (strArray[0].Equals("testdlc") && OS.DEBUG_COMMANDS) { MissionFunctions.runCommand(0, "demoFinalMissionEndDLC"); flag1 = false; } else if (strArray[0].Equals("testircentries") && OS.DEBUG_COMMANDS) { DLCHubServer daemon = Programs.getComputer(os, "dhs").getDaemon(typeof(DLCHubServer)) as DLCHubServer; for (int index = 0; index < 100; ++index) { daemon.IRCSystem.AddLog("Test", "Test Message\nMultiline\nMessage", (string)null); } flag1 = false; } else if (strArray[0].Equals("testirc") && OS.DEBUG_COMMANDS) { DLCHubServer daemon = Programs.getComputer(os, "dhs").getDaemon(typeof(DLCHubServer)) as DLCHubServer; daemon.IRCSystem.AddLog("Test", "Test Message", (string)null); daemon.IRCSystem.AddLog("Channel", "Test Message\nfrom channel", (string)null); flag1 = false; } else if (strArray[0].Equals("flashtest") && OS.DEBUG_COMMANDS) { if (!PostProcessor.dangerModeEnabled) { PostProcessor.dangerModeEnabled = true; PostProcessor.dangerModePercentComplete = 0.5f; } else { PostProcessor.dangerModeEnabled = false; PostProcessor.dangerModePercentComplete = 0.0f; } flag1 = false; } else if (strArray[0].Equals("dectest") && OS.DEBUG_COMMANDS) { string str1 = "this is a test message for the encrypter"; string str2 = FileEncrypter.EncryptString(str1, "header message", "1.2.3.4.5", "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongpass", (string)null); os.write(str1); os.write(" "); os.write(" "); os.write(str2); os.write(" "); os.write(" "); os.write(FileEncrypter.MakeReplacementsForDisplay(FileEncrypter.DecryptString(str2, "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongpass")[2])); os.write(" "); os.write(FileEncrypter.MakeReplacementsForDisplay(FileEncrypter.DecryptString(str2, "wrongPass")[2] == null ? "NULL" : "CORRECT")); os.write(" "); } else if (strArray[0].Equals("test") && OS.DEBUG_COMMANDS) { ((DLCHubServer)Programs.getComputer(os, "dhs").getDaemon(typeof(DLCHubServer))).AddMission((ActiveMission)ComputerLoader.readMission("Content/DLC/Missions/Attack/AttackMission.xml"), (string)null, false); } else if (strArray[0].Equals("testtrace") && OS.DEBUG_COMMANDS) { MissionFunctions.runCommand(1, "triggerDLCHackRevenge"); } else if (strArray[0].Equals("testboot") && OS.DEBUG_COMMANDS) { os.BootAssitanceModule.IsActive = true; os.bootingUp = false; os.canRunContent = false; MusicManager.stop(); } else if (strArray[0].Equals("testhhbs") && OS.DEBUG_COMMANDS) { os.write(HostileHackerBreakinSequence.IsInBlockingHostileFileState((object)os) ? "BLOCKED" : "SAFE"); } else if (strArray[0].Equals("printflags") && OS.DEBUG_COMMANDS) { os.write(os.Flags.GetSaveString()); } else if (strArray[0].Equals("loseadmin") && OS.DEBUG_COMMANDS) { os.connectedComp.adminIP = os.connectedComp.ip; flag1 = false; } else if (strArray[0].Equals("runcmd") && OS.DEBUG_COMMANDS) { if (strArray.Length > 1) { string name = strArray[1]; int num = 0; if (strArray.Length > 2) { num = Convert.ToInt32(strArray[1]); } MissionFunctions.runCommand(num, name); } } else if (strArray[0].ToLower().Equals("runhackscript") && OS.DEBUG_COMMANDS) { if (strArray.Length > 1) { string scriptName = strArray[1]; try { HackerScriptExecuter.runScript(scriptName, (object)os, os.thisComputer.ip, os.thisComputer.ip); } catch (Exception ex) { os.write("Error launching script " + scriptName); os.write(Utils.GenerateReportFromExceptionCompact(ex)); } } } else if (strArray[0].Equals("MotIsTheBest") && OS.DEBUG_COMMANDS) { os.runCommand("probe"); os.runCommand("exe WebServerWorm 80"); os.runCommand("exe SSHcrack 22"); os.runCommand("exe SMTPoverflow 25"); os.runCommand("exe FTPBounce 21"); } else if (strArray[0].Equals("help") || strArray[0].Equals("Help") || strArray[0].Equals("?") || strArray[0].Equals("man")) { int page = 0; if (strArray.Length > 1) { try { page = Convert.ToInt32(strArray[1]); if (page > Helpfile.getNumberOfPages()) { os.write("Invalid Page Number - Displaying First Page"); page = 0; } } catch (FormatException ex) { os.write("Invalid Page Number"); } catch (OverflowException ex) { os.write("Invalid Page Number"); } } Helpfile.writeHelp(os, page); flag1 = false; } else { if (strArray[0] != "") { int num = ProgramRunner.AttemptExeProgramExecution(os, strArray); if (num == 0) { os.write("Execution failed"); } else if (num < 0) { os.write("No Command " + strArray[0] + " - Check Syntax\n"); } } flag1 = false; } if (flag1) { if (!os.commandInvalid) { os.display.command = strArray[0]; os.display.commandArgs = strArray; os.display.typeChanged(); } else { os.commandInvalid = false; } } return(flag1); }
public static void cd(string[] args, OS os) { if (os.hasConnectionPermission(false)) { if (args.Length >= 2) { getCurrentFolder(os); if (args[1].Equals("/")) os.navigationPath.Clear(); if (args[1].Equals("..")) { if (os.navigationPath.Count > 0) { os.navigationPath.RemoveAt(os.navigationPath.Count - 1); } else { os.display.command = "connect"; os.validCommand = false; } } else { if (args[1].StartsWith("/")) { var folder = (os.connectedComp != null ? os.connectedComp : os.thisComputer).files.root; os.navigationPath.Clear(); } var navigationPathAtPath = getNavigationPathAtPath(args[1], os, null); for (var index = 0; index < navigationPathAtPath.Count; ++index) { if (navigationPathAtPath[index] == -1) os.navigationPath.RemoveAt(os.navigationPath.Count - 1); else os.navigationPath.Add(navigationPathAtPath[index]); } } } else os.write("Usage: cd [WHERE TO GO or .. TO GO BACK]"); var str1 = ""; if (os.connectedComp != null) str1 = os.connectedComp.ip + "/"; for (var index = 0; index < os.navigationPath.Count; ++index) str1 = str1 + getFolderAtDepth(os, index + 1).name + "/"; var str2 = str1 + "> "; os.terminal.prompt = str2; } else os.write("Insufficient Privileges to Perform Operation"); }
public static void RunNotesDumperExe(string[] args, object osObj, Computer target) { OS os = (OS)osObj; FileEntry fileEntry = os.thisComputer.files.root.searchForFolder("home").searchForFile("Notes.txt"); if (fileEntry == null) { os.write(LocaleTerms.Loc("Dump Notes Output:") + "_______________\n"); os.write(" "); os.write(LocaleTerms.Loc("ERROR: No notes found on home system!")); os.write("_______________________________"); os.write(" "); } else { string[] strArray = fileEntry.data.Split(new string[1] { "\n\n----------\n\n" }, StringSplitOptions.RemoveEmptyEntries); os.write(" "); os.write(LocaleTerms.Loc("Notes") + ":________________________"); os.write(" "); for (int index = 0; index < strArray.Length; ++index) { os.write(strArray[index]); os.write("______________________________"); os.write(" "); } } }
public static void parseInputMessage(string message, OS os) { if (message.Equals("")) return; var strArray1 = message.Split(delims); if (strArray1.Length == 0) return; if (os.thisComputer != null && os.thisComputer.ip.Equals(strArray1[1])) os.warningFlash(); if (strArray1[0].Equals("init")) { var Seed = Convert.ToInt32(strArray1[1]); Utils.random = new Random(Seed); os.canRunContent = true; os.LoadContent(); os.write("Seed Established :" + Seed); } else if (strArray1[0].Equals("chat")) { var s = ""; for (var index = 2; index < strArray1.Length; ++index) s = s + strArray1[index] + " "; os.write(strArray1[1] + ": " + DisplayModule.splitForWidth(s, 350)); } else if (strArray1[0].Equals("clientConnect")) os.write("Connection Established"); else if (strArray1[0].Equals("cConnection")) { var comp = getComp(strArray1[1], os); if (comp == null) { os.write("Error in Message : " + message); } else { comp.silent = true; comp.connect(strArray1[2]); comp.silent = false; os.opponentLocation = strArray1[1]; } } else if (strArray1[0].Equals("cDisconnect")) { var comp = getComp(strArray1[1], os); comp.silent = true; comp.disconnecting(strArray1[2]); comp.silent = false; os.opponentLocation = ""; } else if (strArray1[0].Equals("cAdmin")) { var comp = getComp(strArray1[1], os); comp.silent = true; comp.giveAdmin(strArray1[2]); comp.silent = false; } else if (strArray1[0].Equals("cPortOpen")) { var comp = getComp(strArray1[1], os); comp.silent = true; comp.openPort(Convert.ToInt32(strArray1[3]), strArray1[2]); comp.silent = false; } else if (strArray1[0].Equals("cPortClose")) { var comp = getComp(strArray1[1], os); comp.silent = true; comp.closePort(Convert.ToInt32(strArray1[3]), strArray1[2]); comp.silent = false; } else if (strArray1[0].Equals("cFile")) { var comp = getComp(strArray1[1], os); comp.silent = true; var f = new FileEntry("", strArray1[3]); comp.canReadFile(strArray1[2], f, Convert.ToInt32(strArray1[4])); comp.silent = false; } else if (strArray1[0].Equals("newComp")) { var strArray2 = message.Split(specSplitDelims); var compLocation = new Vector2(Convert.ToInt32(strArray2[2]), Convert.ToInt32(strArray2[3])); var computer = new Computer(strArray2[5], strArray2[1], compLocation, Convert.ToInt32(strArray2[4]), 1, os); computer.idName = "opponent#" + generatedComputerCount; ++generatedComputerCount; computer.addMultiplayerTargetFile(); os.netMap.nodes.Add(computer); os.opponentComputer = computer; } else if (strArray1[0].Equals("cDelete")) { var strArray2 = message.Split(specSplitDelims); var comp = getComp(strArray2[1], os); var folderPath = new List<int>(); for (var index = 4; index < strArray2.Length; ++index) { if (strArray2[index] != "") folderPath.Add(Convert.ToInt32(strArray2[index])); } comp.silent = true; comp.deleteFile(strArray2[2], strArray2[3], folderPath); comp.silent = false; } else if (strArray1[0].Equals("cMake")) { var strArray2 = message.Split(specSplitDelims); var comp = getComp(strArray2[1], os); var folderPath = new List<int>(); for (var index = 4; index < strArray2.Length; ++index) { if (strArray2[index] != "") folderPath.Add(Convert.ToInt32(strArray2[index])); } comp.silent = true; comp.makeFile(strArray2[2], strArray2[3], strArray2[4], folderPath, false); comp.silent = false; } else if (strArray1[0].Equals("cMove")) { var strArray2 = message.Split(specSplitDelims); var comp = getComp(strArray2[1], os); var separator = new char[1] { '%' }; var folderPath = new List<int>(); var strArray3 = strArray2[5].Split(separator, 500, StringSplitOptions.RemoveEmptyEntries); for (var index = 0; index < strArray3.Length; ++index) { if (strArray2[index] != "") folderPath.Add(Convert.ToInt32(strArray2[index])); } var destFolderPath = new List<int>(); var strArray4 = strArray2[6].Split(separator, 500, StringSplitOptions.RemoveEmptyEntries); for (var index = 0; index < strArray4.Length; ++index) { if (strArray2[index] != "") destFolderPath.Add(Convert.ToInt32(strArray2[index])); } comp.silent = true; comp.moveFile(strArray2[2], strArray2[3], strArray2[4], folderPath, destFolderPath); comp.silent = false; } else if (strArray1[0].Equals("cMkDir")) { var strArray2 = message.Split(specSplitDelims); var comp = getComp(strArray2[1], os); var folderPath = new List<int>(); for (var index = 4; index < strArray2.Length; ++index) { if (strArray2[index] != "") folderPath.Add(Convert.ToInt32(strArray2[index])); } comp.silent = true; comp.makeFolder(strArray2[2], strArray2[3], folderPath); comp.silent = false; } else if (strArray1[0].Equals("cAddUser")) { var strArray2 = message.Split(specSplitDelims); var comp = getComp(strArray2[1], os); var name = strArray2[3]; var pass = strArray2[4]; var type = Convert.ToByte(strArray2[5]); comp.silent = true; comp.addNewUser(strArray2[2], name, pass, type); comp.silent = false; } else if (strArray1[0].Equals("cCopy")) { var comp = getComp(strArray1[1], os); comp.silent = true; comp.canCopyFile(strArray1[2], strArray1[3]); comp.silent = false; FileEntry fileEntry1 = null; for (var index = 0; index < comp.files.root.folders[2].files.Count; ++index) { if (comp.files.root.folders[2].files[index].name.Equals(strArray1[3])) fileEntry1 = comp.files.root.folders[2].files[index]; } var fileEntry2 = new FileEntry(fileEntry1.data, fileEntry1.name); getComp(strArray1[2], os).files.root.folders[2].files.Add(fileEntry2); } else if (strArray1[0].Equals("cCDDrive")) { var comp = getComp(strArray1[1], os); comp.silent = true; if (strArray1[2].Equals("open")) comp.openCDTray(strArray1[1]); else comp.closeCDTray(strArray1[1]); comp.silent = false; } else if (strArray1[0].Equals("cCrash")) { var comp = getComp(strArray1[1], os); comp.silent = true; comp.crash(strArray1[2]); comp.silent = false; } else if (strArray1[0].Equals("cReboot")) { var comp = getComp(strArray1[1], os); comp.silent = true; comp.reboot(strArray1[2]); comp.silent = false; } else if (strArray1[0].Equals("cFBClients")) { var comp = getComp(strArray1[1], os); if (os.connectedComp != null && os.connectedComp.ip.Equals(strArray1[1])) os.exes.Add(new ForkBombExe(os.getExeBounds(), os)); comp.silent = true; comp.forkBombClients(strArray1[2]); comp.silent = false; } else if (strArray1[0].Equals("eForkBomb")) { if (!os.thisComputer.ip.Equals(strArray1[1])) return; var forkBombExe = new ForkBombExe(os.getExeBounds(), os); forkBombExe.LoadContent(); os.exes.Add(forkBombExe); } else if (strArray1[0].Equals("mpOpponentWin")) { os.endMultiplayerMatch(false); } else { if (strArray1[0].Equals("stayAlive")) return; os.write("MSG: " + message); } }
public static void analyze(string[] args, OS os) { var computer = os.connectedComp != null ? os.connectedComp : os.thisComputer; if (computer.firewall != null) { computer.firewall.writeAnalyzePass(os, computer); computer.hostileActionTaken(); } else os.write("No Firewall Detected"); }
public static void execute(string[] args, OS os) { if (os.connectedComp == null) { var computer1 = os.thisComputer; } else { var computer2 = os.connectedComp; } var folder = os.thisComputer.files.root.folders[2]; os.write("Avaliable Executables:\n"); os.write("PortHack"); os.write("ForkBomb"); os.write("Shell"); os.write("Tutorial"); for (var index1 = 0; index1 < folder.files.Count; ++index1) { for (var index2 = 0; index2 < PortExploits.exeNums.Count; ++index2) { if (folder.files[index1].data == PortExploits.crackExeData[PortExploits.exeNums[index2]]) { os.write(folder.files[index1].name.Replace(".exe", "")); break; } } } os.write(" "); }
private static void executeThreadedScript(string[] script, OS os) { KeyValuePair <string, string>?nullable = new KeyValuePair <string, string>?(); bool flag1 = false; Computer target = os.thisComputer; Computer source = (Computer)null; TimeSpan timeout = TimeSpan.FromSeconds(0.5); for (int index1 = 0; index1 < script.Length; ++index1) { if (source != null && source.disabled) { Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("cDisconnect", target, source), os); Console.WriteLine("Early Script Exit on Source Disable"); return; } if (!string.IsNullOrWhiteSpace(script[index1])) { string[] strArray = script[index1].Trim().Split(Utils.spaceDelim, StringSplitOptions.RemoveEmptyEntries); CultureInfo cultureInfo = new CultureInfo("en-au"); bool flag2 = target == os.thisComputer; try { switch (strArray[0]) { case "config": target = Programs.getComputer(os, strArray[1]); if (target == null) { if (!OS.DEBUG_COMMANDS) { return; } os.write(" "); os.write("Error: "); os.write("Hack Script target " + strArray[1] + " not found! Aborting."); os.write("This error will not show up if debug commands are disabled."); os.write(" "); return; } source = Programs.getComputer(os, strArray[2]); if (source == null) { if (!OS.DEBUG_COMMANDS) { return; } os.write(" "); os.write("Error: "); os.write("Hack Script source " + strArray[2] + " not found! Aborting."); os.write("This error will not show up if debug commands are disabled."); os.write(" "); return; } timeout = TimeSpan.FromSeconds(Convert.ToDouble(strArray[3], (IFormatProvider)cultureInfo)); flag2 = false; nullable = new KeyValuePair <string, string>?(new KeyValuePair <string, string>(source.ip, target.ip)); os.ActiveHackers.Add(nullable.Value); break; case "delay": if (!OS.TestingPassOnly) { Thread.Sleep(TimeSpan.FromSeconds(Convert.ToDouble(strArray[1], (IFormatProvider)cultureInfo))); } flag2 = false; break; case "connect": Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("cConnection", target, source), os); if (!flag1 && target.ip == os.thisComputer.ip) { os.IncConnectionOverlay.Activate(); flag1 = true; break; } break; case "openPort": Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("cPortOpen", target, source) + " " + strArray[1], os); break; case "delete": string pathString = HackerScriptExecuter.getPathString(strArray[1], os, target.files.root); Multiplayer.parseInputMessage("cDelete #" + target.ip + "#" + source.ip + "#" + strArray[2] + pathString, os); break; case "reboot": if (target == os.thisComputer) { if (os.connectedComp == null || os.connectedComp == os.thisComputer) { os.runCommand("reboot"); break; } os.rebootThisComputer(); break; } target.reboot(source.ip); break; case "forkbomb": Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("eForkBomb", target, source), os); break; case "disconnect": target.disconnecting(source.ip, true); break; case "systakeover": HostileHackerBreakinSequence.Execute((object)os, source, target); break; case "clearTerminal": if (target == os.thisComputer) { os.terminal.reset(); break; } break; case "write": string str1 = ""; for (int index2 = 1; index2 < strArray.Length; ++index2) { str1 = str1 + strArray[index2] + " "; } string str2 = ComputerLoader.filter(str1.Trim()); if (target == os.thisComputer) { os.terminal.write(" " + str2); os.warningFlash(); break; } break; case "write_silent": string str3 = ""; for (int index2 = 1; index2 < strArray.Length; ++index2) { str3 = str3 + strArray[index2] + " "; } string str4 = ComputerLoader.filter(str3.Trim()); if (target == os.thisComputer) { os.terminal.write(" " + str4); } flag2 = false; break; case "writel": string str5 = ""; for (int index2 = 1; index2 < strArray.Length; ++index2) { str5 = str5 + strArray[index2] + " "; } string text1 = ComputerLoader.filter(str5.Trim()); if (string.IsNullOrWhiteSpace(text1)) { flag2 = false; } if (target == os.thisComputer) { os.terminal.writeLine(text1); os.warningFlash(); break; } break; case "writel_silent": string str6 = ""; for (int index2 = 1; index2 < strArray.Length; ++index2) { str6 = str6 + strArray[index2] + " "; } string text2 = ComputerLoader.filter(str6.Trim()); if (string.IsNullOrWhiteSpace(text2)) { flag2 = false; } if (target == os.thisComputer) { os.terminal.writeLine(text2); } flag2 = false; break; case "hideNetMap": if (target == os.thisComputer) { os.netMap.visible = false; break; } break; case "hideRam": if (target == os.thisComputer) { os.ram.visible = false; break; } break; case "hideDisplay": if (target == os.thisComputer) { os.display.visible = false; break; } break; case "hideTerminal": if (target == os.thisComputer) { os.terminal.visible = false; break; } break; case "showNetMap": if (target == os.thisComputer) { os.netMap.visible = true; break; } break; case "showRam": if (target == os.thisComputer) { os.ram.visible = true; break; } break; case "showTerminal": if (target == os.thisComputer) { os.terminal.visible = true; break; } break; case "showDisplay": if (target == os.thisComputer) { os.display.visible = true; break; } break; case "stopMusic": flag2 = false; if (target == os.thisComputer) { if (HackerScriptExecuter.MusicStopSFX == null) { HackerScriptExecuter.MusicStopSFX = !DLC1SessionUpgrader.HasDLC1Installed ? os.content.Load <SoundEffect>("SFX/MeltImpact") : os.content.Load <SoundEffect>("DLC/SFX/GlassBreak"); } MusicManager.stop(); if (HackerScriptExecuter.MusicStopSFX != null) { HackerScriptExecuter.MusicStopSFX.Play(); } break; } break; case "startMusic": flag2 = false; if (!OS.TestingPassOnly) { if (target == os.thisComputer) { MusicManager.playSong(); } break; } break; case "trackseq": try { if (target == os.thisComputer) { TrackerCompleteSequence.FlagNextForkbombCompletionToTrace(source != null ? source.ip : (string)null); break; } break; } catch (Exception ex) { os.write(Utils.GenerateReportFromExceptionCompact(ex)); break; } case "instanttrace": if (target == os.thisComputer) { TrackerCompleteSequence.TriggerETAS((object)os); break; } break; case "flash": if (!OS.TestingPassOnly) { if (target == os.thisComputer) { os.warningFlash(); } break; } break; case "openCDTray": if (!OS.TestingPassOnly) { if (target == os.thisComputer) { target.openCDTray(source.ip); } break; } break; case "closeCDTray": if (!OS.TestingPassOnly) { if (target == os.thisComputer) { target.closeCDTray(source.ip); } break; } break; case "setAdminPass": target.setAdminPassword(strArray[1]); break; case "makeFile": string folderName = strArray[1]; StringBuilder stringBuilder = new StringBuilder(); for (int index2 = 3; index2 < strArray.Length; ++index2) { stringBuilder.Append(strArray[index2]); if (index2 + 1 < strArray.Length) { stringBuilder.Append(" "); } } Folder folder = target.files.root.searchForFolder(folderName); List <int> folderPath = new List <int>(); if (folder == null) { folderPath.Add(0); } else { folderPath.Add(target.files.root.folders.IndexOf(folder)); } target.makeFile(source.ip, strArray[2], ComputerLoader.filter(stringBuilder.ToString()), folderPath, true); break; } } catch (Exception ex) { if (OS.TestingPassOnly) { throw new FormatException("Error Parsing command " + strArray[0] + " in HackerScript:", ex); } if (OS.DEBUG_COMMANDS) { os.terminal.write(Utils.GenerateReportFromException(ex)); os.write("HackScript error: " + strArray[0]); os.write("Report written to Warnings file"); Utils.AppendToWarningsFile(Utils.GenerateReportFromException(ex)); } } try { if (flag2 && !os.thisComputer.disabled) { if (!OS.TestingPassOnly) { os.beepSound.Play(); } } } catch (Exception ex) { os.terminal.write(Utils.GenerateReportFromException(ex)); Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex)); return; } if (!OS.TestingPassOnly) { Thread.Sleep(timeout); } } } if (!nullable.HasValue) { return; } os.ActiveHackers.Remove(nullable.Value); }
private static int AttemptExeProgramExecution(OS os, string[] p) { var computer = os.connectedComp != null ? os.connectedComp : os.thisComputer; var folder = os.thisComputer.files.root.searchForFolder("bin"); var indexOfExeProgram = GetFileIndexOfExeProgram(p[0], folder); var flag = indexOfExeProgram == int.MaxValue; var index1 = -1; if (indexOfExeProgram < 0) { return(-1); } string exeFileData = null; string exeName = null; if (!flag) { exeFileData = folder.files[indexOfExeProgram].data; for (var index2 = 0; index2 < PortExploits.exeNums.Count; ++index2) { var index3 = PortExploits.exeNums[index2]; if (PortExploits.crackExeData[index3].Equals(exeFileData)) { exeName = PortExploits.cracks[index3].Replace(".exe", "").ToLower(); index1 = index3; break; } } } else { exeName = p[0].Replace(".exe", "").ToLower(); if (exeName == "notes") { exeFileData = PortExploits.crackExeData[8]; } if (exeName == "tutorial") { exeFileData = PortExploits.crackExeData[1]; } } if (exeName == null) { return(-1); } var targetPort = -1; if (!flag) { if (PortExploits.needsPort[index1]) { try { for (var index2 = 0; index2 < computer.ports.Count; ++index2) { if (computer.ports[index2] == Convert.ToInt32(p[1])) { targetPort = computer.ports[index2]; break; } } } catch { os.write("No port number Provided"); return(0); } if (targetPort == -1) { os.write("Target Port is Closed"); return(0); } if (exeFileData != PortExploits.crackExeData[targetPort]) { os.write("Target Port running incompatible service for this executable"); return(0); } } } os.launchExecutable(exeName, exeFileData, targetPort, p); return(1); }
public static void RunShellReopenerExe(string[] args, object osObj, Computer target) { OS os = (OS)osObj; bool flag1 = false; bool flag2 = false; if (args.Length > 1) { if (args[1].ToLower() == "-s") { flag2 = true; } else if (args[1].ToLower() == "-o") { flag1 = true; } } if (!flag1 && !flag2) { os.write("--------------------------------------"); os.write("OpShell " + LocaleTerms.Loc("ERROR: Not enough arguments!")); os.write(LocaleTerms.Loc("Usage:") + " OpShell [-" + LocaleTerms.Loc("option") + "]"); os.write(LocaleTerms.Loc("Valid Options:") + " [-s (" + LocaleTerms.Loc("Save state") + ")] [-o (" + LocaleTerms.Loc("Re-open") + ")]"); os.write("--------------------------------------"); } else { Folder folder = os.thisComputer.files.root.searchForFolder("sys"); FileEntry fileEntry = folder.searchForFile("ShellSources.txt"); List <ShellExe> shellExeList = new List <ShellExe>(); for (int index = 0; index < os.exes.Count; ++index) { ShellExe ex = os.exes[index] as ShellExe; if (ex != null) { shellExeList.Add(ex); } } if (flag1) { if (fileEntry == null) { os.write("--------------------------------------"); os.write("OpShell " + LocaleTerms.Loc("ERROR: No shell sources saved. Save a setup first.")); os.write("--------------------------------------"); } else { string[] lines = fileEntry.data.Split(Utils.robustNewlineDelim, StringSplitOptions.RemoveEmptyEntries); double time1 = 0.2; os.runCommand("disconnect"); for (int index1 = 1; index1 < lines.Length; ++index1) { int index = index1; os.delayer.Post(ActionDelayer.Wait(time1), (Action)(() => os.runCommand("connect " + lines[index]))); double time2 = time1 + 0.2; os.delayer.Post(ActionDelayer.Wait(time2), (Action)(() => os.runCommand("shell"))); time1 = time2 + 0.2; } os.delayer.Post(ActionDelayer.Wait(time1), (Action)(() => { os.runCommand("disconnect"); os.write("--------------------------------------"); os.write("OpShell : " + LocaleTerms.Loc("Operation complete - ran shell on " + (object)(lines.Length - 1) + " nodes")); os.write("--------------------------------------"); })); } } else if (flag2) { if (shellExeList.Count <= 0) { os.write("--------------------------------------"); os.write("OpShell " + LocaleTerms.Loc("ERROR: No active shells")); os.write("--------------------------------------"); } else { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("#OpShell_IP_SourceCache\n"); for (int index = 0; index < shellExeList.Count; ++index) { stringBuilder.Append(shellExeList[index].targetIP + "\n"); } if (fileEntry != null) { fileEntry.data = stringBuilder.ToString(); } else { folder.files.Add(new FileEntry(stringBuilder.ToString(), "ShellSources.txt")); } os.write("--------------------------------------"); os.write("OpShell : " + string.Format(LocaleTerms.Loc("Saved {0} active shell sources successfully"), (object)shellExeList.Count)); os.write("--------------------------------------"); } } } }
public static void ls(string[] args, OS os) { if (os.hasConnectionPermission(false)) { var folder = getCurrentFolder(os); if (args.Length >= 2) folder = getFolderAtPath(args[1], os, null, false); var num = 0; for (var index = 0; index < folder.folders.Count; ++index) { os.write(":" + folder.folders[index].name); ++num; } for (var index = 0; index < folder.files.Count; ++index) { os.write(folder.files[index].name ?? ""); ++num; } if (num != 0) return; os.write("--Folder Empty --"); } else os.write("Insufficient Privileges to Perform Operation"); }
public static void probe(string[] args, OS os) { var computer = os.connectedComp != null ? os.connectedComp : os.thisComputer; var str = computer.ip; os.write("Probing " + str + "...\n"); for (var index = 0; index < 10; ++index) { Thread.Sleep(80); os.writeSingle("."); } os.write("\nProbe Complete - Open ports:\n"); os.write("---------------------------------"); for (var index = 0; index < computer.ports.Count; ++index) { os.write("Port#: " + computer.ports[index] + " - " + PortExploits.services[computer.ports[index]] + (computer.portsOpen[index] > 0 ? " : OPEN" : "")); Thread.Sleep(120); } os.write("---------------------------------"); os.write("Open Ports Required for Crack : " + Math.Max(computer.portsNeededForCrack + 1, 0)); if (computer.hasProxy) os.write("Proxy Detected : " + (computer.proxyActive ? "ACTIVE" : "INACTIVE")); if (computer.firewall == null) return; os.write("Firewall Detected : " + (computer.firewall.solved ? "SOLVED" : "ACTIVE")); }
public static void firstTimeInit(string[] args, OS os) { var flag = Settings.initShowsTutorial; if (flag) { os.display.visible = false; os.ram.visible = false; os.netMap.visible = false; os.terminal.visible = true; os.mailicon.isEnabled = false; } var msDelay = Settings.isConventionDemo ? 80 : 200; var millisecondsTimeout = Settings.isConventionDemo ? 150 : 300; if (Settings.debugCommandsEnabled && GuiData.getKeyboadState().IsKeyDown(Keys.LeftAlt)) msDelay = millisecondsTimeout = 1; typeOut("Initializing .", os, 50); doDots(7, msDelay + 100, os); typeOut("Loading modules.", os, 50); doDots(5, msDelay, os); os.writeSingle("Complete"); if (!Utils.DebugGoFast()) Thread.Sleep(millisecondsTimeout); typeOut("Loading nodes.", os, 50); doDots(5, msDelay, os); os.writeSingle("Complete"); if (!Utils.DebugGoFast()) Thread.Sleep(millisecondsTimeout); typeOut("Reticulating splines.", os, 50); doDots(5, msDelay - 50, os); os.writeSingle("Complete"); if (!Utils.DebugGoFast()) Thread.Sleep(millisecondsTimeout); if (os.crashModule.BootLoadErrors.Length > 0) { typeOut("\n------ BOOT ERROS DETECTED ------", os, 50); Thread.Sleep(200); foreach ( var s in os.crashModule.BootLoadErrors.Split(Utils.newlineDelim, StringSplitOptions.RemoveEmptyEntries)) { typeOut(s, os, 50); Thread.Sleep(100); } typeOut("---------------------------------\n", os, 50); Thread.Sleep(200); } typeOut("\n--Initialization Complete--\n", os, 50); GuiData.getFilteredKeys(); os.inputEnabled = true; if (!Utils.DebugGoFast()) Thread.Sleep(millisecondsTimeout + 100); if (!flag) { typeOut("For A Command List, type \"help\"", os, 50); if (!Utils.DebugGoFast()) Thread.Sleep(millisecondsTimeout + 100); } os.write(""); if (!Utils.DebugGoFast()) Thread.Sleep(millisecondsTimeout); os.write(""); if (!Utils.DebugGoFast()) Thread.Sleep(millisecondsTimeout); os.write(""); if (!Utils.DebugGoFast()) Thread.Sleep(millisecondsTimeout); os.write("\n"); if (flag) { os.write("Launching Tutorial..."); os.launchExecutable("Tutorial.exe", PortExploits.crackExeData[1], -1, null); Settings.initShowsTutorial = false; var num1 = 100; for (var index = 0; index < num1; ++index) { var num2 = index/(double) num1; if (Utils.random.NextDouble() < num2) { os.ram.visible = true; os.netMap.visible = false; os.terminal.visible = false; } else { os.ram.visible = false; os.netMap.visible = false; os.terminal.visible = true; } Thread.Sleep(16); } os.ram.visible = true; os.netMap.visible = false; os.terminal.visible = false; } else os.runCommand("connect " + os.thisComputer.ip); }
public static void reboot(string[] args, OS os) { if (os.hasConnectionPermission(true)) { var flag1 = os.connectedComp == null || os.connectedComp == os.thisComputer; var flag2 = false; if (args.Length > 1 && args[1].ToLower() == "-i") flag2 = true; if (!flag1) os.write("Rebooting Connected System : " + os.connectedComp.name); if (!flag2) { var num = 5; while (num > 0) { os.write("System Reboot in ............" + num); --num; Thread.Sleep(1000); } } if (os.connectedComp == null || os.connectedComp == os.thisComputer) os.rebootThisComputer(); else os.connectedComp.reboot(os.thisComputer.ip); } else os.write("Rebooting requires Admin access"); }
public static void kill(string[] args, OS os) { try { var num = Convert.ToInt32(args[1].Replace("[", "").Replace("]", "").Replace("\"", "")); var index1 = -1; for (var index2 = 0; index2 < os.exes.Count; ++index2) { if (os.exes[index2].PID == num) index1 = index2; } if (index1 < 0 || index1 >= os.exes.Count) { os.write("Invalid PID"); } else { os.write("Process " + num + "[" + os.exes[index1].IdentifierName + "] Ended"); os.exes[index1].Killed(); os.exes.RemoveAt(index1); } } catch { os.write("Error: Invalid PID or Input Format"); } }
public static void opCDTray(string[] args, OS os, bool isOpen) { var computer = os.connectedComp != null ? os.connectedComp : os.thisComputer; if (os.hasConnectionPermission(true) || computer.ip.Equals(os.thisComputer.ip)) { if (isOpen) computer.openCDTray(computer.ip); else computer.closeCDTray(computer.ip); } else os.write("Insufficient Privileges to Perform Operation"); }
public static void upload(string[] args, OS os) { if (os.connectedComp == null || os.connectedComp == os.thisComputer) { os.write("Must be Connected to a Non-Local Host\n"); os.write("Connect to a REMOTE host and run upload with a LOCAL filepath\n"); } else if (args.Length < 2) os.write("Not Enough Arguments"); else if (!os.hasConnectionPermission(false)) { os.write("Insufficient user permissions to upload"); } else { var folder = os.thisComputer.files.root; var length = args[1].LastIndexOf('/'); if (length <= 0) return; var path = args[1].Substring(0, length); var folderAtPath = getFolderAtPath(path, os, os.thisComputer.files.root, false); if (folderAtPath == null) { os.write("Local Folder " + path + " not found."); } else { var fileName = args[1].Substring(length + 1); var fileEntry = folderAtPath.searchForFile(fileName); if (fileEntry == null) { os.write("File " + fileName + " not found at specified filepath."); } else { var currentFolder = getCurrentFolder(os); var folderPath = os.navigationPath; os.write("Uploading Local File " + fileName + "\nto Remote Folder /" + currentFolder.name); var num = fileEntry.size; for (var index = 0; index < num/300; ++index) { os.writeSingle("."); OS.operationProgress = index/(float) (num/1000); Thread.Sleep(200); } os.connectedComp.makeFile(os.thisComputer.ip, fileEntry.name, fileEntry.data, folderPath, true); os.write("Transfer Complete\n"); } } } }
public static Folder getFolderAtPath(string path, OS os, Folder rootFolder = null, bool returnsNullOnNoFind = false) { var folder = rootFolder != null ? rootFolder : getCurrentFolder(os); var chArray = new char[2] { '/', '\\' }; var strArray = path.Split(chArray); var num = 0; for (var index1 = 0; index1 < strArray.Length; ++index1) { if (!(strArray[index1] == "") && !(strArray[index1] == " ")) { if (strArray[index1] == "..") { ++num; folder = getFolderAtDepth(os, os.navigationPath.Count - num); } else { var flag = false; for (var index2 = 0; index2 < folder.folders.Count; ++index2) { if (folder.folders[index2].name == strArray[index1]) { folder = folder.folders[index2]; flag = true; break; } } if (!flag) { os.write("Invalid Path"); if (!returnsNullOnNoFind) return getCurrentFolder(os); return null; } } } } return folder; }
public static void replace(string[] args, OS os) { var currentFolder = getCurrentFolder(os); FileEntry fileEntry = null; var num1 = 2; if (args.Length <= 3) { if (os.display.command.StartsWith("cat")) { var fileName = os.display.commandArgs[1]; fileEntry = currentFolder.searchForFile(fileName); if (fileEntry != null) { os.write("Assuming active flag file \"" + fileName + "\" For editing"); num1 = 1; } } if (fileEntry == null) os.write("Not Enough Arguments\n"); } if (fileEntry == null) { for (var index = 0; index < currentFolder.files.Count; ++index) { if (currentFolder.files[index].name.Equals(args[1])) fileEntry = currentFolder.files[index]; } if (fileEntry == null) { os.write("File " + args[1] + " not found."); if (!os.display.command.StartsWith("cat")) return; var fileName = os.display.commandArgs[1]; if (currentFolder.searchForFile(fileName) == null) return; os.write("Assuming active file \"" + fileName + "\" for editing"); return; } } var str1 = ""; for (var index = num1; index < args.Length; ++index) str1 = str1 + args[index] + " "; var str2 = str1.Trim(); if (str2[0] != 34) return; var num2 = str2.IndexOf('"', 1); if (num2 >= 1) { var num3 = num2 - 1; var length1 = num3; var oldValue = str2.Substring(1, length1); var startIndex1 = num3 + 2; var num4 = str2.IndexOf(" \"", startIndex1); if (num4 > num3) { var num5 = str2.LastIndexOf('"'); if (num5 > num4) { var startIndex2 = num4 + 2; var length2 = num5 - startIndex2; var newValue = str2.Substring(startIndex2, length2); fileEntry.data = fileEntry.data.Replace(oldValue, newValue); if (!os.display.command.ToLower().Equals("cat")) return; os.displayCache = fileEntry.data; return; } } } os.write("Format Error: Target and Replacement strings not found."); os.write("Usage: replace targetFile.txt \"Target String\" \"Replacement String\""); }
public static void connect(string[] args, OS os) { disconnect(args, os); os.display.command = args[0]; os.display.commandArgs = args; os.display.typeChanged(); if (args.Length < 2) { os.write("Usage: connect [WHERE TO CONNECT TO]"); } else { os.write("Scanning For " + args[1]); for (var index1 = 0; index1 < os.netMap.nodes.Count; ++index1) { if (os.netMap.nodes[index1].ip.Equals(args[1]) || os.netMap.nodes[index1].name.Equals(args[1])) { if (os.connectedComp != null && os.connectedComp.Equals(os.netMap.nodes[index1])) { os.write("Already Connected to this Computer"); return; } if (os.netMap.nodes[index1].connect(os.thisComputer.ip)) { os.connectedComp = os.netMap.nodes[index1]; os.connectedIP = os.netMap.nodes[index1].ip; os.write("Connection Established ::"); os.write("Connected To " + os.netMap.nodes[index1].name + "@" + os.netMap.nodes[index1].ip); os.terminal.prompt = os.netMap.nodes[index1].ip + "@> "; if (!os.netMap.visibleNodes.Contains(index1)) os.netMap.visibleNodes.Add(index1); var fileEntry = os.netMap.nodes[index1].files.root.searchForFolder("sys") .searchForFile(ComputerTypeInfo.getDefaultBootDaemonFilename(os.netMap.nodes[index1])); if (fileEntry == null) return; var str = fileEntry.data; for (var index2 = 0; index2 < os.netMap.nodes[index1].daemons.Count; ++index2) { if (os.netMap.nodes[index1].daemons[index2].name == str) { os.netMap.nodes[index1].daemons[index2].navigatedTo(); os.display.command = os.netMap.nodes[index1].daemons[index2].name; } } return; } os.write("External Computer Refused Connection"); } } os.write("Failed to Connect:\nCould Not Find Computer at " + args[1]); } }
public static void mv(string[] args, OS os) { var computer = os.connectedComp != null ? os.connectedComp : os.thisComputer; getCurrentFolder(os); var folderPath = new List<int>(); for (var index = 0; index < os.navigationPath.Count; ++index) folderPath.Add(os.navigationPath[index]); if (args.Length < 3) { os.write("Not Enough Arguments. Usage: mv [FILE] [DESTINATION]"); } else { var name = args[1]; var str = args[2]; var path = ""; var num = str.LastIndexOf('/'); string newName; if (num > 0) { newName = str.Substring(num + 1); path = str.Substring(0, num + 1); if (newName.Length <= 0) newName = name; } else newName = str; var navigationPathAtPath = getNavigationPathAtPath(path, os, null); navigationPathAtPath.InsertRange(0, folderPath); computer.moveFile(os.thisComputer.ip, name, newName, folderPath, navigationPathAtPath); } }
public static List<int> getNavigationPathAtPath(string path, OS os, Folder currentFolder = null) { var list = new List<int>(); var folder = currentFolder != null ? currentFolder : getCurrentFolder(os); var chArray = new char[2] { '/', '\\' }; var strArray = path.Split(chArray); var num = 0; for (var index1 = 0; index1 < strArray.Length; ++index1) { if (!(strArray[index1] == "") && !(strArray[index1] == " ")) { if (strArray[index1] == "..") { list.Add(-1); ++num; folder = getFolderAtDepth(os, os.navigationPath.Count - num); } else { var flag = false; for (var index2 = 0; index2 < folder.folders.Count; ++index2) { if (folder.folders[index2].name == strArray[index1]) { folder = folder.folders[index2]; flag = true; list.Add(index2); break; } } if (!flag) { os.write("Invalid Path"); list.Clear(); return list; } } } } return list; }
public static void solve(string[] args, OS os) { var computer = os.connectedComp != null ? os.connectedComp : os.thisComputer; if (computer.firewall != null) { if (args.Length >= 2) { var attempt = args[1]; os.write(""); doDots(30, 60, os); if (computer.firewall.attemptSolve(attempt, os)) os.write("SOLVE SUCCESSFUL - Syndicated UDP Traffic Enabled"); else os.write("SOLVE FAILED - Incorrect bypass sequence"); } else os.write("ERROR: No Solution provided"); } else os.write("No Firewall Detected"); }
private static int AttemptExeProgramExecution(OS os, string[] p) { Computer target = os.connectedComp != null ? os.connectedComp : os.thisComputer; Folder folder = os.thisComputer.files.root.searchForFolder("bin"); int indexOfExeProgram = ProgramRunner.GetFileIndexOfExeProgram(p[0], (object)folder); bool flag = indexOfExeProgram == int.MaxValue; int index1 = -1; int index2 = -1; if (indexOfExeProgram < 0) { return(-1); } string exeFileData = (string)null; string exeName = (string)null; if (!flag) { exeFileData = folder.files[indexOfExeProgram].data; for (int index3 = 0; index3 < PortExploits.exeNums.Count; ++index3) { int exeNum = PortExploits.exeNums[index3]; if (PortExploits.crackExeData[exeNum].Equals(exeFileData) || PortExploits.crackExeDataLocalRNG[exeNum].Equals(exeFileData)) { exeName = PortExploits.cracks[exeNum].Replace(".exe", "").ToLower(); index2 = exeNum; break; } } if (exeName == "ftpsprint") { int num; index2 = num = 21; if (exeFileData == PortExploits.crackExeData[211] || exeFileData == PortExploits.crackExeDataLocalRNG[211]) { index1 = 211; } } } else { exeName = p[0].Replace(".exe", "").ToLower(); if (exeName == "notes") { exeFileData = PortExploits.crackExeData[8]; } if (exeName == "tutorial") { exeFileData = PortExploits.crackExeData[1]; } } if (exeName == null) { return(-1); } int targetPort = -1; int codePort = -1; if (!flag && PortExploits.needsPort[index2]) { if (p.Length > 1) { try { int int32 = Convert.ToInt32(p[1]); int num = int32; codePort = target.GetCodePortNumberFromDisplayPort(int32); if (num == codePort) { int numberFromCodePort = target.GetDisplayPortNumberFromCodePort(codePort); if (codePort != numberFromCodePort) { codePort = -1; } } } catch (FormatException ex) { codePort = -1; } } else { if (exeName == "ssltrojan") { SSLPortExe.GenerateInstanceOrNullFromArguments(p, Rectangle.Empty, (object)os, target); return(0); } os.write(LocaleTerms.Loc("No port number Provided")); return(0); } } if (!flag && PortExploits.needsPort[index2]) { try { for (int index3 = 0; index3 < target.ports.Count; ++index3) { if (target.ports[index3] == codePort) { targetPort = target.ports[index3]; break; } } } catch { os.write(LocaleTerms.Loc("No port number Provided")); return(0); } if (targetPort == -1) { os.write(LocaleTerms.Loc("Target Port is Closed")); return(0); } if (index1 <= -1) { index1 = targetPort; } if (index1 == 211 && targetPort != 21 || exeFileData != PortExploits.crackExeData[index1] && exeFileData != PortExploits.crackExeDataLocalRNG[index1]) { os.write(LocaleTerms.Loc("Target Port running incompatible service for this executable")); return(0); } } os.launchExecutable(exeName, exeFileData, targetPort, p, p[0]); return(1); }
public static void scan(string[] args, OS os) { if (args.Length > 1) { var computer = getComputer(os, args[1]); if (computer == null) return; os.netMap.discoverNode(computer); os.write("Found Terminal : " + computer.name + "@" + computer.ip); } else { var computer = os.connectedComp != null ? os.connectedComp : os.thisComputer; if (os.hasConnectionPermission(true)) { os.write("Scanning..."); for (var index = 0; index < computer.links.Count; ++index) { if (!os.netMap.visibleNodes.Contains(computer.links[index])) os.netMap.visibleNodes.Add(computer.links[index]); os.netMap.nodes[computer.links[index]].highlightFlashTime = 1f; os.write("Found Terminal : " + os.netMap.nodes[computer.links[index]].name + "@" + os.netMap.nodes[computer.links[index]].ip); os.netMap.lastAddedNode = os.netMap.nodes[computer.links[index]]; Thread.Sleep(400); } os.write("Scan Complete\n"); } else os.write("Scanning Requires Admin Access\n"); } }
private static int AttemptExeProgramExecution(OS os, string[] p) { var computer = os.connectedComp != null ? os.connectedComp : os.thisComputer; var folder = os.thisComputer.files.root.searchForFolder("bin"); var indexOfExeProgram = GetFileIndexOfExeProgram(p[0], folder); var flag = indexOfExeProgram == int.MaxValue; var index1 = -1; if (indexOfExeProgram < 0) return -1; string exeFileData = null; string exeName = null; if (!flag) { exeFileData = folder.files[indexOfExeProgram].data; for (var index2 = 0; index2 < PortExploits.exeNums.Count; ++index2) { var index3 = PortExploits.exeNums[index2]; if (PortExploits.crackExeData[index3].Equals(exeFileData)) { exeName = PortExploits.cracks[index3].Replace(".exe", "").ToLower(); index1 = index3; break; } } } else { exeName = p[0].Replace(".exe", "").ToLower(); if (exeName == "notes") exeFileData = PortExploits.crackExeData[8]; if (exeName == "tutorial") exeFileData = PortExploits.crackExeData[1]; } if (exeName == null) return -1; var targetPort = -1; if (!flag) { if (PortExploits.needsPort[index1]) { try { for (var index2 = 0; index2 < computer.ports.Count; ++index2) { if (computer.ports[index2] == Convert.ToInt32(p[1])) { targetPort = computer.ports[index2]; break; } } } catch { os.write("No port number Provided"); return 0; } if (targetPort == -1) { os.write("Target Port is Closed"); return 0; } if (exeFileData != PortExploits.crackExeData[targetPort]) { os.write("Target Port running incompatible service for this executable"); return 0; } } } os.launchExecutable(exeName, exeFileData, targetPort, p); return 1; }
public static Folder getFolderFromNavigationPath(List<int> path, Folder startFolder, OS os) { var folder1 = startFolder; var folder2 = startFolder; for (var index = 0; index < path.Count; ++index) { if (path[index] <= -1) folder1 = folder2; else if (folder1.folders.Count > path[index]) { folder2 = folder1; folder1 = folder1.folders[path[index]]; } else { os.write("Invalid Path"); return folder1; } } return folder1; }
public static void runCommand(int value, string name) { assertOS(); if (name.Equals("addRank")) { os.currentFaction.addValue(value, os); var mail = MailServer.generateEmail("Contract Successful", "Congratulations,\nThe client of your recent contract has reported a success, and is pleased with your work.\n" + "You are now free to accept further contracts from the contact database.\n" + "\nYour Current Ranking is " + os.currentFaction.getRank() + " of " + os.currentFaction.getMaxRank() + ".\n" + "\nThankyou,\n -" + os.currentFaction.name, os.currentFaction.name + " ReplyBot"); ((MailServer) os.netMap.mailServer.getDaemon(typeof (MailServer))).addMail(mail, os.defaultUser.name); } else if (name.StartsWith("addFlags:")) { foreach ( var flag in name.Substring("addFlags:".Length) .Split(Utils.commaDelim, StringSplitOptions.RemoveEmptyEntries)) os.Flags.AddFlag(flag); } if (name.Equals("triggerThemeHackRevenge")) os.delayer.Post(ActionDelayer.Wait(5.0), () => { var mail = MailServer.generateEmail("Are you Kidding me?", "Seriously?\n\n" + "You think you can just f**k with my stuff and leave without consequence? Did you think I wouldn't notice?\n" + "\nDid you think I wouldn't FIND you!?\n" + "\nYou're a pathetic scrit kiddie, you couldn't hack a f*****g honeypot without your precious buttons and scrollbars.\n" + "\nSay goodbye to your x-server, idiot." + "\n\nNaix", "*****@*****.**"); ((MailServer) os.netMap.mailServer.getDaemon(typeof (MailServer))).addMail(mail, os.defaultUser.name); os.delayer.Post(ActionDelayer.Wait(24.0), () => { try { HackerScriptExecuter.runScript("ThemeHack.txt", os); } catch (Exception ex) { if (!Settings.recoverFromErrorsSilently) throw ex; os.write("CAUTION: UNSYNDICATED OUTSIDE CONNECTION ATTEMPT"); os.write("RECOVERED FROM CONNECTION SUBTERFUGE SUCCESSFULLY"); Console.WriteLine("Critical error loading hacker script - aborting"); } }); }); else if (name.Equals("changeSong")) { switch (value) { case 2: MusicManager.transitionToSong("Music\\The_Quickening"); break; case 3: MusicManager.transitionToSong("Music\\TheAlgorithm"); break; case 4: MusicManager.transitionToSong("Music\\Ryan3"); break; case 5: MusicManager.transitionToSong("Music\\Bit(Ending)"); break; case 6: MusicManager.transitionToSong("Music\\Rico_Puestel-Roja_Drifts_By"); break; case 7: MusicManager.transitionToSong("Music\\out_run_the_wolves"); break; case 8: MusicManager.transitionToSong("Music\\Irritations"); break; case 9: MusicManager.transitionToSong("Music\\Broken_Boy"); break; case 10: MusicManager.transitionToSong("Music\\Ryan10"); break; case 11: MusicManager.transitionToSong("Music\\tetrameth"); break; default: MusicManager.transitionToSong("Music\\Revolve"); break; } } else if (name.Equals("entropyEndMissionSetup")) { runCommand(3, "changeSong"); var comp1 = findComp("corp0#IS"); var comp2 = findComp("corp0#MF"); var comp3 = findComp("corp0#BU"); var fileEntry1 = new FileEntry(Computer.generateBinaryString(5000), "HacknetOS.rar"); var fileEntry2 = new FileEntry(Computer.generateBinaryString(4000), "HacknetOS_Data.xnb"); var fileEntry3 = new FileEntry(Computer.generateBinaryString(4000), "HacknetOS_Content.xnb"); var folder1 = comp1.files.root.folders[2]; folder1.files.Add(fileEntry1); folder1.files.Add(fileEntry2); folder1.files.Add(fileEntry3); var folder2 = comp2.files.root.folders[2]; folder2.files.Add(fileEntry1); folder2.files.Add(fileEntry2); folder2.files.Add(fileEntry3); var fileEntry4 = new FileEntry(fileEntry1.data, fileEntry1.name + "_backup"); var fileEntry5 = new FileEntry(fileEntry2.data, fileEntry2.name + "_backup"); var fileEntry6 = new FileEntry(fileEntry3.data, fileEntry3.name + "_backup"); var folder3 = comp3.files.root.folders[2]; folder3.files.Add(fileEntry4); folder3.files.Add(fileEntry5); folder3.files.Add(fileEntry6); comp1.traceTime = Computer.BASE_TRACE_TIME*7.5f; comp3.traceTime = Computer.BASE_TRACE_TIME*7.5f; comp2.traceTime = Computer.BASE_TRACE_TIME*7.5f; comp2.portsNeededForCrack = 3; comp1.portsNeededForCrack = 2; comp3.portsNeededForCrack = 2; var folder4 = findComp("entropy01").files.root.folders[2]; folder4.files.Add(new FileEntry(PortExploits.crackExeData[25], "SMTPoverflow.exe")); folder4.files.Add(new FileEntry(PortExploits.crackExeData[80], "WebServerWorm.exe")); } else if (name.Equals("entropyAddSMTPCrack")) { var f = findComp("entropy01").files.root.folders[2]; f.files.Add(new FileEntry(PortExploits.crackExeData[25], Utils.GetNonRepeatingFilename("SMTPoverflow", ".exe", f))); os.saveGame(); } else if (name.Equals("transitionToBitMissions")) { if (Settings.isDemoMode) { runCommand(6, "changeSong"); if (Settings.isPressBuildDemo) ComputerLoader.loadMission("Content/Missions/Demo/PressBuild/DemoMission01.xml"); else ComputerLoader.loadMission("Content/Missions/Demo/AvconDemo.xml"); } else ComputerLoader.loadMission("Content/Missions/BitMission0.xml"); } else if (name.Equals("entropySendCSECInvite")) os.delayer.Post(ActionDelayer.Wait(6.0), () => ComputerLoader.loadMission("Content/Missions/MainHub/Intro/Intro01.xml")); else if (name.Equals("hubBitSetComplete01")) { os.delayer.Post(ActionDelayer.Wait(4.0), () => runCommand(1, "addRank")); runCommand(3, "changeSong"); os.Flags.AddFlag("csecBitSet01Complete"); } else if (name.Equals("enTechEnableOfflineBackup")) { var computer = Programs.getComputer(os, "EnTechOfflineBackup"); Programs.getComputer(os, "EnTechMainframe").links.Add(os.netMap.nodes.IndexOf(computer)); os.Flags.AddFlag("VaporSequencerEnabled"); var folder1 = findComp("mainHubAssets").files.root.searchForFolder("bin"); var folder2 = folder1.searchForFolder("Sequencer"); if (folder2 == null) { folder2 = new Folder("Sequencer"); folder1.folders.Add(folder2); } if (folder2.searchForFile("Sequencer.exe") != null) return; folder2.files.Add(new FileEntry(PortExploits.crackExeData[17], "Sequencer.exe")); } else if (name.Equals("rudeNaixResponse")) AchievementsManager.Unlock("rude_response", false); else if (name.Equals("assignPlayerToHubServerFaction")) { os.allFactions.setCurrentFaction("hub", os); var computer = Programs.getComputer(os, "mainHub"); var missionHubServer = (MissionHubServer) computer.getDaemon(typeof (MissionHubServer)); var userDetail = new UserDetail(os.defaultUser.name, "reptile", 3); computer.addNewUser(computer.ip, userDetail); missionHubServer.addUser(userDetail); os.homeNodeID = "mainHub"; os.homeAssetServerID = "mainHubAssets"; runCommand(3, "changeSong"); os.Flags.AddFlag("CSEC_Member"); AchievementsManager.Unlock("progress_csec", false); } else if (name.Equals("assignPlayerToEntropyFaction")) { runCommand(6, "changeSong"); AchievementsManager.Unlock("progress_entropy", false); } else if (name.Equals("assignPlayerToLelzSec")) { os.homeNodeID = "lelzSecHub"; os.homeAssetServerID = "lelzSecHub"; os.Flags.AddFlag("LelzSec_Member"); AchievementsManager.Unlock("progress_lelz", false); } else if (name.Equals("lelzSecVictory")) AchievementsManager.Unlock("secret_path_complete", false); else if (name.Equals("demoFinalMissionEnd")) { os.exes.Clear(); PostProcessor.EndingSequenceFlashOutActive = true; PostProcessor.EndingSequenceFlashOutPercentageComplete = 1f; MusicManager.stop(); os.delayer.Post(ActionDelayer.Wait(0.2), () => os.content.Load<SoundEffect>("Music/Ambient/spiral_gauge_down").Play()); os.delayer.Post(ActionDelayer.Wait(3.0), () => { PostProcessor.dangerModeEnabled = false; PostProcessor.dangerModePercentComplete = 0.0f; os.ExitScreen(); os.ScreenManager.AddScreen(new DemoEndScreen()); }); } else if (name.Equals("demoFinalMissionStart")) { os.Flags.AddFlag("DemoSequencerEnabled"); MusicManager.transitionToSong("Music/Ambient/dark_drone_008"); } else if (name.Equals("CSECTesterGameWorldSetup")) { for (var index = 0; index < PortExploits.services.Count && index < 4; ++index) os.thisComputer.files.root.folders[2].files.Add( new FileEntry(PortExploits.crackExeData[PortExploits.portNums[index]], PortExploits.cracks[PortExploits.portNums[index]])); for (var index = 0; index < 4; ++index) { var c = new Computer("DebugShell" + index, NetworkMap.generateRandomIP(), os.netMap.getRandomPosition(), 0, 2, os); c.adminIP = os.thisComputer.adminIP; os.netMap.nodes.Add(c); os.netMap.discoverNode(c); } os.delayer.Post(ActionDelayer.Wait(0.2), () => { os.allFactions.setCurrentFaction("entropy", os); os.currentMission = null; os.netMap.discoverNode(Programs.getComputer(os, "entropy00")); os.netMap.discoverNode(Programs.getComputer(os, "entropy01")); }); } else if (name.Equals("EntropyFastFowardSetup")) { os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[22], PortExploits.cracks[22])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[21], PortExploits.cracks[21])); for (var index = 0; index < 3; ++index) { var c = new Computer("DebugShell" + index, NetworkMap.generateRandomIP(), os.netMap.getRandomPosition(), 0, 2, os); c.adminIP = os.thisComputer.adminIP; os.netMap.nodes.Add(c); os.netMap.discoverNode(c); } os.delayer.Post(ActionDelayer.Wait(0.2), () => { os.allFactions.setCurrentFaction("entropy", os); os.currentMission = null; os.netMap.discoverNode(Programs.getComputer(os, "entropy00")); os.netMap.discoverNode(Programs.getComputer(os, "entropy01")); var computer = Programs.getComputer(os, "entropy01"); var userDetail = computer.users[0]; userDetail.known = true; computer.users[0] = userDetail; os.allFactions.factions[os.allFactions.currentFaction].playerValue = 2; os.delayer.Post(ActionDelayer.Wait(0.2), () => { os.Flags.AddFlag("eosPathStarted"); ComputerLoader.loadMission( "Content/Missions/Entropy/StartingSet/eosMissions/eosIntroDelayer.xml"); }); }); } else if (name.Equals("CSECFastFowardSetup")) { os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[22], PortExploits.cracks[22])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[21], PortExploits.cracks[21])); for (var index = 0; index < 3; ++index) { var c = new Computer("DebugShell" + index, NetworkMap.generateRandomIP(), os.netMap.getRandomPosition(), 0, 2, os); c.adminIP = os.thisComputer.adminIP; os.netMap.nodes.Add(c); os.netMap.discoverNode(c); } os.delayer.Post(ActionDelayer.Wait(0.2), () => { runCommand(0, "assignPlayerToHubServerFaction"); os.currentMission = null; os.netMap.discoverNode(Programs.getComputer(os, "mainHub")); os.netMap.discoverNode(Programs.getComputer(os, "mainHubAssets")); var computer = Programs.getComputer(os, "mainHubAssets"); var userDetail = computer.users[0]; userDetail.known = true; computer.users[0] = userDetail; }); } else if (name.Equals("csecAddTraceKill")) { var folder = findComp("mainHubAssets").files.root.searchForFolder("bin"); var f = folder.searchForFolder("TK"); if (f == null) { f = new Folder("TK"); folder.folders.Add(f); } f.files.Add( new FileEntry( FileEncrypter.EncryptString(PortExploits.crackExeData[12], "Vapor Trick Enc.", "NULL", "dx122DX", ".exe"), Utils.GetNonRepeatingFilename("TraceKill", ".dec", f))); os.Flags.AddFlag("bitPathStarted"); runCommand(10, "changeSong"); } else if (name.Equals("junebugComplete")) { var computer = Programs.getComputer(os, "pacemaker01"); if (computer != null) { var heartMonitorDaemon = (HeartMonitorDaemon) computer.getDaemon(typeof (HeartMonitorDaemon)); if (heartMonitorDaemon != null) heartMonitorDaemon.ForceStopBeepSustainSound(); } runCommand(1, "addRank"); } else if (name.Equals("eosIntroMissionSetup")) { findComp("entropy01") .files.root.searchForFolder("bin") .files.Add(new FileEntry(PortExploits.crackExeData[13], "eosDeviceScan.exe")); os.delayer.Post(ActionDelayer.Wait(8.0), () => { var mail = MailServer.generateEmail("Fwd: eOS Stuff", Utils.readEntireFile("Content/Post/eosScannerMail.txt"), "vtfx", new List<string>(new string[1] { "note#%#eOS Security Basics#%#" + ("1: Get admin access to a computer that you suspect has an eOS device sync'd to it\n" + "2: Run eosdevicescanner.exe\nto scan for paired devices and automatically open connection ports\n" + "3: connect to the revealed device\n" + "3: login with\nuser: \"admin\"\npassword: \"alpine\"\n\n" + "The password is the same for all eOS devices!") })); ((MailServer) os.netMap.mailServer.getDaemon(typeof (MailServer))).addMail(mail, os.defaultUser.name); }); runCommand(4, "changeSong"); os.saveGame(); } else { if (!name.Equals("eosIntroEndFunc")) return; runCommand(1, "addRank"); var missionListingServer = (MissionListingServer) findComp("entropy00").getDaemon(typeof (MissionListingServer)); var list = os.branchMissions; var m = (ActiveMission) ComputerLoader.readMission( "Content/Missions/Entropy/StartingSet/eosMissions/eosAddedMission.xml"); missionListingServer.addMisison(m); os.branchMissions = list; } }
public bool moveFile(string ipFrom, string name, string newName, List <int> folderPath, List <int> destFolderPath) { if (!silent && !ipFrom.Equals(adminIP) && !ipFrom.Equals(ip)) { return(false); } var folder1 = files.root; var fromNavigationPath = Programs.getFolderFromNavigationPath(folderPath, files.root, os); var folder2 = Programs.getFolderFromNavigationPath(destFolderPath, files.root, os); if (newName.StartsWith("/")) { if (destFolderPath.Count == 0 || folderPath.Count > 0 && destFolderPath.Count == folderPath.Count && destFolderPath[0] == folderPath[0]) { folder2 = files.root; newName = newName.Substring(1); var folder3 = folder2.searchForFolder(newName); if (folder3 != null) { folder2 = folder3; newName = name; } } else { newName = newName.Substring(1); } } FileEntry fileEntry = null; for (var index = 0; index < fromNavigationPath.files.Count; ++index) { if (fromNavigationPath.files[index].name == name) { fileEntry = fromNavigationPath.files[index]; fromNavigationPath.files.RemoveAt(index); break; } } if (fileEntry == null) { os.write("File not Found"); return(false); } if (newName == "" || newName == " ") { newName = name; } fileEntry.name = newName; var str1 = fileEntry.name; var num = 1; while (folder2.searchForFile(fileEntry.name) != null) { fileEntry.name = string.Concat(str1, "(", num, ")"); ++num; } folder2.files.Add(fileEntry); var str2 = "cMove #" + ip + "#" + ipFrom + "#" + name + "#" + newName + "#"; for (var index = 0; index < folderPath.Count; ++index) { str2 = str2 + "%" + folderPath[index]; } var s = str2 + "#"; for (var index = 0; index < destFolderPath.Count; ++index) { s = s + "%" + destFolderPath[index]; } sendNetworkMessage(s); log("File Moved: by " + ipFrom + " - file:" + name + " To: " + newName); return(true); }
public static void disconnect(string[] args, OS os) { os.navigationPath.Clear(); if (os.connectedComp != null) os.connectedComp.disconnecting(os.thisComputer.ip); os.connectedComp = null; os.connectedIP = ""; os.terminal.prompt = "> "; os.write("Disconnected \n"); lock (os.netMap.nodeEffect) os.netMap.nodeEffect.reset(); lock (os.netMap.adminNodeEffect) os.netMap.adminNodeEffect.reset(); }
public static void parseInputMessage(string message, OS os) { if (message.Equals("")) { return; } string[] strArray1 = message.Split(Multiplayer.delims); if (strArray1.Length == 0) { return; } if (os.thisComputer != null && os.thisComputer.ip.Equals(strArray1[1])) { os.warningFlash(); } if (strArray1[0].Equals("init")) { int int32 = Convert.ToInt32(strArray1[1]); Utils.random = new Random(int32); os.canRunContent = true; os.LoadContent(); os.write("Seed Established :" + (object)int32); } else if (strArray1[0].Equals("chat")) { string s = ""; for (int index = 2; index < strArray1.Length; ++index) { s = s + strArray1[index] + " "; } os.write(strArray1[1] + ": " + DisplayModule.splitForWidth(s, 350)); } else if (strArray1[0].Equals("clientConnect")) { os.write("Connection Established"); } else if (strArray1[0].Equals("cConnection")) { Computer comp = Multiplayer.getComp(strArray1[1], os); if (comp == null) { os.write("Error in Message : " + message); } else { comp.silent = true; comp.connect(strArray1[2]); comp.silent = false; os.opponentLocation = strArray1[1]; } } else if (strArray1[0].Equals("cDisconnect")) { Computer comp = Multiplayer.getComp(strArray1[1], os); comp.silent = true; comp.disconnecting(strArray1[2], true); comp.silent = false; os.opponentLocation = ""; } else if (strArray1[0].Equals("cAdmin")) { Computer comp = Multiplayer.getComp(strArray1[1], os); comp.silent = true; comp.giveAdmin(strArray1[2]); comp.silent = false; } else if (strArray1[0].Equals("cPortOpen")) { Computer comp = Multiplayer.getComp(strArray1[1], os); comp.silent = true; comp.openPort(Convert.ToInt32(strArray1[3]), strArray1[2]); comp.silent = false; } else if (strArray1[0].Equals("cPortClose")) { Computer comp = Multiplayer.getComp(strArray1[1], os); comp.silent = true; comp.closePort(Convert.ToInt32(strArray1[3]), strArray1[2]); comp.silent = false; } else if (strArray1[0].Equals("cFile")) { Computer comp = Multiplayer.getComp(strArray1[1], os); comp.silent = true; FileEntry f = new FileEntry("", strArray1[3]); comp.canReadFile(strArray1[2], f, Convert.ToInt32(strArray1[4])); comp.silent = false; } else if (strArray1[0].Equals("newComp")) { string[] strArray2 = message.Split(Multiplayer.specSplitDelims); Vector2 compLocation = new Vector2((float)Convert.ToInt32(strArray2[2]), (float)Convert.ToInt32(strArray2[3])); Computer computer = new Computer(strArray2[5], strArray2[1], compLocation, Convert.ToInt32(strArray2[4]), (byte)1, os); computer.idName = "opponent#" + (object)Multiplayer.generatedComputerCount; ++Multiplayer.generatedComputerCount; computer.addMultiplayerTargetFile(); os.netMap.nodes.Add(computer); os.opponentComputer = computer; } else if (strArray1[0].Equals("cDelete")) { string[] strArray2 = message.Split(Multiplayer.specSplitDelims); Computer comp = Multiplayer.getComp(strArray2[1], os); List <int> folderPath = new List <int>(); for (int index = 4; index < strArray2.Length; ++index) { if (strArray2[index] != "") { folderPath.Add(Convert.ToInt32(strArray2[index])); } } comp.silent = true; comp.deleteFile(strArray2[2], strArray2[3], folderPath); comp.silent = false; } else if (strArray1[0].Equals("cMake")) { string[] strArray2 = message.Split(Multiplayer.specSplitDelims); Computer comp = Multiplayer.getComp(strArray2[1], os); List <int> folderPath = new List <int>(); for (int index = 4; index < strArray2.Length; ++index) { if (strArray2[index] != "") { folderPath.Add(Convert.ToInt32(strArray2[index])); } } comp.silent = true; comp.makeFile(strArray2[2], strArray2[3], strArray2[4], folderPath, false); comp.silent = false; } else if (strArray1[0].Equals("cMove")) { string[] strArray2 = message.Split(Multiplayer.specSplitDelims); Computer comp = Multiplayer.getComp(strArray2[1], os); char[] separator = new char[1] { '%' }; List <int> folderPath = new List <int>(); string[] strArray3 = strArray2[5].Split(separator, 500, StringSplitOptions.RemoveEmptyEntries); for (int index = 0; index < strArray3.Length; ++index) { if (strArray2[index] != "") { folderPath.Add(Convert.ToInt32(strArray2[index])); } } List <int> destFolderPath = new List <int>(); string[] strArray4 = strArray2[6].Split(separator, 500, StringSplitOptions.RemoveEmptyEntries); for (int index = 0; index < strArray4.Length; ++index) { if (strArray2[index] != "") { destFolderPath.Add(Convert.ToInt32(strArray2[index])); } } comp.silent = true; comp.moveFile(strArray2[2], strArray2[3], strArray2[4], folderPath, destFolderPath); comp.silent = false; } else if (strArray1[0].Equals("cMkDir")) { string[] strArray2 = message.Split(Multiplayer.specSplitDelims); Computer comp = Multiplayer.getComp(strArray2[1], os); List <int> folderPath = new List <int>(); for (int index = 4; index < strArray2.Length; ++index) { if (strArray2[index] != "") { folderPath.Add(Convert.ToInt32(strArray2[index])); } } comp.silent = true; comp.makeFolder(strArray2[2], strArray2[3], folderPath); comp.silent = false; } else if (strArray1[0].Equals("cAddUser")) { string[] strArray2 = message.Split(Multiplayer.specSplitDelims); Computer comp = Multiplayer.getComp(strArray2[1], os); string name = strArray2[3]; string pass = strArray2[4]; byte type = Convert.ToByte(strArray2[5]); comp.silent = true; comp.addNewUser(strArray2[2], name, pass, type); comp.silent = false; } else if (strArray1[0].Equals("cCopy")) { Computer comp = Multiplayer.getComp(strArray1[1], os); comp.silent = true; comp.canCopyFile(strArray1[2], strArray1[3]); comp.silent = false; FileEntry fileEntry1 = (FileEntry)null; for (int index = 0; index < comp.files.root.folders[2].files.Count; ++index) { if (comp.files.root.folders[2].files[index].name.Equals(strArray1[3])) { fileEntry1 = comp.files.root.folders[2].files[index]; } } FileEntry fileEntry2 = new FileEntry(fileEntry1.data, fileEntry1.name); Multiplayer.getComp(strArray1[2], os).files.root.folders[2].files.Add(fileEntry2); } else if (strArray1[0].Equals("cCDDrive")) { Computer comp = Multiplayer.getComp(strArray1[1], os); comp.silent = true; if (strArray1[2].Equals("open")) { comp.openCDTray(strArray1[1]); } else { comp.closeCDTray(strArray1[1]); } comp.silent = false; } else if (strArray1[0].Equals("cCrash")) { Computer comp = Multiplayer.getComp(strArray1[1], os); comp.silent = true; comp.crash(strArray1[2]); comp.silent = false; } else if (strArray1[0].Equals("cReboot")) { Computer comp = Multiplayer.getComp(strArray1[1], os); comp.silent = true; comp.reboot(strArray1[2]); comp.silent = false; } else if (strArray1[0].Equals("cFBClients")) { Computer comp = Multiplayer.getComp(strArray1[1], os); if (os.connectedComp != null && os.connectedComp.ip.Equals(strArray1[1])) { os.exes.Add((ExeModule) new ForkBombExe(os.getExeBounds(), os)); } comp.silent = true; comp.forkBombClients(strArray1[2]); comp.silent = false; } else if (strArray1[0].Equals("eForkBomb")) { if (!os.thisComputer.ip.Equals(strArray1[1])) { return; } ForkBombExe forkBombExe = new ForkBombExe(os.getExeBounds(), os); forkBombExe.LoadContent(); os.exes.Add((ExeModule)forkBombExe); } else if (strArray1[0].Equals("mpOpponentWin")) { os.endMultiplayerMatch(false); } else { if (strArray1[0].Equals("stayAlive")) { return; } os.write("MSG: " + message); } }
public static void login(string[] args, OS os) { var str = os.terminal.prompt; os.display.command = "login"; os.displayCache = "loginData#$#$#$$#$&$#$#$#$#"; os.terminal.preventingExecution = true; os.terminal.prompt = "Username :"******"loginData#$#$#$$#$&$#$#$#$#" + lastRunCommand1 + "#$#$#$$#$&$#$#$#$#"; os.terminal.prompt = "Password :"******"Admin Login Successful"); break; case 2: os.write("User " + lastRunCommand1 + " Login Successful"); os.connectedComp.userLoggedIn = true; break; default: os.write("Login Failed"); break; } os.displayCache = string.Concat(os.displayCache, "#$#$#$$#$&$#$#$#$#", num3, "#$#$#$$#$&$#$#$#$#"); }
public static SSLPortExe GenerateInstanceOrNullFromArguments(string[] args, Rectangle location, object osObj, Computer target) { OS operatingSystem = (OS)osObj; if (args.Length < 4) { operatingSystem.write("--------------------------------------"); operatingSystem.write("SSLTrojan " + LocaleTerms.Loc("ERROR: Not enough arguments!")); operatingSystem.write(LocaleTerms.Loc("Usage:") + " SSLTrojan [" + LocaleTerms.Loc("PortNum") + "] [-" + LocaleTerms.Loc("option") + "] [" + LocaleTerms.Loc("option port num") + "]"); operatingSystem.write(LocaleTerms.Loc("Valid Options:") + " [-s (SSH)] [-f (FTP)] [-w (HTTP)] [-r (RTSP)]"); operatingSystem.write("--------------------------------------"); return((SSLPortExe)null); } try { Convert.ToInt32(args[1]); int int32_1 = Convert.ToInt32(args[3]); string str = args[2].ToLower(); SSLPortExe.SSLMode mode = SSLPortExe.SSLMode.SSH; switch (str) { case "-s": mode = SSLPortExe.SSLMode.SSH; break; case "-f": mode = SSLPortExe.SSLMode.FTP; break; case "-w": mode = SSLPortExe.SSLMode.Web; break; case "-r": mode = SSLPortExe.SSLMode.RTSP; break; default: str = (string)null; break; } if (str == null) { operatingSystem.write("--------------------------------------"); operatingSystem.write("SSLTrojan " + string.Format(LocaleTerms.Loc("Error: Mode {0} is invalid."), (object)args[2])); operatingSystem.write(LocaleTerms.Loc("Valid Options:") + " [-s (SSH)] [-f (FTP)] [-w (HTTP)] [-r (RTSP)]"); operatingSystem.write("--------------------------------------"); return((SSLPortExe)null); } int num = -1; bool flag = false; switch (mode) { case SSLPortExe.SSLMode.SSH: flag = target.isPortOpen(22); num = target.GetDisplayPortNumberFromCodePort(22); break; case SSLPortExe.SSLMode.FTP: flag = target.isPortOpen(21); num = target.GetDisplayPortNumberFromCodePort(21); break; case SSLPortExe.SSLMode.Web: flag = target.isPortOpen(80); num = target.GetDisplayPortNumberFromCodePort(80); break; case SSLPortExe.SSLMode.RTSP: flag = target.isPortOpen(554); num = target.GetDisplayPortNumberFromCodePort(554); break; } if (!flag) { operatingSystem.write("--------------------------------------"); operatingSystem.write("SSLTrojan " + LocaleTerms.Loc("Error: Target bypass port is closed!")); return((SSLPortExe)null); } int int32_2; try { int32_2 = Convert.ToInt32(int32_1); } catch (FormatException ex) { operatingSystem.write("--------------------------------------"); operatingSystem.write("SSLTrojan " + string.Format(LocaleTerms.Loc("Error: Invalid tunnel port number : \"{0}\""), (object)int32_1)); return((SSLPortExe)null); } if (int32_2 == num) { return(new SSLPortExe(location, operatingSystem, mode)); } operatingSystem.write("--------------------------------------"); operatingSystem.write("SSLTrojan " + string.Format(LocaleTerms.Loc("Error: Tunnel port number {0} does not match expected service \"{1}"), (object)int32_2, (object)str)); return((SSLPortExe)null); } catch (Exception ex) { operatingSystem.write("SSLTrojan " + LocaleTerms.Loc("Error:")); operatingSystem.write(ex.Message); return((SSLPortExe)null); } }
private IEnumerator<ActionDelayer.Condition> generateOutputPass(int pass, OS os, Computer target) { target.firewallAnalysisInProgress = true; os.write("Firewall Analysis Pass " + analysisPasses + "\n"); yield return ActionDelayer.Wait(0.03); os.write("--------------------"); yield return ActionDelayer.Wait(0.03); var preceedeString = " "; var secondsDelayPerLine = 0.08 + 0.06*pass + additionalDelay; for (var i = 0; i < solutionLength; ++i) { os.write(preceedeString + generateOutputLine(i)); yield return ActionDelayer.Wait(secondsDelayPerLine); } os.write("--------------------\n"); target.firewallAnalysisInProgress = false; }