Fiddler抓包自动解密aes

 

 修改该文件,找到 OnBeforeResponse 方法并修改

import System;
import System.Windows.Forms;
import Fiddler;
import System.Security.Cryptography;
	

static function OnBeforeResponse(oSession: Session) {
		if (m_Hide304s && oSession.responseCode == 304) {
			oSession["ui-hide"] = "true";
		}

        if(oSession.host == "xxx.cn"){
            var responseStringOriginal = oSession.GetResponseBodyAsString();
            var responseJSON = Fiddler.WebFormats.JSON.JsonDecode(responseStringOriginal);
			if (responseJSON.JSONObject['data'] != "") {
				var data = AesDecrypt(responseJSON.JSONObject['data'], "key", "iv");
				responseJSON.JSONObject['ecrypt_data'] = Fiddler.WebFormats.JSON.JsonDecode(data).JSONObject;
				var result = Fiddler.WebFormats.JSON.JsonEncode(responseJSON.JSONObject)
				oSession.utilSetResponseBody(result)
			}
        }
        
		if(oSession.host == "xxx.cn"){
			var responseStringOriginal = oSession.GetResponseBodyAsString();
			var res = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(responseStringOriginal));
			oSession.utilSetResponseBody(res);
		}
	}
	
	static function AesDecrypt(decryptStr, aesKey, aesIV) {
		var byteKEY = System.Text.Encoding.UTF8.GetBytes(aesKey);
		var byteIV = System.Text.Encoding.UTF8.GetBytes(aesIV);
	
		var byteDecrypt = System.Convert.FromBase64String(decryptStr);
	
		var _aes = new RijndaelManaged();
		_aes.Padding = PaddingMode.PKCS7;
		_aes.Mode = CipherMode.CBC;
	             
		_aes.Key = byteKEY;
		_aes.IV = byteIV;
	
		var _crypto = _aes.CreateDecryptor(byteKEY, byteIV);
		var decrypted = _crypto.TransformFinalBlock(
		byteDecrypt, 0, byteDecrypt.Length);
	
		_crypto.Dispose();
	
		return System.Text.Encoding.UTF8.GetString(decrypted);
	}

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值