LinuxMCE Forums

General => Developers => Topic started by: tschak909 on March 24, 2013, 07:50:18 am

Title: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: tschak909 on March 24, 2013, 07:50:18 am
Hello everybody,

I'm progressing on the new AirPlay/AirTunes implementation, and AirTunes is working well. AirPlay is coming next.

But I need some help in parallel. I need a simple radar that can consistently scan the network, and return if any Apple Mac/iPhones/iPads are present. This will be used to trigger a Device Detected event on each media director to install the AirPlay Streamer device.

This can be accomplished as a two step process:

* for each IP address in the network:
* match its MAC address against the known Apple Computer MAC address ranges: http://standards.ieee.org/develop/regauth/oui/oui.txt

there are a LOT of MAC address ranges, and they all need to be matched against, but this way, we can effectively match. Don't worry about sending the Device Detected event, I just need something that can give me a 0 or a 1 if an apple device of any kind is on the network.

-Thom
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: Marie.O on March 24, 2013, 06:03:16 pm
It seems Avahi shows _apple-mobdev._tcp for mobile Apple devices, and _atc._tcp for computers. At least I see that from running avahi-browse -art on the hotel network...
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: tschak909 on March 24, 2013, 06:06:00 pm
mine however, do not show that.

-Thom
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: hari on March 24, 2013, 06:36:10 pm
as possy said you should be able to detect apple devices via bonjour. That is saner than matching mac ranges..
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: tschak909 on March 24, 2013, 06:39:41 pm
In the end, it does not matter, so long as it works most of the time. The plan here is to have the radars running on the md's, and if they detect anything, apple like, to fire a Device Detected event, which will cause the AirPlay Streamer to be installed on the target MD.

-Thom
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: Marie.O on March 24, 2013, 08:04:23 pm
Why would you run it on the MDs? It should run on the core, and the core should take care of installing necessary packages.
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: tschak909 on March 24, 2013, 08:11:38 pm
Because the player is on each MD.

-Thom
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: Armor Gnome on March 26, 2013, 02:10:56 am
Autodetection is smart.
Having a device picked up and configured automatically is a great experience.

It seems though after having watched syslog the last few days that there are quite a few jobs/radars/polls going on all the time to stay on-top of these new additions.

Does running something like this impact total network throughput?  I am at principle level understanding of network transmission and socket communications so perhaps I am only talking about a few bits through a 1000byte capable structure but with several HD movies traveling around etc... would this not slow things down?

The media update daemon has a user defined "on/off" via web-admin and a well documented console command.  Much like bluetooth pairing or z-wave inclusions, could radars such as this be built with search modes?  To make it easily accessible I could put down a list of radars/detection scripts and build a few pk_screens with checkboxes for on/off.  Standard 3:4. ui2 in 16x9, and whatever is needed for qt screens...

Would this be worthwhile?


Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: Marie.O on March 26, 2013, 12:31:28 pm
Because the player is on each MD.

Can't the core take care of setting up the necessary packages on each of the MDs?
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: tschak909 on March 26, 2013, 03:22:19 pm
There is already infrastructure to detect devices on each computer. I am leveraging that.

It would be this:

1. mdns device loads.
2. mdns device scans, finds an apple via mdns...
3. mdns device sends a device detected on this computer of say, CAT:zeroconf_apple_device
4. plug and play plugin catches, matches to Airplay player template.
5. Airplay player installs. since there is a sister router plugin device in the related plugin section, the plugin is installed if needed.

This would take care of devices as media directors are installed, and would not need to have logic to crawl the database looking for new media directors, and keeping track of which ones have been installed, which ones haven't.

-Thom
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: Marie.O on March 26, 2013, 04:17:13 pm
I was just thinking about some of the other radars. And iirc, they used to run on the MDs, but nowadays run on the core only.
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: tschak909 on March 26, 2013, 04:26:49 pm
*nod* It's an odd spot to be in, it's either:

(1) run on the media directors, and follow the usual flow of device detection, or
(2) have the core do all the mdns device handling itself, and write logic specific for it.

