当前位置:网站首页>Gethostbyname \ getaddrinfo DNS domain name IP address is not safe
Gethostbyname \ getaddrinfo DNS domain name IP address is not safe
2022-08-01 07:30:00 【金- 2006】
Step 1:
Make the target domain name point to a fake server IP in the following format:
Fake server IP address website domain nameWrite in %Systemroot%\System32\Drivers\Etc\hosts file:
127.0.0.1 blog.csdn.netStep 2:
Run the following test code and you will find that the domain name has been pointed to a fake server IP address, what harm will it cause?As a result, the software is easily cracked, and the user data is stolen after the user accesses the fake server.
Test code:
// ----Resolving domain name IP test starts----/*After the hosts file is written: 127.0.0.1 blog.csdn.com,The ip address obtained by gethostbyname \ getaddrinfo will be 127.0.0.1, which is why it is called insecure*///WSADATA wsaData;//WSAStartup(MAKEWORD(2, 2), &wsaData);struct addrinfo *result = nullptr, *curr = nullptr;struct addrinfo hints = { 0 };hints.ai_family = AF_UNSPEC;hints.ai_socktype = SOCK_STREAM;hints.ai_protocol = IPPROTO_TCP;int nRet = getaddrinfo("blog.csdn.net", "443", &hints, &result);if (0 != nRet){int nError = WSAGetLastError();CString szMSG;szMSG.Format(_T("getaddrinfo call failed, error code: %d.\r\n"), nError);Log(szMSG);return;}char chIP[16];for (curr = result; curr != nullptr; curr = curr->ai_next) {inet_ntop(AF_INET, &(((struct sockaddr_in *)(curr->ai_addr))->sin_addr), chIP, 16);Log(CString(chIP) + CString(_T("\r\n")));}freeaddrinfo(result);//WSACleanup();// ----End domain name IP test ----边栏推荐
- 阿里三面:MQ 消息丢失、重复、积压问题,该如何解决?
- MVVM项目开发(商品管理系统一)
- Image lossless compression software which works: try completely free JPG - C image batch finishing compression reduces weight tools | latest JPG batch dressing tools download
- 表的创建、修改与删除
- Guest brush SQL - 2
- Fist game copyright-free music download, League of Legends copyright-free music, can be used for video creation, live broadcast
- 微信小程序请求封装
- rhcsa 第三次
- mysql中添加字段的相关问题
- Bean的生命周期
猜你喜欢

聊一聊ICMP协议以及ping的过程

Dbeaver connect the MySQL database and error Connection refusedconnect processing

【手撕AHB-APB Bridge】~ AHB地址总线的低两位为什么不用来表示地址呢?

金山打字通 官网 下载

Electromagnetic compatibility introductory tutorial (6) test project

Golang: go get url and form attribute value

Vim三种模式

Golang:go开启web服务

Data Analysis 6

研发过程中的文档管理与工具
随机推荐
Offer刷题——1
Dart exception details
POJ1251丛林之路题解
小程序全面屏手势配置案例
Generate pictures based on the content of the specified area and share them with a summary
MVVM project development (commodity management system 1)
crypto-js uses
Golang:go连接和使用mysql
LabVIEW RT中的用户界面更新速度
我说过无数遍了:从来没有一种技术是为灵活组合这个目标而设计的
Vim三种模式
app 自动化 通过工具查看app 元素 (三)
聊一聊ICMP协议以及ping的过程
Zero-code website development tool: WordPress
JSON 与 JS 对象的区别
JVM: Runtime Data Area - PC Register (Program Counter)
数据机构----线性表之单向链表
flink sql-client,怎么处理源端与目标增加端,sql-client包括映射表与JOB如
套接字选项
Chapter 9 of Huawei Deep Learning Course - Convolutional Neural Network and Case Practice