Get error "PermissionError: [Errno 13] Permission denied" for some network
tr1cks opened this issue · comments
For subnetwork 192.168.133.0/24 I get error, when others works fine:
ggadminuser@GGAppSrv:~/snmp-v2$ sudo python3 main.py 192.168.133.0/24 ['192.168.133.0', '192.168.133.1', '192.168.133.2', '192.168.133.3', '192.168.133.4', '192.168.133.5', '192.168.133.6', '192.168.133.7', '192.168.133.8', '192.168.133.9', '192.168.133.10', '192.168.133.11', '192.168.133.12', '192.168.133.13', '192.168.133.14', '192.168.133.15', '192.168.133.16', '192.168.133.17', '192.168.133.18', '192.168.133.19', '192.168.133.20', '192.168.133.21', '192.168.133.22', '192.168.133.23', '192.168.133.24', '192.168.133.25', '192.168.133.26', '192.168.133.27', '192.168.133.28', '192.168.133.29', '192.168.133.30', '192.168.133.31', '192.168.133.32', '192.168.133.33', '192.168.133.34', '192.168.133.35', '192.168.133.36', '192.168.133.37', '192.168.133.38', '192.168.133.39', '192.168.133.40', '192.168.133.41', '192.168.133.42', '192.168.133.43', '192.168.133.44', '192.168.133.45', '192.168.133.46', '192.168.133.47', '192.168.133.48', '192.168.133.49', '192.168.133.50', '192.168.133.51', '192.168.133.52', '192.168.133.53', '192.168.133.54', '192.168.133.55', '192.168.133.56', '192.168.133.57', '192.168.133.58', '192.168.133.59', '192.168.133.60', '192.168.133.61', '192.168.133.62', '192.168.133.63', '192.168.133.64', '192.168.133.65', '192.168.133.66', '192.168.133.67', '192.168.133.68', '192.168.133.69', '192.168.133.70', '192.168.133.71', '192.168.133.72', '192.168.133.73', '192.168.133.74', '192.168.133.75', '192.168.133.76', '192.168.133.77', '192.168.133.78', '192.168.133.79', '192.168.133.80', '192.168.133.81', '192.168.133.82', '192.168.133.83', '192.168.133.84', '192.168.133.85', '192.168.133.86', '192.168.133.87', '192.168.133.88', '192.168.133.89', '192.168.133.90', '192.168.133.91', '192.168.133.92', '192.168.133.93', '192.168.133.94', '192.168.133.95', '192.168.133.96', '192.168.133.97', '192.168.133.98', '192.168.133.99', '192.168.133.100', '192.168.133.101', '192.168.133.102', '192.168.133.103', '192.168.133.104', '192.168.133.105', '192.168.133.106', '192.168.133.107', '192.168.133.108', '192.168.133.109', '192.168.133.110', '192.168.133.111', '192.168.133.112', '192.168.133.113', '192.168.133.114', '192.168.133.115', '192.168.133.116', '192.168.133.117', '192.168.133.118', '192.168.133.119', '192.168.133.120', '192.168.133.121', '192.168.133.122', '192.168.133.123', '192.168.133.124', '192.168.133.125', '192.168.133.126', '192.168.133.127', '192.168.133.128', '192.168.133.129', '192.168.133.130', '192.168.133.131', '192.168.133.132', '192.168.133.133', '192.168.133.134', '192.168.133.135', '192.168.133.136', '192.168.133.137', '192.168.133.138', '192.168.133.139', '192.168.133.140', '192.168.133.141', '192.168.133.142', '192.168.133.143', '192.168.133.144', '192.168.133.145', '192.168.133.146', '192.168.133.147', '192.168.133.148', '192.168.133.149', '192.168.133.150', '192.168.133.151', '192.168.133.152', '192.168.133.153', '192.168.133.154', '192.168.133.155', '192.168.133.156', '192.168.133.157', '192.168.133.158', '192.168.133.159', '192.168.133.160', '192.168.133.161', '192.168.133.162', '192.168.133.163', '192.168.133.164', '192.168.133.165', '192.168.133.166', '192.168.133.167', '192.168.133.168', '192.168.133.169', '192.168.133.170', '192.168.133.171', '192.168.133.172', '192.168.133.173', '192.168.133.174', '192.168.133.175', '192.168.133.176', '192.168.133.177', '192.168.133.178', '192.168.133.179', '192.168.133.180', '192.168.133.181', '192.168.133.182', '192.168.133.183', '192.168.133.184', '192.168.133.185', '192.168.133.186', '192.168.133.187', '192.168.133.188', '192.168.133.189', '192.168.133.190', '192.168.133.191', '192.168.133.192', '192.168.133.193', '192.168.133.194', '192.168.133.195', '192.168.133.196', '192.168.133.197', '192.168.133.198', '192.168.133.199', '192.168.133.200', '192.168.133.201', '192.168.133.202', '192.168.133.203', '192.168.133.204', '192.168.133.205', '192.168.133.206', '192.168.133.207', '192.168.133.208', '192.168.133.209', '192.168.133.210', '192.168.133.211', '192.168.133.212', '192.168.133.213', '192.168.133.214', '192.168.133.215', '192.168.133.216', '192.168.133.217', '192.168.133.218', '192.168.133.219', '192.168.133.220', '192.168.133.221', '192.168.133.222', '192.168.133.223', '192.168.133.224', '192.168.133.225', '192.168.133.226', '192.168.133.227', '192.168.133.228', '192.168.133.229', '192.168.133.230', '192.168.133.231', '192.168.133.232', '192.168.133.233', '192.168.133.234', '192.168.133.235', '192.168.133.236', '192.168.133.237', '192.168.133.238', '192.168.133.239', '192.168.133.240', '192.168.133.241', '192.168.133.242', '192.168.133.243', '192.168.133.244', '192.168.133.245', '192.168.133.246', '192.168.133.247', '192.168.133.248', '192.168.133.249', '192.168.133.250', '192.168.133.251', '192.168.133.252', '192.168.133.253', '192.168.133.254', '192.168.133.255'] Traceback (most recent call last): File "main.py", line 31, in <module> main(sys.argv[1:]) File "main.py", line 18, in main snmp_unavailable_ips, created_snmp_cfgs = search_by_snmp(args_to_ips(args), settings) File "/home/ggadminuser/snmp-v2/search_by_snmp.py", line 91, in search_by_snmp int(settings["ping-retries"]))) File "/home/ggadminuser/snmp-v2/search_by_snmp.py", line 72, in search_alive_by_ping available, dead = multi_ping(hosts, timeout, retries) File "/home/ggadminuser/.local/lib/python3.6/site-packages/multiping/__init__.py", line 484, in multi_ping mp.send() File "/home/ggadminuser/.local/lib/python3.6/site-packages/multiping/__init__.py", line 296, in send self._send_ping(addr, payload=struct.pack("d", time.time())) File "/home/ggadminuser/.local/lib/python3.6/site-packages/multiping/__init__.py", line 259, in _send_ping self._sock.sendto(full_pkt, full_dest_addr) PermissionError: [Errno 13] Permission denied
My network interfaces:
`ggadminuser@GGAppSrv:~/snmp-v2$ ifconfig -a
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.133.128 netmask 255.255.255.0 broadcast 192.168.133.255
inet6 fe80::20c:29ff:fe53:4041 prefixlen 64 scopeid 0x20
ether 00:0c:29:53:40:41 txqueuelen 1000 (Ethernet)
RX packets 48323 bytes 22660264 (22.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 208841 bytes 16291320 (16.2 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens38: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 00:0c:29:53:40:4b txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 946 bytes 81224 (81.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 946 bytes 81224 (81.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
`
I am getting this same issue. How was this issue fixed?
I made workaround.