-Thom
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: uplink on April 02, 2013, 05:53:55 pm
So what you want is to create your device template, fill in the MAC address and let DHCP Plugin do its thing when the fruity gadgets request their IPs? Is that it?
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: tschak909 on April 02, 2013, 06:08:16 pm
if we can avoid having to keep mac address ranges, that would be great. The thought has crossed my mind to scan for Bonjour (Zeroconf) services, but I am having difficulty finding a consistent service I can BROWSE for, to find a mac.

-Thom
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: Marie.O on April 02, 2013, 07:03:06 pm
The two hits I highlighted in the first post should work as a start. And if that needs to be extended, so be it...
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: WhateverFits on April 02, 2013, 11:49:16 pm
Looks like 183 MAC ranges. Wow! I just yanked everything out of that list. It should be easy to write a script to compare.
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: WhateverFits on April 04, 2013, 07:13:34 am
Not very efficient, but it works.

Code: [Select]
#!/bin/bash

# This script looks for Apple devices on the network and does something
# for every device that it finds.

if [[ $1 != "background" ]] ;then
        echo "Backgrounding ..."
        screen -d -m -S "AppleRadar" "$0" "background"
        exit 0
fi

## Loging function
function Log() {
        #echo "$(date) $*" >> /var/log/pluto/AppleScanner.log
        echo "$(date) $*"
}

apple_macs=( 00:03:93 00:0a:27 00:0a:95 00:0d:93 00:11:24 00:14:51 00:16:cb 00:17:f2 00:19:e3 00:1b:63 00:1d:4f 00:1e:52 00:10:fa 00:1e:c2 00:1f:5b 00:1f:f3 00:21:e9 00:22:41 00:23:12 00:23:32 00:23:6c 00:23:df 00:24:36 00:25:00 00:25:4b 00:25:bc 00:26:08 00:26:4a 00:26:b0 00:26:bb 00:3e:e1 00:c6:10 00:f4:b9 04:0c:ce 04:1e:64 04:54:53 0c:74:c2 0c:77:1a 10:40:f3 10:93:e9 10:9a:dd 14:5a:05 14:8f:c6 18:20:32 18:34:51 18:e7:f4 1c:ab:a7 24:ab:81 28:37:37 28:6a:b8 28:6a:ba 28:cf:da 28:e0:2c 28:e7:cf 34:15:9e 34:51:c9 3c:07:54 3c:d0:f8 40:30:04 40:3c:fc 40:6c:8f 40:a6:d9 40:d3:2d 44:2a:60 44:d8:84 48:60:bc 4c:b1:99 50:ea:d6 58:1f:aa 58:55:ca 58:b0:35 5c:59:48 60:33:4b 60:c5:47 60:fa:cd 60:fb:42 64:20:0c 64:b9:e8 64:e6:82 68:09:27 68:a8:6d 6c:c2:6b 70:73:cb 70:cd:60 70:de:e2 74:e1:b6 78:a3:e4 78:ca:39 7c:11:be 7c:6d:62 7c:c3:a1 7c:c5:37 7c:f0:5f 88:c6:63 8c:58:77 8c:7b:9d 90:27:e4 90:84:0d 98:03:d8 98:d6:bb a4:67:06 a4:b1:97 a4:d1:d2 b8:17:c2 b8:8d:12 b8:c7:5d b8:f6:b1 b8:ff:61 c0:84:7a c4:2c:03 c8:2a:14 c8:33:4b c8:bc:c8 cc:08:e0 d0:23:db d4:9a:20 d8:30:62 d8:9e:3f d8:a2:5e dc:2b:61 e0:b9:ba e0:f8:47 e4:ce:8f e8:04:0b e8:06:88 ec:85:2f f0:b4:79 f0:cb:a1 f8:1e:df fc:25:3f 00:88:65 04:15:52 04:26:65 04:f7:e4 10:1c:0c 10:dd:b1 1c:e6:2b 20:7d:74 28:cf:e9 2c:b4:3a 30:90:ab 30:f7:c5 34:c0:59 38:0f:4a 38:48:4c 3c:e0:72 40:b3:95 44:fb:42 4c:8d:79 54:26:96 5c:96:9d 60:fe:c5 64:a3:cb 68:9c:70 70:11:24 78:6c:1c 7c:fa:df 80:92:9f 84:fc:fe 88:1f:a1 88:53:95 88:cb:87 94:94:26 98:b8:e3 9c:04:eb a0:ed:cd a8:96:8a a8:fa:d8 ac:3c:0b b4:f0:ab b8:78:2e bc:3b:af bc:92:6b c8:6f:1d cc:78:5f d8:00:4d d8:d1:cb e4:25:e7 e4:8b:7f e8:8d:28 f0:d1:a9 f4:1b:a1 f4:f1:5a )

