Example #1
0
        item = queue.next("Host")

def failed(queue,item):
    try:
        queue.failed(item)
    except Exception as e:
        logger.error("Problem with reaching NI, got error: %s", e)


def main():
    args = CLI().options()
    try:
        config = SafeConfigParser()
        config.readfp(open(args.config))
    except IOError as (errno, strerror):
        logger.error("Config file '%s' is missing", args.config)
        return None
    ## ready :)
    api_user = config.get("NI", "api_user")
    api_key = config.get("NI", "api_key")
    queue_url = url_concat(config.get("NI", "url"), "scan_queue/")
    queue = Queue(queue_url, api_user, api_key)

    nerds_url = url_concat(config.get("NI", "url"), "nerds/")
    nerds_api = NerdsApi(nerds_url, api_user, api_key)
    
    process_host(queue, nerds_api)

if __name__ == "__main__":
    main()
Example #2
0
 def test_slash_on_base_and_chunk(self):
     result = url_concat("https://nordu.net/test/","/some/path")
     self.assertEqual(result, "https://nordu.net/test/some/path")
Example #3
0
 def test_no_slashses(self):
     result = url_concat("https://nordu.net/test","some/path")
     self.assertEqual(result, "https://nordu.net/test/some/path")
Example #4
0
 def test_only_chunk(self):
     result = url_concat("https://nordu.net/test","/some/path")
     self.assertEqual(result, "https://nordu.net/test/some/path")