From 0fd5323d52e70449bc2a89ea103901a12931de55 Mon Sep 17 00:00:00 2001 From: Daniel Xie Date: Wed, 24 May 2017 18:23:28 -0500 Subject: [PATCH] Added scan-analyze to Interactive Tutorial --- css/workinprogress.css | 2 ++ src/Constants.js | 2 +- src/InteractiveTutorial.js | 36 +++++++++++++++++++++++++++++++----- src/Terminal.js | 17 +++++++++++++++-- 4 files changed, 49 insertions(+), 8 deletions(-) diff --git a/css/workinprogress.css b/css/workinprogress.css index 2ce130425..416c8aa35 100644 --- a/css/workinprogress.css +++ b/css/workinprogress.css @@ -4,10 +4,12 @@ padding-top: 10px; padding-left: 10px; height: 100%; + width: 99%; } #work-in-progress-text { color: #66ff33; + width: 70%; } #work-in-progress-cancel-button { diff --git a/src/Constants.js b/src/Constants.js index c95a12c58..975c337ca 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -150,7 +150,7 @@ CONSTANTS = { "rm Delete a script/program from the machine. (WARNING: Permanent)
" + "run [script/program] Execute a program or a script
" + "scan Displays all available network connections
" + - "scan-analyze Displays hacking-related information for all available network connections
" + + "scan-analyze [depth] Displays hacking-related information for all servers up to depth nodes away
" + "sudov Shows whether or not you have root access on this computer
" + "tail [script] Display script logs (logs contain details about active scripts)
" + "top Display all running scripts and their RAM usage
", diff --git a/src/InteractiveTutorial.js b/src/InteractiveTutorial.js index 1de7f1e08..9fb4701f9 100644 --- a/src/InteractiveTutorial.js +++ b/src/InteractiveTutorial.js @@ -8,6 +8,8 @@ iTutorialSteps = { TerminalHelp: "Using the help command to display all options in terminal", TerminalLs: "Use the ls command to show all programs/scripts. Right now we have NUKE.exe", TerminalScan: "Using the scan command to display all available connections", + TerminalScanAnalyze1: "Use the scan-analyze command to show hacking related information", + TerminalScanAnalyze2: "Use the scan-analyze command with a depth of 3", TerminalConnect: "Using the telnet/connect command to connect to another server", TerminalAnalyze: "Use the analyze command to display details about this server", TerminalNuke: "Use the NUKE Program to gain root access to a server", @@ -155,13 +157,29 @@ function iTutorialEvaluateStep() { "the 'scan' command. "); //next step triggered by terminal command break; - case iTutorialSteps.TerminalConnect: + case iTutorialSteps.TerminalScanAnalyze1: iTutorialSetText("The 'scan' command shows all available network connections. In other words, " + "it displays a list of all servers that can be connected to from your " + - "current machine. A server is identified by either its IP or its hostname.

" + - "To connect to a machine, use the 'connect [ip/hostname]' command. You can type in " + + "current machine. A server is identified by either its IP or its hostname.

" + + "That's great and all, but there's so many servers. Which one should you go to? " + + "The 'scan-analyze' command gives some more detailed information about servers on the " + + "network. Try it now"); + //next step triggered by terminal command + break; + case iTutorialSteps.TerminalScanAnalyze2: + iTutorialSetText("You just ran 'scan-analyze' with a depth of one. This command shows more detailed " + + "information about each server that you can connect to (servers that are a distance of " + + "one node away).

It is also possible to run 'scan-analyze' with " + + "a higher depth. Let's try a depth of two with the following command: 'scan-analyze 2'.") + //next step triggered by terminal command + break; + case iTutorialSteps.TerminalConnect: + iTutorialSetText("Now you can see information about all servers that are up to two nodes away, as well " + + "as figure out how to connect to those servers through the network. You can only connect to " + + "a server that is one node away. To connect to a machine, use the 'connect [ip/hostname]' command. You can type in " + "the ip or the hostname, but dont use both.

" + - "Let's try this now by connecting to the 'foodnstuff' server (connect foodnstuff)"); + "From the results of the 'scan-analyze' command, we can see that the 'foodnstuff' server is " + + "only one node away. Let's connect so it now using: 'connect foodnstuff'"); //next step triggered by terminal command break; case iTutorialSteps.TerminalAnalyze: @@ -228,7 +246,7 @@ function iTutorialEvaluateStep() { "}

" + "For anyone with basic programming experience, this code should be straightforward. " + "This script will continuously hack the 'foodnstuff' server.

" + - "To save and close the script editor, press the button in the top right, or press ctrl + b."); + "To save and close the script editor, press the button in the bottom left, or press ctrl + b."); //next step triggered in saveAndCloseScriptEditor() (Script.js) break; case iTutorialSteps.TerminalFree: @@ -406,6 +424,14 @@ function iTutorialNextStep() { iTutorialEvaluateStep(); break; case iTutorialSteps.TerminalScan: + currITutorialStep = iTutorialSteps.TerminalScanAnalyze1; + iTutorialEvaluateStep(); + break; + case iTutorialSteps.TerminalScanAnalyze1: + currITutorialStep = iTutorialSteps.TerminalScanAnalyze2; + iTutorialEvaluateStep(); + break; + case iTutorialSteps.TerminalScanAnalyze2: currITutorialStep = iTutorialSteps.TerminalConnect; iTutorialEvaluateStep(); break; diff --git a/src/Terminal.js b/src/Terminal.js index 5fca816a2..3ec8065c7 100644 --- a/src/Terminal.js +++ b/src/Terminal.js @@ -387,10 +387,23 @@ var Terminal = { iTutorialNextStep(); } else {post("Bad command. Please follow the tutorial");} break; + case iTutorialSteps.TerminalScanAnalyze1: + if (commandArray.length == 1 && commandArray[0] == "scan-analyze") { + Terminal.executeScanAnalyzeCommand(1); + iTutorialNextStep(); + } else {post("Bad command. Please follow the tutorial");} + break; + case iTutorialSteps.TerminalScanAnalyze2: + if (commandArray.length == 2 && commandArray[0] == "scan-analyze" && + commandArray[1] == "2") { + Terminal.executeScanAnalyzeCommand(2); + iTutorialNextStep(); + } else {post("Bad command. Please follow the tutorial");} + break; + break; case iTutorialSteps.TerminalConnect: - if (commandArray.length == 2) { - if ((commandArray[0] == "connect" || commandArray[0] == "telnet") && + if ((commandArray[0] == "connect") && (commandArray[1] == "foodnstuff" || commandArray[1] == foodnstuffServ.ip)) { Player.getCurrentServer().isConnectedTo = false; Player.currentServer = foodnstuffServ.ip;