Skip to content

Commit

Permalink
update armsoft
Browse files Browse the repository at this point in the history
  • Loading branch information
sadoneli committed Jan 15, 2025
1 parent 8a7edc7 commit aeabb65
Show file tree
Hide file tree
Showing 94 changed files with 3,097 additions and 4,454 deletions.
1 change: 1 addition & 0 deletions fixit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shell
67 changes: 67 additions & 0 deletions fixit/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/sh

# build script for rogsoft project
MODULE="fixit"
VERSION="1.5"
TITLE="安全检查"
DESCRIPTION="检测软件中心重要文件是否被篡改,如果检测到恶意篡改,将其修复"
HOME_URL="Module_fixit.asp"
TAGS="系统 工具"
AUTHOR="sadog"

# Check and include base
DIR="$( cd "$( dirname "$BASH_SOURCE[0]" )" && pwd )"

do_build() {
rm -f ${MODULE}.tar.gz

echo "build fixit for arm"
rm -rf ./build
mkdir -p ./build
cp -rf ./fixit ./build/
cd ./build

echo arm386 >fixit/.valid

tar -zcf fixit.tar.gz fixit
if [ "$?" = "0" ];then
echo "build success!"
mv fixit.tar.gz ..
fi
cd ..
rm -rf ./build

# add version to the package
echo ${VERSION} >${MODULE}/version
md5value=$(md5sum ${MODULE}.tar.gz | tr " " "\n" | sed -n 1p)
cat > ./version <<-EOF
${VERSION}
${md5value}
EOF
cat version

DATE=$(date +%Y-%m-%d_%H:%M:%S)
cat > ./config.json.js <<-EOF
{
"version":"$VERSION",
"md5":"$md5value",
"home_url":"$HOME_URL",
"title":"$TITLE",
"description":"$DESCRIPTION",
"tags":"$TAGS",
"author":"$AUTHOR",
"link":"$LINK",
"changelog":"$CHANGELOG",
"build_date":"$DATE"
}
EOF

#update md5
python ../softcenter/gen_install.py stage2
}


# do build
cd $DIR
do_build

12 changes: 12 additions & 0 deletions fixit/config.json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version":"1.5",
"md5":"7227f9a9140719131a2ce93428d446c2",
"home_url":"Module_fixit.asp",
"title":"安全检查",
"description":"检测软件中心重要文件是否被篡改,如果检测到恶意篡改,将其修复",
"tags":"系统 工具",
"author":"sadog",
"link":"",
"changelog":"",
"build_date":"2025-01-15_22:44:31"
}
Binary file added fixit/fixit.tar.gz
Binary file not shown.
1 change: 1 addition & 0 deletions fixit/fixit/.valid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
arm386
Binary file added fixit/fixit/bin/fixit
Binary file not shown.
133 changes: 133 additions & 0 deletions fixit/fixit/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
#!/bin/sh
source /koolshare/scripts/base.sh
alias echo_date='echo 【$(TZ=UTC-8 date -R +%Y年%m月%d日\ %X)】:'
MODEL=
FW_TYPE_CODE=
FW_TYPE_NAME=
DIR=$(cd $(dirname $0); pwd)
module=${DIR##*/}

get_model(){
local ODMPID=$(nvram get odmpid)
local PRODUCTID=$(nvram get productid)
if [ -n "${ODMPID}" ];then
MODEL="${ODMPID}"
else
MODEL="${PRODUCTID}"
fi
}

get_fw_type() {
local KS_TAG=$(nvram get extendno|grep -Eo "kool.+")
if [ -d "/koolshare" ];then
if [ -n "${KS_TAG}" ];then
FW_TYPE_CODE="2"
FW_TYPE_NAME="${KS_TAG}官改固件"
else
FW_TYPE_CODE="4"
FW_TYPE_NAME="koolshare梅林改版固件"
fi
else
if [ "$(uname -o|grep Merlin)" ];then
FW_TYPE_CODE="3"
FW_TYPE_NAME="梅林原版固件"
else
FW_TYPE_CODE="1"
FW_TYPE_NAME="华硕官方固件"
fi
fi
}

platform_test(){
local LINUX_VER=$(uname -r|awk -F"." '{print $1$2}')
if [ -d "/koolshare" -a -f "/usr/bin/skipd" -a "${LINUX_VER}" -eq "26" ];then
echo_date 机型:"${MODEL} ${FW_TYPE_NAME} 符合安装要求,开始安装插件!"
else
exit_install 1
fi
}

set_skin(){
local UI_TYPE=ASUSWRT
local SC_SKIN=$(nvram get sc_skin)
local ROG_FLAG=$(grep -o "680516" /www/form_style.css 2>/dev/null|head -n1)
local TUF_FLAG=$(grep -o "D0982C" /www/form_style.css 2>/dev/null|head -n1)
local TS_FLAG=$(grep -o "2ED9C3" /www/css/difference.css 2>/dev/null|head -n1)
if [ -n "${TS_FLAG}" ];then
UI_TYPE="TS"
else
if [ -n "${TUF_FLAG}" ];then
UI_TYPE="TUF"
fi
if [ -n "${ROG_FLAG}" ];then
UI_TYPE="ROG"
fi
fi
if [ -z "${SC_SKIN}" -o "${SC_SKIN}" != "${UI_TYPE}" ];then
nvram set sc_skin="${UI_TYPE}"
nvram commit
fi
}

exit_install(){
local state=$1
case $state in
1)
echo_date "本插件适用于【koolshare merlin armv7l 384/386】固件平台!"
echo_date "你的固件平台不能安装!!!"
echo_date "本插件支持机型/平台:https://github.com/koolshare/armsoft#armsoft"
echo_date "退出安装!"
rm -rf /tmp/${module}* >/dev/null 2>&1
exit 1
;;
0|*)
rm -rf /tmp/${module}* >/dev/null 2>&1
exit 0
;;
esac
}