while : ;do


        arp_output=$( arp -n |fgrep -v incomplete |fgrep ether |tail -n +2|tr ' \t' '#')
        if [[ $? != "0" ]]; then
                arp_output=""
        fi


        for outputLine in $arp_output
        do
                #sleep 10
                ## Get the important info
                serverIP=$(echo $outputLine | tr '#' ' ' | awk '{print $1}')
                serverMAC=$(echo $outputLine | tr '#' ' ' | awk '{print $3}')

                Log "Processing $serverIP (mac: $serverMAC )"

                for mac in ${apple_macs[@]}
                do
                        mac_match="$mac.*"
                        count=`expr match "$serverMAC" "$mac_match"`
                        #echo expr match "$serverMAC" "$mac_match"
                        if [ "$count" -eq "17" ]
                        then
                                Log Found an apple product here: $serverIP
                                break;
                        fi
                done

        done

        ## Wait 60 seconds before doing another scan
        sleep 60
done
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: tschak909 on April 04, 2013, 07:22:11 am
Wow man, I will test this. Thanks :)

-Thom
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: uplink on April 04, 2013, 07:43:43 am
Not very efficient, but it works.

Suggested efficient version of script:

Code: [Select]
#!/bin/bash

# This script looks for Apple devices on the network and does something
# for every device that it finds.

if [[ $1 != "background" ]] ;then
        echo "Backgrounding ..."
        screen -d -m -S "AppleRadar" "$0" "background"
        exit 0
fi

## Loging function
function Log() {
        #echo "$(date) $*" >> /var/log/pluto/AppleScanner.log
        echo "$(date) $*"
}

apple_macs=( 00:03:93 00:0a:27 00:0a:95 00:0d:93 00:11:24 00:14:51 00:16:cb 00:17:f2 00:19:e3 00:1b:63 00:1d:4f 00:1e:52 00:10:fa 00:1e:c2 00:1f:5b 00:1f:f3 00:21:e9 00:22:41 00:23:12 00:23:32 00:23:6c 00:23:df 00:24:36 00:25:00 00:25:4b 00:25:bc 00:26:08 00:26:4a 00:26:b0 00:26:bb 00:3e:e1 00:c6:10 00:f4:b9 04:0c:ce 04:1e:64 04:54:53 0c:74:c2 0c:77:1a 10:40:f3 10:93:e9 10:9a:dd 14:5a:05 14:8f:c6 18:20:32 18:34:51 18:e7:f4 1c:ab:a7 24:ab:81 28:37:37 28:6a:b8 28:6a:ba 28:cf:da 28:e0:2c 28:e7:cf 34:15:9e 34:51:c9 3c:07:54 3c:d0:f8 40:30:04 40:3c:fc 40:6c:8f 40:a6:d9 40:d3:2d 44:2a:60 44:d8:84 48:60:bc 4c:b1:99 50:ea:d6 58:1f:aa 58:55:ca 58:b0:35 5c:59:48 60:33:4b 60:c5:47 60:fa:cd 60:fb:42 64:20:0c 64:b9:e8 64:e6:82 68:09:27 68:a8:6d 6c:c2:6b 70:73:cb 70:cd:60 70:de:e2 74:e1:b6 78:a3:e4 78:ca:39 7c:11:be 7c:6d:62 7c:c3:a1 7c:c5:37 7c:f0:5f 88:c6:63 8c:58:77 8c:7b:9d 90:27:e4 90:84:0d 98:03:d8 98:d6:bb a4:67:06 a4:b1:97 a4:d1:d2 b8:17:c2 b8:8d:12 b8:c7:5d b8:f6:b1 b8:ff:61 c0:84:7a c4:2c:03 c8:2a:14 c8:33:4b c8:bc:c8 cc:08:e0 d0:23:db d4:9a:20 d8:30:62 d8:9e:3f d8:a2:5e dc:2b:61 e0:b9:ba e0:f8:47 e4:ce:8f e8:04:0b e8:06:88 ec:85:2f f0:b4:79 f0:cb:a1 f8:1e:df fc:25:3f 00:88:65 04:15:52 04:26:65 04:f7:e4 10:1c:0c 10:dd:b1 1c:e6:2b 20:7d:74 28:cf:e9 2c:b4:3a 30:90:ab 30:f7:c5 34:c0:59 38:0f:4a 38:48:4c 3c:e0:72 40:b3:95 44:fb:42 4c:8d:79 54:26:96 5c:96:9d 60:fe:c5 64:a3:cb 68:9c:70 70:11:24 78:6c:1c 7c:fa:df 80:92:9f 84:fc:fe 88:1f:a1 88:53:95 88:cb:87 94:94:26 98:b8:e3 9c:04:eb a0:ed:cd a8:96:8a a8:fa:d8 ac:3c:0b b4:f0:ab b8:78:2e bc:3b:af bc:92:6b c8:6f:1d cc:78:5f d8:00:4d d8:d1:cb e4:25:e7 e4:8b:7f e8:8d:28 f0:d1:a9 f4:1b:a1 f4:f1:5a )

