From 0dbfb86a2d3b3ecacbf32d91a764eaccd869154f Mon Sep 17 00:00:00 2001
From: Alexandr Savca <alexandr.savca89@gmail.com>
Date: Tue, 17 Nov 2020 17:13:51 +0200
Subject: [PATCH] arp-scan: initial commit, v1.9.7

---
 arp-scan/.footprint   | 19 +++++++++++++++++++
 arp-scan/.signature   |  5 +++++
 arp-scan/Pkgfile      | 21 +++++++++++++++++++++
 arp-scan/README       |  9 +++++++++
 arp-scan/post-install | 24 ++++++++++++++++++++++++
 5 files changed, 78 insertions(+)
 create mode 100644 arp-scan/.footprint
 create mode 100644 arp-scan/.signature
 create mode 100644 arp-scan/Pkgfile
 create mode 100644 arp-scan/README
 create mode 100755 arp-scan/post-install

diff --git a/arp-scan/.footprint b/arp-scan/.footprint
new file mode 100644
index 000000000..a58f0dae9
--- /dev/null
+++ b/arp-scan/.footprint
@@ -0,0 +1,19 @@
+drwxr-xr-x	root/root	usr/
+drwxr-xr-x	root/root	usr/bin/
+-rwxr-xr-x	root/root	usr/bin/arp-fingerprint
+-rwxr-xr-x	root/root	usr/bin/arp-scan
+-rwxr-xr-x	root/root	usr/bin/get-iab
+-rwxr-xr-x	root/root	usr/bin/get-oui
+drwxr-xr-x	root/root	usr/share/
+drwxr-xr-x	root/root	usr/share/arp-scan/
+-rw-r--r--	root/root	usr/share/arp-scan/ieee-iab.txt
+-rw-r--r--	root/root	usr/share/arp-scan/ieee-oui.txt
+-rw-r--r--	root/root	usr/share/arp-scan/mac-vendor.txt
+drwxr-xr-x	root/root	usr/share/man/
+drwxr-xr-x	root/root	usr/share/man/man1/
+-rw-r--r--	root/root	usr/share/man/man1/arp-fingerprint.1.gz
+-rw-r--r--	root/root	usr/share/man/man1/arp-scan.1.gz
+-rw-r--r--	root/root	usr/share/man/man1/get-iab.1.gz
+-rw-r--r--	root/root	usr/share/man/man1/get-oui.1.gz
+drwxr-xr-x	root/root	usr/share/man/man5/
+-rw-r--r--	root/root	usr/share/man/man5/mac-vendor.5.gz
diff --git a/arp-scan/.signature b/arp-scan/.signature
new file mode 100644
index 000000000..a4bc9e212
--- /dev/null
+++ b/arp-scan/.signature
@@ -0,0 +1,5 @@
+untrusted comment: verify with /etc/ports/contrib.pub
+RWSagIOpLGJF31DaLHo8vA8n3567VERL7tzFctodVUMITkaa/Je+PfgayK3lQuUrX64xEwh5l2keMqWfiOaYO3Go64NV4XTesAE=
+SHA256 (Pkgfile) = 6046481881de6b8203af49600ce75e943796b196d080fc48b3b0ea4cef29e8e3
+SHA256 (.footprint) = 8b38f85077ee49a19f91c3df59b39a1917fce0b2ead1ca0800b8f8fd90680198
+SHA256 (arp-scan-1.9.7.tar.gz) = e03c36e4933c655bd0e4a841272554a347cd0136faf42c4a6564059e0761c039
diff --git a/arp-scan/Pkgfile b/arp-scan/Pkgfile
new file mode 100644
index 000000000..c4ef07663
--- /dev/null
+++ b/arp-scan/Pkgfile
@@ -0,0 +1,21 @@
+# Description: Tool that uses ARP to discover IP hosts on the local network
+# URL:         https://github.com/royhills/arp-scan
+# Maintainer:  Alexandr Savca, alexandrsavca89 at gmail dot com
+# Depends on:  libpcap p5-lwp-protocol-https p5-http-message
+
+name=arp-scan
+version=1.9.7
+release=1
+source=(https://github.com/royhills/arp-scan/archive/$version/$name-$version.tar.gz)
+
+build() {
+	cd $name-$version
+
+	autoreconf -i
+	./configure --prefix=/usr
+
+	make
+	make DESTDIR=${PKG} install
+
+	#chmod 4755 ${PKG}/usr/bin/arp-scan
+}
diff --git a/arp-scan/README b/arp-scan/README
new file mode 100644
index 000000000..3811dc15d
--- /dev/null
+++ b/arp-scan/README
@@ -0,0 +1,9 @@
+README for arp-scan
+
+POST-INSTALL
+
+    The post-install script requires the partition of /usr to allow
+    setting extended attributes.
+
+    This enables running arp-scan without root privileges, provided
+    the executing user is in the arp-scan group.
diff --git a/arp-scan/post-install b/arp-scan/post-install
new file mode 100755
index 000000000..6fa570d36
--- /dev/null
+++ b/arp-scan/post-install
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# Add your users to the arp-scan group and allow them to capture network data
+# as non-root users.
+#
+
+# ugly hack to test for support for capabilities
+if ! setfattr -n user.xattr_test /usr/bin/arp-scan 2> /dev/null; then
+  echo capabilities not supported on this system
+  echo capturing with arp-scan will require root privileges
+  exit 0
+fi
+
+setfattr -x user.xattr_test /usr/bin/arp-scan
+
+getent group arp-scan >/dev/null || groupadd -r arp-scan
+
+chgrp arp-scan /usr/bin/arp-scan
+
+chmod 754 /usr/bin/arp-scan
+
+/sbin/setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/arp-scan
+
+# End of file