Skip to content

Commit

Permalink
update: v1.1.3.542
Browse files Browse the repository at this point in the history
  • Loading branch information
msojocs committed Jun 6, 2022
1 parent cc70430 commit 241fe6a
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 39 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# v1.1.3-3 / 2022-06-03
# v1.1.3-4 / 2022-06-

- feat: 弹幕支持添加港澳台
- update: 子版本更新 494 -> 542

# v1.1.3-3 / 2022-06-03

Expand Down
2 changes: 1 addition & 1 deletion conf/bilibili_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.3
1.1.3.542
104 changes: 104 additions & 0 deletions test/js-decode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/usr/bin/env node

const fs = require('fs')
const path = require('path')

const args = process.argv.slice(2)
let src = args[0] || path.resolve(__dirname, '../app/app/main/index.js')
let dist = args[1] || path.resolve(__dirname, '../app/app/main/index.dex.js')

function parseSubFunc (str) {
return str.replace(
/(\w+|\S)\['([a-zA-Z_]*?)'\]/g,
function ($0, $1, $2) {
if($2.length===0)return $0
let result = $0
switch ($1) {
case '{':
result = `{${$2}`
break
case '}':
result = `}${$2}`
break
case ']':
result = `].${$2}`
break
case '.':
case ':':
result = `${$1}${$2}`
break
case 'async':
case 'get':
result = `${$1} ${$2}`
break
default:
// console.log("---", $0, $1, $2)
result = `${$1}.${$2}`
break
}
// if($2 === "toString"){
// console.log("---", $0, $1, $2 , " result:", result)
// }
return result
}
)
}

function encodeUnicode (s) {
return s.replace(
/'(\\u([\da-f]{4})){1,}'/g,
function ($0, $1, $2) {
const result = eval('"' + $0 + '"')
// console.log('---', $0, $1, $2)
return result
}
)
}

const sourceCode = fs.readFileSync(src)

