学习C/C++第七天 完成黑客攻击的最后的步骤

黑客攻击系统到今天已经学完了,收获还是挺多的;

void attack404()
{
	char id[64];           
	char response[MAXSIZE];   //攻击后,从服务器返回的结果

	system("cls");

	printInMiddle("———***———");

	cout << "请输入准备攻击***:";
	scanf_s("%s", id, sizeof(id));

	cout << "正在执行攻击。。。\n";

	//发起攻击
	hk_404(id, response);

	//把UTF-8转换成GBK
	string retStr = UTF8ToGBK(response);
	cout << retStr << endl;

	system("pause");
}

void attackSiteEdit()
{
	char id[64];
	char response[MAXSIZE];
	string attackText;

	system("cls");

	printInMiddle("———***———");

	cout << "请输入准备攻击***:";
	scanf_s("%s", id, sizeof(id));

	cout << "请输入你要篡改***:";
	cin >> attackText;

	cout << "正在执行篡改***。。。\n";
	GBKToUTF8(attackText);                                 //把本地的gbk编码转换为UTF8编码
	hk_tamper(id, (char *)attackText.c_str(), response);   //  (char *) attackText.c_str()   常数const 的强制类型转换

	//把UTF-8转换成GBK
	string retStr = UTF8ToGBK(response);
	cout << retStr << endl;
	system("pause");
}

void attackRepair()
{
	char id[64];           
	char response[MAXSIZE];   //攻击后,从服务器返回的结果

	system("cls");

	printInMiddle("———***———");

	cout << "请输入准备修复***:";
	scanf_s("%s", id, sizeof(id));

	cout << "正在执行攻击修复。。。\n";

	
	hk_restore(id, response);

	//把UTF-8转换成GBK
	string retStr = UTF8ToGBK(response);
	cout << retStr << endl;

	system("pause");
}

void attackRecord()
{
	char id[64];           
	char response[MAXSIZE];   //攻击后,从服务器返回的结果

	system("cls");

	printInMiddle("———攻击记录———");

	cout << "请输入需要查看的记录:";
	scanf_s("%s", id, sizeof(id));

	cout << "正在执行记录查询。。。\n";

	hk_record(id, response);

	//把UTF-8转换成GBK
	string retStr = UTF8ToGBK(response);
	cout << retStr << endl;

	system("pause");
}

上面就是所有的攻击代码,但这里还有一个头文件件。
代码如下:

#pragma once

#include <iostream>
#define MAXSIZE 4096

//#pragma execution_character_set("utf-8")  

// 服务器返回的结果是utf-8编码格式
int hk_404(char *id, char *response) ;


int hk_restore(char *id, char *response);


int hk_tamper(char *id, char *para, char *response);


int hk_record(char *id, char *response);


bool check_response(const char *response);

std::string UTF8ToGBK(const char* strUTF8);
void GBKToUTF8(std::string &strGBK);

以上是学习完了简单的一些交互,要好看,就得自己加上学习的EasyX图形库来制作了

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值