declare -A apple_macs_assoc

for mac in "${apple_macs[@]}"; do
    apple_macs_assoc["$mac"]="$mac"
done

while : ;do


        while read serverIP skip serverMAC skip; do
                #sleep 10
                ## Get the important info

                Log "Processing $serverIP (mac: $serverMAC )"

                if [[ -n "${apple_macs_assoc["$serverMAC"]}" ]]; then
                    Log Found an apple product here: $serverIP
                    break;
                fi

        done < <(arp -n |fgrep -v incomplete |fgrep ether)

        ## Wait 60 seconds before doing another scan
        sleep 60
done

I haven't thoroughly tested my new script, but it appears to be doing what the original one did.
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: WhateverFits on April 04, 2013, 07:12:48 pm
I also improved the speed of mine this morning. Now I have to go and read what you did and compare.  ;D

Code: [Select]
#!/bin/bash

# This script looks for Apple devices on the network and does something
# for every device that it finds.

if [[ $1 != "background" ]] ;then
        echo "Backgrounding ..."
        screen -d -m -S "AppleRadar" "$0" "background"
        exit 0
fi

## Loging function
function Log() {
        #echo "$(date) $*" >> /var/log/pluto/AppleScanner.log
        echo "$(date) $*"
}

apple_macs=( 00:03:93 00:0a:27 00:0a:95 00:0d:93 00:11:24 00:14:51 00:16:cb 00:17:f2 00:19:e3 00:1b:63 00:1d:4f 00:1e:52 00:10:fa 00:1e:c2 00:1f:5b 00:1f:f3 00:21:e9 00:22:41 00:23:12 00:23:32 00:23:6c 00:23:df 00:24:36 00:25:00 00:25:4b 00:25:bc 00:26:08 00:26:4a 00:26:b0 00:26:bb 00:3e:e1 00:c6:10 00:f4:b9 04:0c:ce 04:1e:64 04:54:53 0c:74:c2 0c:77:1a 10:40:f3 10:93:e9 10:9a:dd 14:5a:05 14:8f:c6 18:20:32 18:34:51 18:e7:f4 1c:ab:a7 24:ab:81 28:37:37 28:6a:b8 28:6a:ba 28:cf:da 28:e0:2c 28:e7:cf 34:15:9e 34:51:c9 3c:07:54 3c:d0:f8 40:30:04 40:3c:fc 40:6c:8f 40:a6:d9 40:d3:2d 44:2a:60 44:d8:84 48:60:bc 4c:b1:99 50:ea:d6 58:1f:aa 58:55:ca 58:b0:35 5c:59:48 60:33:4b 60:c5:47 60:fa:cd 60:fb:42 64:20:0c 64:b9:e8 64:e6:82 68:09:27 68:a8:6d 6c:c2:6b 70:73:cb 70:cd:60 70:de:e2 74:e1:b6 78:a3:e4 78:ca:39 7c:11:be 7c:6d:62 7c:c3:a1 7c:c5:37 7c:f0:5f 88:c6:63 8c:58:77 8c:7b:9d 90:27:e4 90:84:0d 98:03:d8 98:d6:bb a4:67:06 a4:b1:97 a4:d1:d2 b8:17:c2 b8:8d:12 b8:c7:5d b8:f6:b1 b8:ff:61 c0:84:7a c4:2c:03 c8:2a:14 c8:33:4b c8:bc:c8 cc:08:e0 d0:23:db d4:9a:20 d8:30:62 d8:9e:3f d8:a2:5e dc:2b:61 e0:b9:ba e0:f8:47 e4:ce:8f e8:04:0b e8:06:88 ec:85:2f f0:b4:79 f0:cb:a1 f8:1e:df fc:25:3f 00:88:65 04:15:52 04:26:65 04:f7:e4 10:1c:0c 10:dd:b1 1c:e6:2b 20:7d:74 28:cf:e9 2c:b4:3a 30:90:ab 30:f7:c5 34:c0:59 38:0f:4a 38:48:4c 3c:e0:72 40:b3:95 44:fb:42 4c:8d:79 54:26:96 5c:96:9d 60:fe:c5 64:a3:cb 68:9c:70 70:11:24 78:6c:1c 7c:fa:df 80:92:9f 84:fc:fe 88:1f:a1 88:53:95 88:cb:87 94:94:26 98:b8:e3 9c:04:eb a0:ed:cd a8:96:8a a8:fa:d8 ac:3c:0b b4:f0:ab b8:78:2e bc:3b:af bc:92:6b c8:6f:1d cc:78:5f d8:00:4d d8:d1:cb e4:25:e7 e4:8b:7f e8:8d:28 f0:d1:a9 f4:1b:a1 f4:f1:5a )

