From 9435cd30813bc4362e9ab83f05d973de49bdbba3 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Thu, 2 May 2024 20:18:24 +1000 Subject: [PATCH] =?UTF-8?q?Vendors=20update=20work=20=20#618=20=E2=8F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- Dockerfile.debian | 2 +- back/update_vendors.sh | 53 +++++++------------------- install/install_dependencies.debian.sh | 2 +- server/const.py | 2 +- 5 files changed, 18 insertions(+), 43 deletions(-) diff --git a/Dockerfile b/Dockerfile index 766ca3a9..2300d1f4 100755 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,7 @@ ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 RUN apk update --no-cache \ && apk add --no-cache bash zip lsblk gettext-envsubst sudo mtr tzdata s6-overlay \ - && apk add --no-cache curl arp-scan iproute2 iproute2-ss nmap nmap-scripts traceroute net-tools net-snmp-tools bind-tools awake ca-certificates \ + && apk add --no-cache curl arp-scan iproute2 iproute2-ss nmap nmap-scripts traceroute net-tools net-snmp-tools bind-tools awake ca-certificates \ && apk add --no-cache sqlite php82 php82-fpm php82-cgi php82-curl php82-sqlite3 php82-session \ && apk add --no-cache python3 nginx \ && ln -s /usr/bin/awake /usr/bin/wakeonlan \ diff --git a/Dockerfile.debian b/Dockerfile.debian index 0c252422..3d8a4250 100755 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -32,7 +32,7 @@ COPY --chmod=775 --chown=${USER_ID}:${USER_GID} . ${INSTALL_DIR}/ RUN apt-get install -y \ tini snmp ca-certificates curl libwww-perl arp-scan perl apt-utils cron sudo \ nginx-light php php-cgi php-fpm php-sqlite3 php-curl sqlite3 dnsutils net-tools \ - python3 iproute2 nmap python3-pip zip systemctl usbutils traceroute + python3 iproute2 nmap python3-pip zip systemctl usbutils traceroute # Alternate dependencies RUN apt-get install nginx nginx-core mtr php-fpm php8.2-fpm php-cli php8.2 php8.2-sqlite3 -y diff --git a/back/update_vendors.sh b/back/update_vendors.sh index 896c0a2b..fa03d101 100755 --- a/back/update_vendors.sh +++ b/back/update_vendors.sh @@ -12,56 +12,31 @@ # ---------------------------------------------------------------------- # Main directories to update: # /usr/share/arp-scan -# /usr/share/ieee-data -# /var/lib/ieee-data # ---------------------------------------------------------------------- + echo "---------------------------------------------------------" echo "[INSTALL] Run update_vendors.sh" echo "---------------------------------------------------------" -# ---------------------------------------------------------------------- -echo Updating... /usr/share/ieee-data/ -cd /usr/share/ieee-data/ || { echo "could not enter /usr/share/ieee-data directory"; exit 1; } - -sudo mkdir -p 2_backup -sudo cp -- *.txt 2_backup -sudo cp -- *.csv 2_backup -echo "" -echo Download Start -echo "" -sudo curl "$1" -LO https://standards-oui.ieee.org/oui28/mam.csv \ - -LO https://standards-oui.ieee.org/oui28/mam.csv \ - -LO https://standards-oui.ieee.org/oui28/mam.txt \ - -LO https://standards-oui.ieee.org/oui36/oui36.csv \ - -LO https://standards-oui.ieee.org/oui36/oui36.txt \ - -LO https://standards-oui.ieee.org/oui/oui.csv \ - -LO https://standards-oui.ieee.org/oui/oui.txt -echo "" -echo Download Finished +DL_DIR=/usr/share/arp-scan # ---------------------------------------------------------------------- -echo "" -echo Updating... /usr/share/arp-scan/ -cd /usr/share/arp-scan || { echo "could not enter /usr/share/arp-scan directory"; exit 1; } +echo Updating... $DL_DIR +cd $DL_DIR || { echo "could not enter $DL_DIR directory"; exit 1; } -sudo mkdir -p 2_backup -sudo cp -- *.txt 2_backup +# Define the URL of the IEEE OUI file +IEEE_OUI_URL="http://standards-oui.ieee.org/oui/oui.txt" -# Update from /usb/lib/ieee-data -sudo get-iab -v -sudo get-oui -v +# Download the file using wget +wget "$IEEE_OUI_URL" -O ieee-oui_dl.txt -# make files readable -sudo chmod +r /usr/share/arp-scan/ieee-oui.txt +# Filter lines containing "(base 16)" and remove the "(base 16)" string +grep "(base 16)" ieee-oui_dl.txt | sed 's/ *(base 16)//' > ieee-oui_new.txt -# Update from ieee website -# sudo get-iab -v -u http://standards-oui.ieee.org/iab/iab.txt -# sudo get-oui -v -u http://standards-oui.ieee.org/oui/oui.txt +# Combine ieee-oui_new.txt and ieee-oui.txt, and extract unique MAC start values along with vendor names -# Update from ieee website develop -# sudo get-iab -v -u http://standards.ieee.org/develop/regauth/iab/iab.txt -# sudo get-oui -v -u http://standards.ieee.org/develop/regauth/oui/oui.txt +cat ieee-oui.txt ieee-oui_new.txt >> ieee-oui_all.txt +sort ieee-oui_all.txt > ieee-oui_all_sort.txt +awk '{$1=$1; print}' ieee-oui_all_sort.txt | sort -u > ieee-oui_all_filtered.txt -# Update from Sanitized oui (linuxnet.ca) -# sudo get-oui -v -u https://linuxnet.ca/ieee/oui.txt diff --git a/install/install_dependencies.debian.sh b/install/install_dependencies.debian.sh index dfec7566..84ae5230 100755 --- a/install/install_dependencies.debian.sh +++ b/install/install_dependencies.debian.sh @@ -16,7 +16,7 @@ fi apt-get install -y \ tini snmp ca-certificates curl libwww-perl arp-scan perl apt-utils cron sudo \ nginx-light php php-cgi php-fpm php-sqlite3 php-curl sqlite3 dnsutils net-tools \ - python3 iproute2 nmap python3-pip zip systemctl usbutils traceroute + python3 iproute2 nmap python3-pip zip systemctl usbutils traceroute # alternate dependencies sudo apt-get install nginx nginx-core mtr php-fpm php8.2-fpm php-cli php8.2 php8.2-sqlite3 -y diff --git a/server/const.py b/server/const.py index 68f955ec..482aad4b 100755 --- a/server/const.py +++ b/server/const.py @@ -17,7 +17,7 @@ apiPath = applicationPath + '/front/api/' reportTemplatesPath = applicationPath + '/front/report_templates/' fullConfPath = applicationPath + confPath fullDbPath = applicationPath + dbPath -vendorsPath = '/usr/share/arp-scan/ieee-oui.txt' +vendorsPath = '/usr/share/arp-scan/ieee-oui_all_filtered.txt'