get paid to paste

--- ipv6_surface_analyzer.py	2012-02-22 09:10:50.000000000 +0100
+++ ipv6_surface_analyzer_osx.py	2012-02-22 09:12:23.000000000 +0100
@@ -55,6 +55,10 @@
 		new_nic = line.split(" ")[0].strip()
 		if new_nic!="":
 			available_nics.append( new_nic )
+	if "flags=" in line: # Apple's `ifconfig`
+		new_nic = line.split(" ")[0].strip().strip(':')
+		if new_nic!="":
+			available_nics.append( new_nic )
 if len( available_nics )<1:
 	sys.stderr.write( "error: can't seem to find network interfaces on this system\n" )
 	exit( 1 )
@@ -147,6 +151,11 @@
 				ipv4_alive = True
 			mac = output[0].split( '[' )[1]
 			mac = mac.split( ']' )[0].lower()
+		if "1 packets received" in output[0]: # MacPorts `arping`
+			if not ipv4_alive:
+				sys.stdout.write( " dead to icmp but ARPing so we'll say it's alive\n" )
+				ipv4_alive = True
+			mac = output[0].split()[5]
 	
 	if not ipv4_alive:
 		sys.stdout.write( " dead\n" )

Pasted: Feb 22, 2012, 8:16:05 am
Views: 25