吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 11750|回复: 3
收起左侧

[会员申请] 会员申请:ID:keep

[复制链接]
吾爱游客  发表于 2018-2-10 14:46
1、申请会员ID:Keep(或keep123)
2、个人邮箱:923823264@qq.com
3、原创技术文章:我目前上大二,课余时间充足,希望到贵站学习更多知识。下面附上一篇模拟登录校教务系统的教程:

  • Jsoup应该是Java最简单的网页解析框架
  • 下载地址:https://jsoup.org/download
  • 该实例以强智教务系统为例:http://jwxt.qlu.edu.cn
    搜狗截图20180210142743.png
  • 该教务系统带有验证码,我们就先获取验证码,从Chrome工具中得到验证码地址,如图:
    搜狗截图20180210143200.png
  • 分析Post登录参数,我们发现,参数中并没有我们提交的用户名,密码之类的参数,反而只有形如:

  • view:

    1

  • useDogCode:

  • encoded:

    2i50E6o109c1c24013L1286734P4HF%6mc%n%00D38232529

  • RANDOMCODE:

    1zbz
  • IDA Console, Courier New, monospace">这样的参数。
  • 于是我们回到网页表单中,找到对应的表单:
  • 搜狗截图20180210143612.png
  • 然后找到对应的方法:
    搜狗截图20180210143650.png


    没错,这就是加密算法!


    我们得到了它的运行逻辑,再写代码就容易多了。看代码:
package cn.zyzpp.eduCookie;import java.io.IOException;import java.util.HashMap;import java.util.Map;import java.util.Scanner;import org.jsoup.Connection;import org.jsoup.Connection.Method;import org.jsoup.Connection.Response;import org.jsoup.Jsoup;import org.junit.Before;import org.junit.Test;import cn.zyzpp.eduCookie2.S;/** * 模拟登录带验证码的教务系统 *  * 2018-2-9 */public class JsoupSafeCode {    private String url_safecode = "http://jwxt.qlu.edu.cn/verifycode.servlet?t=0.020974584"; // 验证码    private String url_encode = "http://jwxt.qlu.edu.cn/Logon.do?method=logon&flag=sess"; // 加密字符串    private String url_Login = "http://jwxt.qlu.edu.cn/Logon.do?method=logon"; // 登录    private String username = "";    private String password = "";    private String path = JsoupSafeCode.class.getResource("/").getPath().replaceAll("%20", " ") + "safecode.png";    private Map<String, String> cookie;    /**     * 下载验证码     * 保存Cookie     * @throws IOException     */    public void getSafeCode() throws IOException {        Response response = Jsoup.connect(url_safecode).ignoreContentType(true) // 获取图片需设置忽略内容类型                .userAgent("Mozilla").method(Method.GET).timeout(3000).execute();        cookie = response.cookies();        byte[] bytes = response.bodyAsBytes();        Util.saveFile(path, bytes);        System.out.println("保存验证码到:" + path);    }    /**     * 登录教务系统     */    public void initLogin() throws IOException {        S.print("输入验证码:");        Scanner scan = new Scanner(System.in);        String code = scan.next();        try {            Map<String, String> data = new HashMap<String, String>();            data.put("view", "1");            data.put("encoded", getEncoded());            data.put("RANDOMCODE", code);            Connection connect = Jsoup.connect(url_Login)                    .header("Accept",                            "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")                    .userAgent("Mozilla").method(Method.POST).data(data).timeout(3000);            for (Map.Entry<String, String> entry : cookie.entrySet()) {                connect.cookie(entry.getKey(), entry.getValue());            }            Response response = connect.execute();            S.println(response.parse().text().toString());        } catch (IOException e) {        }    }    /**     * 加密参数(依具体环境而定,加密算法一般在JS中获得)     */    public String getEncoded() {        try {            Connection connect = Jsoup.connect(url_encode)                    .header("Accept",                            "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")                    .userAgent("Mozilla").method(Method.POST).timeout(3000);            for (Map.Entry<String, String> entry : cookie.entrySet()) {                connect.cookie(entry.getKey(), entry.getValue());            }            Response response = connect.execute();            String dataStr = response.parse().text();            // 加密encoded:            String scode = dataStr.split("#")[0];            String sxh = dataStr.split("#")[1];            String code = username + "%%%" + password;            String encoded = "";            for (int i = 0; i < code.length(); i++) {                if (i < 20) {                    encoded = encoded + code.substring(i, i + 1)                            + scode.substring(0, Integer.parseInt(sxh.substring(i, i + 1)));                    scode = scode.substring(Integer.parseInt(sxh.substring(i, i + 1)), scode.length());                } else {                    encoded = encoded + code.substring(i, code.length());                    i = code.length();                }            }            return encoded;        } catch (IOException e) {        }        return null;    }}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
package cn.zyzpp.eduCookie;import java.io.File;import java.io.FileOutputStream;import java.io.IOException;public class Util {    /**     * 将字节流转换成文件     *      * @param filename     * @param data     * @throws Exception     */    public static void saveFile(String filename, byte[] data) {        if (data != null) {            String filepath = filename;            File file = new File(filepath);            if (file.exists()) {                file.delete();            }            try {                FileOutputStream fos = new FileOutputStream(file);                fos.write(data, 0, data.length);                fos.flush();                fos.close();            } catch (IOException e) {                e.printStackTrace();            }        }    }}
搜狗截图20180210142743.png

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

Hmily 发表于 2018-2-11 10:29
抱歉,未能达到申请要求,申请不通过,可以关注论坛官方微信(吾爱破解论坛),等待开放注册通知。
吾爱游客  发表于 2018-2-11 12:52
我嚓,申请多少次了,真麻烦。我特么程序员都申请不了,醉了!贵站门槛太高,和我等无缘

点评

程序员也有三六九等,这只能说明本帖的质量没达到申请要求,你可以参考现有的精华优秀贴的内容,看什么样的申请可以达到,另外大二就说自己是程序员了?  详情 回复 发表于 2018-2-11 15:37
Hmily 发表于 2018-2-11 15:37
游客 117.132.63.x 发表于 2018-2-11 12:52
我嚓,申请多少次了,真麻烦。我特么程序员都申请不了,醉了!贵站门槛太高,和我等无缘

程序员也有三六九等,这只能说明本帖的质量没达到申请要求,你可以参考现有的精华优秀贴的内容,看什么样的申请可以达到,另外大二就说自己是程序员了?
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-17 00:48

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表