Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
heqyoufree committed Aug 23, 2019
0 parents commit 0cb9d28
Show file tree
Hide file tree
Showing 9 changed files with 693 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ModifyBH.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Reference Include="UnityAssetBundleTool">
<HintPath>.\lib\UnityAssetBundleTool.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
487 changes: 487 additions & 0 deletions Program.cs

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ModifyBH

本文按照原生系统来编写,非原生请自行摸索
需要安装证书,Android 7或以上需要root(小米不能用自带的root)

## 大致流程
1. 设置代理
2. 安装证书
3. 进入游戏更新配置

## 代理设置
### Wi-Fi
1. 打开设置,进入Wi-Fi
2. 长按当前Wi-Fi,点击修改(Pie以上点击当前Wi-Fi,然后点右上角的小笔)
3. 代理方式选择手动,写上代理地址和端口
4. 保存退出
### 流量(不推荐)
1. 打开设置,进入移动网络
2. 展开高级菜单,进入接入点名称(APN)
3. 记住你当前的APN,然后点击右上角的加号添加APN
4. 名称随便,APN填上之前的,写上代理和端口
5. 保存退出

## 安装证书
### Android 6或以下安装方法:
1. 下载证书
原生系统只需第2步即可,国内rom跳到第3步
2. 直接点击下载的证书安装,证书名字随便输,用途默认
3. 在设置中搜索“从SD卡安装”(安全/凭据储存)
4. 选择下载的证书安装,证书名字随便输,用途默认

### Android 7或以上安装方法(小米不能用自带的root):
1. 下载证书
2. 重命名为 8208f87d.0
3. 复制到 /system/etc/security/cacerts/

如果有Xposed的话JustTrustMe应该可以不用安装证书

有终端的小伙伴可以执行下面的命令来安装证书(记得mount system)
mv /sdcard/Download/rootCA.crt /system/etc/security/cacerts/8208f87d.0
63 changes: 63 additions & 0 deletions Rsa.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Xml;

namespace bh3tool
{
public static class RsaExtention
{

public static void FromXmlStringA(this RSA rsa, string xmlString)
{
RSAParameters parameters = new RSAParameters();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlString);
if (xmlDoc.DocumentElement.Name.Equals("RSAKeyValue"))
{
foreach (XmlNode node in xmlDoc.DocumentElement.ChildNodes)
{
switch (node.Name)
{
case "Modulus": parameters.Modulus = Convert.FromBase64String(node.InnerText); break;
case "Exponent": parameters.Exponent = Convert.FromBase64String(node.InnerText); break;
case "P": parameters.P = Convert.FromBase64String(node.InnerText); break;
case "Q": parameters.Q = Convert.FromBase64String(node.InnerText); break;
case "DP": parameters.DP = Convert.FromBase64String(node.InnerText); break;
case "DQ": parameters.DQ = Convert.FromBase64String(node.InnerText); break;
case "InverseQ": parameters.InverseQ = Convert.FromBase64String(node.InnerText); break;
case "D": parameters.D = Convert.FromBase64String(node.InnerText); break;
}
}
}
else
{
throw new Exception("Invalid XML RSA key.");
}

rsa.ImportParameters(parameters);
}

public static string ToXmlString(this RSA rsa, bool includePrivateParameters)
{
RSAParameters parameters = rsa.ExportParameters(includePrivateParameters);

if (includePrivateParameters)
{
return string.Format("<RSAKeyValue><Modulus>{0}</Modulus><Exponent>{1}</Exponent><P>{2}</P><Q>{3}</Q><DP>{4}</DP><DQ>{5}</DQ><InverseQ>{6}</InverseQ><D>{7}</D></RSAKeyValue>",
Convert.ToBase64String(parameters.Modulus),
Convert.ToBase64String(parameters.Exponent),
Convert.ToBase64String(parameters.P),
Convert.ToBase64String(parameters.Q),
Convert.ToBase64String(parameters.DP),
Convert.ToBase64String(parameters.DQ),
Convert.ToBase64String(parameters.InverseQ),
Convert.ToBase64String(parameters.D));
}
return string.Format("<RSAKeyValue><Modulus>{0}</Modulus><Exponent>{1}</Exponent></RSAKeyValue>",
Convert.ToBase64String(parameters.Modulus),
Convert.ToBase64String(parameters.Exponent));
}

}
}
Binary file added lib/UnityAssetBundleTool.dll
Binary file not shown.
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "modifybh",
"version": "1.0.0",
"description": "",
"main": "anyproxy -i -r rule.js",
"directories": {
"lib": "lib"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/heqyoufree/ModifyBH.git"
},
"author": "heqyou_free",
"license": "MIT",
"bugs": {
"url": "https://github.com/heqyoufree/ModifyBH/issues"
},
"homepage": "https://github.com/heqyoufree/ModifyBH#readme"
}
60 changes: 60 additions & 0 deletions rule.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
const fs = require('fs')
// 免安装证书,需要合法ssl证书
// var sslServer = ''
module.exports = {
summary: 'ModifyBH by heqyou_free',
* beforeSendRequest (requestDetail) {
if (requestDetail.url.indexOf('_compressed/DataVersion.unity3d') > -1) {
if (requestDetail.url.indexOf('android') > -1) {
return returnFileAsResponse('a_DataVersion.unity3d')
}
if (requestDetail.url.indexOf('iphone') > -1) {
return returnFileAsResponse('i_DataVersion.unity3d')
}
}
if (requestDetail.url.indexOf('excel_output_') > -1) {
if (requestDetail.url.indexOf('android') > -1) {
return returnFileAsResponse('a_excel_output.unity3d')
}
if (requestDetail.url.indexOf('iphone') > -1) {
return returnFileAsResponse('i_excel_output.unity3d')
}
}
if (requestDetail.url.indexOf('setting_') > -1) {
if (requestDetail.url.indexOf('android') > -1) {
return returnFileAsResponse('a_setting.unity3d')
}
if (requestDetail.url.indexOf('iphone') > -1) {
return returnFileAsResponse('i_setting.unity3d')
}
}
},
* beforeSendResponse (requestDetail, responseDetail) {
// 免安装证书,要把beforeSendRequest注释掉
// if (requestDetail.url.indexOf('query_gameserver') > -1) {
// console.log('requested gameserver')
// var newResponse = Object.assign({}, responseDetail.response)
// var json = JSON.parse(newResponse.body)
// json.asset_boundle_url = json.asset_boundle_url.replace('bundle.bh3.com', sslServer)
// var str = JSON.stringify(json)
// newResponse.body = str
// return {
// response: newResponse
// }
// }
}
}
function returnFileAsResponse (name) {
console.log(`requested ${name}`)
var resp = fs.readFileSync(`${name}`)
return {
response: {
statusCode: 200,
header: {
'Accept-Ranges': 'bytes',
'Content-Type': 'application/octet-stream'
},
body: resp
}
}
}
3 changes: 3 additions & 0 deletions 初始化.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
npm install anyproxy -g
node cert.js
4 changes: 4 additions & 0 deletions 启动.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
start ModifyBH.exe
node cert.js
anyproxy -i -r rule.js

0 comments on commit 0cb9d28

Please sign in to comment.