File tree Expand file tree Collapse file tree 1 file changed +22
-6
lines changed
Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -384,19 +384,35 @@ something is wrong here. Please report this to $ISSUES"
384384 fi
385385}
386386
387+ metadefender-scan () {
388+ # Usage:
389+ # metadefender-scan.sh $PATH $APIKEY, for example:
390+ hash=" $( sha256sum " $1 " ) "
391+ hash=" ${hash%% * } "
392+ apikey=7283aa9bbcee83132506659a4e5675bb
393+ curl " https://api.metadefender.com/v4/hash/$hash " -H " apikey: $apikey "
394+ }
395+
387396# Used in geoblock.sh
388397download_geoip_dat () {
389398# 1 = IP version 4 or 6
390399# 2 = v4 or v6
391400if site_200 https://dl.miyuru.lk/geoip/maxmind/country/maxmind" $1 " .dat.gz
392401then
393402 curl_to_dir https://dl.miyuru.lk/geoip/maxmind/country maxmind" $1 " .dat.gz /tmp
394- install_if_not gzip
395- gzip -d /tmp/maxmind" $1 " .dat.gz
396- mv /tmp/maxmind" $1 " .dat /usr/share/GeoIP/GeoIP" $2 " .dat
397- chown root:root /usr/share/GeoIP/GeoIP" $2 " .dat
398- chmod 644 /usr/share/GeoIP/GeoIP" $2 " .dat
399- find " $SCRIPTS " -type f -regex " $SCRIPTS /202[0-9]-[01][0-9]-Maxmind-Country-IP$2 \.dat" -delete
403+ # Scan file for virus
404+ if ! metadefender-scan /tmp/maxmind" $1 " .dat.gz | grep ' "scan_all_result_i":0,"current_av_result_i":0,"'
405+ then
406+ msg_box " Potential threat found in .dat file! Please report this to $ISSUES . We will now delete the file!"
407+ rm -f /tmp/maxmind" $1 " .dat.gz
408+ else
409+ install_if_not gzip
410+ gzip -d /tmp/maxmind" $1 " .dat.gz
411+ mv /tmp/maxmind" $1 " .dat /usr/share/GeoIP/GeoIP" $2 " .dat
412+ chown root:root /usr/share/GeoIP/GeoIP" $2 " .dat
413+ chmod 644 /usr/share/GeoIP/GeoIP" $2 " .dat
414+ find " $SCRIPTS " -type f -regex " $SCRIPTS /202[0-9]-[01][0-9]-Maxmind-Country-IP$2 \.dat" -delete
415+ fi
400416fi
401417}
402418
You can’t perform that action at this time.
0 commit comments