banIP: update 1.5.5-2
authorDirk Brenken <[email protected]>
Sat, 29 Mar 2025 16:06:49 +0000 (17:06 +0100)
committerDirk Brenken <[email protected]>
Sat, 29 Mar 2025 16:07:09 +0000 (17:07 +0100)
* fixed a JSON reporting issue (when the map and NFT counters are disabled)
* optimized the getfetch function call within the reporting function
* removed the stale IPv6 links in the becyber feed
* cosmetics

Signed-off-by: Dirk Brenken <[email protected]>
net/banip/Makefile
net/banip/files/banip-functions.sh
net/banip/files/banip.feeds
net/banip/files/banip.tpl

index 76110a3913f9aa287588ddf2f28b254ffbc1233a..db132ac6666f4ce607980c8a26b2a384fdc54bfe 100644 (file)
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=banip
 PKG_VERSION:=1.5.5
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_LICENSE:=GPL-3.0-or-later
 PKG_MAINTAINER:=Dirk Brenken <[email protected]>
 
index 6694e60a78b3439da36b7a61cb549d36aac0757d..e9d16d1d11f5b6efc0b5011845510cb1441a08bb 100644 (file)
@@ -324,7 +324,7 @@ f_actual() {
 # get fetch utility
 #
 f_getfetch() {
-       local util utils insecure
+       local util utils insecure update="0"
 
        ban_fetchcmd="$(command -v "${ban_fetchcmd}")"
        if { [ "${ban_autodetect}" = "1" ] && [ -z "${ban_fetchcmd}" ]; } || [ ! -x "${ban_fetchcmd}" ]; then
@@ -340,6 +340,7 @@ f_getfetch() {
                                                ;;
                                esac
                                if [ -x "$(command -v "${util}")" ]; then
+                                       update="1"
                                        ban_fetchcmd="$(command -v "${util}")"
                                        uci_set banip global ban_fetchcmd "${util}"
                                        uci_commit "banip"
@@ -373,7 +374,7 @@ f_getfetch() {
                        ;;
        esac
 
-       f_log "debug" "f_getfetch  ::: auto: ${ban_autodetect}, cmd: ${ban_fetchcmd:-"-"}, fetch_parm: ${ban_fetchparm:-"-"}, rdap_parm: ${ban_rdapparm:-"-"}, etag_parm: ${ban_etagparm:-"-"}, , geo_parm: ${ban_geoparm:-"-"}"
+       f_log "debug" "f_getfetch  ::: auto/update: ${ban_autodetect}/${update}, cmd: ${ban_fetchcmd:-"-"}"
 }
 
 # get wan interfaces
@@ -1277,7 +1278,7 @@ f_genstatus() {
                        end_time="$(date "+%s")"
                        duration="$(((end_time - ban_starttime) / 60))m $(((end_time - ban_starttime) % 60))s"
                fi
-               runtime="$(date "+%Y-%m-%d %H:%M:%S"), mode: ${ban_action:-"-"}, duration: ${duration:-"-"}, memory: ${mem_free} MB available, ${mem_max} MB max. used"
+               runtime="$(date "+%Y-%m-%d %H:%M:%S"), duration: ${duration:-"-"}, mode: ${ban_action:-"-"}, memory: ${mem_free} MB available, ${mem_max} MB max. used"
        fi
        [ -s "${ban_customfeedfile}" ] && custom_feed="1"
        [ "${ban_splitsize:-"0"}" -gt "0" ] && split="1"
@@ -1417,7 +1418,6 @@ f_report() {
        local quantity chunk map_jsn chain set_elements set_json sum_setelements sum_synflood sum_udpflood sum_icmpflood sum_ctinvalid sum_tcpinvalid output="${1}"
 
        f_conf
-       f_getfetch
        f_mkdir "${ban_reportdir}"
        report_jsn="${ban_reportdir}/ban_report.jsn"
        report_txt="${ban_reportdir}/ban_report.txt"
@@ -1577,6 +1577,7 @@ f_report() {
        #
        if [ "${ban_nftcount}" = "1" ] && [ "${ban_map}" = "1" ] && [ "${output}" = "json" ] && [ -s "${report_jsn}" ]; then
                cnt="1"
+               f_getfetch
                json_init
                if json_load_file "${ban_rtfile}" >/dev/null 2>&1; then
                        json_get_values jsnval "active_uplink" >/dev/null 2>&1
@@ -1729,7 +1730,7 @@ f_report() {
                                printf "[%s]]\n" "${jsn}"
                        else
                                jsn="$("${ban_catcmd}" ${report_jsn})"
-                               printf "%s\n" "${jsn}"
+                               printf "[%s]\n" "${jsn}"
                        fi
                        ;;
                "mail")
index 203ebd903e4cd91d61261630a83c9114821278d5..406a364bda5bfa1b7f6977d65cc24f8a618f2a0a 100644 (file)
@@ -16,9 +16,7 @@
        },
        "becyber":{
                "url_4": "https://raw.githubusercontent.com/duggytuxy/malicious_ip_addresses/main/botnets_zombies_scanner_spam_ips.txt",
-               "url_6": "https://raw.githubusercontent.com/duggytuxy/malicious_ip_addresses/main/botnets_zombies_scanner_spam_ips_ipv6.txt",
                "rule_4": "/^127\\./{next}/^(([1-9][0-9]{0,2}\\.){1}([0-9]{1,3}\\.){2}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])(\\/(1?[0-9]|2?[0-9]|3?[0-2]))?)$/{printf \"%s,\\n\",$1}",
-               "rule_6": "/^(([0-9A-f]{0,4}:){1,7}[0-9A-f]{0,4}:?(\\/(1?[0-2][0-8]|[0-9][0-9]))?)$/{printf \"%s,\\n\",$1}",
                "chain": "in",
                "descr": "malicious attacker IPs"
        },
index 284901538e72705e68e2dbd2253f60c03d5c9d5d..7f58cc8f2521be9fb243b087b935009a01dcc467 100644 (file)
@@ -15,10 +15,9 @@ fi
 banip_info="$(/etc/init.d/banip status 2>/dev/null)"
 report_info="$("${ban_catcmd}" "${ban_reportdir}/ban_report.txt" 2>/dev/null)"
 log_info="$(${logread_cmd})"
-system_info="$(
-       strings /etc/banner 2>/dev/null
-       "${ban_ubuscmd}" call system board | "${ban_awkcmd}" 'BEGIN{FS="[{}\"]"}{if($2=="kernel"||$2=="hostname"||$2=="system"||$2=="model"||$2=="description")printf "  + %-12s: %s\n",$2,$4}'
-)"
+system_info="$(strings /etc/banner 2>/dev/null
+       "${ban_ubuscmd}" call system board |
+       "${ban_awkcmd}" 'BEGIN{FS="[{}\"]"}{if($2=="kernel"||$2=="hostname"||$2=="system"||$2=="model"||$2=="description")printf "  + %-12s: %s\n",$2,$4}')"
 
 # content header
 #