今天遇到了一个点击事件的js加密。
全局搜索AddTab,
找到之后,惊奇的发现,这个js函数仅仅只需要两个参数即可。
将参数传递过来,然后使用execjs模拟执行js,成功拿回加密后的数据。
废话不多说,直接上代码:
js部分的代码:
function AddTab(url,title){ if(url.indexOf('/GDS_GNJZ_NAVIGATE')>-1){ window.open(""+url); return; } if(url.indexOf('/nsrsb')!=-1){ _app.alert("关联企业报表请到20号以后查询!"); return; } var ssqqqz=url.substring(url.length-8,url.length); if(title=="(新)运输发票"){ newstr="/ListYsInvoiceAction_CX.do"; }else if(url.indexOf('Ndsds2019Action')>0 && ssqqqz<=20180101){ newstr=url.replace("Ndsds2019Action","Ndsds2018Action"); }else if(url.indexOf('Ndsds2018Action')>0 && ssqqqz<=20161231){ newstr=url.replace("Ndsds2018Action","Ndsds2014Action"); }else if(url.indexOf('ReportJdAction_2015')>0 && ssqqqz<=20150531){ newstr=url.replace("ReportJdAction_2015","ReportJdAction_2014"); newstr=url.replace("SB_JD_A_2015","SB_JD_A"); }else if(url.indexOf('ReportJdAction_2019')>0 && ssqqqz<20180630){ newstr=url.replace("ReportJdAction_2019","ReportJdAction_2015"); }else if(url.indexOf('ReportYdAction_2019')>0 && ssqqqz<20180630){ newstr=url.replace("ReportYdAction_2019","ReportYdAction_201506"); }else if(url.indexOf('ReportJdAction_2019')>0 && ssqqqz<20190131){ newstr=url.replace("ReportJdAction_2019","ReportJdAction_2018"); }else if(url.indexOf('ReportYdAction_2019')>0 && ssqqqz<20190131){ newstr=url.replace("ReportYdAction_2019","ReportYdAction_2018"); }else if(url.indexOf('ReportYdAction_201506')>0 && ssqqqz<=20150531){ newstr=url.replace("ReportYdAction_201506","ReportYdAction_2014"); newstr=url.replace("SB_YD_A_2015","SB_YD_A"); }else if(url.indexOf('ReportYdGdjszjAction_2015')>0 && ssqqqz<=20150531){ newstr=url.replace("ReportYdGdjszjAction_2015","ReportYdGdjszjAction"); }else if(url.indexOf('ReportYdGdjszjAction_2018')>0 && ssqqqz<20180630){ newstr=url.replace("ReportYdGdjszjAction_2018","ReportYdGdjszjAction_2015"); }else if(url.indexOf('ReportGdjszjAction_2015')>0 && ssqqqz<=20150531){ newstr=url.replace("ReportGdjszjAction_2015","ReportYdAction_2014"); }else if(url.indexOf('ReportGdjszjAction_2018')>0 && ssqqqz<20180630){ newstr=url.replace("ReportGdjszjAction_2018","ReportGdjszjAction_2015"); }else if(url.indexOf('ReportYdGdjszjAction_2016')>0 && ssqqqz<20151231){ newstr=url.replace("ReportYdGdjszjAction_2016","ReportYdGdjszjAction_2015"); }else if(url.indexOf('ReportYdGdjszjAction_2018')>0 && ssqqqz<20180630){ newstr=url.replace("ReportYdGdjszjAction_2018","ReportYdGdjszjAction_2016"); }else if(url.indexOf('JmsdsmxAction_2018')>0 && ssqqqz<20180630){ newstr=url.replace("JmsdsmxAction_2018","JmsdsmxAction_2015"); }else if(url.indexOf('ReportFB1Action_2018')>0 && ssqqqz<20180630){ newstr=url.replace("ReportFB1Action_2018","ReportFB1Action_2015"); }else if(url.indexOf('ReportJdGdjszjAction_2016')>0 && ssqqqz<20151231){ newstr=url.replace("ReportJdGdjszjAction_2016","ReportGdjszjAction_2015"); }else if(url.indexOf('ReportJdGdjszjAction_2018')>0 && ssqqqz<20180630){ newstr=url.replace("ReportJdGdjszjAction_2018","ReportJdGdjszjAction_2016"); }else if(url.indexOf('ReportJdAction_B_2015')>0 && ssqqqz<=20150531){ newstr=url.replace("ReportJdAction_B_2015","ReportJdAction_2014"); newstr=url.replace("SB_JD_2015_B","SB_JD_B"); }else if(url.indexOf('ReportJdAction_B_2018')>0 && ssqqqz<20180630){ newstr=url.replace("ReportJdAction_B_2018","ReportJdAction_B_2015"); }else if(url.indexOf('ReportJdAction_B_2019')>0 && ssqqqz<20190131){ newstr=url.replace("ReportJdAction_B_2019","ReportJdAction_B_2018"); }else if(url.indexOf('ReportYdAction_B_2015')>0 && ssqqqz<=20150531){ newstr=url.replace("ReportYdAction_B_2015","ReportYdAction_2014"); newstr=url.replace("SB_YD_2015_B","SB_YD_B"); }else if(url.indexOf('ReportYdAction_B_2018')>0 && ssqqqz<20180630){ newstr=url.replace("ReportYdAction_B_2018","ReportYdAction_B_2015"); }else if(url.indexOf('ReportYdAction_B_2019')>0 && ssqqqz<20190131){ newstr=url.replace("ReportYdAction_B_2019","ReportYdAction_B_2018"); }else if(url.indexOf('ReportYdFpAction_2014')>0 && ssqqqz<=20140531){ newstr=url.replace("ReportYdFpAction_2014","ReportYdFpAction"); }else if(url.indexOf('ReportYdFpAction_2018')>0 && ssqqqz<20180630){ newstr=url.replace("ReportYdFpAction_2018","ReportYdFpAction_2014"); }else if(url.indexOf('ReportJdFpAction_2014')>0 && ssqqqz<=20140531){ newstr=url.replace("ReportJdFpAction_2014","ReportJdFpAction"); }else if(url.indexOf('ReportJdFpAction_2018')>0 && ssqqqz<20180630){ newstr=url.replace("ReportJdFpAction_2018","ReportJdFpAction_2014"); }else if(url.indexOf('ReportYGZ_Zzs_2016_Action')>0 && ssqqqz<=20160430){//测试为20160331 正常环境应为20160431 newstr=url.replace("ReportYGZ_Zzs_2016_Action","ReportYGZ_ZzsAction"); }else if(url.indexOf('ReportYGZ_ZzsXGM_2016_Action')>0 && ssqqqz<=20160430){//测试为20160331 正常环境应为20160431 newstr=url.replace("ReportYGZ_ZzsXGM_2016_Action","ReportYGZ_ZzsXGMAction"); }else if(url.indexOf('ReportYGZ_Zzs_2018_Action')>0 && ssqqqz<20180531){//测试为20160331 正常环境应为20160431 if(url.indexOf("YGZ_SB_ZZS_2012_FB1")>0 ){ if(ssqqqz<20180131){ newstr=url.replace("ReportYGZ_Zzs_2018_Action","ReportYGZ_Zzs_2016_Action"); }else{ newstr=url.replace("ReportYGZ_Zzs_2018_Action","ReportYGZ_Zzs_2017_Action"); } }else if(url.indexOf("YGZ_SB_ZZS_2012_FB3")>0){ newstr=url.replace("ReportYGZ_Zzs_2018_Action","ReportYGZ_Zzs_2016_Action"); } }else if(url.indexOf('ReportYGZ_Zzs_2017_Action')>0 && ssqqqz<20170731){//测试为20160331 正常环境应为20160431 newstr=url.replace("ReportYGZ_Zzs_2017_Action","ReportYGZ_Zzs_2016_Action"); }else if(url.indexOf('ReportYGZ_Zzs_2016_Action')>0 && ssqqqz<=20160430){//测试为20160331 正常环境应为20160431 newstr=url.replace("ReportYGZ_Zzs_2016_Action","ReportYGZ_ZzsAction"); }else if(url.indexOf('ReportNdAction_B_2015')>0 && ssqqqz<=20150101){ newstr=url.replace("ReportNdAction_B_2015","ReportNdAction_2014"); }else if(url.indexOf('ReportZzs_JmsSbMxbAction_2016')>0 && ssqqqz<=20160430){//测试为20160331 正常环境应为20160431 newstr=url.replace("ReportZzs_JmsSbMxbAction_2016","ReportZzs_JmsSbMxbAction"); //2016版财务报表一般企业 }else if(url.indexOf('Sb_Cwbb_2016_Action')>0 && ssqqqz<20160930){ newstr=url.replace("Sb_Cwbb_2016_Action","Sb_Cwbb_2013_Action"); //2016版财务报表银行业 }else if(url.indexOf('Sb_Cwbb_Jrqy_Yh_Action_2016')>0 && ssqqqz<20160930){ newstr=url.replace("Sb_Cwbb_Jrqy_Yh_Action_2016","Sb_Cwbb_Jrqy_Yh_Action"); //2016版财务报表保险业 }else if(url.indexOf('Sb_Cwbb_Jrqy_Bx_Action_2018')>0 && ssqqqz<20180731){ newstr=url.replace("Sb_Cwbb_Jrqy_Bx_Action_2018","Sb_Cwbb_Jrqy_Bx_Action_2016"); //2016版财务报表证券业 }else if(url.indexOf('Sb_Cwbb_Jrqy_Zq_Action_2016')>0 && ssqqqz<20160930){ newstr=url.replace("Sb_Cwbb_Jrqy_Zq_Action_2016","Sb_Cwbb_Jrqy_Zq_Action"); //2016版财务报表小企业 }else if(url.indexOf('Sb_Cwbb_Xqy_Action_2016')>0 && ssqqqz<20160930){ newstr=url.replace("Sb_Cwbb_Xqy_Action_2016","Sb_Cwbb_Xqy_Action"); }else if(url.indexOf('consumptionTaxAction2018')>0 && ssqqqz<20180331){ newstr=url.replace("consumptionTaxAction2018","consumptionTaxAction"); }else{ newstr=url; } var URL = ""+newstr; return URL } 模拟执行部分的代码:
import execjs url = '/Cjjjy_Action.do?activity=getData&reportDm=SB_CJJYFJSSB&ssq=YD&fzlx=2&sssq_q=20190201&sssq_z=20190228' title = '城建税、教育费附加、地方教育附加税(费)申报' _JS = execjs.compile(open("./sd_sb.js", "r", encoding='utf-8').read()) # 初始化JS token = _JS.call("AddTab", url, title) print(token)