博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
c/c++实现获取NOD32升级账号密码
阅读量:3530 次
发布时间:2019-05-20

本文共 4417 字,大约阅读时间需要 14 分钟。

功能有待完善和添加

#include 
#include
#include
#include
#include
#include
#include
using namespace std;//通过Wget来获取网页string GetHtmlByWget(string url){ //获取待下载网页文件名 string fileName = url.substr((int)url.find_last_of("/") + 1); if(fileName != "") { string strCom = "wget -q "; //wget命令,-q表示不显示下载信息 strCom.append(url); system(strCom.c_str()); //执行wget ifstream fin(fileName.c_str()); if(!fin) { return ""; } string strHtml = ""; char chTemp[1024] = ""; //读取网页文件到内存中 while(fin.getline(chTemp , 1024)) { strHtml.append(string(chTemp)); strcpy(chTemp , ""); } fin.close(); strCom = "del -f "; //删除文件命令,-f表示直接删除不做任何提示 strCom.append(fileName); system(strCom.c_str()); //删除刚才下载下来的文件 return strHtml; //返回网页源码 } else { return ""; }}string GetHtmlPath(int y, int m, int d){ stringstream str; string now; string path = "http://www.nod32jihuoma.cn/nod32-id/"; str << y + 1900; str >> now; path.append(now); path.append("-"); now.clear(); str.clear(); int month = m + 1; if(month / 10 == 0) { str << 0; str >> now; path.append(now); now.clear(); str.clear(); } str << month; str >> now; path.append(now); path.append("-"); now.clear(); str.clear(); int day = d; if(day / 10 == 0) { str << 0; str >> now; path.append(now); now.clear(); str.clear(); } str << day; str >> now; path.append(now); path.append(".html"); now.clear(); str.clear(); return path;}void SearchData(int n){ ofstream cout("key.txt"); const string key = "
用户名:";//13 const string value = " 密 码:";//14 time_t t = time(NULL); struct tm* cur = localtime(&t); int y = cur->tm_year; int m = cur->tm_mon; int d = cur->tm_mday; for(int i = 0 ; i < n; i++) { int dd = d - i; string path = GetHtmlPath(y, m, dd); cout << "获取网址" << "\n" << path << endl; string data = GetHtmlByWget(path); //cout << data << endl; cout << y + 1900 << "年" << m + 1 << "月" << dd << "日 " << endl; cout << "用户名: 密码:" <

效果图:

由于获取NOD32激活码的网址更改为http://www.nod32jihuoma.cn/nod32-id/index.html

即不需要网址最后的时间的处理了,变得更加简单化

相应的代码更改为:

#include 
#include
#include
#include
#include
#include
#include
#include
using namespace std;string GetHtml(CString url){ CString content; CString data; DWORD dwStatusCode; CInternetSession session("HttpClient"); CHttpFile* pfile = (CHttpFile *)session.OpenURL(url); pfile -> QueryInfoStatusCode(dwStatusCode); if(dwStatusCode == HTTP_STATUS_OK) { while (pfile -> ReadString(data)) { content += data; } } pfile -> Close(); delete pfile; session.Close(); return string(content.GetBuffer(content.GetLength()));}void SearchData(){ ofstream cout("key.txt"); const string key = "

用户名:";//15 const string value = " 密 码:";//14 time_t t = time(NULL); struct tm* cur = localtime(&t); int y = cur->tm_year; int m = cur->tm_mon; int d = cur->tm_mday; string path = "http://www.nod32jihuoma.cn/nod32-id/index.html"; cout << "获取网址" << "\n" << path << endl; CString url; url.Format("%s",path.c_str()); string data = GetHtml(url); //cout << data << endl; cout << y + 1900 << "年" << m + 1 << "月" << d << "日 " << endl; cout << "用户名: 密码:" <

http://www.nod32jihuoma.cn/nod32-id/index.html

#include 
#include
#include
#include
#include
#include
#include
using namespace std;//通过Wget来获取网页string GetHtmlByWget(string url){ //获取待下载网页文件名 string fileName = url.substr((int)url.find_last_of("/") + 1); if(fileName != "") { string strCom = "wget -q "; //wget命令,-q表示不显示下载信息 strCom.append(url); system(strCom.c_str()); //执行wget ifstream fin(fileName.c_str()); if(!fin) { return ""; } string strHtml = ""; char chTemp[1024] = ""; //读取网页文件到内存中 while(fin.getline(chTemp , 1024)) { strHtml.append(string(chTemp)); strcpy(chTemp , ""); } fin.close(); strCom = "del -f "; //删除文件命令,-f表示直接删除不做任何提示 strCom.append(fileName); system(strCom.c_str()); //删除刚才下载下来的文件 return strHtml; //返回网页源码 } else { return ""; }}void SearchData(){ ofstream cout("key.txt"); const string key = "

用户名:";//15 const string value = " 密 码:";//14 time_t t = time(NULL); struct tm* cur = localtime(&t); int y = cur->tm_year; int m = cur->tm_mon; int d = cur->tm_mday; string path = "http://www.nod32jihuoma.cn/nod32-id/index.html"; cout << "获取网址" << "\n" << path << endl; string data = GetHtmlByWget(path); //cout << data << endl; cout << y + 1900 << "年" << m + 1 << "月" << d << "日 " << endl; cout << "用户名: 密码:" <

转载地址:http://koyhj.baihongyu.com/

你可能感兴趣的文章
自动配置原理
查看>>
TCP协议
查看>>
关于Linux系统使用遇到的问题-1:vi 打开只读(readonly)文件如何退出保存?
查看>>
redis 持久化详解,RDB和AOF是什么?他们优缺点是什么?运行流程是什么?
查看>>
spring注解版(一)
查看>>
SpringBoot中访问控制层(controller)得不到Json数据
查看>>
react项目报出警告Warning: Cannot update during an existing state transition (such as within `render`).
查看>>
BFC(Block Formatting Context)
查看>>
什么是作用域,什么是闭包,什么是作用域链
查看>>
惰性求值,面向对象
查看>>
lodash源码分析之baseSlice()函数
查看>>
数据结构之列表
查看>>
发布/订阅模式 vs 观察者模式
查看>>
es5中的arguments对象
查看>>
git本地仓库和远程仓库关联,分支重命名
查看>>
js对象的深拷贝,你真的觉得很简单吗?
查看>>
你真的了解map方法吗?手动实现数组map方法。
查看>>
带你手动实现call方法,让你收获满满
查看>>
前端知识体系
查看>>
查找入职员工时间排名倒数第三的员工所有信息
查看>>