install_now(){
# default value
local TITLE="安全检查"
local DESCR="检测软件中心重要文件是否被篡改,如果检测到恶意篡改,将其修复"
local PLVER=$(cat ${DIR}/version)

# install file
echo_date "安装插件相关文件..."
cd /tmp
cp -rf /tmp/${module}/res/* /koolshare/res/
cp -rf /tmp/${module}/scripts/* /koolshare/scripts/
cp -rf /tmp/${module}/webs/* /koolshare/webs/
cp -rf /tmp/${module}/uninstall.sh /koolshare/scripts/uninstall_${module}.sh
cp -ff /tmp/${module}/bin/* /koolshare/bin/

# Permissions
chmod 755 /koolshare/bin/fixit >/dev/null 2>&1
chmod 755 /koolshare/scripts/fixit_config >/dev/null 2>&1

# intall different UI
set_skin

# dbus value
echo_date "设置插件默认参数..."
dbus set ${module}_version="${PLVER}"
dbus set softcenter_module_${module}_version="${PLVER}"
dbus set softcenter_module_${module}_install="1"
dbus set softcenter_module_${module}_name="${module}"
dbus set softcenter_module_${module}_title="${TITLE}"
dbus set softcenter_module_${module}_description="${DESCR}"

# finish
echo_date "${TITLE}插件安装完毕!"
exit_install
}

install(){
get_model
get_fw_type
platform_test
install_now
}

install
Binary file added fixit/fixit/res/icon-fixit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fixit/fixit/scripts/fixit_config
Binary file not shown.
8 changes: 8 additions & 0 deletions fixit/fixit/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

rm -rf /koolshare/res/icon-fixit.png >/dev/null 2>&1
rm -rf /koolshare/bin/fixit >/dev/null 2>&1
rm -rf /koolshare/scripts/fixit_config >/dev/null 2>&1
rm -rf /koolshare/webs/Module_fixit.asp >/dev/null 2>&1
rm -rf /koolshare/scripts/uninstall_fixit.sh >/dev/null 2>&1
rm -rf /tmp/fixit* >/dev/null 2>&1
1 change: 1 addition & 0 deletions fixit/fixit/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.5
144 changes: 144 additions & 0 deletions fixit/fixit/webs/Module_fixit.asp
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
<meta HTTP-EQUIV="Expires" CONTENT="-1"/>
<link rel="shortcut icon" href="images/favicon.png"/>
<link rel="icon" href="images/favicon.png"/>
<title>软件中心 - 漏洞修复</title>
<link rel="stylesheet" type="text/css" href="index_style.css"/>
<link rel="stylesheet" type="text/css" href="form_style.css"/>
<link rel="stylesheet" type="text/css" href="css/element.css">
<link rel="stylesheet" type="text/css" href="res/softcenter.css">
<script language="JavaScript" type="text/javascript" src="/js/jquery.js"></script>
<script language="JavaScript" type="text/javascript" src="/state.js"></script>
<script language="JavaScript" type="text/javascript" src="/help.js"></script>
<script language="JavaScript" type="text/javascript" src="/general.js"></script>
<script language="JavaScript" type="text/javascript" src="/popup.js"></script>
<script language="JavaScript" type="text/javascript" src="/validator.js"></script>
<script language="JavaScript" type="text/javascript" src="/switcherplugin/jquery.iphone-switch.js"></script>
<script language="JavaScript" type="text/javascript" src="/res/softcenter.js"></script>
<style>
input:focus {
outline: none;
}
input[type=checkbox]{
vertical-align:middle;
}
.FormTitle i {
color: #ff002f;
font-style: normal;
}
.SimpleNote { padding:5px 10px;}
</style>
<script>
var params_inp = ['fixit_key'];
var dbus;
var online_ver;
String.prototype.myReplace = function(f, e){
var reg = new RegExp(f, "g");
return this.replace(reg, e);
}
function init() {
show_menu(menu_hook);
get_log();
}
function get_log(action){
$.ajax({
url: '/_temp/fixit_log.txt',
type: 'GET',
cache:false,
dataType: 'text',
success: function(response) {
var retArea = E("log_content_text");
if (response.search("XU6J03M6") != -1) {
retArea.value = response.myReplace("XU6J03M6", " ");
return false;
}
if(action){
setTimeout("get_log(1);", 350);
}
retArea.value = response.myReplace("XU6J03M6", " ");
retArea.scrollTop = retArea.scrollHeight;
}
});
}
function menu_hook(title, tab) {
tabtitle[tabtitle.length - 1] = new Array("", "fixit");
tablink[tablink.length - 1] = new Array("", "Module_fixit.asp");
}
function fixit(action){
var dbus_new = {}
E("fixit_apply").disabled = true;
var id = parseInt(Math.random() * 100000000);
var postData = {"id": id, "method": "fixit_config", "params": [action], "fields": dbus_new};
$.ajax({
type: "POST",
url: "/_api/",
data: JSON.stringify(postData),
dataType: "json",
success: function(response) {
E("fixit_apply").disabled = false;
get_log(action);
}
});
}
</script>
</head>
<body onload="init();">
<div id="TopBanner"></div>
<div id="Loading" class="popup_bg"></div>
<iframe name="hidden_frame" id="hidden_frame" src="" width="0" height="0" frameborder="0"></iframe>
<table class="content" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="17">&nbsp;</td>
<td valign="top" width="202">
<div id="mainMenu"></div>
<div id="subMenu"></div>
</td>
<td valign="top">
<div id="tabMenu" class="submenuBlock"></div>
<table width="98%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top">
<table width="760px" border="0" cellpadding="5" cellspacing="0" bordercolor="#6b8fa3" class="FormTitle" id="FormTitle">
<tr>
<td bgcolor="#4D595D" colspan="3" valign="top">
<div>&nbsp;</div>
<div class="formfonttitle">安全检测 - fixit<lable id="fixit_version"><lable></div>
<div style="float:right; width:15px; height:25px;margin-top:-20px">
<img id="return_btn" onclick="reload_Soft_Center();" align="right" style="cursor:pointer;position:absolute;margin-left:-30px;margin-top:-25px;" title="返回软件中心" src="/images/backprev.png" onMouseOver="this.src='/images/backprevclick.png'" onMouseOut="this.src='/images/backprev.png'"></img>
</div>
<div style="margin:10px 0 10px 5px;" class="splitLine"></div>
<div id="head_note">
<span>本插件可以检测路由器软件中心是否被恶意代码篡改,并且可以尝试修复被篡改的文件。</span>
<lable id="fixit_o_version"></lable>
</div>
<div id="log_content" class="soft_setting_log">
<textarea cols="63" rows="30" wrap="on" readonly="readonly" id="log_content_text" class="soft_setting_log1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
</div>
<div class="apply_gen">
<input class="button_gen" id="fixit_apply" onClick="fixit(1)" type="button" value="开始检测" />
</div>
<div id="warn_msg_1" style="display: none;text-align:center; line-height: 4em;"><i></i></div>
<div style="margin:10px 0 10px 5px;display: none;" class="splitLine" id="spl"></div>
<div class="SimpleNote" id="message" style="display: none;">
<li id="msg1"></li>
<li id="msg2"></li>
<li id="msg3"></li>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="10" align="center" valign="top"></td>
</tr>
</table>
<div id="footer"></div>
</body>
</html>
2 changes: 2 additions & 0 deletions fixit/version
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1.5
7227f9a9140719131a2ce93428d446c2
Loading

0 comments on commit aeabb65

Please sign in to comment.