while : ;do


        arp_output=$( arp -n |fgrep -v incomplete |fgrep ether |tail -n +2|tr ' \t' '#')
        if [[ $? != "0" ]]; then
                arp_output=""
        fi


        for outputLine in $arp_output
        do
                ## Get the important info
                serverIP=$(echo $outputLine | tr '#' ' ' | awk '{print $1}')
                serverMAC=$(echo $outputLine | tr '#' ' ' | awk '{print $3}')
                serverMAC_sub=${serverMAC:0:8}

                Log "Processing $serverIP (mac: $serverMAC )"

                for mac in ${apple_macs[@]}
                do
                        if [ "$serverMAC_sub" == "$mac" ]
                        then
                                Log Found an apple product here: $serverIP $serverMAC
                        fi
                done

        done

        ## Wait 60 seconds before doing another scan
        sleep 60
done
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: WhateverFits on April 04, 2013, 07:23:50 pm
Wow uplink! Yours is distinctly faster than mine, even my improved version. However, it had two problems in that it bailed out at the first Mac MAC and was comparing full MACs not the range. I fixed it and here it is in wonderful efficiency! I have a couple of Macs here and my wife just turned one on without me knowing and it showed up in the list while I was testing it. That was a fun little break!

Code: [Select]
#!/bin/bash

# This script looks for Apple devices on the network and does something
# for every device that it finds.

if [[ $1 != "background" ]] ;then
        echo "Backgrounding ..."
        screen -d -m -S "AppleRadar" "$0" "background"
        exit 0
fi

## Loging function
function Log() {
        #echo "$(date) $*" >> /var/log/pluto/AppleScanner.log
        echo "$(date) $*"
}

