# Path: golismero/api/net/web_utils.py
# def detect_auth_method(url):
#     """
#     Detects authentication method/type for an URL.
# 
#     .. warning:
#        This function may be removed in future versions of GoLismero.
# 
#     :param url: url to test authentication.
#     :type url: str.
# 
#     :return: (scheme, realm) if auth required. None otherwise.
#     """
# 
#     url = to_utf8(url)
#     req = Request(url=url)
# 
#     p = req.prepare()
#     s = Session()
#     r = s.send(p)
# 
#     if 'www-authenticate' in r.headers:
#         authline = r.headers['www-authenticate']
#         authobj  = re.compile(
#             r'''(?:\s*www-authenticate\s*:)?\s*(\w*)\s+realm=['"]([^'"]+)['"]''',
#             re.IGNORECASE)
#         matchobj = authobj.match(authline)
# 
#         if matchobj:
#             scheme = matchobj.group(1)
#             realm  = matchobj.group(2)
#             return scheme, realm
# 
#     return None, None
# 
# def check_auth(url, user, password):
#     """
#     Check the auth for and specified url.
# 
#     .. warning:
#        This function may be removed in future versions of GoLismero.
# 
#     :param url: String with url.
#     :type url: str
# 
#     :param user: string with user text
#     :type user: str
# 
#     :param password: string with password text
#     :type password: str
# 
#     :return: True if authentication is successful, False otherwise.
#     :rtype: bool
#     """
# 
#     # Check trivial case.
#     if not url:
#         return False
# 
#     # Sanitize URL string.
#     url = to_utf8(url)
# 
#     # Get authentication method.
#     auth, _ = detect_auth_method(url)
# 
#     # Is authentication required?
#     if auth:
# 
#         # Get authentication object.
#         m_auth_obj = get_auth_obj(auth, user, password)
# 
#         # Try the request.
#         req = Request(url = url, auth = m_auth_obj)
#         p = req.prepare()
#         s = Session()
#         r = s.send(p)
# 
#         # Check if authentication was successful.
#         return r.status_code == codes.ok
# 
#     # No authentication is required.
#     return True


from .console import Console
from .orchestrator import Orchestrator
from ..api.net.web_utils import detect_auth_method, check_auth
from ..common import OrchestratorConfig, AuditConfig, get_default_config_file,\
    get_default_user_config_file
import datetime
import traceback
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
GoLismero launcher.
"""

__license__ = """
GoLismero 2.0 - The web knife - Copyright (C) 2011-2014

Golismero project site: https://github.com/golismero
Golismero project mail: contact@golismero-project.com

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,

# Path: golismero/api/net/web_utils.py
# def detect_auth_method(url):
#     """
#     Detects authentication method/type for an URL.
# 
#     .. warning:
#        This function may be removed in future versions of GoLismero.
# 
#     :param url: url to test authentication.
#     :type url: str.
# 
#     :return: (scheme, realm) if auth required. None otherwise.
#     """
# 
#     url = to_utf8(url)
#     req = Request(url=url)
# 
#     p = req.prepare()
#     s = Session()
#     r = s.send(p)
# 
#     if 'www-authenticate' in r.headers:
#         authline = r.headers['www-authenticate']
#         authobj  = re.compile(
#             r'''(?:\s*www-authenticate\s*:)?\s*(\w*)\s+realm=['"]([^'"]+)['"]''',
#             re.IGNORECASE)
#         matchobj = authobj.match(authline)
# 
#         if matchobj:
#             scheme = matchobj.group(1)
#             realm  = matchobj.group(2)
#             return scheme, realm
# 
#     return None, None
# 
# def check_auth(url, user, password):
#     """
#     Check the auth for and specified url.
# 
#     .. warning:
#        This function may be removed in future versions of GoLismero.
# 
#     :param url: String with url.
#     :type url: str
# 
#     :param user: string with user text
#     :type user: str
# 
#     :param password: string with password text
#     :type password: str
# 
#     :return: True if authentication is successful, False otherwise.
#     :rtype: bool
#     """
# 
#     # Check trivial case.
#     if not url:
#         return False
# 
#     # Sanitize URL string.
#     url = to_utf8(url)
# 
#     # Get authentication method.
#     auth, _ = detect_auth_method(url)
# 
#     # Is authentication required?
#     if auth:
# 
#         # Get authentication object.
#         m_auth_obj = get_auth_obj(auth, user, password)
# 
#         # Try the request.
#         req = Request(url = url, auth = m_auth_obj)
#         p = req.prepare()
#         s = Session()
#         r = s.send(p)
# 
#         # Check if authentication was successful.
#         return r.status_code == codes.ok
# 
#     # No authentication is required.
#     return True


# Path: golismero/main/launcher.py
from .console import Console
from .orchestrator import Orchestrator
from ..api.net.web_utils import detect_auth_method, check_auth
from ..common import OrchestratorConfig, AuditConfig, get_default_config_file,\
    get_default_user_config_file
import datetime
import traceback

#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
GoLismero launcher.
"""

__license__ = """
GoLismero 2.0 - The web knife - Copyright (C) 2011-2014

Golismero project site: https://github.com/golismero
Golismero project mail: contact@golismero-project.com

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of