let resultCode = sourceCode.toString()
let i = 0;
resultCode = resultCode.replace(
/'(([\\xa-z0-9]{2,2})+)'/g,
function ($0, $1, $2) {
i++;
// 二分法查找异常点
// 763 ok
// 764 error
// if(i >= 10830){
// if(i === 763){
// console.log("---", $0, $1, $2)
// let result = eval('"' + $1 + '"')
// console.log("---", result)
// }
// return $0
// }

let result = eval('"' + $1 + '"')
if (result.includes('*')) {
// 不做处理
return $0
}
if (result.includes("\\")) {
result = result.replace(/\\/g, "\\\\")
}
if (result.includes("'")) {
result = result.replace(/'/g, "\\'")
}
if (result.includes("\n")) {
result = result.replace(/\n/g, "\\n")
}
if (result.includes("\r")) {
result = result.replace(/\r/g, "\\r")
}
return `'${result}'`
}
)
resultCode = encodeUnicode(resultCode)
// fs.writeFileSync(path.resolve(__dirname, '../app/app/main/index1.js'), resultCode)
resultCode = parseSubFunc(resultCode)
resultCode = parseSubFunc(resultCode)
resultCode = resultCode.replace(/'\+'/g, '')
fs.writeFileSync(dist, resultCode)
// fs.writeFileSync(path.resolve(__dirname, '../'), resultCode)
6 changes: 4 additions & 2 deletions tools/app-decrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ const crypto = require('crypto')

const biliKey = "7b305469a2c01ef020b0a624ffcd9f19"
const biliIv = "64853c1f595ca897db82273d40a73c31"
const authTagHex = "a51de0b99340166df727511c0fb87331"
const args = process.argv.slice(2)

const src = args[0]
const dist = args[1]

const sourceCode = fs.readFileSync(src).toString()

// get AuthTag
const appkey = fs.readFileSync(path.resolve(path.dirname(src), '../.appkey')).toString();
const authTagHex = appkey.split('.')[1];
const authTagBuf = Buffer.from(authTagHex, 'hex');
const sourceBuf = Buffer.from(sourceCode,'hex');
const decipher = crypto.createDecipheriv('aes-256-gcm', biliKey, biliIv)
// console.log(decipher)

decipher.setAuthTag(authTagBuf);
const dotBiliappContentDecrypted=Buffer.concat([decipher.update(sourceBuf),decipher.final()]);

Expand Down
17 changes: 15 additions & 2 deletions tools/area-unlimit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,21 @@
root_dir=$(cd `dirname $0`/.. && pwd -P)

set -e
trap 'catchError $LINENO "$BASH_COMMAND"' ERR # 捕获错误情况
catchError() {
exit_code=$?
if [ $exit_code -ne 0 ]; then
fail "\033[31mcommand: $2\n at $0:$1\n at $STEP\033[0m"
fi
exit $exit_code
}

notice() {
echo -e "\033[36m $1 \033[0m "
}
fail() {
echo -e "\033[41;37m 失败 \033[0m $1"
}

res_dir="$root_dir/tmp/bili/resources"
mkdir -p "$root_dir/app"
Expand All @@ -26,9 +37,11 @@ rm -f "app/main/app.js"
mv "app/main/temp.js" "app/main/app.js"

notice "添加PAC设置channel"
sed -i "s#'window/isFocused',a2#'window/isFocused','config/roamingPAC',a2#" "app/main/assets/bili-bridge.js"
grep -lr "'window/isFullScreen',W" --exclude="app.asar" .
sed -i "s#'window/isFullScreen',W#'window/isFullScreen','config/roamingPAC',W#" "app/main/assets/bili-bridge.js"

# 暴露弹幕管理接口
notice "暴露弹幕管理接口"
grep -lr "this.initDanmaku(),this" --exclude="app.asar" .
sed -i 's#this.initDanmaku(),this#this.initDanmaku(),window.danmakuManage = this,this#' "app/render/assets/lib/core.js"

asar p app app.asar
Expand Down
28 changes: 14 additions & 14 deletions tools/fix-other.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,28 @@ notice "====index.js===="
# 修复新版不能启动的问题
notice "修复新版不能启动的问题 index.js"
# 从app.js加载 ok
grep -lr 'if(!_0x4bb4b2)' --exclude="app.asar" .
sed -i 's#if(!_0x4bb4b2)#if(_0x4bb4b2)#' app/main/index.js
grep -lr 'if(!_0x3ca18c)' --exclude="app.asar" .
sed -i 's#if(!_0x3ca18c)#if(_0x3ca18c)#' app/main/index.js

notice "====app.js===="

notice "屏蔽检测"
grep -lr 'if(!z2){' --exclude="app.asar" .
sed -i 's#if(!z2){#if(false\&\&!z2){#' app/main/app.js
grep -lr 'if(!ls){' --exclude="app.asar" .
sed -i 's#if(!ls){#if(false\&\&!ls){#' app/main/app.js
grep -lr 'if(!d2){' --exclude="app.asar" .
sed -i 's#if(!d2){#if(false\&\&!d2){#' app/main/app.js
grep -lr 'if(!tp){' --exclude="app.asar" .
sed -i 's#if(!tp){#if(false\&\&!tp){#' app/main/app.js

# package检测
grep -lr "}ll\\[lA(')\$6Z'" --exclude="app.asar" .
sed -i "s#}ll\\[lA(')\$6Z'#}false\&\&ll[lA(')\$6Z'#" app/main/app.js
grep -lr "}tw\\[tO('3HJ@'" --exclude="app.asar" .
sed -i "s#}tw\\[tO('3HJ@'#}false\&\&tw\\[tO('3HJ@'#" app/main/app.js

notice "路由"
grep -lr 'case"SettingsPage":return r.push({name:"Settings"})}}' --exclude="app.asar" .
sed -i 's#case"SettingsPage":return r.push({name:"Settings"})}}#case"SettingsPage":return r.push({name:"Settings"});default:if(a)return r.push({name:a.page})}}#' app/render/assets/index.*.js

notice "添加主页菜单" # ok
grep -lr "'emplate'](\[{'label':'设置" --exclude="app.asar" .
sed -i "s#'emplate'](\[{'label':'设置#'emplate'](\[{'label':'首页','click':()=>this.openMainWindowPage$.next({'page':'Root'})},{'label':'设置#" app/main/app.js
grep -lr "'FromTemplate'](\[{'label':'设置" --exclude="app.asar" .
sed -i "s#'FromTemplate'](\[{'label':'设置#'FromTemplate'](\[{'label':'首页','click':()=>this.openMainWindowPage$.next({'page':'Root'})},{'label':'设置#" app/main/app.js

# 任务栏菜单
# sed -i 's#\\x77\\x69\\x6e\\x33\\x32#linux#' app/main/index.js
Expand All @@ -70,11 +70,11 @@ sed -i 's#process.resourcesPath#path.dirname(this.app.getAppPath())#' app/node_m

notice "====Bili Bridge===="
notice "hack debugger"
grep -lr "(ab(0x246,']nU]')+ab(0x24f,'tN&\!'))" --exclude="app.asar" .
sed -i "s#(ab(0x246,']nU]')+ab(0x24f,'tN&\!'))#(ab(0x246,']nU]')+ab(0x24f,'tN\&\!')+'123')#" "app/main/assets/bili-bridge.js"
# grep -lr "(ab(0x246,']nU]')+ab(0x24f,'tN&\!'))" --exclude="app.asar" .
# sed -i "s#(ab(0x246,']nU]')+ab(0x24f,'tN&\!'))#(ab(0x246,']nU]')+ab(0x24f,'tN\&\!')+'123')#" "app/main/assets/bili-bridge.js"

grep -lr "('debu'+ab" --exclude="app.asar" .
sed -i "s#('debu'+ab#('123debu'+ab#" "app/main/assets/bili-bridge.js"
grep -lr "('debu'+a6" --exclude="app.asar" .
sed -i "s#('debu'+a6#('123debu'+a6#" "app/main/assets/bili-bridge.js"

notice "直播间:isWin强制true"
grep -lr "G=(g,...h)=>{var" --exclude="app.asar" .
Expand Down
37 changes: 18 additions & 19 deletions tools/update-bilibili
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,30 @@ tmp_dir="$root_dir/tmp"
mkdir -p "$tmp_dir/bili"

# notice "一次版本校验"
# BILIBILI_VERSION=$(exiftool -S -ProductVersion "$root_dir/cache/bili_win-install.exe")
# BILIBILI_VERSION=(${BILIBILI_VERSION//: / })
# BILIBILI_VERSION=${BILIBILI_VERSION[1]}
# # BILIBILI_VERSION=$(grep -Pa 'version": "\d+\.\d+\.\d' -o app/package.json | sed 's/version": "//')
# CONF_VERSION=$(cat "$root_dir/conf/bilibili_version")
# if [[ "$BILIBILI_VERSION" != "$CONF_VERSION" ]];then
# fail "下载的版本与配置的版本不匹配!!!$BILIBILI_VERSION != $CONF_VERSION"
# exit 1
# fi
BILIBILI_VERSION=$(exiftool -S -ProductVersionNumber "$root_dir/cache/bili_win-install.exe")
BILIBILI_VERSION=(${BILIBILI_VERSION//: / })
BILIBILI_VERSION=${BILIBILI_VERSION[1]}
CONF_VERSION=$(cat "$root_dir/conf/bilibili_version")
if [[ "$BILIBILI_VERSION" != "$CONF_VERSION" ]];then
fail "下载的版本与配置的版本不匹配!!!$BILIBILI_VERSION != $CONF_VERSION"
exit 1
fi

7z x "$root_dir/cache/bili_win-install.exe" -o"$tmp_dir/bili" "\$PLUGINSDIR/app-64.7z"
7z x "$tmp_dir/bili/\$PLUGINSDIR/app-64.7z" -o"$tmp_dir/bili" "resources"
rm -rf "$tmp_dir/bili/\$PLUGINSDIR/app-64.7z" "$tmp_dir/bili/resources/elevate.exe"

cd "$tmp_dir/bili/resources"
asar e app.asar app
# cd "$tmp_dir/bili/resources"
# asar e app.asar app

notice "二次版本校验"
BILIBILI_VERSION=$(grep -Pa 'version": "\d+\.\d+\.\d' -o app/package.json | sed 's/version": "//')
CONF_VERSION=$(cat "$root_dir/conf/bilibili_version")
if [[ "$BILIBILI_VERSION" != "$CONF_VERSION" ]];then
fail "下载的版本与配置的版本不匹配!!!"
exit 1
fi
rm -rf app
# notice "二次版本校验"
# BILIBILI_VERSION=$(grep -Pa 'version": "\d+\.\d+\.\d' -o app/package.json | sed 's/version": "//')
# CONF_VERSION=$(cat "$root_dir/conf/bilibili_version")
# if [[ "$BILIBILI_VERSION" != "$CONF_VERSION" ]];then
# fail "下载的版本与配置的版本不匹配!!!"
# exit 1
# fi
# rm -rf app

rm -rf "$root_dir/app"
mkdir -p "$root_dir/app"
Expand Down

0 comments on commit 241fe6a

Please sign in to comment.