I've looked through the debug, and this seems to be the only thing relevant.
Code: Select all
2015-06-16 17:45:10.358 Python[79085:3665173] modalSession has been exited prematurely - check for a reentrant call to endModalSession:
I've looked through the debug, and this seems to be the only thing relevant.
Code: Select all
2015-06-16 17:45:10.358 Python[79085:3665173] modalSession has been exited prematurely - check for a reentrant call to endModalSession:Ok, I'm giving up for today.
The package I installed with MacPorts was called py27-pyqt4. I opened up a Python shell and imported PyQt4 all right with no errors, so I assume its working fine. I'll keep looking myself as well. Looks nice from the pictures though!I will debug the mac issue tomorrow, but it looks like version problem (is it qt4 and pyqt4 ...?!)
Code: Select all
#!/usr/bin/env python
# -*- coding: latin-1 -*-
import sys
import os
import nmap # import nmap.py module
try:
nm = nmap.PortScanner() # instantiate nmap.PortScanner object
except nmap.PortScannerError:
print('Nmap not found', sys.exc_info()[0])
sys.exit(1)
except:
print("Unexpected error:", sys.exc_info()[0])
sys.exit(1)
print('----------------------------------------------------')
nm.scan('10.1.1.0/24', arguments='-sn')
print nm.command_line()
print('----------------------------------------------------')
for x in nm.all_hosts():
print x, nm[x].hostname()
try:
print nm[x]['addresses']['mac']
except:
print "XE:ER:RO:OR:RR:RX"
print "---"
Then I'm more puzzled than ever. That scan works for me. I've not looked at how you parse the results.Nolaan wrote:@DougieLawson![]()
I run the exact same command
![]()
![]()
Code: Select all
root@raspberrypi:~# python test.py
----------------------------------------------------
nmap -oX - -sn 10.42.0.0/24
----------------------------------------------------
10.42.0.1
B8:6B:23:AC:FC:13
---
10.42.0.167 raspberrypi
XE:ER:RO:OR:RR:RX
---
Code: Select all
----------------------------------------------------
nmap -oX - -sn 10.1.1.0/24
10.1.1.101
32:91:8F:11:05:40
---
10.1.1.138
30:91:8F:11:05:40
---
10.1.1.17
XE:ER:RO:OR:RR:RX
---
10.1.1.230 the-vault.example.bogus
40:4A:03:2C:72:9C
---
10.1.1.249 gutenberg.example.bogus
00:0E:7F:CF:18:79
---
10.1.1.251
00:90:4C:91:00:01
---
10.1.1.26
B8:27:EB:14:46:70
---
10.1.1.27 raspberry.example.bogus
80:1F:02:68:C6:AF
---
10.1.1.32 dhcp-10-1-1-32.example.bogus
08:3E:8E:AB:DE:93
---
10.1.1.41
B8:27:EB:5F:FF:ED
---
10.1.1.49 dhcp-10-1-1-49.example.bogus
80:D2:1D:3C:C7:BF
---
10.1.1.7
00:0F:13:40:18:4F
---
10.1.1.9 eagle.example.bogus
00:F1:40:84:15:1A
---
Code: Select all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Requires netifaces, python-libnmap - install them with pip
# Usage: sudo ./libnmap-test.py
import re, netifaces
from libnmap.process import NmapProcess
from libnmap.parser import NmapParser, NmapParserException
def get_networks():
""" Scan cards and returns the networks reachable by the
computer """
iflist = netifaces.interfaces()
# Remove localhost
iflist = [ i for i in iflist if not ('lo' in i )]
addresses_list = []
for iface in iflist:
ad = netifaces.ifaddresses(iface)
if netifaces.AF_INET in ad.keys():
addresses_list.append(ad[netifaces.AF_INET][0]['addr'])
network_list = [re.sub(".\d{1,3}$",".0/24",fname) for fname in addresses_list]
return network_list
def scan_networks(targets, options):
parsed = None
nmproc = NmapProcess(targets, options)
rc = nmproc.run()
if rc != 0:
print("nmap scan failed: {0}".format(nmproc.stderr))
try:
parsed = NmapParser.parse(nmproc.stdout)
except NmapParserException as e:
print("Exception raised while parsing scan: {0}".format(e.msg))
return parsed
def filter_results(nmap_report):
host_list = []
for host in nmap_report.hosts:
#if host.status == 'up' and re.match('Raspberry Pi', host.vendor):
if host.status == 'up':
hostData = []
hostData.append(host.address)
hostData.append(host.mac)
hostData.append(host.vendor)
host_list.append(hostData)
return host_list
if __name__ == "__main__":
networks = get_networks()
nmap_report = scan_networks(networks, "-sn")
if nmap_report:
host_list = filter_results(nmap_report)
for host in host_list:
print(host)
#print(host[0] + ' | ' + host[1] + ' | ' + host[2])
print(str(len(host_list)) + " hosts")
else:
print("No results returned")
