示例#1
0
def main():

    # no args provided
    if len(sys.argv) == 1:
        parser.print_help()
        sys.exit(1)
    
    logsDir = os.path.join(os.getcwd(), 'logs')
    #resultsDir = os.path.join(os.getcwd(), 'results')
    if not os.path.exists(logsDir):
        os.mkdir(logsDir)
    #if not os.path.exists(resultsDir):
    #    os.mkdir(resultsDir)
        
    logger = Logger(args.nolog, args.verbose)
    
    #single target or multiple targets 
    if(args.target and args.tlist):
        logger.PrintError("You can request Geolocation information either for a single target(-t) or a list of targets(-T). Not both!", args.nolog)
        sys.exit(2)
        
    #my ip address or single target
    if(args.target and args.myip):
        logger.PrintError("You can request Geolocation information either for a single target(-t) or your own IP address. Not both!", args.nolog)
        sys.exit(3)
        
    #multiple targets or my ip address
    if(args.tlist and args.myip):
        logger.PrintError("You can request Geolocation information either for a list of targets(-T) or your own IP address. Not both!", args.nolog)
        sys.exit(4)
    
    #single target and google maps only allowed
    if(args.tlist and args.g):
        logger.PrintError("Google maps location is working only with single targets.", args.nolog)
        sys.exit(5)
    
    #specify user-agent or random
    if(args.uagent and args.ulist):
        logger.PrintError("You can either specify a user-agent string or let IPGeolocation pick random user-agent strings for you from a file.", args.nolog)
        sys.exit(6)
        
    #specify proxy or random
    if(args.proxy and args.xlist):
        logger.PrintError("You can either specify a proxy or let IPGeolocation pick random proxy connections for you from a file.", args.nolog)
        sys.exit(7)
        
        
    #init lib
    ipGeoLocRequest = IpGeoLocationLib(args.target, logger, args.noprint)
    
    print(banner)
    
    #retrieve information
    if not ipGeoLocRequest.GetInfo(args.uagent, args.tlist, 
                                     args.ulist, args.proxy, args.xlist,
                                     args.csv, args.xml, args.txt, args.g):
        logger.PrintError("Retrieving IP Geolocation information failed.")
        sys.exit(8)
示例#2
0
class Utils:
    
    def __init__(self, nolog=False, verbose=False):    
        self.Logger = Logger(nolog, verbose)
        
        
    def openLocationInGoogleMaps(self, ipGeolObj):
        """Open IP Geolocation in Google Maps with default browser"""
        if type(ipGeolObj.Longtitude) == float and type(ipGeolObj.Latitude) == float:
            self.Logger.Print('Opening Geolocation in browser..')
            
            if _platform == 'cygwin':
                call(['cygstart', ipGeolObj.GoogleMapsLink])
                
            elif _platform == 'win32' or _platform == 'linux' or _platform == 'linux2':
                webbrowser.open(ipGeolObj.GoogleMapsLink)
            
            else:
                self.Logger.PrintError('-g option is not available on your platform.')
                
                
    def hostnameToIP(self, hostname):
        """Resolve hostname to IP address"""
        try:
            return socket.gethostbyname(hostname)
        except:
            return False
    
    
    def isValidIPAddress(self, ip):
        """Check if ip is a valid IPv4/IPv6 address"""
        try:
            ipaddress.ip_address(ip)
            return True
        except:
            return False
    
            
    def checkProxyConn(self, url, proxy):
        """check proxy connectivity"""
        check = True
        self.Logger.Print('Testing proxy {} connectivity..'.format(proxy))
    
        try:
            req = request.Request(url)
            req.set_proxy(proxy, 'http')
            request.urlopen(req)
        except:
            check = False
        
        if check == True:
            self.Logger.Print('Proxy server is reachable.')
        else:
            raise MyExceptions.ProxyServerNotReachableError()
示例#3
0
    #if not os.path.exists(resultsDir):

    # os.mkdir(resultsDir)

        

    logger = Logger(args.nolog, args.verbose)

    

    #single target or multiple targets 

    if(args.target and args.tlist):

        logger.PrintError("You can request Geolocation information either for a single target(-t) or a list of targets(-T). Not both!", args.nolog)

        sys.exit(2)

        

    #my ip address or single target

    if(args.target and args.myip):

        logger.PrintError("You can request Geolocation information either for a single target(-t) or your own IP address. Not both!", args.nolog)

        sys.exit(3)

        
