Пример #1
0
    public void ListFiles(string[] args)
    {
        TerminalCore.AddMessage("LS");
        string reason;

        if (!TerminalNetwork.GetCurrentDevice().networkNode.HasAccess(out reason))
        {
            TerminalCore.AddMessage(TerminalColourScheme.FormatText(reason, TerminalStyle.DANGER));
            return;
        }


        FileSystem fs            = TerminalNetwork.GetCurrentDevice().GetComponent <FileSystem>();
        bool       hasFileSystem = fs != null;


        print("Has File System: " + hasFileSystem);
        if (hasFileSystem)
        {
            if (fs.HasPermission())
            {
                PrintDirectory(fs.CurrentDirectory);
            }
            else
            {
                NotifyBlocked();
            }
        }
        else
        {
            TerminalCore.AddLoadingBar(1.5f, null, "\nFile System: ", "Not Found.");
        }
    }
Пример #2
0
    public void SolveCommand(string[] args)
    {
        NetworkDevice   device = TerminalNetwork.GetCurrentDevice();
        NetworkFirewall wall   = device.networkNode.FireWall;

        NetworkFirewall.FirewallLevel level = wall.GetNextClosedFirewall();
        int levelIndex = wall.GetNextClosedFirewallIndex();

        if (args.Length > 0)
        {
            if (args[0].ToUpper() == level.Password.ToUpper())
            {
                TerminalCore.AddLoadingBar(0.5f, AttemptSolve, "\n\tAttempting Solution: " + level.Password, "\n\tSolution Accepted.");

                level.CurrentGuess = level.Password;
                return;
            }

            char   guess        = args[0].ToUpper()[0];
            char[] CurrentGuess = level.CurrentGuess.ToCharArray();
            for (int i = 0; i < level.Password.Length; i++)
            {
                if (level.Password.ToUpper()[i] == guess)
                {
                    CurrentGuess[i] = level.Password[i];
                }
            }

            level.CurrentGuess = new string(CurrentGuess);
            TerminalCore.AddMessage("");
            string[] array = level.CurrentGuess.ToCharArray().Select(a => a.ToString()).ToArray();
            array[0] = "\t - Guess: " + array[0];
            TerminalCore.AddLoadingBar(0.5f, AttemptSolve, array);
        }
    }
Пример #3
0
    public IEnumerator DisplayMessage()
    {
        char[] split = bootingText.text.ToCharArray();
        TerminalCore.PauseTerminal(5f);
        string[] sSplit = new string[split.Length];

        for (int i = 0; i < split.Length; i++)
        {
            sSplit[i] = split[i].ToString();
        }

        TerminalCore.AddLoadingBar(3f, null, sSplit);
        yield return(new WaitForSeconds(10f));

        // TerminalCore.AddMessage("Clearing Terminal...");
        // yield return new WaitForSeconds(0.1f);
        // TerminalCore.AddMessage(".");
        // yield return new WaitForSeconds(0.1f);
        // TerminalCore.AddMessage(".");
        // yield return new WaitForSeconds(0.1f);
        // TerminalCore.AddMessage(".");
        // yield return new WaitForSeconds(1f);
        // TerminalCore.ClearTerminal();
        TerminalCore.AddMessage("System Ready");
    }
Пример #4
0
    private void PortHackCommand(string[] args)
    {
        if (args.Length == 0)
        {
            return;
        }

        int port = int.Parse(args[0]);

        portToOpen = port;
        NetworkDevice device = TerminalNetwork.GetCurrentDevice();

        TerminalCore.AddLoadingBar(2f, OpenPort, "\n\tPort:" + port + " -", "-", "-", "-", "-", "-", "-", "-", "Cracked.");
    }
Пример #5
0
    public void ConnectNetwork(string[] args)
    {
        if (TerminalNetwork.GetCurrentDevice().networkNode.FireWall != null)
        {
            if (!TerminalNetwork.GetCurrentDevice().networkNode.FireWall.IsOpen())
            {
                TerminalCore.AddLoadingBar(0.1f, null,
                                           "\n \t - Attempting Connection...",
                                           "\n \t - Connection lost", TerminalColourScheme.FormatText("\n \t - Access Restricted - Firewall Detected", TerminalStyle.DANGER));
                //TerminalCore.AddMessage("\t-Access Restricted - Firewall Detected");
                return;
            }
        }

        TerminalCore.AddMessage("\n \t Connecting");
        if (args.Length < 1)
        {
            TerminalCore.AddLoadingBar(0.2f, null, ".", ".", ".", " \t <color=orange>Device not found</color>");
            return;
        }


        //Find Closest Match
        if (args[0].Contains("*"))
        {
            NetworkNode currentNode = TerminalNetwork.GetCurrentDevice().networkNode;

            List <NetworkNode> possibilities = currentNode._nodes.Where(a => a.networkDevice.GetDeviceName().ToUpper().StartsWith(args[0].ToUpper().Replace("*", ""))).ToList();
            possibilities.Sort();
            args[0] = possibilities[0].networkDevice.GetDeviceName();
        }

        bool deviceFound = TerminalNetwork.GetCurrentDevice().networkNode._nodes.Any(a => a.networkDevice.GetDeviceName().ToUpper() == args[0].ToUpper());

        if (deviceFound)
        {
            TerminalCore.AddLoadingBar(0.1f, AttemptConnection, ".", ".", ".");
            deviceName = args[0].ToUpper();
        }
        else
        {
            TerminalCore.AddLoadingBar(1.5f, null, ".", ".", ".", " <color=orange>Device not found</color>");
        }
    }
Пример #6
0
    public void Shell(string[] args)
    {
        NetworkDevice device = TerminalNetwork.GetCurrentDevice();

        if (device == null)
        {
            return;
        }

        if (args.Length == 0)
        {
            TerminalCore.AddMessage("<color=#0087ff> Shell <cmd>:</color>");

            foreach (string cmd in device.GetCommands())
            {
                TerminalCore.AddMessage("\t-" + cmd);
            }
        }
        else
        {
            string inputString = args[0];
            for (int i = 1; i < args.Length; i++)
            {
                inputString += " " + args[i];
            }

            Command command = device.GetCommand(TerminalLogic.FindKeyword(inputString));
            if (command != null)
            {
                TerminalCore.AddLoadingBar(0.4f, null, "\n\tSending Command.", "\n\tCommand Recieved");

                Shell(inputString);
            }
            else
            {
                PrintUsage();
            }
        }
    }
Пример #7
0
 public void ScanNetwork(string[] args)
 {
     TerminalCore.AddMessage("Scanning");
     TerminalCore.AddLoadingBar(0.5f, ContinueScanning, ".", ".", ".");
 }
Пример #8
0
 private void AttemptConnection()
 {
     TerminalCore.AddLoadingBar(0.1f, CompleteConnection,
                                "\n \t Attempting Connection...",
                                "\n \t -<color=green>Connection Successfull. </color> \n");
 }