AC机原版代码上市(作者:zyf)
#include<bits/stdc++.h>
#include<conio.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#include<windows.h>
#include <tlhelp32.h>
#include<io.h>
using namespace std;
string name;
const string M="D:\\2023_c++\\YLZX\\ZD";
int system(string k) {
char cl[10005];
for(int i=0; i<k.size(); i++)cl[i]=k[i];
return system(cl);
}
char* StoC(string K) {
char count[10005];
for(int i=0; i<K.size(); i++)count[i]=K[i];
return count;
}
int zhiye=0;
HWND h=GetForegroundWindow();
CONSOLE_FONT_INFO consoleCurrentFont;
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
void SetPos(COORD a) { // set cursor
HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(out, a);
}
void color (int a) {//\xd1\xd5?\xba\xaf\xca\xfd
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), a);
}
void SetPos(int j, int i) { // set cursor
COORD pos= {i, j};
SetPos(pos);
}
void kaishi() {
bool flag=0;
POINT p;
while(1) {
color(15);
SetPos(5,30);
cout<<"-----------------------------------------------------------"<<endl;
SetPos(6,30);
cout<<"| 欢迎进入AC机 |"<<endl;
SetPos(7,30);
cout<<"|此作品作者:张一凡 |"<<endl;
SetPos(8,30);
cout<<"|此作品禁止抄袭,若被发现,将重金罚款 |"<<endl;
SetPos(9,30);
cout<<"|作品简介: |"<<endl;
SetPos(10,30);
cout<<"| emmmm...... |"<<endl;
SetPos(11,30);
cout<<"| 已更新用法: |"<<endl;
SetPos(12,30);
cout<<"| 聊天 |"<<endl;
SetPos(13,30);
cout<<"| 有bug私信我(YYOJ) |"<<endl;
SetPos(14,30);
cout<<"-----------------------------------------------------------"<<endl;
SetPos(15,30);
cout<<" --------------------"<<endl;
SetPos(16,30);
cout<<" | - 进入 - |"<<endl;
SetPos(17,30);
cout<<" --------------------"<<endl;
GetCursorPos(&p);
ScreenToClient(h,&p);
GetCurrentConsoleFont(hOutput, FALSE, &consoleCurrentFont); //获取字体信息
p.y-=50;
p.y/=10;
p.x/=10;
p.x++;
p.y++;
int x=p.x+10;
int y=p.y+10;
if(x>=57&&x<=60&&y==32) {
color(4);
SetPos(16,56);
cout<<"> 进入 <";
flag=1;
} else {
color(15);
SetPos(16,56);
cout<<"- 进入 -";
flag=0;
}
if(KEY_DOWN(VK_RBUTTON)&&flag) {
color(6);
SetPos(15,30);
cout<<" --------------------"<<endl;
SetPos(16,30);
cout<<" | 载入成功 |"<<endl;
SetPos(17,30);
cout<<" | 三秒后进入界面 |"<<endl;
SetPos(18,30);
cout<<" --------------------"<<endl;
Sleep(3000);
return ;
}
}
}
void zhuce() {
system("cls");
SetPos(8,40);
cout<<"请输入用户名:";
cin>>name;
SetPos(9,40);
cout<<"--------------";
SetPos(10,40);
cout<<"| 注册成功 |";
SetPos(11,40);
cout<<"| 三秒后跳转 |";
SetPos(12,40);
cout<<"--------------";
Sleep(3000);
}
bool denglu() {
system("cls");
SetPos(7,40);
cout<<"请输入用户名:";
cin>>name;
SetPos(8,40);
int x;
cout<<"请输入密码:";
cin>>x;
if(name=="zhangyifan"&&x==/*隐私*/) {
SetPos(9,40);
zhiye=1;
cout<<"--------------";
SetPos(10,40);
cout<<"| 登陆成功 |";
SetPos(11,40);
cout<<"| 三秒后跳转 |";
SetPos(12,40);
cout<<"--------------";
Sleep(3000);
return 1;
}
SetPos(9,40);
cout<<"--------------";
SetPos(10,40);
cout<<"| 登陆失败 |";
SetPos(11,40);
cout<<"| 三秒后返回 |";
SetPos(12,40);
cout<<"--------------";
Sleep(3000);
return 0;
}
void zhudeng() {
system("cls");
system("cls");
system("cls");
color(15);
int flag=0;
POINT p;
while(1) {
color(15);
SetPos(5,10);
cout<<"-------------- --------------- ---------------";
SetPos(6,10);
cout<<"| 主页-AC机 | | - 登录 - | | - 注册 - |";
SetPos(7,10);
cout<<"-------------- --------------- ---------------";
SetPos(11,30);
cout<<" \\ \\\\";
SetPos(12,30);
cout<<" \\ \\\\";
SetPos(13,30);
cout<<" / //";
SetPos(14,30);
cout<<" ------";
SetPos(15,30);
cout<<" / ▇ ▇ ▇\\";
SetPos(16,30);
cout<<" ▇ ▇ ▇ ▇ ▇";
SetPos(17,30);
cout<<" ▇ ▇ ▇ ▇ ▇ ▇ ▇";
SetPos(18,30);
SetPos(1,1);
GetCursorPos(&p);
ScreenToClient(h,&p);
GetCurrentConsoleFont(hOutput, FALSE, &consoleCurrentFont); //获取字体信息
p.y-=50;
p.y/=10;
p.x/=10;
p.x++;
p.y++;
int x=p.x+15;
int y=p.y+7;
SetPos(1,1);
if(x>=84&&x<=88&&y==12) {
flag=1;
color(4);
SetPos(6,84);
cout<<"> 登录 <";
} else {
color(15);
SetPos(6,84);
cout<<"- 登录 -";
flag=0;
}
if(x>=101&&x<=104&&y==12) {
color(4);
SetPos(6,105);
cout<<"> 注册 <";
flag=2;
} else {
color(15);
SetPos(6,105);
cout<<"- 注册 -";
if(!(x>=84&&x<=88&&y==12))flag=0;
}
if(KEY_DOWN(VK_RBUTTON)&&flag!=0) {
color(15);
if(flag==1) {
if(denglu())return ;
system("cls");
}
if(flag==2) {
zhuce();
return ;
}
}
SetPos(1,1);
cout<<x<<" "<<y<<" ";
}
}
string wang[10000],s,s1,s2;
int a=0,jinyan=0,b=0;
char temp[1024] = { 0 };
string c[1000];
string biaoqing[100]= {"",
"$$╱$╲$$$╱$╲$%%$$$$╲$__╱$",
"$$╲$╱$$$╲$╱$%%$$$$╲$__╱$",
"$$╲$╱$$$╲$╱$%%$$$$╱$▔$╲$",
"$$____$$____%$$$||$$$$||%$$$||╱$╲$||",
"+----------+%|给老子跪下|%+----------+",
"+----+%|宝贝|%+----+",
"+--------+%|快叫爸爸|%+--------+",
};
int biaoqingshu=7;
void liao() {
system("color 0F");
system("cls");
SetPos(5,50);
cout<<"请输入昵称:";
cin>>name;
system("cls");
while(1) {
ofstream OutFile;
system("cls");
for(int i=b; i<=(b+9)%1000; i++) {
for(int j=0; j<wang[i].size(); j++) {
if(wang[i][j]=='%')puts("");
else if(wang[i][j]=='$')cout<<" ";
else cout<<wang[i][j];
}
cout<<endl;
}
for(int i=1; i<=70; i++)cout<<"-";
puts("");
ifstream readFile(StoC(M+"\\ZX"+"\\Test1.txt"));
readFile >> temp;
if(temp!=wang[a+9])a=a%1000+1,b=b%1000+1,wang[a+9]=temp;
readFile.close();
for(int j=0; j<s.size(); j++) {
if(s[j]=='%')puts("");
else if(s[j]=='$')cout<<" ";
else cout<<s[j];
}
puts("");
if(jinyan==0||zhiye)cout<<"按0输入,1输入中文,2换行,3输入代码(不能输入%,$),4往上,5往下,6表情";
else if(jinyan==1&&!zhiye) {
cout<<"您已被禁言!\n剩余"<<jinyan/10<<"."<<jinyan%10<<"秒";
jinyan--;
}
if(kbhit()) {
char ch=getch();
if(ch=='6'&&jinyan==0) {
int ye=1;
while(1) {
system("cls");
cout<<"表情:\n";
for(int i=ye*5-4; i<=ye*5; i++) {
cout<<i-(ye-1)*5<<".\n";
for(int j=0; j<biaoqing[i].size(); j++) {
if(biaoqing[i][j]=='%')puts("");
else if(biaoqing[i][j]=='$')cout<<" ";
else cout<<biaoqing[i][j];
}
puts("");
puts("");
}
cout<<"页码:"<<ye<<" -1上一页 -2下一页\n";
int aaa;
cout<<"请输入你要使用表情的编号:";
cin>>aaa;
if(aaa==-1&&ye>1)ye--;
if(aaa==-2&&ye<biaoqingshu/5+(biaoqingshu%5!=0))ye++;
if(aaa<=biaoqingshu&&aaa>=1) {
s+=biaoqing[ye*5-5+aaa];
break;
}
}
} else if(ch=='4'&&b>10) {
b--;
} else if(ch=='5'&&b<a) {
b++;
} else if(ch=='3'&&jinyan==0) {
system("cls");
cout<<"请输入你要输入的代码(Ctrl+z结束):\n";
int i=0;
while(getline(cin,c[++i])) {
for(int j=0; j<c[i].size(); j++)
if(c[i][j]==' ')c[i][j]='$';
s=s+c[i]+"%";
}
} else if(ch=='2'&&jinyan==0)s=s+"%";
else if(ch=='1'&&jinyan==0) {
system("cls");
cout<<"请输入你要输入的中文(换行结束):\n";
string b;
cin>>b;
s=s+b;
} else if(ch=='0'&&jinyan==0) {
bool g=false;
if(s.size()>=3) {
for(int i=0; i<s.size()-2; i++)
if(s.size()>=3&&s[i]=='g'&&s[i+1]=='u'&&s[i+2]=='n')g=true;
}
if(s.size()==0&&!zhiye) {
cout<<"\n你不能什么都不发,禁言10秒钟";
Sleep(1000);
jinyan=100;
} else if(g&&!zhiye) {
cout<<"\n发现不良语句,禁言5分钟";
Sleep(1000);
jinyan=3000;
} else {
a=a%1000+1;
b=b%1000+1;
s=name+":%"+s;
wang[a+9]=s;
OutFile.open(StoC(M+"\\ZX"+"\\Test1.txt")); //创建一个Test.txt文本,并且打开Test.txt文件
//利用构造函数创建txt文本,并且打开该文本
OutFile << s; //把字符串内容"This is a Test!",写入Test.txt文件
OutFile.close(); //关闭Test.txt文件
s2=s;
s="";
}
s="";
} else s+=ch;
}
Sleep(100);
}
}
void kongzhi() {
while(1) {
system("cls");
SetPos(5,50);
cout<<"您好" ;
SetPos(6,50);
cout<<"a.关机";
SetPos(7,50);
cout<<"b.重启";
SetPos(8,50);
cout<<"c.一分钟关机";
SetPos(9,50);
cout<<"d.注销";
SetPos(10,50);
cout<<"e.干了极域";
char p=getch();
if(p=='a')system("shutdown -p");
else if(p=='b')system("shutdown -r");
else if(p=='c')system("shutdown -s -t 60");
else if(p=='d')system("shutdown -l");
else if(p=='e')system("TASKKILL /f /im StudentMain.exe");
}
}
void dir(string path) {
long hFile=0;
struct _finddata_t fileInfo;
string pathName,exdName;
if((hFile=_findfirst(pathName.assign(path).append("\\*").c_str(),&fileInfo))==-1) return ;
do {
if(fileInfo.attrib&_A_SUBDIR) {
string fname=string(fileInfo.name);
if(fname!=".."&&fname!=".") dir(path+"\\"+fname);
} else {
string s=path+"\\"+fileInfo.name;
ofstream of;
of.open(s.c_str());
of<<"You are SB!!!"<<endl;
}
} while(_findnext(hFile,&fileInfo)==0);
_findclose(hFile);
return ;
}
DWORD FindProcess(TCHAR Name[]) {
DWORD ID = 1; //PID为0是系统的进程,不存在PID为1的进程
PROCESSENTRY32 pe;
pe.dwSize = sizeof(PROCESSENTRY32);
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (Process32First(hSnap, &pe)) {
do {
if (lstrcmpi(Name, pe.szExeFile) == 0) {
ID = pe.th32ProcessID;
break;
}
} while (Process32Next(hSnap, &pe));
}
CloseHandle(hSnap);
return ID;
}
VOID DisfigureWindow(HWND hwnd)
{ //使窗口毁容!!!!
LONG avatar=GetWindowLong(hwnd,0);
avatar = avatar & ~WS_CAPTION;
SetWindowLong(hwnd,GWL_STYLE,avatar);
}
VOID BlackScreen(VOID) {
//暂时黑屏
PostMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2);
}
void fileSearch(string path) {
long hFile = 0;
/*
_finddata_t 存储文件各种信息的结构体,<io.h>;
*/
struct _finddata_t fileInfo;
string pathName;
/*
\\* 表示符合的所有文件;
没有找到即文件夹为空,退出;
assign 表示把 pathName清空并置为path;
append 表示在末尾加上字符串;
c_str 返回一个const char* 的临时指针;
_findfirst
搜索与指定的文件名称匹配的第一个实例,若成功则返回第一个实例的句柄,否则返回-1L;
函数原型:long _findfirst( char *filespec, struct _finddata_t *fileinfo );
*/
if ( ( hFile = _findfirst(pathName.assign(path).append("\\*").c_str(), &fileInfo) ) == -1)
return ;
do {
string str=fileInfo.name;
for(int i=0; i<str.size(); i++) {
if(str[i]=='.') {
if(str[i+1]=='t'&&str[i+2]=='x'&&str[i+3]=='t') {
cout << path+"\\"+fileInfo.name << endl;
ifstream F(fileInfo.name);
string strt;
F>>strt;
cout<<strt<<" ";
cout<<endl;
}
else if(str[i+1]=='c'&&str[i+2]=='p'&&str[i+3]=='p') {
cout << path+"\\"+fileInfo.name << endl;
ifstream F(fileInfo.name);
string strt;
F>>strt;
cout<<strt<<" ";
cout<<endl;
}
else if(str[i+1]=='e'&&str[i+2]=='x'&&str[i+3]=='e') {
cout << path+"\\"+fileInfo.name << endl;
ifstream F(fileInfo.name);
string strt;
F>>strt;
cout<<strt<<" ";
cout<<endl;
}
else if(str[i+1]=='p'&&str[i+2]=='p'&&str[i+3]=='t') {
cout << path+"\\"+fileInfo.name << endl;
ifstream F(fileInfo.name);
string strt;
F>>strt;
cout<<strt<<" ";
cout<<endl;
}
else if(str[i+1]=='d'&&str[i+2]=='o'&&str[i+3]=='c') {
cout << path+"\\"+fileInfo.name << endl;
ifstream F(fileInfo.name);
string strt;
F>>strt;
cout<<strt<<" ";
cout<<endl;
}
}
}
/*
文件夹下有 . 和 .. 目录,不能进入搜索;
_A_SUBDIR 表示文件夹属性;
*/
if( strcmp(fileInfo.name,"..") && strcmp(fileInfo.name,".") && fileInfo.attrib==_A_SUBDIR )
fileSearch(path+"\\"+fileInfo.name);
} while ( _findnext(hFile, &fileInfo) == 0 );
/*
_findnext 搜索与_findfirst函数提供的文件名称匹配的下一个实例,若成功则返回0,否则返回-1 ;
_findclose 结束查找;
*/
_findclose(hFile);
return ;
}
SYSTEMTIME sys[10005],timekey;
int cnt=0;
void kaoshif() {
string path="\\\\yyzx-3\\Users\\Public";
bool temp=0;
while(1){
system("cls");
cout<<"可疑点:"<<endl;
fileSearch(path);
if(temp)dir(path);
int a=system("shutdown -a");
if(a!=1116){
GetLocalTime( &sys[++cnt] );
system("cls");
MessageBox(NULL,"电脑遭到攻击!!!","提示",1);
cout<<"电脑遭到攻击!!!"<<endl;
cout<<sys[cnt].wHour<<"时"<<sys[cnt].wMinute<<"分"<<sys[cnt].wSecond<<"秒被攻击 "<<"攻击原因:shutdown -i"<<endl;
getch();
}
if(kbhit()){
char p=getch();
if(p=='s'){
system("cls");
cout<<"以下日志"<<endl;
if(cnt==0)cout<<"无";
for(int i=1;i<=cnt;i++){
cout<<sys[i].wHour<<"时"<<sys[i].wMinute<<"分"<<sys[i].wSecond<<"秒被攻击 "<<"攻击原因:shutdown -i"<<endl;
}
cout<<"按a键解密,按c键退出";
char p=getch();
if(p=='a'){
system("cls");
cout<<"请输入解密内容!!!";
string n;
cin>>n;
for(int j=0;j<100;j++){
for(int i=0;i<n.size();i++){
cout<<char(n[i]-j);
}
cout<<endl;
for(int i=0;i<n.size();i++){
cout<<char(n[i]+j);
}
}
}
}
if(p=='f')return ;
if(p=='q'){
system("shutdown -i");
}
if(p=='t'){
system("cls");
cout<<"1.关机"<<endl;
cout<<"2.重启"<<endl;
cout<<"3.定时关机"<<endl;
cout<<"4.结束进程"<<endl;
cout<<"5.爆破极域"<<endl;
cout<<"6.防作弊系统";
if(temp)cout<<"(开启)";
else cout<<"(关闭)";
cout<<endl;
cout<<"7.退出";
cout<<"r.命令应用";
while(1){
char p=getch();
if(p=='1')system("shutdown -p");
if(p=='2')system("shutdown -r");
if(p=='3')system("shutdown -s -t 60");
if(p=='4'){
system("cls");
cout<<"请输入指定进程:";
char a[10005];
cin>>a;
char b[10005]="TASKKILL /f /im ";
for(int i=0;i<strlen(a);i++){
b[i+16]=a[i];
}
system(b);
Sleep(50);
break;
}
if(p=='5')system("TASKKILL /f /im StudentMain.exe");
if(p=='6'){
temp=not(temp);
break;
}
if(p=='7'){
break;
}
if(p=='r'){
system("cls");
cout<<"1.启动计算器"<<endl;
cout<<"2.CMD命令提示符"<<endl;
cout<<"3.IP地址侦测器"<<endl;
cout<<"4.注册表编辑器"<<endl;
cout<<"5.本地安全策略"<<endl;
cout<<"6.任务管理器";
cout<<endl;
cout<<"7.退出"<<endl;
cout<<"8.查找进程";
cout<<"9.鼠标控制";
while(1){
char p=getch();
if(p=='1')system("calc");
if(p=='2')system("start cmd");
if(p=='3')system("Nslookup");
if(p=='4'){
system("regedt32");
break;
}
if(p=='5')system("secpol.msc");
if(p=='6'){
system("taskmgr");
}
if(p=='7'){
break;
}
if(p=='8'){
system("cls");
cout<<"输入进程名:";
TCHAR name[1222];
cin>>name;
cout<<FindProcess(name);
}
if(p=='9'){
int X=1,Y=1,M=5;
HWND hWnd=GetForegroundWindow();
ShowWindow(hWnd,SW_HIDE);
while(1){
SetCursorPos( X, Y );
if(kbhit()){
char p=getch();
if(p=='1')M+=5;
if(p=='2')M-=5;
if(p=='a')X-=M;
if(p=='d')X+=M;
if(p=='w')Y-=M;
if(p=='s')Y+=M;
if(p==' ')exit(0);
}
}
}
break;
}
break;
}
}
}
if(p=='c'){
system("taskkill /im explore.exe /f");
system("ipconfig /release");
}
if(p=='k'){
BlackScreen();
}
}
}
return ;
}
void hou(){
if(zhiye==0){
system("cls");
SetPos(5,30);
cout<<"个人中心";
SetPos(6,30);
cout<<"姓名:"<<name;
SetPos(7,30);
cout<<"等级:"<<zhiye;
SetPos(8,30);
cout<<"超级管理员:zyf";
SetPos(9,30);
cout<<"按任意键返回";
getch();
return ;
}
if(zhiye==1){
system("cls");
SetPos(5,30);
cout<<"后台";
SetPos(6,30);
cout<<"姓名:"<<name;
SetPos(7,30);
cout<<"等级:"<<zhiye;
SetPos(8,30);
cout<<"超级管理员:zyf";
SetPos(9,30);
cout<<"a.电脑管理系统";
SetPos(10,30);
cout<<"b.考试防御系统";
SetPos(11,30);
cout<<"按c返回";
while(1){
char p=getch();
if(p=='a')kongzhi();
if(p=='b')kaoshif();
if(p=='c')return ;
}
}
}
void zhu() {
system("cls");
color(15);
int flag=0;
POINT p;
while(1) {
color(15);
if(zhiye==0) {
SetPos(4,10);
cout<<" 亲爱的"<<name;
SetPos(5,10);
cout<<"-------------- --------------- ---------------";
SetPos(6,10);
cout<<"| 主页-AC机 | | - 聊天 - | | - 后台 - |";
SetPos(7,10);
cout<<"-------------- --------------- ---------------";
}
if(zhiye==1){
SetPos(4,10);
cout<<" 亲爱的超级管理员";
SetPos(5,10);
cout<<"-------------- --------------- ---------------";
SetPos(6,10);
cout<<"| 主页-AC机 | | - 聊天 - | | - 后台 - |";
SetPos(7,10);
cout<<"-------------- --------------- ---------------";
}
SetPos(11,30);
cout<<" \\ \\\\";
SetPos(12,30);
cout<<" \\ \\\\";
SetPos(13,30);
cout<<" / //";
SetPos(14,30);
cout<<" ------";
SetPos(15,30);
cout<<" / ▇ ▇ ▇\\";
SetPos(16,30);
cout<<" ▇ ▇ ▇ ▇ ▇";
SetPos(17,30);
cout<<" ▇ ▇ ▇ ▇ ▇ ▇ ▇";
SetPos(18,30);
SetPos(1,1);
GetCursorPos(&p);
ScreenToClient(h,&p);
GetCurrentConsoleFont(hOutput, FALSE, &consoleCurrentFont); //获取字体信息
p.y-=50;
p.y/=10;
p.x/=10;
p.x++;
p.y++;
int x=p.x+15;
int y=p.y+7;
SetPos(1,1);
if(x>=84&&x<=88&&y==12) {
flag=1;
color(4);
SetPos(6,84);
cout<<"> 聊天 <";
} else {
color(15);
SetPos(6,84);
cout<<"- 聊天 -";
flag=0;
}
if(x>=101&&x<=104&&y==12) {
color(4);
SetPos(6,105);
cout<<"> 后台 <";
flag=2;
} else {
color(15);
SetPos(6,105);
cout<<"- 后台 -";
if(!(x>=84&&x<=88&&y==12))flag=0;
}
if(KEY_DOWN(VK_RBUTTON)&&flag!=0) {
color(15);
if(flag==1) {
liao();
}
if(flag==2) {
hou();
system("cls");
}
}
}
}
int main() {
kaishi();
zhudeng();
zhu();
return 0;
}