This commit is contained in:
Itay Mizeretz 2018-04-11 11:28:59 +03:00
parent 1d07e5f98f
commit fcb5b8f85d
4 changed files with 5 additions and 4 deletions

View File

@ -15,7 +15,7 @@ class NetworkRange(object):
self._shuffle = shuffle
def get_range(self):
return [x for x in self._get_range() if (x & 0xFF != 0)] # remove broadcast ips
return self._get_range()
def __iter__(self):
base_range = self.get_range()
@ -66,7 +66,7 @@ class CidrRange(NetworkRange):
return ipaddress.ip_address(ip_address) in self._ip_network
def _get_range(self):
return [CidrRange._ip_to_number(str(x)) for x in self._ip_network]
return [CidrRange._ip_to_number(str(x)) for x in self._ip_network if x != self._ip_network.broadcast_address]
class IpRange(NetworkRange):

View File

@ -8,7 +8,7 @@ import itertools
import netifaces
from subprocess import check_output
from random import randint
from common.network.range import CidrRange
from common.network.network_range import CidrRange
def get_host_subnets():

View File

@ -3,7 +3,7 @@ import time
from config import WormConfiguration
from info import local_ips, get_interfaces_ranges
from common.network.range import *
from common.network.network_range import *
from model import VictimHost
from . import HostScanner

View File

@ -14,3 +14,4 @@ ecdsa
netifaces
mock
nose
ipaddress