- Add patches:

* netdiscover-update-oui.patch
  * netdiscover-fix-makefile.patch
  * netdiscover-fix-spelling-binary.patch
  * netdiscover-fix-manpage.patch

OBS-URL: https://build.opensuse.org/package/show/network:utilities/netdiscover?expand=0&rev=3
This commit is contained in:
Martin Pluskal 2017-07-24 11:38:48 +00:00 committed by Git OBS Bridge
parent 33719a1b3c
commit 14010e6d97
9 changed files with 228 additions and 586 deletions

View File

@ -1,121 +0,0 @@
#!/bin/bash
# Script for generation "oui.h" file (netdiscover program at
# http://nixgeneration.com/~jaime/netdiscover/
#
# Obtain data from internet source at:
# lynx -source http://standards.ieee.org/regauth/oui/oui.txt >oui.txt
#
# Syntax: oui.txt2oui.h_netdiscover
#
# Script generate src/oui.h file.
#
# 16-May-2009 Frantisek Hanzlik <franta@hanzlici.cz> (Original author)
# 07-Jun-2001 Larry Reznick <lreznick@rezfam.com> (fixes & code clean)
#**********************************************************************
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
JA=${0##*/}
DATE=$(date +'%Y%m%d')
ORIGF=oui.txt
#DSTD=src
DSTF=oui.h
URL="http://standards.ieee.org/develop/regauth/oui/oui.txt"
TMPF=$ORIGF
AWK="gawk"
#AWK="mawk"
#AWK="awk"
#[ -d "$DSTD" ] || { echo "$JA: Destdir \"$DSTD\" not exist!"; exit 1; }
#if ! [ -f "$TMPF" -a -s "$TMPF" ]; then
# echo "Trying download \"$ORIGF\" with lynx..."
# if ! lynx -source $URL >"$TMPF"; then
# echo "Trying download \"$ORIGF\" with elinks..."
# if ! elinks -source $URL >"$TMPF"; then
# echo "Trying download \"$ORIGF\" with wget..."
# if ! wget --quiet --output-document="$TMPF" $URL; then
# echo "$JA: Cann't obtain \"$URL\"!"
# exit 1
# fi
# fi
# fi
#else
# echo "\"$TMPF\" already exist, skipping download..."
#fi
#if ! [ -f "$TMPF" -a -s "$TMPF" ]; then
# echo -n "Trying download \"$ORIGF\" with lynx..."
# if [[ -x /usr/bin/lynx ]]; then
# lynx -source $URL >"$TMPF"
# else
# echo -n " with elinks..."
# if [[ -x /usr/bin/elinks ]]; then
# elinks -source $URL >"$TMPF"
# else
# echo " with wget..."
# if [[ -x /usr/bin/wget ]]; then
# wget --quiet --output-document="$TMPF" $URL
# else
# if [[ -x /usr/bin/curl ]]; then
# curl -s $URL >"$TMPF"
# else
# echo "$JA: Can't obtain \"$URL\"!"
# exit 1
# fi
# fi
# fi
# fi
#else
# echo -n "\"$TMPF\" already exist, skipping download..."
#fi
#echo ""
echo "Process oui.txt (\"$TMPF\")..."
# if RS is null string, then records are separated by blank lines...
# but this isn't true in oui.txt
LANG=C grep "base 16" $TMPF | sed "s/\"/'/g" | $AWK --re-interval --assign URL="$URL" '
BEGIN {
NN = 0;
printf( \
"/*\n" \
" * Organizationally Unique Identifier list at date %s\n" \
" * Automatically generated from %s\n" \
" * For Netdiscover by Jaime Penalba\n" \
" *\n" \
" */\n" \
"\n" \
"struct oui {\n" \
" char *prefix; /* 24 bit global prefix */\n" \
" char *vendor; /* Vendor id string */\n" \
"};\n" \
"\n" \
"struct oui oui_table[] = {\n", strftime("%d-%b-%Y"), URL);
}
{
printf(" { \"%s\", \"", $1);
for (i=4; i<NF; i++) printf $i " ";
printf("%s\" },\n", $NF);
NN++;
}
END {
printf(" { NULL, NULL }\n};\n\n");
printf("// Total %i items.\n\n", NN);
}' >"$DSTF"
##}' >"$DSTD/$DSTF"
if [ $? -ne 0 ]; then
echo "$JA: $TMPF parsing error !"
exit 1
else
echo "All OK"
## ls -oh oui.txt-* src/oui.h
fi

View File

@ -0,0 +1,18 @@
Description: avoid to install undesirable files.
Author: Joao Eriberto Mota Filho <eriberto@debian.org>
Last-Update: 2015-04-15
Index: netdiscover-0.3-pre-beta7/Makefile.am
===================================================================
--- netdiscover-0.3-pre-beta7.orig/Makefile.am
+++ netdiscover-0.3-pre-beta7/Makefile.am
@@ -5,10 +5,7 @@ SUBDIRS = src doc
doc_DATA = \
README\
- COPYING\
AUTHORS\
- ChangeLog\
- NEWS\
TODO
EXTRA_DIST = \

View File

@ -0,0 +1,53 @@
Description: fix some spelling mistakes.
Author: William Vera <billy@billy.com.mx>
Joao Eriberto Mota Filho <eriberto@debian.org>
Last-Update: 2016-11-28
Index: netdiscover-0.3-pre-beta7/doc/netdiscover.8
===================================================================
--- netdiscover-0.3-pre-beta7.orig/doc/netdiscover.8
+++ netdiscover-0.3-pre-beta7/doc/netdiscover.8
@@ -61,7 +61,7 @@ wireless networks with low signal level.
.TP
\fB\-f\fR
Enable fast mode scan. This will only scan for .1, .100 and .254 on
-each network. This mode is usefull while searching for ranges being
+each network. This mode is useful while searching for ranges being
used. After you found such range you can make a specific range scan to
find online boxes.
@@ -83,7 +83,7 @@ When using -P, continue program executio
to capture ARP packets passively.
.SH USAGE
-If passive mode (-p), scan list (-l) or scan range (-r) options arent
+If passive mode (-p), scan list (-l) or scan range (-r) options aren't
enabled, netdiscover will scan for common lan addresses.
.PP
Screen control keys
@@ -102,7 +102,7 @@ Scroll up (or up arrow)
.TP
\fBa\fR
-Show arp replys list
+Show arp replies list
.TP
\fBr\fR
@@ -114,7 +114,7 @@ Close help screen or end application
.SH CONFIG FILES
There are 2 configuration files that netdiscover will look for, each
-time it is executed, if file doesnt exist it will use default values.
+time it is executed, if file doesn't exist it will use default values.
You can use the -d switch to disable reading and loading configuration
files.
@@ -131,7 +131,7 @@ Example:\fR
.TP
\fB~/.netdiscover/fastips\fR
-List contaning the last octect of the ips to be scanned on each
+List containing the last octect of the ips to be scanned on each
subnet, when using fast mode, by default (1,100,154).
Example:\fR

View File

@ -0,0 +1,35 @@
Description: fix spellings in final binary.
Author: Joao Eriberto Mota Filho <eriberto@debian.org>
Last-Update: 2016-04-14
Index: netdiscover-0.3-pre-beta7/src/screen.c
===================================================================
--- netdiscover-0.3-pre-beta7.orig/src/screen.c
+++ netdiscover-0.3-pre-beta7/src/screen.c
@@ -326,7 +326,7 @@ void fill_screen()
"\t | q: exit this screen or end | \n"
"\t | | \n"
"\t | \33[1mScreen views\33[0m | \n"
- "\t | a: show arp replys list | \n"
+ "\t | a: show arp replies list | \n"
"\t | r: show arp requests list | \n"
"\t | u: show unique hosts detected | \n"
"\t | | \n"
Index: netdiscover-0.3-pre-beta7/src/main.c
===================================================================
--- netdiscover-0.3-pre-beta7.orig/src/main.c
+++ netdiscover-0.3-pre-beta7/src/main.c
@@ -528,12 +528,12 @@ void usage(char *comando)
" -p passive mode: do not send anything, only sniff\n"
" -m file: scan the list of known MACs and host names\n"
" -F filter: Customize pcap filter expression (default: \"arp\")\n"
- " -s time: time to sleep between each arp request (miliseconds)\n"
+ " -s time: time to sleep between each arp request (milliseconds)\n"
" -n node: last ip octet used for scanning (from 2 to 253)\n"
" -c count: number of times to send each arp reques (for nets with packet loss)\n"
" -f enable fastmode scan, saves a lot of time, recommended for auto\n"
" -d ignore home config files for autoscan and fast mode\n"
- " -S enable sleep time supression betwen each request (hardcore mode)\n"
+ " -S enable sleep time supression between each request (hardcore mode)\n"
" -P print results in a format suitable for parsing by another program\n"
" -N Do not print header. Only valid when -P is enabled.\n"
" -L in parsable output mode (-P), continue listening after the active scan is completed\n\n"

View File

@ -0,0 +1,99 @@
Index: netdiscover-0.3-pre-beta7/update-oui-database.sh
===================================================================
--- netdiscover-0.3-pre-beta7.orig/update-oui-database.sh
+++ netdiscover-0.3-pre-beta7/update-oui-database.sh
@@ -23,15 +23,15 @@
JA=${0##*/}
DATE=$(date +'%Y%m%d')
ORIGF=oui.txt
-DSTD=src
+#DSTD=src
DSTF=oui.h
URL="http://standards.ieee.org/develop/regauth/oui/oui.txt"
-TMPF=$ORIGF-$DATE
+TMPF=$ORIGF
AWK="gawk"
#AWK="mawk"
#AWK="awk"
-[ -d "$DSTD" ] || { echo "$JA: Destdir \"$DSTD\" not exist!"; exit 1; }
+#[ -d "$DSTD" ] || { echo "$JA: Destdir \"$DSTD\" not exist!"; exit 1; }
#if ! [ -f "$TMPF" -a -s "$TMPF" ]; then
# echo "Trying download \"$ORIGF\" with lynx..."
# if ! lynx -source $URL >"$TMPF"; then
@@ -47,32 +47,32 @@ AWK="gawk"
#else
# echo "\"$TMPF\" already exist, skipping download..."
#fi
-if ! [ -f "$TMPF" -a -s "$TMPF" ]; then
- echo -n "Trying download \"$ORIGF\" with lynx..."
- if [[ -x /usr/bin/lynx ]]; then
- lynx -source $URL >"$TMPF"
- else
- echo -n " with elinks..."
- if [[ -x /usr/bin/elinks ]]; then
- elinks -source $URL >"$TMPF"
- else
- echo " with wget..."
- if [[ -x /usr/bin/wget ]]; then
- wget --quiet --output-document="$TMPF" $URL
- else
- if [[ -x /usr/bin/curl ]]; then
- curl -s $URL >"$TMPF"
- else
- echo "$JA: Can't obtain \"$URL\"!"
- exit 1
- fi
- fi
- fi
- fi
-else
- echo -n "\"$TMPF\" already exist, skipping download..."
-fi
-echo ""
+#if ! [ -f "$TMPF" -a -s "$TMPF" ]; then
+# echo -n "Trying download \"$ORIGF\" with lynx..."
+# if [[ -x /usr/bin/lynx ]]; then
+# lynx -source $URL >"$TMPF"
+# else
+# echo -n " with elinks..."
+# if [[ -x /usr/bin/elinks ]]; then
+# elinks -source $URL >"$TMPF"
+# else
+# echo " with wget..."
+# if [[ -x /usr/bin/wget ]]; then
+# wget --quiet --output-document="$TMPF" $URL
+# else
+# if [[ -x /usr/bin/curl ]]; then
+# curl -s $URL >"$TMPF"
+# else
+# echo "$JA: Can't obtain \"$URL\"!"
+# exit 1
+# fi
+# fi
+# fi
+# fi
+#else
+# echo -n "\"$TMPF\" already exist, skipping download..."
+#fi
+#echo ""
echo "Process oui.txt (\"$TMPF\")..."
@@ -108,7 +108,8 @@ BEGIN {
END {
printf(" { NULL, NULL }\n};\n\n");
printf("// Total %i items.\n\n", NN);
-}' >"$DSTD/$DSTF"
+}' >"$DSTF"
+##}' >"$DSTD/$DSTF"
if [ $? -ne 0 ]; then
@@ -116,5 +117,5 @@ if [ $? -ne 0 ]; then
exit 1
else
echo "All OK"
- ls -oh oui.txt-* src/oui.h
+## ls -oh oui.txt-* src/oui.h
fi

View File

@ -1,451 +0,0 @@
diff -uraN netdiscover-0.3-pre-beta7/src/data_reply.c netdiscover.svn/src/data_reply.c
--- netdiscover-0.3-pre-beta7/src/data_reply.c 2015-03-24 05:03:46.000000000 +0100
+++ netdiscover.svn/src/data_reply.c 2016-05-22 23:54:48.803447040 +0200
@@ -98,7 +98,7 @@
/* Fill again with spaces and cut the string to fit width */
- for (j=strlen(line); j<win_sz.ws_col - 1; j++)
+ for (j=strlen(line); (j<win_sz.ws_col - 1) && (j<sizeof(line)-1) ; j++)
strcat(line, blank);
string_cutter(line, win_sz.ws_col - 1 );
diff -uraN netdiscover-0.3-pre-beta7/src/data_request.c netdiscover.svn/src/data_request.c
--- netdiscover-0.3-pre-beta7/src/data_request.c 2015-03-24 05:03:46.000000000 +0100
+++ netdiscover.svn/src/data_request.c 2016-05-22 23:54:48.851447278 +0200
@@ -103,7 +103,7 @@
strcat(line, tline);
/* Fill again with spaces and cut the string to fit width */
- for (j=strlen(line); j<win_sz.ws_col - 1; j++)
+ for (j=strlen(line); (j<win_sz.ws_col - 1) && (j<sizeof(line)-1); j++)
strcat(line, blank);
string_cutter(line, win_sz.ws_col - 1);
diff -uraN netdiscover-0.3-pre-beta7/src/data_unique.c netdiscover.svn/src/data_unique.c
--- netdiscover-0.3-pre-beta7/src/data_unique.c 2015-03-24 05:03:46.000000000 +0100
+++ netdiscover.svn/src/data_unique.c 2016-05-22 23:54:48.799447020 +0200
@@ -97,7 +97,7 @@
strcat(line, tline);
/* Fill again with spaces and cut the string to fit width */
- for (j=strlen(line); j<win_sz.ws_col - 1; j++)
+ for (j=strlen(line); (j<win_sz.ws_col - 1) && (j<sizeof(line)-1); j++)
strcat(line, blank);
string_cutter(line, win_sz.ws_col - 1);
diff -uraN netdiscover-0.3-pre-beta7/update-oui-database-legacy.sh netdiscover.svn/update-oui-database-legacy.sh
--- netdiscover-0.3-pre-beta7/update-oui-database-legacy.sh 1970-01-01 01:00:00.000000000 +0100
+++ netdiscover.svn/update-oui-database-legacy.sh 2016-05-22 23:54:48.603446048 +0200
@@ -0,0 +1,120 @@
+#!/bin/bash
+
+# Script for generation "oui.h" file (netdiscover program at
+# http://nixgeneration.com/~jaime/netdiscover/
+#
+# Obtain data from internet source at:
+# lynx -source http://standards.ieee.org/regauth/oui/oui.txt >oui.txt
+#
+# Syntax: oui.txt2oui.h_netdiscover
+#
+# Script generate src/oui.h file.
+#
+# 16-May-2009 Frantisek Hanzlik <franta@hanzlici.cz> (Original author)
+# 07-Jun-2001 Larry Reznick <lreznick@rezfam.com> (fixes & code clean)
+#**********************************************************************
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+
+JA=${0##*/}
+DATE=$(date +'%Y%m%d')
+ORIGF=oui.txt
+DSTD=src
+DSTF=oui.h
+URL="http://standards.ieee.org/develop/regauth/oui/oui.txt"
+TMPF=$ORIGF-$DATE
+AWK="gawk"
+#AWK="mawk"
+#AWK="awk"
+
+[ -d "$DSTD" ] || { echo "$JA: Destdir \"$DSTD\" not exist!"; exit 1; }
+#if ! [ -f "$TMPF" -a -s "$TMPF" ]; then
+# echo "Trying download \"$ORIGF\" with lynx..."
+# if ! lynx -source $URL >"$TMPF"; then
+# echo "Trying download \"$ORIGF\" with elinks..."
+# if ! elinks -source $URL >"$TMPF"; then
+# echo "Trying download \"$ORIGF\" with wget..."
+# if ! wget --quiet --output-document="$TMPF" $URL; then
+# echo "$JA: Cann't obtain \"$URL\"!"
+# exit 1
+# fi
+# fi
+# fi
+#else
+# echo "\"$TMPF\" already exist, skipping download..."
+#fi
+if ! [ -f "$TMPF" -a -s "$TMPF" ]; then
+ echo -n "Trying download \"$ORIGF\" with lynx..."
+ if [[ -x /usr/bin/lynx ]]; then
+ lynx -source $URL >"$TMPF"
+ else
+ echo -n " with elinks..."
+ if [[ -x /usr/bin/elinks ]]; then
+ elinks -source $URL >"$TMPF"
+ else
+ echo " with wget..."
+ if [[ -x /usr/bin/wget ]]; then
+ wget --quiet --output-document="$TMPF" $URL
+ else
+ if [[ -x /usr/bin/curl ]]; then
+ curl -s $URL >"$TMPF"
+ else
+ echo "$JA: Can't obtain \"$URL\"!"
+ exit 1
+ fi
+ fi
+ fi
+ fi
+else
+ echo -n "\"$TMPF\" already exist, skipping download..."
+fi
+echo ""
+
+echo "Process oui.txt (\"$TMPF\")..."
+
+# if RS is null string, then records are separated by blank lines...
+# but this isn't true in oui.txt
+
+LANG=C grep "base 16" $TMPF | sed "s/\"/'/g" | $AWK --re-interval --assign URL="$URL" '
+BEGIN {
+ NN = 0;
+ printf( \
+ "/*\n" \
+ " * Organizationally Unique Identifier list at date %s\n" \
+ " * Automatically generated from %s\n" \
+ " * For Netdiscover by Jaime Penalba\n" \
+ " *\n" \
+ " */\n" \
+ "\n" \
+ "struct oui {\n" \
+ " char *prefix; /* 24 bit global prefix */\n" \
+ " char *vendor; /* Vendor id string */\n" \
+ "};\n" \
+ "\n" \
+ "struct oui oui_table[] = {\n", strftime("%d-%b-%Y"), URL);
+}
+
+{
+ printf(" { \"%s\", \"", $1);
+ for (i=4; i<NF; i++) printf $i " ";
+ printf("%s\" },\n", $NF);
+ NN++;
+}
+
+END {
+ printf(" { NULL, NULL }\n};\n\n");
+ printf("// Total %i items.\n\n", NN);
+}' >"$DSTD/$DSTF"
+
+
+if [ $? -ne 0 ]; then
+ echo "$JA: $TMPF parsing error !"
+ exit 1
+else
+ echo "All OK"
+ ls -oh oui.txt-* src/oui.h
+fi
diff -uraN netdiscover-0.3-pre-beta7/update-oui-database.sh netdiscover.svn/update-oui-database.sh
--- netdiscover-0.3-pre-beta7/update-oui-database.sh 2015-03-24 05:03:46.000000000 +0100
+++ netdiscover.svn/update-oui-database.sh 2016-05-22 23:54:48.603446048 +0200
@@ -1,120 +1,177 @@
#!/bin/bash
-# Script for generation "oui.h" file (netdiscover program at
-# http://nixgeneration.com/~jaime/netdiscover/
+# update-oui-database-ng.sh
+# This script creates the src/oui.h file needed by netdiscover.
#
-# Obtain data from internet source at:
-# lynx -source http://standards.ieee.org/regauth/oui/oui.txt >oui.txt
+# Copyright 2016 Joao Eriberto Mota Filho <eriberto@debian.org>
+# This file is under GPL-2+ license.
#
-# Syntax: oui.txt2oui.h_netdiscover
+# netdiscover was written by Jaime Penalba Estebanez <jpenalbae@gmail.com>
+# and is available at http://nixgeneration.com/~jaime/netdiscover/
#
-# Script generate src/oui.h file.
-#
-# 16-May-2009 Frantisek Hanzlik <franta@hanzlici.cz> (Original author)
-# 07-Jun-2001 Larry Reznick <lreznick@rezfam.com> (fixes & code clean)
-#**********************************************************************
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-
-JA=${0##*/}
-DATE=$(date +'%Y%m%d')
-ORIGF=oui.txt
-DSTD=src
-DSTF=oui.h
-URL="http://standards.ieee.org/develop/regauth/oui/oui.txt"
-TMPF=$ORIGF-$DATE
-AWK="gawk"
-#AWK="mawk"
-#AWK="awk"
-
-[ -d "$DSTD" ] || { echo "$JA: Destdir \"$DSTD\" not exist!"; exit 1; }
-#if ! [ -f "$TMPF" -a -s "$TMPF" ]; then
-# echo "Trying download \"$ORIGF\" with lynx..."
-# if ! lynx -source $URL >"$TMPF"; then
-# echo "Trying download \"$ORIGF\" with elinks..."
-# if ! elinks -source $URL >"$TMPF"; then
-# echo "Trying download \"$ORIGF\" with wget..."
-# if ! wget --quiet --output-document="$TMPF" $URL; then
-# echo "$JA: Cann't obtain \"$URL\"!"
-# exit 1
-# fi
-# fi
-# fi
-#else
-# echo "\"$TMPF\" already exist, skipping download..."
-#fi
-if ! [ -f "$TMPF" -a -s "$TMPF" ]; then
- echo -n "Trying download \"$ORIGF\" with lynx..."
- if [[ -x /usr/bin/lynx ]]; then
- lynx -source $URL >"$TMPF"
- else
- echo -n " with elinks..."
- if [[ -x /usr/bin/elinks ]]; then
- elinks -source $URL >"$TMPF"
- else
- echo " with wget..."
- if [[ -x /usr/bin/wget ]]; then
- wget --quiet --output-document="$TMPF" $URL
- else
- if [[ -x /usr/bin/curl ]]; then
- curl -s $URL >"$TMPF"
- else
- echo "$JA: Can't obtain \"$URL\"!"
- exit 1
- fi
- fi
- fi
- fi
-else
- echo -n "\"$TMPF\" already exist, skipping download..."
+# License for this script:
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+VERSION=0.1
+
+# CHANGELOG
+#
+# v0.1, 2016-04-13, Eriberto
+#
+# * Initial release.
+
+
+#####################
+# Initial variables #
+#####################
+
+PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+
+DATE=$(date +%F | tr -d "-")
+DATE2=$(date +%F)
+NAME=oui.txt-$DATE
+OUIFILE=src/oui.h
+
+# Minimum amount of MAC addresses for check.
+# To calculate, use "cat `oui_file` | grep "base 16" | wc -l"
+# Last definition on 2016-04-13.
+MINIMUM_MAC=21900
+
+# The original URL[1] redirects to this URL[2].
+# [1] http://standards.ieee.org/develop/regauth/oui/oui.txt
+# [2] http://standards-oui.ieee.org/oui/oui.txt
+URL=http://standards-oui.ieee.org/oui/oui.txt
+
+
+####################
+# Help and version #
+####################
+
+if [ "$1" = "--help" ]
+then
+ printf "\nupdate-oui-database-ng.sh\n\n"
+ printf "Usage: ./update-oui-database-ng.sh [OPTIONS]\n\n"
+ printf " --help Show this help.\n"
+ printf " --no-download Do not download the oui.txt to use an existent version.\n"
+ printf " --version Show version.\n"
+ exit 0
fi
-echo ""
-echo "Process oui.txt (\"$TMPF\")..."
+if [ "$1" = "--version" ]
+then
+ printf "\nupdate-oui-database-ng.sh\n\n"
+ printf "Version $VERSION\n\n"
+ exit 0
+fi
-# if RS is null string, then records are separated by blank lines...
-# but this isn't true in oui.txt
-LANG=C grep "base 16" $TMPF | sed "s/\"/'/g" | $AWK --re-interval --assign URL="$URL" '
-BEGIN {
- NN = 0;
- printf( \
- "/*\n" \
- " * Organizationally Unique Identifier list at date %s\n" \
- " * Automatically generated from %s\n" \
- " * For Netdiscover by Jaime Penalba\n" \
- " *\n" \
- " */\n" \
- "\n" \
- "struct oui {\n" \
- " char *prefix; /* 24 bit global prefix */\n" \
- " char *vendor; /* Vendor id string */\n" \
- "};\n" \
- "\n" \
- "struct oui oui_table[] = {\n", strftime("%d-%b-%Y"), URL);
-}
-
-{
- printf(" { \"%s\", \"", $1);
- for (i=4; i<NF; i++) printf $i " ";
- printf("%s\" },\n", $NF);
- NN++;
-}
-
-END {
- printf(" { NULL, NULL }\n};\n\n");
- printf("// Total %i items.\n\n", NN);
-}' >"$DSTD/$DSTF"
-
-
-if [ $? -ne 0 ]; then
- echo "$JA: $TMPF parsing error !"
- exit 1
-else
- echo "All OK"
- ls -oh oui.txt-* src/oui.h
+######################
+# Check for dos2unix #
+######################
+
+dos2unix -V > /dev/null 2> /dev/null || { printf "\nYou need dos2unix command to use this script.\n\n"; exit 1; }
+
+
+####################
+# OUI.txt download #
+####################
+
+# Search for downloaders
+
+DOWN=0
+
+if [ "$1" = "--no-download" ]; then DOWN=no; fi
+
+if [ "$DOWN" = "0" ]; then axel -V > /dev/null 2> /dev/null && DOWN="axel -ao $NAME"; fi
+if [ "$DOWN" = "0" ]; then curl -V > /dev/null 2> /dev/null && DOWN="curl -Lo $NAME"; fi
+if [ "$DOWN" = "0" ]; then wget -V > /dev/null 2> /dev/null && DOWN="wget -O $NAME"; fi
+if [ "$DOWN" = "0" ]; then printf "\nYou need axel (faster!), wget or curl to use this script.\n\n" && exit 1; fi
+
+# Download the oui.txt
+
+if [ -f "$NAME" ] && [ "$DOWN" != "no" ]
+then
+ printf "\nThe file $NAME already exists. To run this script, remove $NAME or use --no-download option.\n\n"
+ exit 0
+elif [ ! -f "$NAME" ] && [ "$DOWN" = "no" ]
+then
+ printf "\nThe file $NAME is missing. To download it, does not use --no-download option.\n\n"
+ exit 0
+elif [ "$DOWN" != "no" ]
+then
+ printf "\n\nDownloading oui.txt from $URL\n"
+ printf "Downloader to be used: $(echo $DOWN | cut -d" " -f1)\n\n"
+ $DOWN $URL
fi
+
+# Final check and conversion to Unix
+
+TOTAL_MAC=$(cat $NAME | grep "base 16" | wc -l)
+
+if [ "$TOTAL_MAC" -lt "$MINIMUM_MAC" ]
+then
+ printf "\nThe file $NAME seems to be corrupted. There are $TOTAL_MAC MAC addresses. However, over the $MINIMUM_MAC were expected.\n\n"
+ exit 0
+fi
+
+dos2unix -q $NAME
+
+
+######################
+# Building src/oui.h #
+######################
+
+printf "\n\nBuilding the $OUIFILE.\n"
+
+# The header
+
+cat << EOT > $OUIFILE
+/*
+ * Organizationally Unique Identifier list downloaded on $DATE2
+ * Automatically generated from http://standards.ieee.org/develop/regauth/oui/oui.txt
+ * For Netdiscover by Jaime Penalba
+ *
+ */
+
+struct oui {
+ char *prefix; /* 24 bit global prefix */
+ char *vendor; /* Vendor id string */
+};
+
+struct oui oui_table[] = {
+EOT
+
+# The MACs
+
+cat $NAME | grep "base 16" | tr '\t' ' ' | tr -s " " | sed 's/(base 16) //' | \
+ grep '[0-9A-F]' | sort | sed 's/ /", "/' | sed 's/^/ { "/' | \
+ sed -z 's/\n/" },#/g' | tr '#' '\n' >> $OUIFILE
+
+# Total of MACs
+
+TOTALMAC=$(cat $OUIFILE | egrep "{ .[0-9A-F]" | wc -l)
+
+# The tail
+
+cat << EOT >> $OUIFILE
+ { NULL, NULL }
+};
+
+// Total $TOTALMAC items.
+EOT
+
+printf "Done. $OUIFILE has $TOTALMAC MAC addresses.\n"
+# END

View File

@ -1,7 +1,12 @@
-------------------------------------------------------------------
Thu Jun 29 08:17:32 UTC 2017 - mpluskal@suse.com
Mon Jul 24 11:25:06 UTC 2017 - mpluskal@suse.com
- Cleaned up spec file with spec-cleaner
- Add patches:
* netdiscover-update-oui.patch
* netdiscover-fix-makefile.patch
* netdiscover-fix-spelling-binary.patch
* netdiscover-fix-manpage.patch
-------------------------------------------------------------------
Sun May 22 22:09:18 UTC 2016 - AxelKoellhofer@web.de - 0.3_beta7

View File

@ -16,20 +16,25 @@
#
%define oui_date 20160522
%define pkgver 0.3-pre-beta7
Name: netdiscover
Version: 0.3_beta7
Release: 0
Summary: A network address discovering/monitoring tool
License: GPL-3.0+
Group: Productivity/Networking/Other
Url: http://nixgeneration.com/~jaime/netdiscover/
Source0: http://nixgeneration.com/~jaime/netdiscover/releases/%{name}-0.3-pre-beta7-LINUXONLY.tar.gz
Source1: oui.h-%{oui_date}.bz2
Source100: %{name}.changes
Patch0: %{name}-upstream-20160415.patch
Url: https://sourceforge.net/projects/netdiscover/?source=directory
Source0: https://sourceforge.net/projects/netdiscover/files/netdiscover/%{pkgver}-LINUXONLY/netdiscover-%{pkgver}-LINUXONLY.tar.gz
# PATCH-FIX-OPENSUSE netdiscover-update-oui.patch -- alows us updating oui
# database from hwdata
Patch0: netdiscover-update-oui.patch
# Patches from debian
Patch1: netdiscover-fix-makefile.patch
Patch2: netdiscover-fix-spelling-binary.patch
Patch3: netdiscover-fix-manpage.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: hwdata
BuildRequires: libnet-devel
BuildRequires: libpcap-devel
@ -44,14 +49,17 @@ inspect your network arp traffic, and find network addresses using auto scan
mode, which will scan for common local networks.
%prep
%setup -q -n netdiscover-0.3-pre-beta7
%setup -q -n netdiscover-%{pkgver}
%patch0 -p1
# update oui database
bzcat %{SOURCE1} > src/oui.h
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
autoreconf -fiv
%configure
cp %{_datadir}/hwdata/oui.txt ./
sh update-oui-database.sh
make %{?_smp_mflags}
%install
@ -59,7 +67,6 @@ make %{?_smp_mflags}
rm -rf %{buildroot}%{_datadir}/doc
%files
%defattr(-,root,root)
%doc ChangeLog COPYING README AUTHORS NEWS TODO
%{_sbindir}/netdiscover
%{_mandir}/man8/*.8*

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:99a8e03f932aca03c27c1df03c05b554d090b3523d6c4fca62f6214ee5ca51bd
size 190497