public static void doDots(int num, int msDelay, OS os) { for (var index = 0; index < num; ++index) { os.writeSingle("."); Thread.Sleep(Utils.DebugGoFast() ? 1 : msDelay); } }
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 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 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 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 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 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")); }