当前位置:网站首页>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 ----边栏推荐
猜你喜欢

How to generate and configure public key certificate in Alipay

MVVM project development (commodity management system 1)

Guest brush SQL - 2

VoLTE基础学习系列 | 企业语音网简述

Image lossless compression software which works: try completely free JPG - C image batch finishing compression reduces weight tools | latest JPG batch dressing tools download

国内外最顶级的8大plm项目管理系统

Golang: go open web service

nodetype中值1、2、3分别代表什么意思

MVVM项目开发(商品管理系统一)

Dart exception details
随机推荐
2022杭电多校第二场1011 DOS Card(线段树)
Vim三种模式
好的plm软件有哪些?plm软件排行榜
华为深度学习课程第六、七章
Go supports OOP: use struct instead of class
app 自动化 通过工具查看app 元素 (三)
MATLAB program design and application of MATLAB 2.5
图像基本操作的其他内容
Introduction to the basic principles, implementation and problem solving of crawler
mysql查看cpu使用情况
拳头游戏免版权音乐下载,英雄联盟无版权音乐,可用于视频创作、直播
MVVM project development (commodity management system 1)
05-SDRAM:仲裁
POJ2421道路建设题解
gethostbyname \ getaddrinfo 解析域名IP地址不安全的原因
图片无损压缩软件哪个好用:试试完全免费的JPG-C 图片批量修整压缩减肥工具吧 | 最新jpg批量修整工具下载
特殊的日子,值得纪念
国内外最顶级的8大plm项目管理系统
Generate pictures based on the content of the specified area and share them with a summary
rhcsa 第四天