VC设置cookies实现文件刷下载量

分类: c/c++2013-10-11 17:22 250人阅读 评论(0) 收藏 举报
 

目录(?)[+]

 

同学XXX提问:

大家好,我们做的Android应用已经成功在中兴汇天地成功上架了,打开“中兴汇天地应用商店”http://apps.ztems.com/,搜索栏搜索“睿云”就能找到了,但是需要你注册一个应用商店的账号,完成后就可以下载了,还可以给我们评论。最简单的刷下载量请直接点击http://dl5.ztems.com/tmpfile/cst2009/2009001/appSoft/2013/10/9/ruiyun.apk(经测试可以下载,不能增加下载量)
以上两种方法均可,第一种更好,第二种也可。但是在大家空闲的时候还是推荐第一种。XXX在此谢谢各位的帮助了。

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

类似这样的app下载网站,是不会验证IP,更不会验证MAC,来实现仅仅让一个客户端下载一次.(验证IP,我们可以用代理IP来实现我们的刷下载量的目的)

模拟登录一下,看看服务器是怎样处理用户请求的.

用抓包软件监测下:

  1. POST /storeUserbasicFacade/login.ssm HTTP/1.1
  2. Host: apps.ztems.com
  3. Connection: keep-alive
  4. Content-Length: 72
  5. Origin: http://apps.ztems.com
  6. User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36
  7. Content-Type: text/plain;charset=UTF-8
  8. Accept: */*
  9. Referer: http://apps.ztems.com/newLogin.html
  10. Accept-Encoding: gzip,deflate,sdch
  11. Accept-Language: zh-CN,zh;q=0.8
  12. Cookie: JSESSIONID=811B619FA8744978B07238A82F1E6A8B.app42-1; zte_store_view=4028329f417e6dcd01419d5dafa21aa3-1131011170551%2C
  13. [{"email":"******","userPasswd":"****","checkCode":"3367"}]

http://apps.ztems.com/newLogin.html

/storeUserbasicFacade/login.ssm

这种东西由于水平有限暂时不知道如何去处理,所以就从cookies入手了.

得到了cookies我们就可以非常轻松的绕过后台登录了.

接下来用VC实现上述操作,利用win api

InternetSetCookie

Syntax

 
BOOL InternetSetCookie(
_In_  LPCTSTR lpszUrl,
_In_  LPCTSTR lpszCookieName,
_In_  LPCTSTR lpszCookieData
);

Parameters

lpszUrl [in]

Pointer to a null-terminated string that specifies the URL for which the cookie should be set.

lpszCookieName [in]

Pointer to a null-terminated string that specifies the name to be associated with the cookie data. If this parameter is NULL, no name is associated with the cookie.

lpszCookieData [in]

Pointer to the actual data to be associated with the URL.

Return value

Returns TRUE if successful, or FALSE otherwise. To get a specific error message, call GetLastError.

Remarks

Cookies created by InternetSetCookie without an expiration date are stored in memory and are available only in the same process that created them. Cookies that include an expiration date are stored in the windows\cookies directory.

Creating a new cookie might cause a dialog box to appear on the screen asking the user if they want to allow or disallow cookies from this site based on the privacy settings for the user.

Caution  InternetSetCookie will unconditionally create a cookie even if “Block all cookies” is set in Internet Explorer. This behavior can be viewed as a breach of privacy even though such cookies are not subsequently sent back to servers while the “Block all cookies” setting is active. Applications should use InternetSetCookieEx to correctly honor the user's privacy settings.

For more cookie internals, see http://blogs.msdn.com/ieinternals/archive/2009/08/20/WinINET-IE-Cookie-Internals-FAQ.aspx.

Like all other aspects of the WinINet API, this function cannot be safely called from within DllMain or the constructors and destructors of global objects.

Note  WinINet does not support server implementations. In addition, it should not be used from a service. For server implementations or services use Microsoft Windows HTTP Services (WinHTTP).

  1. #include <iostream>
  2. #include <cstdio>
  3. #include <afxinet.h>
  4. using namespace std;
  5. CString getHtml(CString url)
  6. {
  7. CString content;
  8. CString data;
  9. DWORD dwStatusCode;
  10. CInternetSession session(TEXT("HttpClient"));
  11. CHttpFile* pfile = (CHttpFile *)session.OpenURL(url);
  12. pfile->QueryInfoStatusCode(dwStatusCode);
  13. if(dwStatusCode == HTTP_STATUS_OK)
  14. {
  15. while (pfile->ReadString(data))
  16. {
  17. content += data;
  18. }
  19. }
  20. pfile->Close();
  21. delete pfile;
  22. session.Close();
  23. return content;
  24. }
  25. int main()
  26. {
  27. CString url = "http://apps.ztems.com/fdpc?appcode=4028329f417e6dcd01419d5dafa21aa3";
  28. InternetSetCookie(url, NULL, TEXT("JSESSIONID=811B619FA8744978B07238A82F1E6A8B.app42-1; zte_store_view=;expires=Sat,01-Jan-2014 00:00:00GMT"));
  29. getHtml(url);
  30. }

VC设置cookies实现文件刷下载量的更多相关文章

  1. VS VC++ 设置版本号

    我并不是专职的VC++的开发者,只是有时候偶尔要开发一些C++的DLL,每当要发布新版本的时候,隔得时间长一点总会忘记了在那里设置生成文件的版本号. 在这里把VC++设置的步骤记录下来,以备忘! 设置 ...

  2. Django 设置cookies与获取cookies.

    在Django里面,使用Cookie和Session看起来好像是一样的,使用的方式都是request.COOKIES[XXX]和request.session[XXX],其中XXX是您想要取得的东西的 ...

  3. 转载 VC轻松解析XML文件 - CMarkup类的使用方法

    VC轻松解析XML文件 - CMarkup类的使用方法http://www.cctry.com/thread-3866-1-1.html VC解析XML文件的工具有很多,CMarkup, tinyXM ...

  4. apache启动目录(禁止目录)与设置默认入口文件的方法

    设置默认入口文件的方法: 打开apache的conf目录,找到httpd.conf文件,打开这个文件,搜索dir_module,找到以下截图修改位置进行修改,注意重启apache服务器,修改位置才会生 ...

  5. 一个简单的C#获取Session、设置Session类文件

    一个简单的C#获取Session.设置Session类文件,本类主要实现大家最常用的两个功能: 1.GetSession(string name)根据session名获取session对象: 2.Se ...

  6. vc++基础班[21]---文件的基本操作之CFile

    ①.文件的创建.打开.关闭: 文件的创建.打开:CFile::Open 文件的关闭:CFile::Close   CFile::modeCreate:以新建方式打开,如果文件不存在,则新建:如果文件已 ...

  7. 设置tomcat 编译文件位置【转】

    问题: 将项目发布到tomcat时,发现tomcat的cclasses目录下无任何编译后的文件. 解决方法:设置MyEclipse的文件编译目录即可: http://my.oschina.net/u/ ...

  8. 【平差软件学习---科傻】四、科傻二等水准平差(参数设置和in1文件讲解)

    [平差软件学习---科傻]四.科傻二等水准平差(参数设置和in1文件讲解) 这个算是最后一集了,也可能不是如果我想到不足的地方我会在补上一集视频,或者是文章页.总感觉自己操作的很熟练,到自己真正讲的时 ...

  9. VC设置代理方法

      参考文章: VC 设置代理 Setting and Retrieving Internet Options Change Internet Proxy settings http://suppor ...

随机推荐

  1. 网络构建入门技术(1)——IP概述

    说明(2017-5-10 11:02:31): 0. IP地址的作用,TCP/IP,网络层,包,源IP(哪个设备发出).目的IP(数据要发到哪个设备),每个设备需要唯一的一个IP地址.32个0到32个 ...

  2. ILOG JRules 和 WebSphere Process Server 集成概述

    ILOG JRules 和 WebSphere Process Server 集成概述 简介 业务流程管理(Business Process Management,BPM)和业务规则管理系统(Busi ...

  3. Android基础——使用Fragment适应不同屏幕和分辨率

    最近事情很忙,一个新项目赶着出来,但是很多功能都要重新做,一直在编写代码.Debug.今天因为一个新程序要使用Fragment来做,虽然以前也使用过Fragment,不过没有仔细研究,今天顺道写篇文章 ...

  4. [转]Oracle 树操作(select…start with…connect by…prior)

    原文地址:https://www.cnblogs.com/colder/p/4838574.html oracle树查询的最重要的就是select…start with…connect by…prio ...

  5. 【转】mybatis连接Oracle做增删改查

    原文地址:http://blog.csdn.net/liumengcheng/article/details/34422475 入门请看http://blog.csdn.NET/liumengchen ...

  6. cas单点登录-CAS5.1.3 overlay服务器搭建(二)

    前言    本节主要讲解怎么搭建cas服务端,并且在浏览器中使用https访问cas服务端 1.通过cas代码生成工具(https://casinitializr.herokuapp.com/),生成 ...

  7. java获取classpath以外的路径

    最近在使用以前写过的代码生成器(从表名可生成所有的代码)的时候,发现生成的文件都在classpath目录下,所有的文件都得自己拷到工程目录下,于是,想优化一下,取得classpath目录以外的路径,很 ...

  8. C++客户端访问Java服务端发布的SOAP模式的WebService接口

    gSOAP是一个绑定SOAP/XML到C/C++语言的工具,使用它可以 简单快速地开发出SOAP/XML的服务器端和客户端 Step1 使用gsoap-2.8\gsoap\bin\win32\wsdl ...

  9. CPP_template

    泛型编程是独立于任何特定类型的方式编写代码.模板是泛型编程的基础,模板使程序员能够快速建立具有类型安全的类库集合和函数集合,它的实现,方便了大规模的软件开发. 模板提供通用类型和通用函数,定义中包含t ...

  10. hdfs清空回收站

    1. 直接删除目录(不放入回收站) hdfs dfs -rm -skipTrash /usr/tmp/log/ 2. 清空回收站 hdfs dfs -expunge