Skip to content

Commit

Permalink
Merge pull request #7 from RaccoonWhu/master
Browse files Browse the repository at this point in the history
Allow commands to be case-insensitive
  • Loading branch information
hv0905 committed Jun 16, 2023
2 parents 7fe6cca + beaf3b7 commit 3760629
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 151 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,6 @@ fabric.properties
# Visual Studio Project stuff

.vs/
.build/
build/
src/.vscode
1 change: 1 addition & 0 deletions src/AsciiArt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <fstream>
#include <stdexcept>
#include <iostream>
#include <algorithm>
#include "Utility/Util.h"

void AsciiArt::draw(Coord begin) const
Expand Down
73 changes: 37 additions & 36 deletions src/BackgroundTasks/TutorialBgTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,78 +3,79 @@
//

#include <iostream>
#include <algorithm>
#include "../HacknetApplication.h"
#include "TutorialBgTask.h"
#include "../Utility/Util.h"
#include "../Utility/StringUtil.h"

const wchar_t *StepsText[] = {
L"现在你正处于危险之中! \n"
"以你最快的速度完成教程.\n"
"在终端中输入\"connect [IP]\",或使用\"netmap\"命令来连接到一台电脑\n"
"----------\n"
"现在,连接到你自己的电脑(127.0.0.1)",
L"以你最快的速度完成教程.\n"
L"在终端中输入\"connect [IP]\",或使用\"netmap\"命令来连接到一台电脑\n"
L"----------\n"
L"现在,连接到你自己的电脑(127.0.0.1)",
L"干得漂亮. \n"
" \n"
"在你连接到任何系统之后, 你需要做的第一件事便是扫描(scan)它的相关节点. \n"
L"在你连接到任何系统之后, 你需要做的第一件事便是扫描(scan)它的相关节点. \n"
"----------\n"
"现在, 使用\"scan\"指令扫描这台电脑",
L"现在, 使用\"scan\"指令扫描这台电脑",
L"好了, 需要在你自己电脑上进行的操作已经结束了. \n"
"现在从你的机器断开.(使用dc指令即可断开连接) \n",
L"现在从你的机器断开.(使用dc指令即可断开连接) \n",
L"是时候连接到一台外部计算机了. \n"
" \n"
"注意: 试图破坏他人计算机的安全将违反U.S.C 1030-1条规. \n"
L"注意: 试图破坏他人计算机的安全将违反U.S.C 1030-1条规. \n"
" \n"
"从现在开始, 为自己的行为负责吧! \n"
"----------\n"
"使用\"connect [IP]\"指令连接到一台电脑, 连接到你刚刚扫描到的电脑",
L"从现在开始, 为自己的行为负责吧! \n"
L"----------\n"
L"使用\"connect [IP]\"指令连接到一台电脑, 连接到你刚刚扫描到的电脑",
L"这个虚拟机的终端模块已被激活. 这将是你用于导航的主菜单. \n"
" \n"
"可以输入一个命令, 然后按回车键(ENTER)来运行. \n"
L"可以输入一个命令, 然后按回车键(ENTER)来运行. \n"
" \n"
"查看计算机的安全系统和活动端口可以使用\"nmap\"命令. \n"
L"查看计算机的安全系统和活动端口可以使用\"nmap\"命令. \n"
"----------\n"
"分析当前连接的计算机",
L"分析当前连接的计算机",
L"在这里你可以看到活动端口, 已激活的安全系统和需要破解的端口数, 你需要破解规定数量的端口才能运行PortHack. \n"
"这台服务器没有已激活的安全系统, 需要破解的端口数量为0. 使用\"PortHack\"开始破解. \n"
"----------\n"
"如果想要在你连接到的设备上运行你所拥有的程序, 可在终端上输入该程序的名字. \n"
L"这台服务器没有已激活的安全系统, 需要破解的端口数量为0. 使用\"PortHack\"开始破解. \n"
L"----------\n"
L"如果想要在你连接到的设备上运行你所拥有的程序, 可在终端上输入该程序的名字. \n"
"\n"
"输入程序名字时不需要带上.exe",
L"输入程序名字时不需要带上.exe",
L"恭喜! 你已经控制了这个外部系统, 现在你是该系统的管理员. 你可以做任何事, 但你最好先扫描本机的相关节点\n"
"-----------\n"
"使用\"扫描网络(scan)\"命令来定位相关节点. ",
L"使用\"扫描网络(scan)\"命令来定位相关节点. ",
L"没有结果 - 没有就没有吧. \n"
"\n"
"下一步, 查看文件系统. \n"
L"下一步, 查看文件系统. \n"
"----------\n"
"列出当前目录中的文件和文件夹\n"
"输入\"ls\"查看当前目录中的文件和文件夹",
L"列出当前目录中的文件和文件夹\n"
L"输入\"ls\"查看当前目录中的文件和文件夹",
L"访问\"bin\"文件夹(二进制文件夹)来搜索有用的可执行文件, 使用命令\n"
" \n"
"\"cd [文件夹名]\" (注意空格)",
L"\"cd [文件夹名]\" (注意空格)",
L"要查看当前文件夹的内容, 使用\"ls\"命令. \n"
"这里没有程序, 但你最好查看config.txt以防止漏掉有用的信息. \n"
"读取任何文件都可以使用cat命令. 例: \n"
L"这里没有程序, 但你最好查看config.txt以防止漏掉有用的信息. \n"
L"读取任何文件都可以使用cat命令. 例: \n"
" \n"
"\"cat config.txt\"\n",
L"然而这里面卵都没有! \n"
"现在, 你要清理你访问的痕迹. \n"
"返回上一个目录\n"
"使用\"cd ..\"\n"
"注: 通配符\"..\"表示\"返回\"\"\". ",
L"现在, 你要清理你访问的痕迹. \n"
L"返回上一个目录\n"
L"使用\"cd ..\"\n"
L"注: 通配符\"..\"表示\"返回\"\"\". ",
L"进入log文件夹",
L"删除此目录中的所有文件\n"
"你可以使用该命令删除该文件\n"
"rm [文件名]\n"
"你也可以使用该命令删除当前目录下的所有文件\n"
L"你可以使用该命令删除该文件\n"
L"rm [文件名]\n"
L"你也可以使用该命令删除当前目录下的所有文件\n"
"rm *\n"
"注: 通配符\"*\"表示\"所有\". ",
L"注: 通配符\"*\"表示\"所有\". ",
L"干的很好! \n"
"与这台计算机断开连接",
L"与这台计算机断开连接",
L"恭喜, 你已经完成了本教程的所有内容. \n"
"想要结束本教学, 你需要找到本教学程序的PID, 并结束它. \n"
"\"help\"命令可以给你列出完整的命令列表. "
L"想要结束本教学, 你需要找到本教学程序的PID, 并结束它. \n"
L"\"help\"命令可以给你列出完整的命令列表. "
};

void TutorialBgTask::renderMemory(Coord begin)
Expand Down
1 change: 1 addition & 0 deletions src/HackMenuPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "HackMenuPanel.h"
#include <conio.h>
#include <iostream>
#include <algorithm>
#include "Utility/UiUtil.h"
#include "Utility/Util.h"

Expand Down
1 change: 1 addition & 0 deletions src/HacknetApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ void HacknetApplication::processCommand(const std::string &command)
std::stringstream ss(command);
std::string prefix;
ss >> prefix;
std::transform(prefix.begin(), prefix.end(), prefix.begin(), tolower);
// Phrase 1: global
int globalSize = std::extent<decltype(globalCommands)>::value;
auto targetCommand = std::find_if(globalCommands, globalCommands + globalSize, [&prefix](const HackCommand &cmd)
Expand Down
1 change: 1 addition & 0 deletions src/RenderService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

#include <iostream>
#include <algorithm>
#include <utility>
#include "RenderService.h"
#include "Utility/Util.h"
Expand Down
Loading

0 comments on commit 3760629

Please sign in to comment.