示例#4
0
def main():

    # no args provided
    if len(sys.argv) == 1:
        parser.print_help()
        sys.exit(1)

    logsDir = os.path.join(os.getcwd(), 'logs')
    #resultsDir = os.path.join(os.getcwd(), 'results')
    if not os.path.exists(logsDir):
        os.mkdir(logsDir)
    #if not os.path.exists(resultsDir):
    #    os.mkdir(resultsDir)

    logger = Logger(args.nolog, args.verbose)

    #single target or multiple targets
    if (args.target and args.tlist):
        logger.PrintError(
            "Вы можете запросить геолокационную информацию либо для одной цели (- t), либо для списка целей(-T). Только не оба!",
            args.nolog)
        sys.exit(2)

    #my ip address or single target
    if (args.target and args.myip):
        logger.PrintError(
            "Вы можете запросить геолокационную информацию либо для одной цели (- t), либо для вашего собственного IP-адреса. Только не оба!",
            args.nolog)
        sys.exit(3)

    #multiple targets or my ip address
    if (args.tlist and args.myip):
        logger.PrintError(
            "Вы можете запросить геолокационную информацию либо для списка целей (- T), либо для вашего собственного IP-адреса. Только не оба!!",
            args.nolog)
        sys.exit(4)

    #single target and google maps only allowed
    if (args.tlist and args.g):
        logger.PrintError(
            "Google maps location работает только с одиночными целями.",
            args.nolog)
        sys.exit(5)

    #specify user-agent or random
    if (args.uagent and args.ulist):
        logger.PrintError(
            "Вы можете либо указать строку агента пользователя, либо позволить IPGeolocation выбрать случайные строки агента пользователя для вас из файла.",
            args.nolog)
        sys.exit(6)

    #specify proxy or random
    if (args.proxy and args.xlist):
        logger.PrintError(
            "Вы можете либо указать прокси-сервер, либо позволить IPGeolocation выбрать случайные прокси-соединения для вас из файла.",
            args.nolog)
        sys.exit(7)

    #init lib
    ipGeoLocRequest = IpGeoLocationLib(args.target, logger, args.noprint)

    print(banner)

    #retrieve information
    if not ipGeoLocRequest.GetInfo(args.uagent, args.tlist, args.ulist,
                                   args.proxy, args.xlist, args.csv, args.xml,
                                   args.txt, args.g):
        logger.PrintError(
            "Не удалось получить информацию о геолокации IP-адресов.")
        sys.exit(8)
示例#5
0
def main():


    # no args provided

    if len(sys.argv) == 1:

        parser.print_help()

        sys.exit(1)

    

    logsDir = os.path.join(os.getcwd(), 'logs')

    #resultsDir = os.path.join(os.getcwd(), 'results')

    if not os.path.exists(logsDir):

        os.mkdir(logsDir)

    #if not os.path.exists(resultsDir):

    # os.mkdir(resultsDir)

        

    logger = Logger(args.nolog, args.verbose)

    

    #single target or multiple targets 

    if(args.target and args.tlist):

        logger.PrintError("Anda dapat meminta informasi FCAlokasi untuk satu target (-t) atau daftar target (-T). Tidak keduanya! ", Args.nolog")

        sys.exit(2)

        

    #my ip address or single target

    if(args.target and args.myip):

        logger.PrintError("Anda dapat meminta informasi FCAlokasi untuk daftar target (-T) atau alamat IP Anda sendiri. Tidak keduanya! ", Args.nolog")

        sys.exit(3)

        

    #multiple targets or my ip address

    if(args.tlist and args.myip):

        logger.PrintError("Anda dapat meminta informasi FCAlokasi untuk daftar target (-T) atau alamat IP Anda sendiri. Tidak keduanya! ", Args.nolog")

        sys.exit(4)

    

    #single target and google maps only allowed

    if(args.tlist and args.g):

        logger.PrintError("Google maps location is working only with single targets.", args.nolog)

        sys.exit(5)

    

    #specify user-agent or random

    if(args.uagent and args.ulist):

        logger.PrintError("You can either specify a user-agent string or let IPFCAocation pick random user-agent strings for you from a file.", args.nolog)

        sys.exit(6)

        

    #specify proxy or random

    if(args.proxy and args.xlist):

        logger.PrintError("You can either specify a proxy or let FRI3NDS CYBER ARMY LACAK TOOLS pick random proxy connections for you from a file.", args.nolog)

        sys.exit(7)

        

        

    #init lib

    ipFCALocRequest = IPFCALocationLib(args.target, logger, args.noprint)

    

    print(banner)

    

    #retrieve information

    if not ipGeoLocRequest.GetInfo(args.uagent, args.tlist, 

                                     args.ulist, args.proxy, args.xlist,

                                     args.csv, args.xml, args.txt, args.g):

        logger.PrintError("Retrieving FRI3NDS CYBER ARMY LACAK TOOLS information failed.")

        sys.exit(8)