mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2025-05-02 06:26:20 -04:00
Further improve malware scanner
This commit is contained in:
parent
82758a5303
commit
82896187de
6 changed files with 38 additions and 27 deletions
|
@ -48,25 +48,20 @@ gitReset() {
|
|||
export -f gitReset;
|
||||
|
||||
scanForMalware() {
|
||||
#This isn't perfect, but if it ever catches something be happy that it exists
|
||||
#Speed Goals (on a standard 7200 RPM drive):
|
||||
# - quick: < 10 mins
|
||||
# - extra: < 30 mins
|
||||
# - slow: < 1 hour
|
||||
#TODO: Scan more of /frameworks and /packages
|
||||
if [ -x /usr/bin/clamscan ] && [ -f /var/lib/clamav/main.cvd ]; then
|
||||
echo -e "\e[0;32mStarting a malware scan, this might take a while...\e[0m";
|
||||
$excludes="--exclude-dir=\".git\" --exclude-dir=\".repo\"";
|
||||
scanQueue="$base/android $base/art $base/bionic $base/bootable $base/build $base/compatibility $base/dalvik $base/device $base/hardware $base/libcore $base/libnativehelper $base/lineage-sdk $base/pdk $base/platform_testing $base/sdk"; #top-level directories
|
||||
scanQueue=$scanQueue" $base/frameworks/av $base/frameworks/native $base/packages/inputmethods $base/vendor/lineage";
|
||||
if [ "$MALWARE_SCAN_SETTING" != "quick" ] || [ "$MALWARE_SCAN_SETTING" = "extra" ]; then
|
||||
scanQueue=$scanQueue" $base/packages $base/vendor";
|
||||
fi;
|
||||
if [ "$MALWARE_SCAN_SETTING" = "slow" ]; then
|
||||
scanQueue=$scanQueue"$base/external $base/frameworks $base/prebuilts $base/system $base/toolchain $base/tools";
|
||||
fi;
|
||||
if [ "$MALWARE_SCAN_SETTING" = "full" ]; then
|
||||
scanQueue="$base";
|
||||
if [ -x /usr/bin/clamscan ] && [ -r /var/lib/clamav/main.cvd ]; then
|
||||
echo -e "\e[0;32mStarting a malware scan...\e[0m";
|
||||
excludes="--exclude-dir=\".git\" --exclude-dir=\".repo\"";
|
||||
scanQueue=$2;
|
||||
if [ "$1" = true ]; then
|
||||
if [ "$MALWARE_SCAN_SETTING" != "quick" ] || [ "$MALWARE_SCAN_SETTING" = "extra" ]; then
|
||||
scanQueue=$scanQueue" $base/frameworks $base/vendor";
|
||||
fi;
|
||||
if [ "$MALWARE_SCAN_SETTING" = "slow" ]; then
|
||||
scanQueue=$scanQueue"$base/external $base/prebuilts $base/toolchain $base/tools";
|
||||
fi;
|
||||
if [ "$MALWARE_SCAN_SETTING" = "full" ]; then
|
||||
scanQueue="$base";
|
||||
fi;
|
||||
fi;
|
||||
du -hsc $scanQueue;
|
||||
/usr/bin/clamscan --recursive --detect-pua --infected $excludes $scanQueue;
|
||||
|
@ -79,7 +74,6 @@ scanForMalware() {
|
|||
fi;
|
||||
if [ "$clamscanExit" -eq "0" ]; then
|
||||
echo -e "\e[0;32mNo malware found\e[0m";
|
||||
sleep 15;
|
||||
fi;
|
||||
if [ "$clamscanExit" -eq "2" ]; then
|
||||
echo -e "\e[0;33m----------------------------------------------------------------\e[0m";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue