Example #1
0
def net_mode():
    ori_str = conf.NETWORK_STR
    try:
        _list = IPy.IP(ori_str)
    except Exception as e:
        sys.exit(logger.error('Invalid IP/MASK,%s' % e))
    for each in _list:
        th.queue.put(str(each))
Example #2
0
def handle_addr(addr):
    '''
    Handle addr user input, return IP list.
    '''
    try:
        return IPy.IP(addr)
    except ValueError:
        print '[-] Invalid CIDR.'
        sys.exit(0)
Example #3
0
def setTarget():
    ori_str = conf.TARGET = sys.argv[1]
    for each in ori_str:
        if each.isalpha():
            conf.MODE = TARGET_MODE.DOMAIN
            break
    else:
        conf.MODE = TARGET_MODE.IP
        try:
            _list = IPy.IP(ori_str)
        except Exception, e:
            sys.exit(logger.error('Invalid IP, %s' % e))
Example #4
0
    def check_target(self):
        """Check targets and add in queue"""
        ok = 0

        if self.ip != None:
            try:
                _list = IPy.IP(self.ip)
            except Exception, e:
                logger.error('Invalid IP/MASK, %s' % e)
                return False
            for i in _list:
                self.targets.put(str(i))
            ok = 1
Example #5
0
def net_mode():
    ori_str = conf.NETWORK_STR
    try:
        _list = IPy.IP(ori_str)
    except Exception, e:
        sys.exit(logger.error('Invalid IP/MASK,%s' % e))
Example #6
0
def collect_ip_range(ip_list, netmask='255.255.255.0'):
    '''
    Collect IP range by IP list.
    '''
    ip_range_list = [str(IPy.IP(ip).make_net(netmask)) for ip in ip_list]
    return list(set(ip_range_list))
Example #7
0
def cidr_mode():
    ori_str = conf.NETWORK_STR
    try:
        _list = IPy.IP(ori_str) #使用IPy插件得到IP列表
    except Exception, e:
        sys.exit(logger.error('Invalid IP/MASK,%s' % e))