有道云笔记自动签到
2016-06-08 13:34
1776 查看
主体步骤
1. 笔记本装fiddler;猎豹WiFi开热点;
2. 手机连接热点,WiFi设置代理-手动-主机为192.168.1.1,端口为8888;
3. 手机浏览器访问fiddler代理ip+端口,如猎豹WiFi是192.168.191.1:8888,安装fiddler证书到手机;否则app是不给联网的。
4. 抓app的包。
5. 分析app登录、签到时都干了什么。
更多关于fiddller参考:
http://chessman-126-com.iteye.com/blog/2001501 http://www.cnphp6.com/archives/97865 http://www.cnblogs.com/mfryf/p/5028010.html
具体实施
好,假设你已经做好了准备工作。
(1)第一步,device_open
当有道云笔记app打开时,app访问device_open,fiddler抓到的包:
注意返回的delusers数组,删除用户?怪吓人的。
上图是POST请求,下图是服务器返回(下同)。
Java Code
2016/05/12 00:53
把程序放在服务器上:
设置crontab例行任务
log:
1. 笔记本装fiddler;猎豹WiFi开热点;
2. 手机连接热点,WiFi设置代理-手动-主机为192.168.1.1,端口为8888;
3. 手机浏览器访问fiddler代理ip+端口,如猎豹WiFi是192.168.191.1:8888,安装fiddler证书到手机;否则app是不给联网的。
4. 抓app的包。
5. 分析app登录、签到时都干了什么。
更多关于fiddller参考:
http://chessman-126-com.iteye.com/blog/2001501 http://www.cnphp6.com/archives/97865 http://www.cnblogs.com/mfryf/p/5028010.html
具体实施
好,假设你已经做好了准备工作。
(1)第一步,device_open
当有道云笔记app打开时,app访问device_open,fiddler抓到的包:
注意返回的delusers数组,删除用户?怪吓人的。
上图是POST请求,下图是服务器返回(下同)。
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.io.PrintWriter; import java.net.URLConnection; import java.util.*; import java.io.*; import java.util.zip.GZIPInputStream; import java.io.UnsupportedEncodingException; public class Signin { public static String seesion_cookie = null; public static void main(String[] args) throws IOException { /* * set proxy so that fiddler * can capture packages sent by this program System.setProperty("http.proxyHost", "127.0.0.1"); System.setProperty("https.proxyHost", "127.0.0.1"); System.setProperty("http.proxyPort", "8888"); System.setProperty("https.proxyPort", "8888"); System.setProperty("javax.net.ssl.trustStore", "D:\\Program Files\\Java\\jre1.8.0_25\\lib\\security\\FiddleKeystore"); System.setProperty("javax.net.ssl.trustStorePassword", "your_passwd"); */ System.out.println("deviceOpen:" + deviceOpen()); System.out.println("login:" + login()); System.out.println("checkIn:" + checkIn()); } public static String deviceOpen() { String url = "http://note.youdao.com/yws/device_open/poll"; String arg = "your_arg"; Map<String, String> headers = new HashMap<String, String>(); headers.put("Content-Length", "481"); headers.put("Content-Type", "application/x-www-form-urlencoded"); return sendPost(url, arg, headers); } public static String login() { String url = "http://note.youdao.com/login/acc/co/cq?product=YNOTE&cf=7&userid=......."; String arg = null; Map<String, String> headers = new HashMap<String, String>(); headers.put("Content-Length", "0"); headers.put("YNOTE-PC", "v2|urstoken||YNOTE|......"); return sendPost(url, arg, headers); } public static String checkIn() { String url = "https://note.youdao.com/yws/mapi/user?method=checkin"; String arg = "your_arg"; Map<String, String> headers = new HashMap<String, String>(); headers.put("Cookie", "YNOTE_LOGIN=true;" + seesion_cookie); headers.put("Content-Length", "481"); headers.put("Content-Type", "application/x-www-form-urlencoded"); return sendPost(url, arg, headers); } public static String sendPost(String url, String param, Map<String, String> headers) { PrintWriter out = null; BufferedReader in = null; StringBuilder result = new StringBuilder(); try { URL realUrl = new URL(url); HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Accept-Encoding", "gzip"); conn.setRequestProperty("Accept-Charset", "GBK,utf-8;q=0.7,*;q=0.3"); for (String key : headers.keySet()) conn.setRequestProperty(key, headers.get(key)); conn.setRequestProperty("Host", "note.youdao.com"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("User-Agent", "ynote-android"); conn.setDoOutput(true); conn.setDoInput(true); out = new PrintWriter(conn.getOutputStream()); if (param != null) out.print(param); out.flush(); System.out.println(conn.getResponseCode() + " " + conn.getResponseMessage()); for (int i = 1; conn.getHeaderFieldKey(i) != null; ++i) { if (conn.getHeaderFieldKey(i).equals("Set-Cookie") && conn.getHeaderField(i).contains("YNOTE_SESS=v2")) { seesion_cookie = conn.getHeaderField(i).split(";")[0]; System.out.println("seesion_cookie:" + seesion_cookie); break; } } Reader reader = null; if ("gzip".equals(conn.getContentEncoding())) { System.out.println("Response body is encoded in gzip."); reader = new InputStreamReader(new GZIPInputStream(conn.getInputStream())); } else { reader = new InputStreamReader(conn.getInputStream()); } in = new BufferedReader(reader); String line; while ((line = in.readLine()) != null) { result.append(line); } } catch (Exception e) { System.out.println("sendPost Exception !!! " + e); e.printStackTrace(); } finally { try { if (out != null) out.close(); if (in != null) in.close(); } catch (IOException ex) { ex.printStackTrace(); } } return result.toString(); } }
Java Code
2016/05/12 00:53
把程序放在服务器上:
设置crontab例行任务
# signin.sh cd /home/whuliss/Documents/ date >> signin_log java SignIn >> signin_log
log:
Fri Jun 3 00:37:01 CST 2016 checkIn:{"total":830472192,"time":1464885510110,"space":6291456,"success":1} Sat Jun 4 00:37:01 CST 2016 checkIn:{"total":834666496,"time":1464971913651,"space":4194304,"success":1} Sun Jun 5 00:37:02 CST 2016 checkIn:{"total":840957952,"time":1465058318146,"space":6291456,"success":1} Mon Jun 6 00:37:01 CST 2016 checkIn:{"total":842006528,"time":1465144721286,"space":1048576,"success":1} Tue Jun 7 00:37:01 CST 2016 checkIn:{"total":847249408,"time":1465231125472,"space":5242880,"success":1} Wed Jun 8 00:37:01 CST 2016 checkIn:{"total":852492288,"time":1465317528907,"space":5242880,"success":1}
相关文章推荐
- Navicat 该怎样检测 Oracle 数据库安全性
- array高亮及替换(合并)与简单应用(文字背景)demo
- TortoiseSVN 命令 (命令行执行工具)
- 6/8 sprint2 看板和燃尽图的更新
- myeclipse运行过程中报错 Java was started ,but return exit code=1
- Linux系统知识
- #ifndef和#define
- GDB常用调试命令,layout很有用
- 恶心的A+B
- Android 中自定义View的初步总结
- React Native开发之IDE(Atom+Nuclide)安装,运行,调试
- MVP+RXJAVA+RecyclerView实现sd卡根目录下的所有文件中的照片加载并显示
- 解决WebClient或HttpWebRequest首次连接缓慢问题
- UBUNTU环境下编译的openwrt
- logrotate切割日志rsyslog不重新上传,清空归零iCurrOffs
- java多线程基础概念
- 关于jquery中on绑定click事件在苹果手机失效的问题
- SSL/TLS协议笔记
- springmvc,mybatis,logback整合相关
- XZ压缩