apple_macs=( 00:03:93 00:0a:27 00:0a:95 00:0d:93 00:11:24 00:14:51 00:16:cb 00:17:f2 00:19:e3 00:1b:63 00:1d:4f 00:1e:52 00:10:fa 00:1e:c2 00:1f:5b 00:1f:f3 00:21:e9 00:22:41 00:23:12 00:23:32 00:23:6c 00:23:df 00:24:36 00:25:00 00:25:4b 00:25:bc 00:26:08 00:26:4a 00:26:b0 00:26:bb 00:3e:e1 00:c6:10 00:f4:b9 04:0c:ce 04:1e:64 04:54:53 0c:74:c2 0c:77:1a 10:40:f3 10:93:e9 10:9a:dd 14:5a:05 14:8f:c6 18:20:32 18:34:51 18:e7:f4 1c:ab:a7 24:ab:81 28:37:37 28:6a:b8 28:6a:ba 28:cf:da 28:e0:2c 28:e7:cf 34:15:9e 34:51:c9 3c:07:54 3c:d0:f8 40:30:04 40:3c:fc 40:6c:8f 40:a6:d9 40:d3:2d 44:2a:60 44:d8:84 48:60:bc 4c:b1:99 50:ea:d6 58:1f:aa 58:55:ca 58:b0:35 5c:59:48 60:33:4b 60:c5:47 60:fa:cd 60:fb:42 64:20:0c 64:b9:e8 64:e6:82 68:09:27 68:a8:6d 6c:c2:6b 70:73:cb 70:cd:60 70:de:e2 74:e1:b6 78:a3:e4 78:ca:39 7c:11:be 7c:6d:62 7c:c3:a1 7c:c5:37 7c:f0:5f 88:c6:63 8c:58:77 8c:7b:9d 90:27:e4 90:84:0d 98:03:d8 98:d6:bb a4:67:06 a4:b1:97 a4:d1:d2 b8:17:c2 b8:8d:12 b8:c7:5d b8:f6:b1 b8:ff:61 c0:84:7a c4:2c:03 c8:2a:14 c8:33:4b c8:bc:c8 cc:08:e0 d0:23:db d4:9a:20 d8:30:62 d8:9e:3f d8:a2:5e dc:2b:61 e0:b9:ba e0:f8:47 e4:ce:8f e8:04:0b e8:06:88 ec:85:2f f0:b4:79 f0:cb:a1 f8:1e:df fc:25:3f 00:88:65 04:15:52 04:26:65 04:f7:e4 10:1c:0c 10:dd:b1 1c:e6:2b 20:7d:74 28:cf:e9 2c:b4:3a 30:90:ab 30:f7:c5 34:c0:59 38:0f:4a 38:48:4c 3c:e0:72 40:b3:95 44:fb:42 4c:8d:79 54:26:96 5c:96:9d 60:fe:c5 64:a3:cb 68:9c:70 70:11:24 78:6c:1c 7c:fa:df 80:92:9f 84:fc:fe 88:1f:a1 88:53:95 88:cb:87 94:94:26 98:b8:e3 9c:04:eb a0:ed:cd a8:96:8a a8:fa:d8 ac:3c:0b b4:f0:ab b8:78:2e bc:3b:af bc:92:6b c8:6f:1d cc:78:5f d8:00:4d d8:d1:cb e4:25:e7 e4:8b:7f e8:8d:28 f0:d1:a9 f4:1b:a1 f4:f1:5a )

declare -A apple_macs_assoc

for mac in "${apple_macs[@]}"; do
    apple_macs_assoc["$mac"]="$mac"
done

while : ;do


        while read serverIP skip serverMAC skip; do
                #sleep 10
                ## Get the important info

                Log "Processing $serverIP (mac: $serverMAC )"

                serverMAC_sub=${serverMAC:0:8}

                if [[ -n "${apple_macs_assoc["$serverMAC_sub"]}" ]]; then
                    Log Found an apple product here: $serverIP
                fi

        done < <(arp -n |fgrep -v incomplete |fgrep ether)

        ## Wait 60 seconds before doing another scan
        sleep 60
done
Title: Re: Need a shell scripter to develop mac/ipad/iphone detection routine
Post by: tschak909 on April 04, 2013, 07:26:08 pm
Thanks, uplink and Whateverfits! :)

-Thom