跳到正文

剪贴板

剪贴板 umpjxxxz

原文
剪贴板信息

剪贴板信息

收录
更新

欠费版Hack.net又更新了! 共412行代码!

C++
//起于2025.7.24
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
string names;
void write(string writeword, int waittime) {
	int lw = writeword.size();
	for (int i = 0; i < lw; i++) {
		printf("%c", writeword[i]);
		Sleep(waittime);
	}
}
void swrite(string writeword, int waittime) {
	int lw = writeword.size();
	for (int i = 0; i < lw; i++) {
		printf("%c", writeword[i]);
	}
}
void Preparesubtitles() {
	string word = "Initializing ";
	for (int i = 0; i < 13; i++) {
		printf("%c", word[i]);
		Sleep(50);
	}
	for (int i = 0; i < 8; i++) {
		printf(".");
		Sleep(630);
	}
	cout << endl;
	word = "Loading modules......Conmplete";
	for (int i = 0; i < 30; i++) {
		printf("%c", word[i]);
		Sleep(150);
	}
	printf("\n");
	word = "Loading nodes......";
	for (int i = 0; i < 19; i++) {
		printf("%c", word[i]);
		Sleep(150);
	}
	printf("Complete");
	Sleep(100);
	printf("\n");
	word = "Reticulating splines......";
	for (int i = 0; i < 26; i++) {
		printf("%c", word[i]);
		Sleep(150);
	}
	printf("Complete");
	Sleep(100);
	printf("\n");
	printf("-");
	Sleep(555);
	printf("-");
	Sleep(555);
	word = "Initialization Complete";
	for (int i = 0; i < 23; i++) {
		printf("%c", word[i]);
		Sleep(150);
	}
	printf("-");
	Sleep(555);
	printf("-");
	Sleep(555);
	return ;
}
void checkinstructions(const string true_instructions, const string now_IP) {
	string cin_instructions;
	cin >> cin_instructions;
//	getline(cin, cin_instructions);
	while (cin_instructions != true_instructions) {
		printf("No Command %s - Check Syntax\n", cin_instructions.c_str());
		printf("%s@> ", now_IP.c_str());
//		getline(cin, cin_instructions);
		cin >> cin_instructions;
	}
}
void Font_size_setting(int _size) {
	HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
	CONSOLE_FONT_INFOEX cfi;
	cfi.cbSize = sizeof(cfi);
	cfi.nFont = 0;
	cfi.dwFontSize.X = 0;
	cfi.dwFontSize.Y = _size;
	cfi.FontFamily = FF_DONTCARE;
	cfi.FontWeight = FW_NORMAL;
	wcscpy(cfi.FaceName, L"Consolas");
	SetCurrentConsoleFontEx(hConsole, FALSE, &cfi);
}
void setCursorPosition(int x, int y) {
	HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
	COORD pos = {static_cast<SHORT>(x), static_cast<SHORT>(y)};
	SetConsoleCursorPosition(hConsole, pos);
}
COORD getCursorPosition() {
	HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
	CONSOLE_SCREEN_BUFFER_INFO csbi;
	GetConsoleScreenBufferInfo(hConsole, &csbi);
	return csbi.dwCursorPosition;
}
inline void font_size() {
	int font_size_int;
	printf("     输入初始字体大小选择,-1退出\n    ") ;
	cin >> font_size_int;
	if (font_size_int != -1) Font_size_setting(font_size_int);
	return ;
}
inline void background_color() {
	printf("    0 = 黑色       8 = 灰色\n");
	printf("    1 = 蓝色       9 = 亮蓝色\n");
	printf("    2 = 绿色       A = 亮绿色\n");
	printf("    3 = 青色       B = 亮浅绿色\n");
	printf("    4 = 红色       C = 亮红色 \n");
	printf("    5 = 紫色       D = 亮紫色\n");
	printf("    6 = 黄色       E = 亮黄色\n");
	printf("    7 = 白色       F = 亮白色\n");
	printf("    输入初始背景选择(后续可能会还原),-1退出: \n    ");
	string s;
	cin >> s;
	if (s == "-1") return ;
	if (s == "0") system("color 07");
	if (s == "1") system("color 10");
	if (s == "2") system("color 20");
	if (s == "3") system("color 30");
	if (s == "4") system("color 40");
	if (s == "5") system("color 50");
	if (s == "6") system("color 60");
	if (s == "7") system("color 70");
	if (s == "8") system("color 80");
	if (s == "9") system("color 90");
	if (s == "A") system("color A0");
	if (s == "B") system("color B0");
	if (s == "C") system("color C0");
	if (s == "D") system("color D0");
	if (s == "E") system("color E0");
	if (s == "F") system("color F0");
	return ;
}
inline void set_up() {
	printf("    字体大小扣1\n    背景颜色扣2\n    退出输出-1\n\n    ");
	string s;
	cin >> s;
	if (s == "-1") return ;
	else if (s == "1") font_size();
	else if (s == "2") background_color();
	else cout << "invalid instruction";
}
void initial_Tutorial() {
	Sleep(550);
	printf("\n");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x87);
	printf("[LISED RAM: 500mb / 761mb  ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
	printf("            1]");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("\n _______________________________________\n|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x08);
	printf("Turotial                               ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("|\n");
	printf("|                                       |\n");
	printf("|现在你正处于危险之中!                  |\n|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
	printf("以你最快的速度完成教程.                ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("|\n|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
	printf("输入下面的\"继续\"指令开始教程.          ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("|\n|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
	printf("[#Continue]");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("                            |\n|_______________________________________|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
}
void moveToStartOfLine() {
	cout << "\r";
}
void clearCurrentLine() {
	cout << "\r";
	for (int i = 0; i < 80; ++i) {
		cout << " ";
	}
	cout << "\r";
}
void showProgressBar(int duration) {
	const int barWidth = 50;
	const string red = "\033[31m";    // 红色
	const string green = "\033[32m";  // 绿色
	const string reset = "\033[0m";   // 重置颜色
	const string bold = "\033[1m";    // 加粗

	cout << "            [";
	for (int i = 0; i < barWidth; ++i) {
		cout << " ";
	}
	cout << "]" << flush;
	for (int i = 0; i <= barWidth; ++i) {
		cout << "\r            [";
		for (int j = 0; j < i; ++j) {
			if (i == barWidth) {
				cout << green << "=" << reset;
			} else {
				cout << red << "=" << reset;
			}
		}
		for (int j = i; j < barWidth; ++j) {
			cout << " ";
		}

		cout << "] ";
		if (i == barWidth) {
			cout << green << bold;
		} else {
			cout << red;
		}
		cout << int((i / (float)barWidth) * 100.0) << "%" << reset << flush;
		Sleep(100);
	}
	cout << endl;
}
string str, s;
void Turotial_1() {
	system("cls");
	Sleep(550);
	printf("\n");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x87);
	printf("[LISED RAM: 500mb / 761mb  ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
	printf("            1]");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("\n _______________________________________\n|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x08);
	printf("Turotial                               ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("|\n");
	printf("|                                       |\n|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
	printf("在终端中输入\"connect [IP]\".            ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("|\n|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
	printf("链接地图上的节点.                      ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("|\n|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("链接到你的电脑.");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("                        |\n|_______________________________________|\n\n");
	Sleep(375);
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x37);
	printf("netMap v1.7                              ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("\n|                                       |");
	printf("\n|                                       |");
	printf("\n|      ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x0A);
	printf("@");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("                                |");
	printf("\n|                                       |");
	printf("\n|_______________________________________|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
	string ss = "\n正在自动生成IP集文件...";
	write(ss,78);
	ofstream outFile("IP_Set.txt");
	outFile << names << " PC   IP:192.168.81.101" << endl;
	outFile.close();
	printf("\n已生成IP集文件 IP_Set.txt.\n> ");
	cin>>s;
	if(s=="connect "){
		cin>>s;
		checkinstructions("192.168.81.101",s);
	}
	system("cls");
	return ;
}
void Turotial_2() {
	system("cls");
	Sleep(550);
	printf("\n");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x87);
	printf("[LISED RAM: 500mb / 761mb  ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
	printf("            1]");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("\n _______________________________________\n|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x08);
	printf("Turotial                               ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("|\n");
	printf("|                                       |\n|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
	printf("干得漂亮.                              ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("|\n");
	printf("|                                       |\n|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
	printf("在你连接到任何系统之后.                ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("|\n|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
	printf("你需要做的第一件事便是扫描(scan)它     ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("|\n|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
	printf("的相关节点.                            ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("|\n|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
	printf("这将会在地图上显示其相关节点.          ");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x03);
	printf("|\n|现在,扫描这台电脑                      |\n|_______________________________________|");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x07);
	printf("\n192.168.81.101@> ");
}
void prepare() {
	printf("\n\n    -- New Hacknet User Registration --\n");
	Sleep(50);
	printf("    用户名:");
	getline(cin, names);
	printf("    进入设置输入Y,否则输入N\n    ");
	string ss;
	getline(cin, ss);
	while (ss != "N") {
		if (ss == "Y")
			set_up();
		system("cls");
		printf("    再次进入设置输入Y,否则输入N\n    ");
		cin >> ss;
	}
	system("cls");
	printf("\n\n\n    用户须知:每次生成的文件会在该cpp文件所在目录下生成\n");
	printf("    作者正在努力更新,敬请期待\n");
	printf("\n    正在初始化设置\n");
	const char* spinner = "|/-\\";
	for (int i = 1; i <= 50;) {
		cout << "\r    Loading " << spinner[i++ % 4] << flush;
		Sleep(100);
	}
	printf("\n\n    正在准备资源");
	printf("\n");
	string s = "            /=————————————————————————=\\\n|\n            \\=————————————————————————=/";
	swrite(s, 110);
	COORD currentPos = getCursorPosition();
	setCursorPosition(0, currentPos.Y - 1);
	int duration = 5000;
	showProgressBar(duration);
	system("cls");
	cout << endl;
	cout << endl;
	cout << endl;
	Sleep(1000);
	s = "-已过期14天:初始化FailSafe模式-\n";
	printf("   ");
	write(s, 80);
	s = "______________________________________________\n";
	printf("   ");
	write(s, 110);
	cout << endl;
	s = "你好.\n";
	printf("   ");
	write(s, 80);
	s = "这件事不对劲......比我想象中的还要奇怪.\n";
	printf("   ");
	write(s, 80);
	s = "我原以为我应该用过去时来写这段话,不过恐怕我得承认......这件事还没有画上句号.\n";
	printf("   ");
	write(s, 80);
	s = "我的名字是Bit,如果你正在阅读这封邮件,那意味着我已经死了.\n";
	printf("   ");
	write(s, 80);
	Sleep(1000);
	system("cls");
	for (int i = 1; i <= 300; i++) printf("\n");
	Preparesubtitles();//准备字幕
	s = "\n正在启动教程";
	write(s, 55);
	s = "...";
	write(s, 155);
	initial_Tutorial();
	printf("\n\n> ");
	getline(cin, str);
	if (str == "continue" || str == "Continue" || str == "#continue" || str == "#Continue") {
		Turotial_1();
	}
	Turotial_2();
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	prepare();
//    printf("\n//  %s PC\n// IP 192.0.0.1\n", names.c_str());
//    printf("//  connect +IP连接\n");
//    checkinstructions("connect 192.0.0.1","192.0.0.1");
//    printf("\n节点X_01 IP: 192.8.9.101\n");
//    printf("看到这个节点了吗?连接它.\n");
//    printf("192.0.0.1@> ");
//    getline(cin, s);
//	if (s == "Y") {
//		ofstream outFile("Take_1.txt");
//		if (!outFile.is_open()) {
//			cerr << "无法打开文件" << endl;
//			return 1;
//		}
//		outFile << "Hello, World!" << endl;
//		outFile << "这是第二行。" << endl;
//		outFile.close();
//	}
	return 0;
}