同学入职了滴滴,要录入人员信息,手动一个一个输太慢,遂喊我帮忙,先逆向一个请求的加密,没有啥技术含量就是扣了一个common方法结束。手动下载crypto-js和jsencrypt把姓名身份证和验证码请求补全就能直接跑了

window = {}

const CryptoJS = require('crypto-js');
const JSEncrypt = require('jsencrypt');

const text = '{"staffName":"姓名","idType":"1","idCard":"身份证","Page":1,"PageSize":10,"captcha":"请求验证码返回的结果"}'
const data = {};
data.field = JSON.parse(text);


var CONST_TC_NAME = 'typeCode';
var CONST_TC_VALUE = 'preValue';
var CONST_TC_PARENT_VALUE = 'parentValue';
var RSA_PUBLIC_KEY="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJKTV32+OIzBMTDQreJGwjDe8/88a6QpeKSWdivyQkvIwq8d0BL1cOiSujKZP+G+3LGBfha2B6O0EiLT1ArKgC0CAwEAAQ==";
var AES_KEY_IV="1234567812345678";

var common = {
    /**
     * 判断对象为空
     * @param obj
     * @returns {boolean}
     */
    isBlank: function(obj) {
        if(obj == undefined || obj == null || obj === '') {
            return true;
        } else {
            return false;
        }
    },
    /**
     * 判断对象不为空
     * @param obj
     * @returns {boolean}
     */
    isNotBlank: function(obj) {
        return !common.isBlank(obj);
    },
    /**
     * 判断输入的信息是否由汉字字母数字组成
     * @param obj
     * @returns {boolean}
     */
    isHanziLetterFigure: function (obj) {
        var isHanziLetterFigureFlag = /^((?![\u3000-\u303F])[\u2E80-\uFE4F\a-z0-9A-Z\-])*(?![\u3000-\u303F])[\u2E80-\uFE4F\a-z0-9A-Z\-]*$/.test(obj);
        return !isHanziLetterFigureFlag;
    },
    /**
     * layui禁用样式
     * @param id
     */
    initDisbled: function(id){
        $(id).attr("disabled", "");
        $(id).addClass("layui-disabled");
    },

    /**
     * 移除layui禁用样式
     * @param id
     */
    initRemoveDisbled: function(id){
        $(id).removeAttr("disabled", "");
        $(id).removeClass("layui-disabled");
    },
    /**
     * url参数拼接
     * @param url
     * @param params
     */
    urlMake:function(url,params){
        var dataparams = JSON.stringify(params, function(k, v)
        {
            if (k != "$$hashKey" && v != null && v != undefined)
                return v;
        });
        return url+"?data="+encodeURIComponent(dataparams);
    },
    /**
     * 日期格式化
     * @param url
     * @param params
     */
    formatDate:function(datetime){
        var str = "";
        if(common.isBlank(datetime) || datetime.length < 8) {
            str = datetime;
        } else {
            var pattern = /(\d{4})(\d{2})(\d{2})/;
            str = datetime.replace(pattern, '$1-$2-$3');
        }
        return str;
    },
    formatDates:function(datetime){
        var str = "";
        if(common.isBlank(datetime) && datetime.length < 8) {
            var pattern = /(\d{4})(\d{2})/;
            str = datetime.replace(pattern, '$1年$2月');
        } else {
            var pattern = /(\d{4})(\d{2})(\d{2})/;
            str = datetime.replace(pattern, '$1年$2月$3日');
        }
        return str;
    },
    getDaysBetween : function (dateString1,dateString2){
        var  startDate = Date.parse(dateString1);
        var  endDate = Date.parse(dateString2);
        var days=(endDate - startDate)/(1*24*60*60*1000);
        // alert(days);
        return  days;
    },
    /**
     * 数据字典翻译
     * @param businessType :业务大类,如果网上年审,出入境管理,其他默认0000
     * @param businessNmae :业务名称,如车牌颜色,工单办理进度,经营范围
     * @param keys :业务keys值,如01000,01101,01102
     */
    getDatadict:function(businessType,businessName,keys){
        var result = "";
        var json = yearAuditButtonJson;
        if(common.isBlank(keys)) {
            return result;
        } else {
            var arr = keys.split(",");
            for(var i=0;i<arr.length;i++) {
                result += json[arr[i]] + ",";
            }
            if(result.length > 0) {
                result = result.substring(0,result.length-1);
                if(businessName == "operType"){
                    result = result.replace(","," ");
                }
            }
        }
        return result;
    },
    /**
     * 生成16进制随机数
     * @returns {string}
     */
    getRamNumber:function(digit){
        var result='';
        for(var i=0;i<digit;i++){
            result+=Math.floor(Math.random()*digit).toString(digit);
        }
        return result.toUpperCase();
    },
    rsaEncrypt:function(bodyText){
        var encrypt = new JSEncrypt();
        encrypt.setPublicKey(RSA_PUBLIC_KEY);
        return encrypt.encrypt(bodyText);
    },
    aesEnrypt:function(key,bodyText){
        var key  = CryptoJS.enc.Utf8.parse(key);//秘钥
        var iv   = CryptoJS.enc.Utf8.parse(AES_KEY_IV);//秘钥偏移量
        var encrypted =CryptoJS.AES.encrypt(bodyText,key,
            {
                iv:iv,
                mode:CryptoJS.mode.CBC,
                //padding:CryptoJS.pad.ZeroPadding
                padding:CryptoJS.pad.Pkcs7
            });
        return  encrypted.ciphertext.toString()//128位的字符串
    },
    aesDecrypt:function(key,bodyText) {
        var key  = CryptoJS.enc.Utf8.parse(key);//秘钥
        var iv   = CryptoJS.enc.Utf8.parse(AES_KEY_IV);//秘钥偏移量
        var encryptedHexStr = CryptoJS.enc.Hex.parse(bodyText);//转为十六进制
        var srcs = CryptoJS.enc.Base64.stringify(encryptedHexStr);//变为Base64编码的字符串
        var decrypt = CryptoJS.AES.decrypt(srcs, key, {
            iv: iv,
            mode: CryptoJS.mode.CBC,
            padding: CryptoJS.pad.ZeroPadding
        });
        var decryptedStr = decrypt.toString(CryptoJS.enc.Utf8);//按照Utf8格式转为字符串
        return decryptedStr;
    },
    /**
     * 提交参数加密操作
     * @param url
     * @param params
     */
    postParamMake:function(params){
        // 获取16位随机数,当做aes秘钥key
        var aesKey = common.getRamNumber(16);
        // aes加密
        var requestData = common.aesEnrypt(aesKey,JSON.stringify(params));
        // rsa加密
        var encrypted = common.rsaEncrypt(aesKey);
        // 创建json对象
        var postParam={
            requestData :requestData,
            encrypted : encrypted
        }
        return postParam;
    },
    /**
     * 设置键盘切换上一步
     */
    leaveStepPrevious:function(number){
        number = number?number:4;
        var buttonPrevious = $('a[href="#step-'+number+'"]').index($('.selected'));
        if(buttonPrevious == 0) {
            $('.swMain .buttonNext').css('display', 'block');
            $('.swMain .buttonFinish').css('display', 'none');
        }
    },
    /**
     * 设置键盘切换下一步
     */
    leaveStepNext:function(number){
        number = number?number:3;
        var buttonPrevious = $('a[href="#step-'+number+'"]').index($('.selected'));
        if(buttonPrevious == 0) {
            if(validateStep3() == true){
                $('.swMain .buttonNext').css('display', 'none');
                $('.swMain .buttonFinish').css('display', 'block');
            }
        }
    },
    /**
     * 移除空字符串或者非法字符串,返回""
     * 如果是合法字符串,则返回原值
     * @param obj 文本
     */
    removeNullOrUndefined :function (obj) {
        //typeof 返回的是字符串,有六种可能:"number"、"string"、"boolean"、"object"、"function"、"undefined"
        if (typeof(obj) == "undefined" || obj == "" || obj == null || obj == "null" || obj.length == 0) {
            return "无";
        } else {
            //删除全是空格的情况
            var regu = "^[ ]+$";
            var re = new RegExp(regu);
            if(re.test(obj)){
                return "";
            }else{
                return obj;
            }

        }
    },


    /**
     * 校验信息是否为空,或其他字符,统一返回空
     */
    isUndefinedReturnEmpty :function (obj) {
        //typeof 返回的是字符串,有六种可能:"number"、"string"、"boolean"、"object"、"function"、"undefined"
        if (typeof(obj) == "undefined" || obj == "" || obj == null || obj == "null" || obj.length == 0) {
            return "";
        } else {
            //删除全是空格的情况
            var regu = "^[ ]+$";
            var re = new RegExp(regu);
            if(re.test(obj)){
                return "";
            }else{
                return obj;
            }
        }
    },
    checkBusinessOpen: function (busiType, workTypeCode, provinceId,userApplyType) {
        var dateStr = '';
        $.ajax({
            type: "POST",
            url: jQuery.basePath + '/stafforder/cxkh/checkBusinessOpen',
            data: {"busiType": busiType,"provinceId": provinceId,"workTypeCode": workTypeCode,'userApplyType': userApplyType},
            dataType: "json",
            async: false,
            success: function (data) {
                if (data && data.success && data.result) {
                    dateStr = data.result
                }
            }
        });
        return dateStr;
    },
    checkSupPayment: function(busiType, cityCode) {
        var ret = '';
        $.ajax({
            type: "POST",
            url: jQuery.basePath + '/stafforder/cxkh/checkSupElectronicLicense',
            data: {"busiType": busiType,"provinceCode": cityCode},
            dataType: "json",
            async: false,
            success: function (data) {
                if (data && data.result && data.code === '0000') {
                    ret = data.result;
                }
            }
        });
        return ret;
    }


}

const res = common.postParamMake(data.field)

console.log(JSON.stringify(res));