Showing preview only (2,628K chars total). Download the full file or copy to clipboard to get everything.
Repository: blackye/lalascan
Branch: master
Commit: e35726e66485
Files: 258
Total size: 2.5 MB
Directory structure:
gitextract_yawu4nrk/
├── .gitignore
├── README.md
├── bin/
│ └── __init__.py
├── cache/
│ ├── __init__.py
│ └── leakinfo.json
├── conf.py
├── lalascan/
│ ├── __init__.py
│ ├── api/
│ │ ├── __init__.py
│ │ ├── exception.py
│ │ ├── option.py
│ │ └── proxycrawl.py
│ ├── cache/
│ │ └── __init__.py
│ ├── data/
│ │ ├── __init__.py
│ │ ├── datatype.py
│ │ ├── enum.py
│ │ ├── http.py
│ │ ├── information/
│ │ │ ├── __init__.py
│ │ │ ├── banner.py
│ │ │ ├── html.py
│ │ │ ├── portscan.py
│ │ │ └── webservice.py
│ │ ├── resource/
│ │ │ ├── __init__.py
│ │ │ ├── domain.py
│ │ │ ├── ip.py
│ │ │ └── url.py
│ │ └── vuln/
│ │ ├── __init__.py
│ │ └── vulnerability.py
│ ├── launcher.py
│ ├── libs/
│ │ ├── __init__.py
│ │ ├── core/
│ │ │ ├── __init__.py
│ │ │ ├── common.py
│ │ │ ├── globaldata.py
│ │ │ ├── logger.py
│ │ │ ├── plugin.py
│ │ │ ├── pluginmanager.py
│ │ │ ├── pluginregister.py
│ │ │ ├── report.py
│ │ │ ├── scope.py
│ │ │ ├── settings.py
│ │ │ ├── singletonclass.py
│ │ │ ├── spider.py
│ │ │ └── threads.py
│ │ └── net/
│ │ ├── __init__.py
│ │ ├── dns.py
│ │ ├── http.py
│ │ ├── scraper.py
│ │ ├── web_mutants.py
│ │ └── web_utils.py
│ ├── models/
│ │ ├── __init__.py
│ │ ├── auditdb.py
│ │ ├── scan_task.py
│ │ └── scan_vuldetail.py
│ └── utils/
│ ├── __init__.py
│ ├── console_utils.py
│ ├── mymath.py
│ ├── mytime.py
│ └── text_utils.py
├── lalascan.py
├── requirement.txt
├── tests/
│ ├── __init__.py
│ └── unittest/
│ ├── __init__.py
│ ├── console_output.py
│ ├── db_test.py
│ ├── ip_resource.py
│ ├── scope_test.py
│ ├── t_attribdict.py
│ ├── t_pluginmanager.py
│ ├── test_func.py
│ └── thread_test.py
├── thirdparty_libs/
│ ├── __init__.py
│ ├── ansistrm/
│ │ ├── __init__.py
│ │ └── ansistrm.py
│ ├── argparse/
│ │ ├── __init__.py
│ │ └── argparse.py
│ ├── bind_sql_inject/
│ │ ├── __init__.py
│ │ ├── diff.py
│ │ ├── fuzzy_string_cmp.py
│ │ └── upper_bounds.py
│ ├── colorizer/
│ │ ├── __init__.py
│ │ ├── ansi.py
│ │ ├── ansitowin32.py
│ │ ├── initialise.py
│ │ ├── termcolor.py
│ │ ├── win32.py
│ │ └── winterm.py
│ ├── oset/
│ │ ├── LICENSE.txt
│ │ ├── __init__.py
│ │ ├── _abc.py
│ │ └── pyoset.py
│ ├── prettytable/
│ │ ├── CHANGELOG
│ │ ├── COPYING
│ │ ├── MANIFEST.in
│ │ ├── PKG-INFO
│ │ ├── README
│ │ ├── __init__.py
│ │ └── prettytable.py
│ ├── requests/
│ │ ├── __init__.py
│ │ ├── adapters.py
│ │ ├── api.py
│ │ ├── auth.py
│ │ ├── cacert.pem
│ │ ├── certs.py
│ │ ├── compat.py
│ │ ├── cookies.py
│ │ ├── exceptions.py
│ │ ├── hooks.py
│ │ ├── models.py
│ │ ├── packages/
│ │ │ ├── __init__.py
│ │ │ ├── charade/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── big5freq.py
│ │ │ │ ├── big5prober.py
│ │ │ │ ├── chardistribution.py
│ │ │ │ ├── charsetgroupprober.py
│ │ │ │ ├── charsetprober.py
│ │ │ │ ├── codingstatemachine.py
│ │ │ │ ├── compat.py
│ │ │ │ ├── constants.py
│ │ │ │ ├── cp949prober.py
│ │ │ │ ├── escprober.py
│ │ │ │ ├── escsm.py
│ │ │ │ ├── eucjpprober.py
│ │ │ │ ├── euckrfreq.py
│ │ │ │ ├── euckrprober.py
│ │ │ │ ├── euctwfreq.py
│ │ │ │ ├── euctwprober.py
│ │ │ │ ├── gb2312freq.py
│ │ │ │ ├── gb2312prober.py
│ │ │ │ ├── hebrewprober.py
│ │ │ │ ├── jisfreq.py
│ │ │ │ ├── jpcntx.py
│ │ │ │ ├── langbulgarianmodel.py
│ │ │ │ ├── langcyrillicmodel.py
│ │ │ │ ├── langgreekmodel.py
│ │ │ │ ├── langhebrewmodel.py
│ │ │ │ ├── langhungarianmodel.py
│ │ │ │ ├── langthaimodel.py
│ │ │ │ ├── latin1prober.py
│ │ │ │ ├── mbcharsetprober.py
│ │ │ │ ├── mbcsgroupprober.py
│ │ │ │ ├── mbcssm.py
│ │ │ │ ├── sbcharsetprober.py
│ │ │ │ ├── sbcsgroupprober.py
│ │ │ │ ├── sjisprober.py
│ │ │ │ ├── universaldetector.py
│ │ │ │ └── utf8prober.py
│ │ │ └── urllib3/
│ │ │ ├── __init__.py
│ │ │ ├── _collections.py
│ │ │ ├── connectionpool.py
│ │ │ ├── exceptions.py
│ │ │ ├── filepost.py
│ │ │ ├── packages/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── ordered_dict.py
│ │ │ │ ├── six.py
│ │ │ │ └── ssl_match_hostname/
│ │ │ │ └── __init__.py
│ │ │ ├── poolmanager.py
│ │ │ ├── request.py
│ │ │ ├── response.py
│ │ │ └── util.py
│ │ ├── sessions.py
│ │ ├── status_codes.py
│ │ ├── structures.py
│ │ └── utils.py
│ ├── requests_ntlm/
│ │ ├── __init__.py
│ │ ├── ntlm/
│ │ │ ├── HTTPNtlmAuthHandler.py
│ │ │ ├── U32.py
│ │ │ ├── __init__.py
│ │ │ ├── des.py
│ │ │ ├── des_c.py
│ │ │ ├── des_data.py
│ │ │ └── ntlm.py
│ │ └── requests_ntlm.py
│ ├── termcolor/
│ │ ├── __init__.py
│ │ └── termcolor.py
│ ├── texttable.py
│ ├── tldextract/
│ │ ├── .tld_set_snapshot
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── __init__.py
│ │ └── tldextract.py
│ ├── torndb.py
│ └── wvs_spider/
│ ├── __init__.py
│ ├── lib/
│ │ ├── __init__.py
│ │ └── config.py
│ ├── run.py
│ ├── wvs_celery_config.py
│ ├── wvs_console.py
│ ├── wvs_run.py
│ ├── wvs_tasks.py
│ └── xml2mysql.py
└── webservice/
└── lalascan_web/
├── app/
│ ├── __init__.py
│ ├── extensions/
│ │ ├── __init__.py
│ │ └── flask_paginate.py
│ ├── forms.py
│ ├── models/
│ │ ├── __init__.py
│ │ ├── leakinfo.py
│ │ ├── policy.py
│ │ ├── scanner.py
│ │ └── spider.py
│ ├── services.py
│ ├── static/
│ │ ├── css/
│ │ │ └── oneui.css
│ │ ├── fonts/
│ │ │ └── FontAwesome.otf
│ │ ├── img/
│ │ │ └── avatars/
│ │ │ └── readme.txt
│ │ ├── js/
│ │ │ ├── app.js
│ │ │ └── pages/
│ │ │ ├── base_comp_animations.js
│ │ │ ├── base_comp_calendar.js
│ │ │ ├── base_comp_charts.js
│ │ │ ├── base_comp_maps.js
│ │ │ ├── base_forms_validation.js
│ │ │ ├── base_forms_wizard.js
│ │ │ ├── base_pages_coming_soon.js
│ │ │ ├── base_pages_dashboard.js
│ │ │ ├── base_pages_lock.js
│ │ │ ├── base_pages_login.js
│ │ │ ├── base_pages_register.js
│ │ │ ├── base_pages_reminder.js
│ │ │ ├── base_tables_datatables.js
│ │ │ ├── base_ui_activity.js
│ │ │ ├── base_ui_icons.js
│ │ │ ├── base_ui_widgets.js
│ │ │ ├── frontend_contact.js
│ │ │ └── frontend_features.js
│ │ └── less/
│ │ ├── main.less
│ │ ├── mixins.less
│ │ ├── modules/
│ │ │ ├── base.bootstrap-overwrite.less
│ │ │ ├── base.bootstrap.less
│ │ │ ├── extend.animations.less
│ │ │ ├── extend.plugins.less
│ │ │ ├── icons.fontawesome.less
│ │ │ ├── icons.simplelineicons.less
│ │ │ ├── oneui.blocks.less
│ │ │ ├── oneui.forms.less
│ │ │ ├── oneui.images.less
│ │ │ ├── oneui.layout.less
│ │ │ ├── oneui.lists.less
│ │ │ ├── oneui.navigation.less
│ │ │ ├── oneui.print.less
│ │ │ ├── oneui.themes.less
│ │ │ └── oneui.utilities.less
│ │ ├── themes/
│ │ │ ├── amethyst.less
│ │ │ ├── city.less
│ │ │ ├── flat.less
│ │ │ ├── modern.less
│ │ │ └── smooth.less
│ │ └── variables.less
│ ├── templates/
│ │ ├── add_leakinfo.html
│ │ ├── add_task.html
│ │ ├── base.html
│ │ ├── detail.html
│ │ ├── leakinfo.html
│ │ ├── policy.html
│ │ └── scanner.html
│ ├── util.py
│ └── views/
│ ├── __init__.py
│ ├── login.py
│ └── webscan.py
├── config.py
├── manage.py
└── requirements.txt
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
#env/
#bin/
build/
develop-eggs/
dist/
eggs/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
#test
temp/
output/
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
nosetests.xml
coverage.xml
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Rope
.ropeproject
# Django stuff:
*.log
*.pot
# Sphinx documentation
#docs/_build/
# CTag
.tags*
# mac
.DS_Store
#pycharm
.idea/
#policy
scanpolicy/
#plugins
plugins/
================================================
FILE: README.md
================================================

What's lalascan?
===================================
Web vulnerability scanner framework
Basic usage
===================================
```
_ _
| | __ _| | __ _ ___ ___ __ _ _ __
| | / _` | |/ _` / __|/ __/ _` | '_ \
| |__| (_| | | (_| \__ \ (_| (_| | | | |
|_____\__,_|_|\__,_|___/\___\__,_|_| |_|
LalaScan WebApplication vul scanner!
usage:
optional arguments:
-h, --help Show help message and exit
--version Show program's version number and exit
[ Targets ]:
-u URL, --url URL Target URL (e.g. "http://www.lalascan.com/")
-t PROCESS_NUM, --threads PROCESS_NUM
max number of process, default cpu number
[ Resource Found ]:
-S, --spider Enable user Spider
[ Plugin Option ]:
-e PLUGIN, --enable-plugin PLUGIN
enable a plugin
[ Request Option ]:
--data POST DATA HTTP Post data
--cookie COOKIE HTTP Cookie header value
--referer REFERER HTTP Referer header value
--user-agent AGENT HTTP User-Agent header value
--random-agent Use randomly selected HTTP User-Agent header value
--proxy PROXY Use a proxy to connect to the target URL
--timeout TIMEOUT Seconds to wait before timeout connection (default 30)
--retry RETRY Time out retrials times.
```
###正在开发中........
================================================
FILE: bin/__init__.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
================================================
FILE: cache/__init__.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
================================================
FILE: cache/leakinfo.json
================================================
{"sqli":
{"risk_level": 4,
"description": "\u6076\u610f\u7528\u6237\u53ef\u4ee5\u5229\u7528\u8be5\u6f0f\u6d1e\u6267\u884c\u4efb\u610fSQL\u8bed\u53e5,\u53ef\u4ee5\u9020\u6210\u5982\u4e0b\u5371\u5bb3\uff1a\u672a\u7ecf\u8fc7\u6388\u6743\u64cd\u4f5c\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e,\u6076\u610f\u7be1\u6539\u6570\u636e\u5e93\u5185\u5bb9,\u6dfb\u52a0\u7cfb\u7edf\u5e10\u53f7\u6216\u6570\u636e\u5e93\u5e10\u53f7\uff0c\u8fdb\u884c\u63d0\u6743\uff0c\u8fdb\u800c\u5bfc\u81f4\u7f51\u7ad9\u670d\u52a1\u5668\u88ab\u5165\u4fb5",
"leak_name": "sqli",
"fix_content": "",
"id": 1,
"spt_id": 1,
"leak_name_cn": "SQL\u6ce8\u5165"
},
"any_file_read":
{"risk_level": 4,
"description": "\u6cc4\u6f0f\u670d\u52a1\u5668\u4e0a\u7684\u4efb\u610f\u6587\u4ef6\u5185\u5bb9\uff0c\u66b4\u9732web\u670d\u52a1\u5668\u7684\u6587\u4ef6\u7cfb\u7edf\u7ed3\u6784\u548c\u5185\u5bb9\uff0c\u53ef\u5bfc\u81f4\u7f51\u7ad9\u670d\u52a1\u5668\u88ab\u5165\u4fb5",
"leak_name": "any_file_read",
"fix_content": "",
"id": 4,
"spt_id": 1,
"leak_name_cn": "\u4efb\u610f\u6587\u4ef6\u8bfb\u53d6"
},
"reflect_xss":
{"risk_level": 3,
"description": "\u5ba2\u53ef\u4ee5\u5229\u7528\u8be5\u6f0f\u6d1e\u6267\u884c\u4efb\u610fHTML/JS\u4ee3\u7801\uff0c\u53ef\u5bfc\u81f4\u5982\u4e0b\u5371\u5bb3\uff1a\u7a83\u53d6\u7528\u6237cookie\u4fe1\u606f\uff0c\u4f20\u64ad\u8815\u866b\u7b49",
"leak_name": "reflect_xss",
"fix_content": "",
"id": 2,
"spt_id" : 1,
"leak_name_cn": "\u53cd\u5c04-XSS"
},
"dom_xss":
{"risk_level": 3,
"description": "\u5ba2\u53ef\u4ee5\u5229\u7528\u8be5\u6f0f\u6d1e\u6267\u884c\u4efb\u610fHTML/JS\u4ee3\u7801\uff0c\u53ef\u5bfc\u81f4\u5982\u4e0b\u5371\u5bb3\uff1a\u7a83\u53d6\u7528\u6237cookie\u4fe1\u606f\uff0c\u4f20\u64ad\u8815\u866b\u7b49",
"leak_name": "dom_xss",
"fix_content": "",
"id": 3,
"spt_id" : 1,
"leak_name_cn": "DOM-XSS"
},
"cmd_inject":
{"risk_level": 4,
"description": "\u6267\u884c\u4efb\u610f\u7cfb\u7edf\u547d\u4ee4,\u4f8b\u5982systerm(),eval(),exec()\u7b49\u547d\u4ee4\uff0c\u53ef\u4ee5\u5bfc\u81f4\u7f51\u7ad9\u670d\u52a1\u5668\u88ab\u5165\u4fb5",
"leak_name": "cmd_inject",
"fix_content": "",
"id": 5,
"spt_id" : 1,
"leak_name_cn": "\u547d\u4ee4\u6ce8\u5165"}
}
================================================
FILE: conf.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
import os
import sys
import sys
dirname_path_func = os.path.dirname
abspath_path_func = os.path.abspath
join_path_func = os.path.join
BASEDIR = os.path.dirname(__file__)
LIBDIR = BASEDIR + '/lib'
PLUGINDIR = BASEDIR + '/plugins'
CACHEDIR = BASEDIR + '/cache'
CACHELOG = CACHEDIR + '/scanlog'
# system path
if BASEDIR not in sys.path:
sys.path.append(BASEDIR)
if LIBDIR not in sys.path:
sys.path.append(LIBDIR)
if PLUGINDIR not in sys.path:
sys.path.append(PLUGINDIR)
#mysql config
DB_MYSQL_HOST = 'localhost'
DB_MYSQL_USER = 'root'
DB_MYSQL_PWD = ''
DB_MYSQL_PORT = 3306
DB_MYSQL_DATABASE = 'lalascan'
#webvul leakinfo
LEAK_JSON_FILE = 'leakinfo.json'
================================================
FILE: lalascan/__init__.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
================================================
FILE: lalascan/api/__init__.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
================================================
FILE: lalascan/api/exception.py
================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Exception Base class
"""
__all__ = ["LalascanBaseException",
"LalascanDataException",
"LalascanSystemException",
"LalascanThreadException",
"LalascanNetworkException",
"LalascanNetworkOutOfScope",
"LalascanNotImplementedError",
"LalascanAttributeError",
"LalascanTypeError",
"LalascanValueError",
"LalascanFileNotFoundException"]
class LalascanBaseException(Exception):
pass
class LalascanDataException(LalascanBaseException):
pass
class LalascanSystemException(LalascanBaseException):
pass
class LalascanThreadException(LalascanBaseException):
pass
class LalascanNetworkException(LalascanBaseException):
"""
Network connection errors.
"""
pass
#------------------------------------------------------------------------------
class LalascanNetworkOutOfScope(LalascanNetworkException):
"""
Resource is out of audit scope.
"""
pass
class LalascanNotImplementedError(NotImplementedError):
pass
class LalascanAttributeError(AttributeError):
pass
class LalascanTypeError(TypeError):
pass
class LalascanValueError(ValueError):
pass
class LalascanFileNotFoundException(LalascanBaseException):
pass
================================================
FILE: lalascan/api/option.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
from lalascan.models.auditdb import AuditMysqlDB
from lalascan.utils.mytime import MyTime
from conf import CACHEDIR, LEAK_JSON_FILE, join_path_func
import json
import copy
def generate_leak_info():
with AuditMysqlDB() as auditdb:
leak_json = {}
all_leak_data = auditdb.get_alldata(audit_table = "webvul_leak_info")
for _ in all_leak_data:
s = copy.copy(_).pop('leak_name')
leak_json[s] = _
with open(join_path_func(CACHEDIR, LEAK_JSON_FILE), 'w') as f:
f.write(json.dumps(leak_json))
def generate_vul_policy():
with AuditMysqlDB() as auditdb:
pass
def _sava_policy2db():
with AuditMysqlDB() as auditdb:
from scanpolicy.policy import ALL_LIST
for _ in ALL_LIST:
test_case_module = "from scanpolicy.policy import %s" % _
exec test_case_module
try:
module = eval(_)
for test_case in module:
test_case.pop('case_id')
new_test_case = {}
new_test_case['spt_id'] = 1
new_test_case['sli_id'] = 2
new_test_case['policy_name'] = _.replace('_detect_test_cases', '')
new_test_case['content'] = str(test_case)
new_test_case['insert_time'] = MyTime.get_current_datetime()
new_test_case['update_time'] = MyTime.get_current_datetime()
auditdb().insert_by_dict('scan_leak_policy', new_test_case)
except Exception,e:
print str(e)
print 'error'
================================================
FILE: lalascan/api/proxycrawl.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
================================================
FILE: lalascan/cache/__init__.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
================================================
FILE: lalascan/data/__init__.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
__all__ = [
# Base class for all data objects.
"Data",
]
#------------------------------------------------------------------------------
class Data(object):
"""
Base class for all data entities.
This is the common interface for Information, Resource and Vulnerability.
"""
#--------------------------------------------------------------------------
# Data types
TYPE_UNKNOWN = 0 # not a real type! only used in get_accepted_types()
TYPE_INFORMATION = 1
TYPE_VULNERABILITY = 2
TYPE_RESOURCE = 3
data_type = TYPE_UNKNOWN
#--------------------------------------------------------------------------
def __init__(self):
pass
def is_instance(self, clazz):
try:
data_type = clazz.data_type
data_subtype = clazz.data_subtype
except AttributeError:
return False
return self.data_type == data_type and \
self.data_subtype == data_subtype
================================================
FILE: lalascan/data/datatype.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
import copy
import types
from lalascan.api.exception import LalascanDataException
class AttribDict(dict):
"""
>>> foo = AttribDict()
>>> foo.bar = 1
>>> foo.bar
1
"""
def __init__(self, indict=None, attribute=None):
if indict is None:
indict = {}
# Set any attributes here - before initialisation
# these remain as normal attributes
self.attribute = attribute
dict.__init__(self, indict)
self.__initialised = True
# After initialisation, setting attributes
# is the same as setting an item
def __getattr__(self, item):
"""
Maps values to attributes
Only called if there *is NOT* an attribute with this name
"""
try:
return self.__getitem__(item)
except KeyError:
raise LalascanDataException("unable to access item '%s'" % item)
def __setattr__(self, item, value):
"""
Maps attributes to values
Only if we are initialised
"""
# This test allows attributes to be set in the __init__ method
if "_AttribDict__initialised" not in self.__dict__:
return dict.__setattr__(self, item, value)
# Any normal attributes are handled normally
elif item in self.__dict__:
dict.__setattr__(self, item, value)
else:
self.__setitem__(item, value)
def __getstate__(self):
return self.__dict__
def __setstate__(self, dict):
self.__dict__ = dict
def __deepcopy__(self, memo):
retVal = self.__class__()
memo[id(self)] = retVal
for attr in dir(self):
if not attr.startswith('_'):
value = getattr(self, attr)
if not isinstance(value, (types.BuiltinFunctionType, types.FunctionType, types.MethodType)):
setattr(retVal, attr, copy.deepcopy(value, memo))
for key, value in self.items():
retVal.__setitem__(key, copy.deepcopy(value, memo))
return retVal
================================================
FILE: lalascan/data/enum.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
class CUSTOM_LOGGING:
SYSINFO = 9
SUCCESS = 8
ERROR = 7
WARNING = 6
class RISK_LEVEL:
HIGH = u'High'
MIDDLE = u'Middle'
LOW = u'Low'
INFO = u'Info'
================================================
FILE: lalascan/data/http.py
================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
HTTP requests and responses.
"""
__all__ = ["HTTP_Request", "HTTP_Response"]
from lalascan.data.information import Capture
from lalascan.utils.text_utils import to_utf8
from lalascan.libs.net.web_utils import ParsedURL, generate_user_agent
from lalascan.libs.core.globaldata import conf
import re
import httplib
#------------------------------------------------------------------------------
class HTTP_Headers (object):
"""
HTTP headers.
Unlike other methods of storing HTTP headers in Python this class preserves
the original order of the headers, doesn't remove duplicated headers,
preserves the original case but still letting your access them in a
case-insensitive manner, and is read-only.
Also see: parse_headers
"""
# Also see: https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
#--------------------------------------------------------------------------
def __init__(self, raw_headers):
"""
:param raw_headers: Raw headers to parse.
:type raw_headers: str
"""
self.__raw_headers = to_utf8(raw_headers)
self.__headers, self.__cache = self.parse_headers(raw_headers)
#--------------------------------------------------------------------------
@staticmethod
def from_items(items):
"""
Get HTTP headers in pre-parsed form.
This is useful for integrating with other libraries that have
already parsed the HTTP headers in their own way.
:param items: Iterable of key/value pairs.
:type items: iterable( tuple(str, str) )
"""
# Reconstruct the raw headers the best we can.
# reconstructed = [
# "%s: %s" % (to_utf8(name),
# (to_utf8(value)
# if value.endswith("\r\n")
# else value + "\r\n")
# )
# for name, value in items
# ]
reconstructed = []
for name,value in items:
# because the cookie type is a dict
if name == 'Cookie':
value=";".join(["%s=%s" %
(k,v) for k,v in value.items() ] )
if not value.endswith("\r\n"):
value = value + "\r\n"
reconstructed.append("%s: %s" %
(to_utf8(name),to_utf8(value)))
reconstructed.append("\r\n")
raw_headers = "".join(reconstructed)
# Return an HTTP_Headers object using the reconstructed raw headers.
return HTTP_Headers(raw_headers)
#--------------------------------------------------------------------------
@staticmethod
def parse_headers(raw_headers):
"""
Parse HTTP headers.
:param raw_headers: Raw headers to parse.
:type raw_headers: str
:returns: Parsed headers in original and simplified forms.
:rtype: tuple( tuple(tuple(str, str)), dict(str -> str) )
"""
# Split the headers into lines and parse each line.
original = []
parsed = {}
last_name = None
for line in to_utf8(raw_headers).split("\r\n"):
# If we find an empty line, stop processing.
if not line:
break
# If the line begins with whitespace, it's a continuation.
if line[0] in " \t":
if last_name is None:
break # broken headers
line = line.strip()
parsed[last_name] += " " + line
item = original[-1]
item = (item[0], item[1] + " " + line)
original[-1] = item
continue # next line
# Split the name and value pairs.
name, value = line.split(":", 1)
# Strip the leading and trailing whitespace.
name = name.strip()
value = value.strip()
# Convert the name to lowercase.
name_lower = name.lower()
# Remember the last name we've seen.
last_name = name_lower
# Add the headers to the parsed form.
# If the name already exists, merge the headers.
# If not, add a new one.
if name_lower in parsed:
parsed[name_lower] += ", " + value
else:
parsed[name_lower] = value
# Add the headers to the original form.
original.append( (name, value) )
# Convert the original headers list into a tuple to make it
# read-only, then return the tuple and the dictionary.
return tuple(original), parsed
#--------------------------------------------------------------------------
def __str__(self):
return self.__raw_headers
#--------------------------------------------------------------------------
def get_headers(self):
return str(self.__raw_headers)
#--------------------------------------------------------------------------
def __repr__(self):
return "<%s headers=%r>" % (self.__class__.__name__, self.__headers)
#--------------------------------------------------------------------------
def to_tuple(self):
"""
Convert the headers to Python tuples of strings.
:returns: Headers.
:rtype: tuple( tuple(str, str) )
"""
# Immutable object, we can return it directly.
return self.__headers
#--------------------------------------------------------------------------
def to_dict(self):
"""
Convert the headers to a Python dictionary.
:returns: Headers.
:rtype: dict(str -> str)
"""
# Mutable object, we need to make a new one.
return dict(self.to_tuple())
#--------------------------------------------------------------------------
def __iter__(self):
"""
When iterated, whole header lines are returned.
To iterate header names and values use iterkeys(), itervalues()
or iteritems().
:returns: Iterator of header lines.
:rtype: iter(str)
"""
return ("%s: %s\r\n" % item for item in self.__headers)
#--------------------------------------------------------------------------
def iteritems(self):
"""
When iterating, the original case and order of the headers
is preserved. This means some headers may be repeated.
:returns: Iterator of header names and values.
:rtype: iter( tuple(str, str) )
"""
return self.__headers.__iter__()
#--------------------------------------------------------------------------
def iterkeys(self):
"""
When iterating, the original case and order of the headers
is preserved. This means some headers may be repeated.
:returns: Iterator of header names.
:rtype: iter(str)
"""
return (name for name, _ in self.__headers)
#--------------------------------------------------------------------------
def itervalues(self):
"""
When iterating, the original case and order of the headers
is preserved. This means some headers may be repeated.
:returns: Iterator of header values.
:rtype: iter(str)
"""
return (value for _, value in self.__headers)
#--------------------------------------------------------------------------
def __getitem__(self, key):
"""
The [] operator works both for index lookups and key lookups.
When provided with an index, the whole header line is returned.
When provided with a header name, the value is looked up.
Only the first header of that name is returned. Comparisons
are case-insensitive.
:param key: Index or header name.
:type key: int | str
:returns: Header line (for indices) or value (for names).
:rtype: str
"""
if type(key) in (int, long):
return "%s: %s\r\n" % self.__headers[key]
try:
key = key.lower()
except AttributeError:
raise TypeError("Expected str, got %s" % type(key))
return self.__cache[key]
#--------------------------------------------------------------------------
def get(self, name, default = None):
"""
Get a header by name.
Comparisons are case-insensitive. When more than one header has
the requested name, only the first one is returned.
:param name: Header name.
:type name: str
:returns: Header value.
:rtype: str
"""
try:
name = to_utf8(name)
if ":" in name:
name = name.split(":", 1)[0]
name = name.strip().lower()
except AttributeError:
raise TypeError("Expected str, got %s" % type(name))
try:
return self.__cache[name]
except KeyError:
return default
#--------------------------------------------------------------------------
def __getslice__(self, start = None, end = None):
"""
When sliced, whole header lines are returned in a single string.
:param start: Start of the slice.
:type start: int | None
:param end: End of the slice.
:type end: int | None
:returns: The requested header lines merged into a single string.
:rtype: str
"""
return "".join(
"%s: %s\r\n" % item
for item in self.__headers[start:end]
)
#--------------------------------------------------------------------------
def has_key(self, name):
"""
Test the presence of a header.
Comparisons are case-insensitive.
:param name: Header name.
:type name: str
:returns: True if present, False otherwise.
:rtype: bool
"""
try:
name = to_utf8(name)
if ":" in name:
name = name.split(":", 1)[0]
name = name.strip().lower()
except AttributeError:
raise TypeError("Expected str, got %s" % type(name))
return name in self.__cache
# Alias.
__contains__ = has_key
#--------------------------------------------------------------------------
def items(self):
"""
The original case and order of the headers is preserved.
This means some headers may be repeated.
:returns: Header names and values.
:rtype: list( tuple(str, str) )
"""
return list(self.iteritems())
#--------------------------------------------------------------------------
def keys(self):
"""
The original case and order of the headers is preserved.
This means some headers may be repeated.
:returns: Header names.
:rtype: list(str)
"""
return list(self.iterkeys())
#--------------------------------------------------------------------------
def values(self):
"""
The original case and order of the headers is preserved.
This means some headers may be repeated.
:returns: Header values.
:rtype: list(str)
"""
return list(self.itervalues())
#------------------------------------------------------------------------------
class HTTP_Request (Capture):
"""
HTTP request information.
"""
data_subtype = "http_request"
#
# TODO:
# + Allow multipart file uploads.
# + Parse and reconstruct requests as it's done with responses.
# It may be useful one day, for example, for HTTP proxying.
#
# Default user agent string.
DEFAULT_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36 luscan"
# Default headers to use in HTTP requests.
DEFAULT_HEADERS = (
("Accept-Language", "en-US"),
("Accept", "*/*"),
("Cache-Control", "no-store"),
("Pragma", "no-cache"),
("Expires", "0"),
("Connection", "Close")
)
#--------------------------------------------------------------------------
def __init__(self, url, headers = None, post_data = None, method = None, protocol = "HTTP", version = "1.1", referer = None, user_agent = None):
"""
:param url: Absolute URL to connect to.
:type url: str
:param headers: HTTP headers, in raw or parsed form.
Defaults to DEFAULT_HEADERS.
:type headers: HTTP_Headers | dict(str -> str) | tuple( tuple(str, str) ) | str | None
:param post_data: Optional POST data.
If used, the Content-Type and Content-Length headers are populated automatically,
unless already present in "headers".
:type post_data: str | None
:param method: HTTP method.
Defaults to POST if post_data is used, or to GET if no post_data is used.
:type method: str
:param protocol: Protocol name.
:type protocol: str
:param version: Protocol version.
:type version: str
:param referer: Optional referer. Ignored if already present in "headers".
:type referer: str
:param user_agent: Optional user-agent string. Ignored if already present in "headers".
Defaults to DEFAULT_USER_AGENT.
:type user_agent: str | None
"""
# Default method.
if not method:
method = "POST" if post_data else "GET"
# HTTP method, protocol and version.
self.__method = to_utf8(method.upper()) # Not sure about upper() here...
self.__protocol = to_utf8(protocol.upper()) # Not sure about upper() here...
self.__version = to_utf8(version)
# POST data.
self.__post_data = post_data
# URL.
self.__parsed_url = ParsedURL(url)
self.__url = self.__parsed_url.url
# Cookie header value.
try:
if conf is not None and conf.has_key('cookie'):
cookie = conf.cookie
else:
cookie = None
except Exception:
cookie = None
# User-Agent header value.
if user_agent:
if user_agent.lower() == "random":
user_agent = generate_user_agent()
else:
user_agent = to_utf8(user_agent)
else:
user_agent = self.DEFAULT_USER_AGENT
# Referer header value.
if referer:
referer = to_utf8(referer)
else:
referer = None
# HTTP headers.
if headers is None:
headers = self.DEFAULT_HEADERS
if version == "1.1":
headers = (("Host", self.__parsed_url.host),) + headers
if post_data:
headers = headers + (("Content-Type", "application/x-www-form-urlencoded"),
("Content-Length", str(len(post_data))))
if cookie:
headers = headers + (("Cookie", cookie),)
if referer:
headers = headers + (("Referer", referer),)
if user_agent:
headers = headers + (("User-Agent", user_agent),)
headers = headers + (("Connection" , "close"),) #ADD By BlackYe. Deal Caused by NewConnectionError
headers = HTTP_Headers.from_items(headers)
elif not isinstance(headers, HTTP_Headers):
headers = to_utf8(headers)
if type(headers) == str: # raw headers
headers = HTTP_Headers(headers)
elif hasattr(headers, "items"): # dictionary
headers = HTTP_Headers.from_items(sorted(headers.items()))
else: # dictionary items
headers = HTTP_Headers.from_items(sorted(headers))
if cookie or referer or user_agent:
headers = headers.to_tuple()
if cookie and not any(x[0].lower() == "cookie" for x in headers):
headers = headers + (("Cookie", cookie),)
if referer and not any(x[0].lower() == "referer" for x in headers):
headers = headers + (("Referer", referer),)
if user_agent and not any(x[0].lower() == "user-agent" for x in headers):
headers = headers + (("User-Agent", user_agent),)
headers = HTTP_Headers.from_items(headers)
self.__headers = headers
# Call the parent constructor.
super(HTTP_Request, self).__init__()
##--------------------------------------------------------------------------
#@staticmethod
#def from_form(form, data):
#"""
#Get the HTTP request needed to send form data.
#:param form: HTML form.
#:type form: Form
#:param data: Mapping of key/value pairs.
#:type data: dict(str -> str)
#:returns: HTTP request ready to send the form data.
#:rtype: HTTP_Request
#"""
#if set(form.parameters) != set(data.keys()):
#raise ValueError("Form data doesn't match form parameters")
#return HTTP_Request(url = form.url,
#method = form.method,
#post_data = data)
#--------------------------------------------------------------------------
@property
def method(self):
"""
:returns: HTTP method.
:rtype: str
"""
return self.__method
@property
def url(self):
"""
:returns: URL.
:rtype: str
"""
return self.__url
@property
def protocol(self):
"""
:returns: Protocol name.
:rtype: str
"""
return self.__protocol
@property
def version(self):
"""
:returns: Protocol version.
:rtype: str
"""
return self.__version
@property
def headers(self):
"""
:return: HTTP headers.
:rtype: HTTP_Headers
"""
return self.__headers
@property
def post_data(self):
"""
:return: POST data.
:rtype: str | None
"""
return self.__post_data
#--------------------------------------------------------------------------
@property
def parsed_url(self):
"""
:returns: URL split to its components.
:rtype: ParsedURL
"""
return self.__parsed_url
@property
def request_uri(self):
"""
:return: Request URI.
:rtype: str
"""
return self.__parsed_url.request_uri
@property
def hostname(self):
"""
:return: 'Host' HTTP header.
:rtype: str | None
"""
return self.__headers.get('Host')
@property
def user_agent(self):
"""
:return: 'User-Agent' HTTP header.
:rtype: str | None
"""
return self.__headers.get('User-Agent')
@user_agent.setter
def user_agent(self, user_agent):
"""
Set 'User-Agent' HTTP header.
:param user_agent: String with the user agent
:type user_agent: str
"""
self.__headers['User-Agent'] = user_agent
@property
def accept_language(self):
"""
:return: 'Accept-Language' HTTP header.
:rtype: str | None
"""
return self.__headers.get('Accept-Language')
@property
def accept(self):
"""
:return: 'Accept' HTTP header.
:rtype: str | None
"""
return self.__headers.get('Accept')
@property
def referer(self):
"""
:return: 'Referer' HTTP header.
:rtype: str
"""
return self.__headers.get('Referer')
@property
def cookie(self):
"""
:return: 'Cookie' HTTP header.
:rtype: str | None
"""
return self.__headers.get('Cookie')
@property
def content_type(self):
"""
:return: 'Content-Type' HTTP header.
:rtype: str | None
"""
return self.__headers.get('Content-Type')
@property
def content_length(self):
"""
:return: 'Content-Length' HTTP header.
:rtype: int | None
"""
try:
return int(self.__headers.get('Content-Length'))
except Exception:
pass
#------------------------------------------------------------------------------
class HTTP_Raw_Request (Capture):
"""
Raw HTTP request information.
"""
data_subtype = "http_raw_request"
#--------------------------------------------------------------------------
def __init__(self, raw_request):
"""
:param raw_request: Raw HTTP request.
:type raw_request: str
"""
self.__raw_request = to_utf8(raw_request)
super(HTTP_Raw_Request, self).__init__()
#--------------------------------------------------------------------------
@property
def raw_request(self):
"""
:returns: Raw HTTP request.
:rtype: str
"""
return self.__raw_request
#------------------------------------------------------------------------------
class HTTP_Response (Capture):
"""
HTTP response information.
Typically plugins don't directly instance these objects,
but receive them from the HTTP API.
"""
data_subtype = "http_response"
min_informations = 1
#--------------------------------------------------------------------------
def __init__(self, request, **kwargs):
"""
All optional arguments must be passed as keywords.
:param request: HTTP request that originated this response.
:type request: HTTP_Request | HTTP_Raw_Request
:param raw_response: (Optional) Raw bytes received from the server.
:type raw_response: str
:param status: (Optional) HTTP status code. Defaults to "200".
:type status: str
:param reason: (Optional) HTTP reason message.
:type reason: str
:param protocol: (Optional) Protocol name. Defaults to "HTTP".
:type protocol: str
:param version: (Optional) Protocol version. Defaults to "1.1".
:type version: str
:param raw_headers: (Optional) Raw HTTP headers.
:type raw_headers: str
:param headers: (Optional) Parsed HTTP headers.
:type headers: HTTP_Headers | dict(str -> str) | tuple( tuple(str, str) )
:param data: (Optional) Raw data that followed the response headers.
:type data: str
:param elapsed: (Optional) Time elapsed in milliseconds since the request
was sent until the response was received.
:type elapsed: int
"""
# Initialize everything.
self.__request = request
self.__raw_response = None
self.__raw_headers = None
self.__status = None
self.__reason = None
self.__protocol = getattr(request, "protocol", "HTTP")
self.__version = getattr(request, "version", "1.1")
self.__headers = None
self.__data = None
self.__elapsed = None
# Raw response bytes.
self.__raw_response = kwargs.get("raw_response", None)
if self.__raw_response:
self.__parse_raw_response(request)
# Status line.
self.__status = to_utf8( kwargs.get("status", self.__status) )
self.__reason = to_utf8( kwargs.get("reason", self.__reason) )
self.__protocol = to_utf8( kwargs.get("protocol", self.__protocol) )
self.__version = to_utf8( kwargs.get("version", self.__version) )
if self.__status and not self.__reason:
try:
self.__reason = httplib.responses[self.__status]
except Exception:
pass
elif not self.__status and self.__reason:
lower_reason = self.__reason.strip().lower()
for code, text in httplib.responses.iteritems():
if text.lower() == lower_reason:
self.__status = str(code)
break
elif not self.__status:
self.__status = "200"
self.__reason = "OK"
# HTTP headers.
self.__raw_headers = to_utf8( kwargs.get("raw_headers", self.__raw_headers) )
self.__headers = kwargs.get("headers", self.__headers)
if self.__headers:
if not isinstance(self.__headers, HTTP_Headers):
if hasattr(self.__headers, "items"):
self.__headers = HTTP_Headers.from_items(sorted(self.__headers.items()))
else:
self.__headers = HTTP_Headers.from_items(sorted(self.__headers))
if not self.__raw_headers:
self.__reconstruct_raw_headers()
elif self.__raw_headers and not self.__headers:
self.__parse_raw_headers()
# Data.
self.__data = to_utf8( kwargs.get("data", self.__data) )
# Reconstruct the raw response if needed.
if not self.__raw_response:
self.__reconstruct_raw_response()
# Response time.
self.elapsed = kwargs.get("elapsed", None)
# Call the parent constructor.
super(HTTP_Response, self).__init__()
# Link this response to the request that originated it.
#self.add_link(request)
#--------------------------------------------------------------------------
'''
@keep_newer # TODO: maybe the times should be collected and/or averaged instead?
'''
@property
def elapsed(self):
"""
:returns: Time elapsed in seconds since the request was sent
until the response was received. None if not available.
:rtype: float | None
"""
return self.__elapsed
@elapsed.setter
def elapsed(self, elapsed):
"""
:param elapsed: Time elapsed in seconds since the request was
sent until the response was received. None if not available.
:type elapsed: float | None
"""
self.__elapsed = float(elapsed) if elapsed is not None else None
#--------------------------------------------------------------------------
@property
def raw_response(self):
"""
:returns: Raw HTTP response.
:rtype: str | None
"""
return self.__raw_response
#--------------------------------------------------------------------------
@property
def status(self):
"""
:returns: HTTP status code.
:rtype: str | None
"""
return self.__status
@property
def reason(self):
"""
:returns: HTTP reason message.
:rtype: str | None
"""
return self.__reason
@property
def protocol(self):
"""
:returns: Protocol name.
:rtype: str | None
"""
return self.__protocol
@property
def version(self):
"""
:returns: Protocol version.
:rtype: str | None
"""
return self.__version
@property
def headers(self):
"""
:return: HTTP headers.
:rtype: dict(str -> str) | None
"""
return self.__headers
@property
def raw_headers(self):
"""
:returns: HTTP method used for this request.
:rtype: str | None
"""
return self.__raw_headers
@property
def data(self):
"""
:return: Response data.
:rtype: str | None
"""
return self.__data
@property
def content_length(self):
"""
:return: 'Content-Length' HTTP header.
:rtype: int | None
"""
try:
return int(self.__headers.get('Content-Length'))
except Exception:
pass
@property
def content_type(self):
"""
:return: 'Content-Type' HTTP header.
:rtype: str | None
"""
return self.__headers.get('Content-Type')
@property
def content_disposition(self):
"""
:return: 'Content-Disposition' HTTP header.
:rtype: str | None
"""
if self.__headers:
return self.__headers.get('Content-Disposition')
@property
def transport_encoding(self):
"""
:return: 'Transport-Encoding' HTTP header.
:rtype: str | None
"""
if self.__headers:
return self.__headers.get('Transport-Encoding')
@property
def cookie(self):
"""
:return: 'Set-Cookie' HTTP header.
:rtype: str | None
"""
if self.__headers:
return self.__headers.get('Set-Cookie')
set_cookie = cookie
@property
def server(self):
"""
:return: 'Server' HTTP header.
:rtype: str | None
"""
if self.__headers:
return self.__headers.get('Server')
#--------------------------------------------------------------------------
def __parse_raw_response(self, request):
# Special case: if parsing HTTP/0.9, everything is data.
if getattr(request, "version", None) == "0.9":
self.__protocol = "HTTP"
self.__version = "0.9"
self.__status = "200"
self.__reason = httplib.responses[200]
self.__data = self.__raw_response
return
# Split the response from the data.
response, data = self.__raw_response.split("\r\n\r\n", 1)
response = response + "\r\n\r\n"
# Split the response line from the headers.
raw_line, raw_headers = response.split("\r\n", 1)
# Split the response line into its components.
try:
proto_version, status, reason = re.split("[ \t]+", raw_line, 2)
except Exception:
proto_version, status = re.split("[ \t]+", raw_line, 1)
try:
reason = httplib.responses[int(status)]
except Exception:
reason = None
if "/" in proto_version:
protocol, version = proto_version.split("/")
else:
protocol = proto_version
version = None
# Set missing components to None.
if not status:
status = None
if not reason:
reason = None
if not protocol:
protocol = None
if not data:
data = None
# Store the components.
self.__protocol = protocol
self.__version = version
self.__status = status
self.__reason = reason
self.__raw_headers = raw_headers
self.__data = data
# Parse the raw headers.
self.__parse_raw_headers()
#--------------------------------------------------------------------------
def __reconstruct_raw_response(self):
# Special case: if parsing HTTP/0.9, everything is data.
if self.__version == "0.9":
self.__raw_response = self.__data
return
# FIXME: not sure how Requests handles content encoding,
# it may be possible to generate broken raw responses if
# the content is decoded automatically behind our backs
# Reconstruct the response line.
if self.__protocol and self.__version:
proto_ver = "%s/%s " % (self.__protocol, self.__version)
elif self.__protocol:
proto_ver = self.__protocol + " "
elif self.__version:
proto_ver = self.__version + " "
else:
proto_ver = ""
if self.__status and self.__reason:
status_line = "%s%s %s\r\n" % (proto_ver, self.__status, self.__reason)
elif self.__status:
status_line = "%s%s\r\n" % (proto_ver, self.__status)
elif self.__reason:
status_line = "%s%s\r\n" % (proto_ver, self.__reason)
# Reconstruct the headers.
raw_headers = self.__raw_headers
if not raw_headers:
if self.__headers:
self.__reconstruct_raw_headers()
raw_headers = self.__raw_headers
else:
raw_headers = ""
# Get the data if available.
if self.__data:
data = self.__data
else:
data = ""
# Store the reconstructed raw response.
self.__raw_response = "%s%s%s" % (status_line, raw_headers, data)
#--------------------------------------------------------------------------
def __parse_raw_headers(self):
self.__headers = HTTP_Headers(self.__raw_headers)
#--------------------------------------------------------------------------
def __reconstruct_raw_headers(self):
self.__raw_headers = str(self.__headers)
#add by blackye
@property
def raw_request(self):
return self.__request
================================================
FILE: lalascan/data/information/__init__.py
================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Information types.
"""
__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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""
__all__ = ["Information", "File", "Asset", "Capture", "Fingerprint"]
from .. import Data
#------------------------------------------------------------------------------
class Information(Data):
"""
Base class for informational results.
"""
# Categories of informational data.
CATEGORY_UNKNOWN = 0 # Not a real value!
CATEGORY_FILE = 1
CATEGORY_CAPTURE = 2
CATEGORY_FINGERPRINT = 3
data_type = Data.TYPE_INFORMATION
data_subtype = "information/abstract"
information_category = CATEGORY_UNKNOWN
#------------------------------------------------------------------------------
class File(Information):
"""
File Data: raw file contents.
"""
data_subtype = "information/abstract"
information_category = Information.CATEGORY_FILE
#------------------------------------------------------------------------------
class Capture(Information):
"""
Protocol captures: raw network protocol dumps.
"""
data_subtype = "information/abstract"
information_category = Information.CATEGORY_CAPTURE
#------------------------------------------------------------------------------
class Fingerprint(Information):
"""
Fingerprints: reconnaissance results.
"""
data_subtype = "information/abstract"
information_category = Information.CATEGORY_FINGERPRINT
================================================
FILE: lalascan/data/information/banner.py
================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Service banner.
"""
__all__ = ["Banner"]
from . import Fingerprint
from .. import identity
from ..resource.domain import Domain
from ..resource.ip import IP
from ...text.text_utils import to_utf8
from warnings import warn
#------------------------------------------------------------------------------
class Banner(Fingerprint):
"""
Service banner.
"""
min_resources = 1
#--------------------------------------------------------------------------
def __init__(self, host, banner, port):
"""
:param host: IP address or domain name where the banner was found.
:type host: IP | Domain
:param banner: Banner of the service.
:type banner: str
:param port: Port number of the service.
:type port: int
"""
# Sanitize the properties.
if not isinstance(host, IP) and not isinstance(host, Domain):
host = to_utf8(host)
if isinstance(host, basestring):
warn("Expected IP or Domain, got string instead",
RuntimeWarning)
try:
host = IP(host)
except Exception:
host = Domain(host)
else:
raise TypeError(
"Expected IP or Domain, got %r instead" % type(host))
banner = to_utf8(banner)
if type(banner) is not str:
raise TypeError("Expected str, got %r instead" % type(banner))
port = int(port)
if port <= 0 or port >= 65536:
raise ValueError("Invalid port number: %d" % port)
# Save the properties.
self.__banner = banner
self.__port = port
# Parent constructor.
super(Banner, self).__init__()
# Link the banner to the host.
host.add_information(self)
#--------------------------------------------------------------------------
@identity
def banner(self):
"""
:returns: Banner of the service.
:rtype: str
"""
return self.__banner
#--------------------------------------------------------------------------
@identity
def port(self):
"""
:returns: Port number of the service.
:type port: int
"""
return self.__port
#--------------------------------------------------------------------------
def get_ip_addresses(self):
"""
:returns: Set of IP addresses where this banner was found.
:rtype: set(str)
"""
return {
ip.address
for ip in self.get_associated_resources_by_category(
IP.data_subtype)
}
#--------------------------------------------------------------------------
def get_domains(self):
"""
:returns: Set of domains where this banner was found.
:rtype: set(str)
"""
return {
domain.name
for domain in self.get_associated_resources_by_category(
Domain.data_subtype)
}
#--------------------------------------------------------------------------
def get_hosts(self):
"""
:returns: Set of IP addresses and domains where this banner was found.
:rtype: set(str)
"""
s = self.get_ip_addresses()
s.update(self.get_domains())
return s
================================================
FILE: lalascan/data/information/html.py
================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
HTML document.
"""
__all__ = ["HTML"]
from lalascan.data.information import File
from lalascan.libs.net.web_utils import HTMLParser
from lalascan.utils.text_utils import to_utf8
#------------------------------------------------------------------------------
class HTML(File):
"""
HTML document.
This object contains all of relevant tags of a HTML document:
- title
- links
- forms
- images
- objects
- metas
- css_links
- css_embedded
- javascript_links
"""
#--------------------------------------------------------------------------
def __init__(self, data):
"""
:param data: Raw HTML content.
:type data: str
"""
# Raw HTML content
self.__raw_data = to_utf8(data)
# Parent constructor
super(HTML, self).__init__()
#--------------------------------------------------------------------------
@property
def display_name(self):
return "HTML Content"
#--------------------------------------------------------------------------
@property
def raw_data(self):
"""
:return: Raw HTML content.
:rtype: str
"""
return self.__raw_data
#--------------------------------------------------------------------------
@property
def elements(self):
"""
:return: All HTML elements.
:rtype: list(HTMLElement)
"""
return HTMLParser(self.raw_data).elements
#--------------------------------------------------------------------------
@property
def forms(self):
"""
:return: HTML form tags.
:rtype: list(HTMLElement)
"""
return HTMLParser(self.raw_data).forms
#--------------------------------------------------------------------------
@property
def images(self):
"""
:return: Image tags.
:rtype: list(HTMLElement)
"""
return HTMLParser(self.raw_data).images
#--------------------------------------------------------------------------
@property
def url_links(self):
"""
:return: Link tags.
:rtype: list(HTMLElement)
"""
return HTMLParser(self.raw_data).url_links
#--------------------------------------------------------------------------
@property
def css_links(self):
"""
:return: CSS links.
:rtype: list(HTMLElement)
"""
return HTMLParser(self.raw_data).css_links
#--------------------------------------------------------------------------
@property
def javascript_links(self):
"""
:return: JavaScript links.
:rtype: list(HTMLElement)
"""
return HTMLParser(self.raw_data).javascript_links
#--------------------------------------------------------------------------
@property
def css_embedded(self):
"""
:return: Embedded CSS.
:rtype: list(HTMLElement)
"""
return HTMLParser(self.raw_data).css_embedded
#--------------------------------------------------------------------------
@property
def javascript_embedded(self):
"""
:return: Embedded JavaScript.
:rtype: list(HTMLElement)
"""
return HTMLParser(self.raw_data).javascript_embedded
#--------------------------------------------------------------------------
@property
def metas(self):
"""
:return: Meta tags.
:rtype: list(HTMLElement)
"""
return HTMLParser(self.raw_data).metas
#--------------------------------------------------------------------------
@property
def title(self):
"""
:return: Document title.
:rtype: HTMLElement
"""
return HTMLParser(self.raw_data).title
#--------------------------------------------------------------------------
@property
def objects(self):
"""
:return: Object tags.
:rtype: list(HTMLElement)
"""
return HTMLParser(self.raw_data).objects
================================================
FILE: lalascan/data/information/portscan.py
================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Portscan results.
"""
__all__ = ["Portscan"]
from . import Fingerprint
from ..resource.ip import IP
from lalascan.api.exception import LalascanTypeError, LalascanValueError
#------------------------------------------------------------------------------
class PortScanFingerprint(Fingerprint):
"""
Portscan results.
"""
#--------------------------------------------------------------------------
def __init__(self, ip, ports):
"""
:param ip: Scanned host's IP address.
:type ip: IP
:param ports: Portscan results.
A set of tuples, each tuple containing the following data for
each scanned port: state, protocol, port. The state is a string
with one of the following values: "OPEN, "CLOSED" or "FILTERED".
The protocol is a string with one of the following values: "TCP"
or "UDP". The port is an integer from 0 to 65536, not included.
:type ports: set( tuple(int, str), ... )
"""
# Sanitize and store the properties.
try:
assert isinstance(ip, IP), type(ip)
self.__address = ip.address
sane = set()
visited = set()
for port, service in ports:
port = int(port)
service = str(service.upper())
if port <= 0 or port > 65535:
raise LalascanValueError("Invalid port number: %d" % port)
key = (port, service)
if key not in visited:
visited.add(key)
sane.add( (port, service) )
self.__ports = frozenset(sane)
except Exception:
##raise # XXX DEBUG
raise LalascanValueError("Malformed portscan results!")
# Call the superclass constructor.
super(PortScanFingerprint, self).__init__()
#--------------------------------------------------------------------------
@property
def address(self):
"""
:returns: Scanned host's IP address.
:rtype: str
"""
return self.__address
#--------------------------------------------------------------------------
@property
def ports(self):
"""
:returns: Portscan results.
A set of tuples, each tuple containing the following data for
each scanned port: service.
:rtype: frozenset( tuple(int, str), ... )
"""
return self.__ports
#--------------------------------------------------------------------------
def __repr__(self):
return "<%s name=%s port=%d service=%s" % (
self.__class__.__name__, self.name, self.port, self.protocol
)
#--------------------------------------------------------------------------
def __str__(self):
return "\n".join("%-8s %-3s %d" % p for p in sorted(self.ports))
#--------------------------------------------------------------------------
@property
def display_name(self):
return "Port Scan Results"
================================================
FILE: lalascan/data/information/webservice.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
from . import Fingerprint
from ...utils.text_utils import to_utf8
#------------------------------------------------------------------------------
class WebServiceFingerprint(Fingerprint):
"""
Fingerprint information for a particular host and web server.
"""
data_subtype = "webservice"
#--------------------------------------------------------------------------
def __init__(self, name, version, banner, canonical_name, related = None, others = None):
"""
:param name: Web server name. Example: "Apache".
:type name: str
:param version: Web server version. Example: "2.2.23".
:type version: str
:param banner: Web server banner. Example:
"Apache 2.2.23 ((Unix) mod_ssl/2.2.23 OpenSSL/1.0.1e-fips)".
:type banner: str
:param canonical_name: Web server name, in lowercase.
The name will be one of the file:
'wordlist/fingerprint/webservers_keywords.txt'.
Example: "apache".
:type canonical_name: str
:param related: Alternative brands for this web server.
:type related: set(str)
:param others: Map of other possible web servers by name and their probabilities of being correct [0.0 ~ 1.0].
:type others: dict( str -> float )
"""
# Sanitize the strings.
name = to_utf8(name)
version = to_utf8(version)
banner = to_utf8(banner)
canonical_name = to_utf8(canonical_name)
# Check the data types.
if not isinstance(name, str):
raise TypeError("Expected str, got %r instead" % type(name))
if not isinstance(version, str):
raise TypeError("Expected str, got %r instead" % type(version))
if not isinstance(banner, str):
raise TypeError("Expected str, got %r instead" % type(banner))
if not isinstance(canonical_name, str):
raise TypeError("Expected str, got %r instead" % type(canonical_name))
# Save the identity properties.
self.__name = name
self.__version = version
self.__banner = banner
self.__canonical_name = canonical_name
# Save the mergeable properties.
self.related = related
self.others = others
# Parent constructor.
super(WebServiceFingerprint, self).__init__()
#--------------------------------------------------------------------------
def __repr__(self):
return "<WebServerFingerprint server='%s-%s' banner='%s'>" % (
self.__name,
self.__version,
self.__banner,
)
#--------------------------------------------------------------------------
def __str__(self):
return self.__banner
#--------------------------------------------------------------------------
def to_dict(self):
d = super(WebServiceFingerprint, self).to_dict()
d["others"] = { k: list(v) for (k,v) in self.others.iteritems() }
return d
#--------------------------------------------------------------------------
@property
def display_properties(self):
others = []
for k in sorted(self.others.iterkeys()):
others.append("%s:" % k)
for v in sorted(self.others[k]):
others.append(" %s" % v)
props = super(WebServiceFingerprint, self).display_properties
props["[DEFAULT]"]["Others"] = "\n".join(others)
return props
#--------------------------------------------------------------------------
@identity
def name(self):
"""
:return: Web server name. Example: "Apache".
:rtype: str
"""
return self.__name
#--------------------------------------------------------------------------
@identity
def version(self):
"""
:return: Web server version. Example: "2.2.3".
:rtype: str
"""
return self.__version
#--------------------------------------------------------------------------
@identity
def banner(self):
"""
:return: Web server banner. Example:
"Apache 2.2.23 ((Unix) mod_ssl/2.2.23 OpenSSL/1.0.1e-fips)".
:rtype: str
"""
return self.__banner
#--------------------------------------------------------------------------
@identity
def canonical_name(self):
"""
:return: Web server name, in lowercase.
The full list of names is taken from the file:
'wordlist/fingerprint/webservers_keywords.txt'.
Example: "apache".
:rtype: str
"""
return self.__canonical_name
#--------------------------------------------------------------------------
@merge
def others(self):
"""
:return: Map of other possible web servers by name and their
probabilities of being correct [0.0 ~ 1.0].
:rtype: dict( str -> float )
"""
return self.__others
#--------------------------------------------------------------------------
@others.setter
def others(self, others):
"""
:param others: Map of other possible web servers by name and their
probabilities of being correct [0.0 ~ 1.0].
:type others: dict( str -> float )
"""
if others:
if not isinstance(others, dict):
raise TypeError("Expected dict, got %r instead" % type(others))
others = {
to_utf8(k): float(v)
for k,v in others.iteritems()
}
for k in others.iterkeys():
if not isinstance(k, str):
raise TypeError("Expected str, got %r instead" % type(k))
else:
others = {}
self.__others = others
#--------------------------------------------------------------------------
@merge
def related(self):
"""
:return: Alternative brands for this web server.
:rtype: set(str)
"""
return self.__related
#--------------------------------------------------------------------------
@related.setter
def related(self, related):
"""
:param related: Alternative brands for this web server.
:type related: set(str)
"""
if related:
if not isinstance(related, set):
raise TypeError("Expected set, got %r instead" % type(related))
related = { to_utf8(v) for v in related }
for v in related:
if not isinstance(v, str):
raise TypeError("Expected str, got %r instead" % type(v))
else:
related = {}
self.__related = related
================================================
FILE: lalascan/data/resource/__init__.py
================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Resource types.
"""
__all__ = ["Resource"]
from .. import Data
#------------------------------------------------------------------------------
class Resource(Data):
"""
Base class for resources.
"""
data_type = Data.TYPE_RESOURCE
data_subtype = "resource/abstract"
================================================
FILE: lalascan/data/resource/domain.py
================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Domain name.
"""
__all__ = ["Domain", "RootDomain"]
from . import Resource
from ...libs.net.web_utils import split_hostname
from ...utils.text_utils import to_utf8
from netaddr import IPAddress
import re
#------------------------------------------------------------------------------
class Domain(Resource):
"""
Domain name.
This data type maps the root domain names
to the IP addresses they resolve to.
"""
data_subtype = "domain"
_re_is_domain = re.compile(r"^[A-Za-z0-9][A-Za-z0-9\_\-\.]*[A-Za-z0-9]$")
#--------------------------------------------------------------------------
def __init__(self, hostname):
"""
:param hostname: Domain name.
:type hostname: str
"""
hostname = to_utf8(hostname)
if not isinstance(hostname, str):
raise TypeError(
"Expected string, got %r instead" % type(hostname))
if not hostname:
raise ValueError("Missing hostname")
# Check we've not confused an IP address for a hostname.
try:
if hostname.startswith("[") and hostname.endswith("]"):
IPAddress(hostname[1:-1], version=6)
else:
IPAddress(hostname)
except Exception:
pass
else:
raise ValueError(
"This is an IP address (%s) not a domain!" % hostname)
# Make sure the hostname is valid.
if not self._re_is_domain.match(hostname):
raise ValueError("Invalid domain name: %r" % hostname)
# Domain name.
self.__hostname = hostname
# Parent constructor.
super(Domain, self).__init__()
# Reset the crawling depth.
self.depth = 0
#--------------------------------------------------------------------------
def __str__(self):
return self.hostname
#--------------------------------------------------------------------------
def __repr__(self):
return "<Domain name=%r>" % self.hostname
#--------------------------------------------------------------------------
@property
def display_name(self):
return "Domain Name"
#--------------------------------------------------------------------------
@property
def hostname(self):
"""
:return: Domain name.
:rtype: str
"""
return self.__hostname
#--------------------------------------------------------------------------
@property
def root(self):
"""
:return: Root domain. i.e: www.mysite.com -> mysite.com
:rtype: str
"""
_, domain, suffix = split_hostname(self.hostname)
if suffix:
return "%s.%s" % (domain, suffix)
return domain
#--------------------------------------------------------------------------
@property
def discovered(self):
domain = self.hostname
result = [RootDomain(self.root)]
subdomain, domain, suffix = split_hostname(domain)
if subdomain:
prefix = ".".join( (domain, suffix) )
'''
for part in reversed(subdomain.split(".")):
if prefix in Config.audit_scope:
result.append( Domain(prefix) )
prefix = ".".join( (part, prefix) )
'''
return result
#------------------------------------------------------------------------------
class RootDomain(Domain):
"""
Root domain name.
This data type maps the domain names to the IP addresses they resolve to.
"""
data_subtype = "root_domain"
#--------------------------------------------------------------------------
def __init__(self, hostname):
# Parent constructor.
super(RootDomain, self).__init__(hostname)
# Make sure it's really a root domain.
if self.hostname != self.root:
raise ValueError(
"Domain %s is not a root domain" % self.hostname)
#--------------------------------------------------------------------------
def __repr__(self):
return "<Root Domain name=%r>" % self.hostname
#--------------------------------------------------------------------------
@property
def display_name(self):
return "Root Domain Name"
#--------------------------------------------------------------------------
@property
def root(self):
"""
Alias of "hostname", to ensure both Domain and RootDomain have
the same interface.
:return: Root domain.
:rtype: str
"""
return self.hostname
#--------------------------------------------------------------------------
@property
def discovered(self):
return [Domain(self.hostname)]
================================================
FILE: lalascan/data/resource/ip.py
================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
IP address.
"""
__all__ = ["IP"]
from . import Resource
from ...utils.text_utils import to_utf8
from ...api.exception import LalascanValueError
from netaddr import IPAddress
#------------------------------------------------------------------------------
class IP(Resource):
"""
IP address.
"""
#--------------------------------------------------------------------------
def __init__(self, address):
"""
:param address: IP address.
:type address: str
"""
address = to_utf8(address)
if not isinstance(address, str):
raise TypeError("Expected str, got %r instead" % type(address))
try:
if address.startswith("[") and address.endswith("]"):
parsed = IPAddress(address[1:-1], version=6)
address = address[1:-1]
else:
parsed = IPAddress(address)
version = int( parsed.version )
except Exception:
raise LalascanValueError("Invalid IP address: %s" % address)
# IP address and protocol version.
self.__address = address
self.__version = version
# Parent constructor.
super(IP, self).__init__()
#--------------------------------------------------------------------------
def __str__(self):
return self.address
#--------------------------------------------------------------------------
def __repr__(self):
return "<IPv%s address=%r>" % (self.version, self.address)
#--------------------------------------------------------------------------
@property
def display_name(self):
return "IP info"
#--------------------------------------------------------------------------
@property
def address(self):
"""
:return: IP address.
:rtype: str
"""
return self.__address
#--------------------------------------------------------------------------
@property
def version(self):
"""
:return: version of IP protocol: 4 or 6.
:rtype: int(4|6)
"""
return self.__version
================================================
FILE: lalascan/data/resource/url.py
================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Universal Resource Locator (URL).
"""
__all__ = ["BaseURL", "FolderURL", "URL", "SpiderURL"]
from . import Resource
from .domain import Domain
from .ip import IP
from ...libs.net.web_utils import parse_url
from ...utils.text_utils import to_utf8
from urllib import quote
#------------------------------------------------------------------------------
class _AbstractURL(Resource):
"""
Abstract class for all URL based resources.
"""
# Not true, but this bypasses an integrity check in the metaclass.
data_subtype = "resource/abstract"
#--------------------------------------------------------------------------
def __init__(self, url):
"""
:param url: Absolute URL.
:type url: str
:raises ValueError: Relative URLs are not allowed.
"""
# Parse, verify and canonicalize the URL.
# TODO: if relative, make it absolute using the referer when available.
parsed = parse_url(url)
if not parsed.host or not parsed.scheme:
raise ValueError("Only absolute URLs must be used! Got: %r" % url)
if parsed.scheme == "mailto":
raise ValueError("For emails use the Email type instead! Got: %r" % url)
if parsed.scheme not in ("http", "https", "ftp"):
raise ValueError("URL scheme not supported: %r" % parsed.scheme)
url = parsed.url
# URL.
self.__url = url
# Parsed URL.
self.__parsed_url = parsed
# Parent constructor.
super(_AbstractURL, self).__init__()
#--------------------------------------------------------------------------
@property
def url(self):
"""
:return: URL in canonical form.
:rtype: str
"""
return self.__url
#--------------------------------------------------------------------------
@property
def parsed_url(self):
"""
:return: URL in parsed form.
:rtype: ParsedURL
"""
return self.__parsed_url
@property
def hostname(self):
"""
:return: Hostname this URL points to.
:rtype: str
"""
return self.parsed_url.hostname
@property
def path(self):
"""
:return: Path component of the URL.
:rtype: str
"""
return self.parsed_url.path
@property
def is_https(self):
"""
:return: True if it's HTTPS, False otherwise.
:rtype: bool
"""
return self.parsed_url.scheme == "https"
#--------------------------------------------------------------------------
def __str__(self):
return self.url
#--------------------------------------------------------------------------
def __repr__(self):
cls = self.__class__.__name__
if "." in cls:
cls = cls[ cls.rfind(".") + 1 : ]
return "<%s url=%r>" % (cls, self.url)
#------------------------------------------------------------------------------
class URL(_AbstractURL):
"""
Universal Resource Locator (URL).
You can get the URL in canonical form:
- url
In deconstructed form:
- parsed_url
The current crawling depth level:
- depth
And some extra information needed to build an HTTP request:
- method
- url_params
- post_params
- referer
"""
data_subtype = "url"
#--------------------------------------------------------------------------
def __init__(self, url, method = "GET", post_params = None, referer = None, urlencode = True, **kwargs):
"""
:param url: Absolute URL.
:type url: str
:param method: HTTP method.
:type method: str
:param post_params: POST parameters or raw data.
:type post_params: dict(str -> str) | str
:param referer: Referrer URL.
:type referer: str
:param urlencode: POST|GET Data urlencode
:type urlencode: bool
:raises ValueError: Currently, relative URLs are not allowed.
"""
# Validate the arguments.
if method:
method = to_utf8(method)
else:
method = "GET"
if referer:
referer = to_utf8(referer)
else:
referer = None
if not isinstance(method, str):
raise TypeError("Expected string, got %r instead" % type(method))
if post_params is not None and not isinstance(post_params, dict):
raise TypeError("Expected dict, got %r instead" % type(post_params))
if referer is not None and not isinstance(referer, str):
raise TypeError("Expected string, got %r instead" % type(referer))
if post_params:
if hasattr(post_params, "iteritems"):
post_params = {
to_utf8(k): to_utf8(v) for k,v in post_params.iteritems()
}
if urlencode:
post_data = '&'.join(
'%s=%s' % ( quote(k, safe=''), quote(v, safe='') )
for (k, v) in sorted(post_params.iteritems())
)
else:
post_data = '&'.join(
'%s=%s' % ( k, v ) for (k, v) in sorted(post_params.iteritems())
)
else:
post_data = to_utf8(post_params)
post_params = None
else:
post_data = None
post_params = None
'''
# Checks for get param
url_params = kwargs.get('url_params', None)
if url_params is not None:
if hasattr(url_params, "iteritems"):
url_params = {
to_utf8(k): to_utf8(v) for k, v in url_params.iteritems()
}
query_param = '&'.join(
'%s=%s' % ( quote(k, safe=''), quote(v, safe='') )
for (k, v) in sorted(url_params.iteritems())
)
url = url + '?' + query_param
'''
#bug solved by blackye
#solve get_param bug
#http://www.baidu.com/index.php?id=1 POST: a=1
# Checks for get param
url_params = kwargs.get('url_params', None)
if url_params is not None:
if hasattr(url_params, "iteritems"):
url_params = {
to_utf8(k): to_utf8(v) for k, v in url_params.iteritems()
}
if urlencode:
query_param = '&'.join(
'%s=%s' % ( quote(k, safe=''), quote(v, safe='') )
for (k, v) in sorted(url_params.iteritems()))
else:
query_param = '&'.join(
'%s=%s' % ( k, v)
for (k, v) in sorted(url_params.iteritems())
)
url = url + '?' + query_param
if "sysdate" in query_param and "limit" in query_param:
print url, 'fuck!!'
# Save the properties.
self.__method = method
self.__post_data = post_data
self.__post_params = post_params
self.__referer = parse_url(referer).url if referer else None
# Call the parent constructor.
super(URL, self).__init__(url)
#--------------------------------------------------------------------------
def __repr__(self):
s = "<URL url=%r, method=%r, params=%r, referer=%r>"
s %= (self.url, self.method, self.post_params, self.referer)
return s
#--------------------------------------------------------------------------
@property
def display_name(self):
return "URL"
#--------------------------------------------------------------------------
@property
def method(self):
"""
:return: HTTP method.
:rtype: str
"""
return self.__method
@property
def post_data(self):
"""
:return: POST data.
:rtype: str
"""
return self.__post_data
#--------------------------------------------------------------------------
@property
def url_params(self):
"""
:return: GET parameters.
:rtype: dict(str -> str)
"""
query_params = self.parsed_url.query_params
if query_params:
return query_params
return {}
@property
def has_url_params(self):
"""
:return: True if there are GET parameters, False otherwise.
:rtype: bool
"""
return bool(self.url_params)
@property
def post_params(self):
"""
:return: POST parameters.
:rtype: dict(str -> str)
"""
if self.__post_params:
return self.__post_params.copy()
return {}
@property
def has_post_params(self):
"""
:return: True if there are POST parameters, False otherwise.
:rtype: bool
"""
return bool(self.post_params)
@property
def referer(self):
"""
:return: Referer for this URL.
:rtype: str
"""
return self.__referer
#--------------------------------------------------------------------------
@property
def discovered(self):
if self.is_in_scope():
result = FolderURL.from_url(self.url)
result.append( BaseURL(self.url) )
try:
result.append( IP(self.hostname) )
except ValueError:
result.append( Domain(self.hostname) )
return result
return []
#------------------------------------------------------------------------------
class BaseURL(_AbstractURL):
"""
Base URL.
Unlike the URL type, which refers to any URL, this type is strictly for
root level URLs in a web server. Plugins that only run once per web server
should probably receive this data type.
For example, a plugin receiving both BaseURL and URL may get this input:
- BaseURL("http://www.example.com/")
- URL("http://www.example.com/")
- URL("http://www.example.com/index.php")
- URL("http://www.example.com/admin.php")
- URL("http://www.example.com/login.php")
Notice how the root level URL is sent twice,
once as BaseURL and again the more generic URL.
"""
data_subtype = "base_url"
#--------------------------------------------------------------------------
def __init__(self, url):
"""
:param url: Any **absolute** URL. The base will be extracted from it.
:type url: str
:raises ValueError: Only absolute URLs must be used.
"""
# Parse, verify and canonicalize the URL.
parsed = parse_url(url)
if not parsed.host or not parsed.scheme:
raise ValueError("Only absolute URLs must be used! Got: %r" % url)
# Convert it into a base URL.
parsed.auth = None
parsed.path = "/"
parsed.fragment = None
parsed.query = None
parsed.query_char = None
url = parsed.url
# Call the parent constructor.
super(BaseURL, self).__init__(url)
#--------------------------------------------------------------------------
@property
def display_name(self):
return "Base URL"
#--------------------------------------------------------------------------
@property
def discovered(self):
if self.is_in_scope():
try:
return [IP(self.hostname)]
except ValueError:
return [Domain(self.hostname)]
return []
#------------------------------------------------------------------------------
class FolderURL(_AbstractURL):
"""
Folder URL.
Unlike the URL type, which refers to an URL that's linked or somehow found
to be valid, the FolderURL type refers to inferred URLs to folders detected
within another URL.
This makes it semantically different, since there's no guarantee that the
URL actually points to a valid resource, nor that it belongs to the normal
web access flow.
For example, a plugin receiving both FolderURL and URL may get this input:
- URL("http://www.example.com/wp-content/uploads/2013/06/attachment.pdf")
- FolderURL("http://www.example.com/wp-content/uploads/2013/06/")
- FolderURL("http://www.example.com/wp-content/uploads/2013/")
- FolderURL("http://www.example.com/wp-content/uploads/")
- FolderURL("http://www.example.com/wp-content/")
Note that the folder URLs may or may not be sent again as an URL object.
For example, for a site that has a link to the "incoming" directory in its
index page, we may get something like this:
- URL("http://www.example.com/index.html")
- URL("http://www.example.com/incoming/")
- FolderURL("http://www.example.com/incoming/")
FolderURL objects are never sent for the root folder of a web site.
For that, see the BaseURL data type.
"""
data_subtype = "folder_url"
#--------------------------------------------------------------------------
def __init__(self, url):
"""
:param url: Absolute URL to a folder.
:type url: str
:raises ValueError: The URL wasn't absolute or didn't point to a folder.
"""
# Parse, verify and canonicalize the URL.
parsed = parse_url(url)
if not parsed.host or not parsed.scheme:
raise ValueError("Only absolute URLs must be used! Got: %r" % url)
if not parsed.path.endswith("/"):
raise ValueError("URL does not point to a folder! Got: %r" % url)
# Call the parent constructor.
super(FolderURL, self).__init__(parsed.url)
#--------------------------------------------------------------------------
@staticmethod
def from_url(url):
"""
:param url: Any **absolute** URL. The folder will be extracted from it.
:type url: str
:returns: Inferred folder URLs.
:rtype: list(FolderURL)
:raises ValueError: Only absolute URLs must be used.
"""
assert isinstance(url, basestring)
# Parse, verify and canonicalize the URL.
parsed = parse_url(url)
if not parsed.host or not parsed.scheme:
raise ValueError("Only absolute URLs must be used! Got: %r" % url)
# Extract the folders from the path.
path = parsed.path
folders = path.split("/")
if not path.endswith("/"):
folders.pop()
# Convert the URL to a base URL.
parsed.auth = None
parsed.path = "/"
parsed.fragment = None
parsed.query = None
parsed.query_char = None
# Generate a new folder URL for each folder.
folder_urls = {parsed.url}
for folder in folders:
if folder:
parsed.path += folder + "/"
folder_urls.add(parsed.url)
# Return the generated URLs.
return [FolderURL(x) for x in folder_urls]
#--------------------------------------------------------------------------
@property
def display_name(self):
return "Folder URL"
#--------------------------------------------------------------------------
@property
def discovered(self):
if self.is_in_scope():
result = [ BaseURL(self.url) ]
try:
result.append( IP(self.hostname) )
except ValueError:
result.append( Domain(self.hostname) )
return result
return []
#------------------------------------------------------------------------------
class SpiderURL(_AbstractURL):
"""
Spider URL.
Unlike the URL type, which refers to any URL, this type is strictly for
root level URLs in a web server. Plugins that only run once per web server
should probably receive this data type.
For example, a plugin receiving both BaseURL and URL may get this input:
- BaseURL("http://www.example.com/")
- URL("http://www.example.com/")
- URL("http://www.example.com/index.php")
- URL("http://www.example.com/admin.php")
- URL("http://www.example.com/login.php")
Notice how the root level URL is sent twice,
once as BaseURL and again the more generic URL.
"""
data_subtype = "spider_url"
#--------------------------------------------------------------------------
def __init__(self, url):
"""
:param url: Any **absolute** URL. The base will be extracted from it.
:type url: str
:raises ValueError: Only absolute URLs must be used.
"""
# Call the parent constructor.
super(SpiderURL, self).__init__(url)
#--------------------------------------------------------------------------
@property
def display_name(self):
return "Spider URL"
#--------------------------------------------------------------------------
@property
def discovered(self):
if self.is_in_scope():
try:
return [IP(self.hostname)]
except ValueError:
return [Domain(self.hostname)]
return []
================================================
FILE: lalascan/data/vuln/__init__.py
================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'BlackYe.'
================================================
FILE: lalascan/data/vuln/vulnerability.py
================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Vulnerability types.
"""
__author__ = 'BlackYe.'
__all__ = [
"Vulnerability",
"WebVulnerability",
]
from .. import Data
from ..resource import Resource
from ..resource.url import BaseURL, FolderURL, URL
from lalascan.utils.text_utils import to_utf8
from ...api.exception import LalascanSystemException
from ...data.enum import RISK_LEVEL
from conf import CACHEDIR, LEAK_JSON_FILE, join_path_func
from collections import defaultdict
from inspect import getmro
from textwrap import dedent
from warnings import warn
import json
#------------------------------------------------------------------------------
# Base class for all vulnerabilities.
class Vulnerability(Data):
"""
Vulnerability Base Class
"""
max_vulnerabilities = 0
# Vulnerability levels.
VULN_LEVELS = ("informational", "low", "middle", "high", "critical")
# Default vuln properties.
# Note: plugin_id and custom_id must NOT be defined here.
DEFAULTS = {
"level": "low",
"impact": 0,
"severity": 0,
"risk": 0,
"title": None, # special value, do not change!
"description": None, # special value, do not change!
"solution": None, # special value, do not change!
"references": (),
}
def __init__(self, target, **kwargs):
pass
#------------------------------------------------------------------------------
class WebVulnerability(Vulnerability):
"""
Base class for web vulnerabilities
"""
# Vulnerability levels.
VULN_LEVELS = ("informational", "low", "middle", "high")
# Default vuln properties.
# Note: plugin_id and custom_id must NOT be defined here.
DEFAULTS = {
"level": "low",
"impact": 0,
"severity": 0,
"risk": 0,
"title": None, # special value, do not change!
"description": None, # special value, do not change!
"solution": None, # special value, do not change!
"references": (),
}
#--------------------------------------------------------------------------
def __init__(self, target, **kwargs):
# Sanitize the "target" argument.
target = self._sanitize_url(self, target)
self._leak_info = self._load_leakinfo()
# Save the raw URL.
self.__url = target.url
# Save the Method
self.__vul_method = kwargs.get('method')
#vul params point key
self.__vulparam_point = kwargs.get('vulparam_point')
#test case payload
self.__payload = kwargs.get('payload')
#vul type
self.__vul_type = kwargs.get('injection_type')
#response info
self.__vul_response = kwargs.get('vul_response')
# Parent constructor.
super(WebVulnerability, self).__init__(target, **kwargs)
#--------------------------------------------------------------------------
@staticmethod
def _sanitize_url(self, url, stacklevel = 2):
if (
not isinstance(url, URL) and
not isinstance(url, FolderURL) and
not isinstance(url, BaseURL)
):
if isinstance(url, basestring):
msg = "You should pass an URL object" \
" to %s instead of a string!"
msg %= self.__class__.__name__
url = URL(str(url))
elif hasattr(url, "url"):
try:
t = url.__class__.__name__
except Exception:
t = str(type(url))
msg = "You should pass an URL object to %s instead of %s!"
msg %= (self.__class__.__name__, t)
url = url.url
if isinstance(url, basestring):
url = URL(str(url))
elif not isinstance(url, URL):
raise TypeError("Expected URL, got %r instead" % t)
warn(msg, RuntimeWarning, stacklevel=stacklevel+1)
return url
def _load_leakinfo(self):
#TODO Get Content from leak Json
with open(join_path_func(CACHEDIR, LEAK_JSON_FILE)) as f:
_json_content = f.read()
try:
leak_json = json.loads(_json_content)
return leak_json
except Exception,e:
raise LalascanSystemException(e)
#--------------------------------------------------------------------------
def __str__(self):
return self.url
#--------------------------------------------------------------------------
'''
def __repr__(self):
return "<%s url=%r plugin_id=%r level=%r desc=%r>" % (
self.__class__.__name__,
self.url,
self.level,
self.description,
)
'''
#--------------------------------------------------------------------------
@property
def url(self):
"""
:return: Raw URL where the vuln was found.
:rtype: str
"""
return self.__url
#--------------------------------------------------------------------------
def __get_default_text(self, propname):
text = self.DEFAULTS.get(propname, None)
return text
@property
def injection_type(self):
if self._leak_info.has_key('%s' % self.__vul_type):
leak_info = self._leak_info['%s' % self.__vul_type]
if leak_info is not None:
self.__risk_level = int(leak_info['risk_level'])
if self.__risk_level == 4:
self.__risk_level_desc = RISK_LEVEL.HIGH
elif self.__risk_level == 3:
self.__risk_level_desc = RISK_LEVEL.MIDDLE
elif self.__risk_level == 2:
self.__risk_level_desc = RISK_LEVEL.LOW
elif self.__risk_level == 1:
self.__risk_level_desc = RISK_LEVEL.INFO
self.__sli_id = int(leak_info['id'])
return leak_info['leak_name']
#maybe UnicodeEncodeError
def get_injection_type_desc(self):
if self._leak_info.has_key('%s' % self.__vul_type):
leak_info = self._leak_info['%s' % self.__vul_type]
if leak_info is not None:
return leak_info['leak_name_cn']
@property
def vul_method(self):
return self.__vul_method
@property
def vulparam_point(self):
return self.__vulparam_point
@property
def payload(self):
return self.__payload
@property
def vul_response(self):
return self.__vul_response
@property
def vul_risk(self):
return self.__risk_level
@property
def vul_risk_desc(self):
return self.__risk_level_desc
@property
def vul_sli_id(self):
return self.__sli_id
================================================
FILE: lalascan/launcher.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
from lalascan.libs.core.pluginmanager import PluginManager, PluginImporter
from lalascan.libs.core.common import readfile, post_query, cookie_query
from lalascan.libs.core.globaldata import register_plugins, conf, db_audit, vulresult, source_result
from lalascan.libs.core.report import TextReport
from lalascan.libs.core.scope import AuditScope, DummyScope
from lalascan.libs.core.spider import spider_task
from lalascan.libs.core.threads import plugin_run_thread, execute_plugin, MyResourcePool, MyGeventPool
from lalascan.data.resource.url import URL
from lalascan.data.resource.domain import Domain
from lalascan.models.scan_task import ScanTask
from lalascan.utils.mytime import MyTime
def init():
source_result.start_time = MyTime.get_current_datetime()
http_req_initoption()
get_multiple_target()
def run():
report = TextReport()
pluginmanager = PluginManager()
pluginmanager.set_plugin()
proPool = MyResourcePool(4)
for m_resource in conf.targets:
print '*' * 50
proPool.apply_async(execute_plugin, (register_plugins, m_resource,))
proPool.close()
try:
proPool.join()
except KeyboardInterrupt,e:
print 'fuck!'
source_result.end_time = MyTime.get_current_datetime()
report.generate_report()
def get_multiple_target():
#TODO infocollect
#add scan task into db
scan_task_model = ScanTask(audit_name = conf.audit_name, scan_url = conf.url, starttime = MyTime.get_current_datetime(), finishtime = MyTime.get_current_datetime())
db_audit.session.add(scan_task_model)
db_audit.session.commit()
_set_task_id(source_result, scan_task_model.id)
if conf.bspider:
spider_task(conf.audit_name)
else:
if conf.post_data is not None:
m_resource = URL(url = conf.url , post_params = post_query(conf.post_data), method = 'POST')
else:
m_resource = URL(url = conf.url, method = 'GET')
conf.targets.append(m_resource)
conf.audit_scope.roots = ['www.baidu.com', 'bbs.baidu.com']
conf.audit_scope.domains = 'www.baidu.com'
conf.audit_scope.addresses = '192.168.0.1'
conf.audit_scope.web_pages = "http://www.baidu.com"
#scan_task_model = ScanTask(audit_name = conf.audit_name, scan_url = conf.url, starttime = MyTime.get_current_datetime(), finishtime = MyTime.get_current_datetime())
#db_audit.session.add(scan_task_model)
#db_audit.session.commit()
def init_report():
report = TextReport()
report.generate_report()
def http_req_initoption():
_set_http_useragnet()
_set_http_cookie()
def _set_http_useragnet():
pass
def _set_http_cookie():
conf.cookie = cookie_query(conf.cookie)
def _set_http_referer():
pass
def _set_http_proxy():
pass
def _set_http_timeout():
pass
def _set_task_id(source_result, task_id):
source_result.task_id = task_id
return source_result
================================================
FILE: lalascan/libs/__init__.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
================================================
FILE: lalascan/libs/core/__init__.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
================================================
FILE: lalascan/libs/core/common.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
import os
from lalascan.api.exception import LalascanTypeError, LalascanValueError
from lalascan.libs.core.settings import BANNER
from lalascan.libs.core.settings import BANNER, UNICODE_ENCODING
from lalascan.libs.core.logger import LOGGER_HANDLER
from lalascan.data.enum import CUSTOM_LOGGING
from lalascan.utils.text_utils import to_utf8
from lalascan.api.exception import LalascanSystemException
from thirdparty_libs.colorizer import colored
from urllib import quote, quote_plus, unquote, unquote_plus
import sys
import re
import datetime, time
import random
import hashlib
import urllib
def banner():
"""
Function prints lalascan banner with its version
"""
_ = BANNER
#if not getattr(LOGGER_HANDLER, "is_tty", False):
# _ = re.sub("\033.+?m", "", _)
#dataToStdout(_)
print _
def console_output(data, bold = True):
"""
Writes text to the stdout (console) stream
"""
if isinstance(data, unicode):
message = _stdoutencode(data)
else:
message = data
sys.stdout.write(_setColor(message, bold))
try:
sys.stdout.flush()
except IOError:
pass
return
def _stdoutencode(data):
retVal = None
try:
data = data or ""
retVal = data.encode(sys.stdout.encoding)
except:
retVal = data.encode(UNICODE_ENCODING) if isinstance(data, unicode) else data
return retVal
def _setColor(message, bold=False):
retVal = message
if message and getattr(LOGGER_HANDLER, "is_tty", False): # colorizing handler
if bold:
retVal = colored(message, color= None, on_color=None, attrs=("bold",))
return retVal
try:
# The fastest JSON parser available for Python.
from cjson import decode as json_decode
from cjson import encode as json_encode
except ImportError:
try:
# Faster than the built-in module, usually found.
from simplejson import loads as json_decode
from simplejson import dumps as json_encode
except ImportError:
# Built-in module since Python 2.6, very very slow!
from json import loads as json_decode
from json import dumps as json_encode
# Remove the docstrings. This prevents errors when generating the API docs.
try:
json_encode.__doc__ = ""
except Exception:
_orig_json_encode = json_encode
def json_encode(*args, **kwargs):
return _orig_json_encode(*args, **kwargs)
try:
json_decode.__doc__ = ""
except Exception:
_orig_json_decode = json_decode
def json_decode(*args, **kwargs):
return _orig_json_decode(*args, **kwargs)
def readfile(filename):
try:
with open(filename) as f:
retval = f.read()
return retval
except IOError, ex:
errMsg = "something went wrong while trying to read "
errMsg += "the input file ('%s')" % ex
raise LalascanSystemException(errMsg)
def multiple_replace(text, adict):
rx = re.compile("|".join(map(re.escape, adict)))
def oneXlat(match):
return adict[match.group(0)]
return rx.sub(oneXlat, text)
#--------------------------------------------------------
# http option
def get_domain(url):
if isinstance(url, str):
try:
protocol, __ = urllib.splittype(url)
host = urllib.splitnport(urllib.splithost(__)[0])
return host[0]
except Exception:
return None
def post_query(query):
try:
# much faster than parse_qsl()
query_params = dict(( map(unquote_plus, (to_utf8(token) + '=').split('=', 2)[:2])
for token in query.split('&') ))
if len(query_params) == 1 and not query_params.values()[0]:
query_params = {}
else:
query = None
except Exception:
##raise # XXX DEBUG
query_params = {}
return query_params
def cookie_query(cookie_query):
try:
# much faster than parse_qsl()
cookie_params = dict(( map(unquote_plus, (to_utf8(token) + '=').split('=', 2)[:2])
for token in cookie_query.split(';') ))
if len(cookie_params) == 1 and not cookie_params.values()[0]:
cookie_params = {}
else:
query = None
except Exception:
##raise # XXX DEBUG
cookie_params = {}
return cookie_params
#---------------------------------------------
def generate_audit_name(url):
if not isinstance(url, str):
raise LalascanTypeError('target url %s must bu STR_Object' % url)
domain = get_domain(url)
if domain is not None:
cur_time = str(int(time.mktime(datetime.datetime.now().timetuple())))
seed = ''.join(random.sample('abcdefghijklmnopqrstuvwxyz!@#$%^&*', 5))
__ = hashlib.md5()
__.update(cur_time + seed)
return '{0}_{1}'.format(domain, __.hexdigest())
else:
raise LalascanValueError('target audit_name type error!')
================================================
FILE: lalascan/libs/core/globaldata.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
'''
global var data
'''
from lalascan.libs.core.logger import _ScanLog
from lalascan.data.datatype import AttribDict
from lalascan.models import _DBConfig
from multiprocessing import Queue
# object to share within function and classes command
# line options and settings
conf = AttribDict()
source_result = AttribDict()
conf.audit_scope = AttribDict()
# logger
class L(object):
logger = None
@classmethod
def set_logfilepath(cls, audit_name):
L.logger = _ScanLog(audit_name)
db_audit = _DBConfig()
#global multiprocessing result var
vulresult = Queue()
# Dictionary storing
# (1)targets, (2)registeredPocs, (3) bruteMode
# (4)results, (5)pocFiles
# (6)multiThreadMode \ threadContinue \ threadException
#kb = AttribDict()
cmdLineOptions = AttribDict()
register_plugins = AttribDict()
#registeredPocs = {}
#defaults = AttribDict(defaults)
================================================
FILE: lalascan/libs/core/logger.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import sys
from lalascan.data.enum import CUSTOM_LOGGING
from lalascan.libs.core.singletonclass import Singleton
from conf import CACHELOG, join_path_func
logging.addLevelName(CUSTOM_LOGGING.SYSINFO, "*")
logging.addLevelName(CUSTOM_LOGGING.SUCCESS, "+")
logging.addLevelName(CUSTOM_LOGGING.ERROR, "-")
logging.addLevelName(CUSTOM_LOGGING.WARNING, "!")
LOGGER = logging.getLogger("lalascan")
LOGGER_HANDLER = None
LOGGER_FILE_HANDLER = None
try:
from thirdparty_libs.ansistrm.ansistrm import ColorizingStreamHandler
disableColor = False
for argument in sys.argv:
if "disable-col" in argument:
disableColor = True
break
if disableColor:
LOGGER_HANDLER = logging.StreamHandler(sys.stdout)
else:
LOGGER_HANDLER = ColorizingStreamHandler(sys.stdout)
LOGGER_HANDLER.level_map[logging.getLevelName("*")] = (None, "cyan", False)
LOGGER_HANDLER.level_map[logging.getLevelName("+")] = (None, "green", False)
LOGGER_HANDLER.level_map[logging.getLevelName("-")] = (None, "red", False)
LOGGER_HANDLER.level_map[logging.getLevelName("!")] = (None, "yellow", False)
except ImportError, e:
print str(e)
LOGGER_HANDLER = logging.StreamHandler(sys.stdout)
FORMATTER = logging.Formatter("\r[%(asctime)s] [%(levelname)s] %(name)s: %(message)s", datefmt = "%Y-%m-%d %H:%M:%S")
LOGGER_HANDLER.setFormatter(FORMATTER)
LOGGER.addHandler(LOGGER_HANDLER)
LOGGER.setLevel(CUSTOM_LOGGING.WARNING)
class _ScanLog(Singleton):
def __init__(self, audit_name):
#写入磁盘cache目录下
bcahce_log = True
if bcahce_log:
LOGGER_FILE_HANDLER = logging.FileHandler(join_path_func(CACHELOG, audit_name))
LOGGER_FILE_HANDLER.setFormatter(FORMATTER)
LOGGER.addHandler(LOGGER_FILE_HANDLER)
super(Singleton, self).__init__()
def log_verbose(self, msg):
LOGGER.log(CUSTOM_LOGGING.SYSINFO ,msg)
def log_warning(self, msg):
LOGGER.log(CUSTOM_LOGGING.WARNING, msg)
def log_success(self, msg):
LOGGER.log(CUSTOM_LOGGING.SUCCESS, msg)
def log_error(self, msg):
LOGGER.log(CUSTOM_LOGGING.ERROR, msg)
================================================
FILE: lalascan/libs/core/plugin.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
from lalascan.api.exception import LalascanNotImplementedError
from lalascan.libs.net.web_mutants import get_request
from lalascan.libs.core.globaldata import conf
from lalascan.data.resource import Data
from lalascan.data.resource.url import URL
from inspect import isclass
from time import sleep
class PluginBase(object):
def __init__(self):
pass
def get_accepted_types(self):
raise LalascanNotImplementedError()
def run(self, info):
raise LalascanNotImplementedError()
def run_plugin(self, resource_input, resource_method , resource_param):
#gevent pool run scan policy
if isinstance(resource_input, Data):
data = resource_input
try:
accepted_info = self.get_accepted_types()
if isclass(accepted_info):
found = data.is_instance(accepted_info)
else:
found = False
for clazz in accepted_info:
if data.is_instance(clazz):
found = True
break
if not found:
msg = "Plugin %s cannot process data of type %s"
raise TypeError(msg % ('sqli', type(data)))
if isinstance(data, URL):
#test url whether access
if get_request(url = data, allow_redirects = False) is None:
return
# Call the plugin.
print resource_param
result = self.run(data, method = resource_method, param = resource_param)
sleep(0.05)
return result
except LalascanNotImplementedError:
pass
================================================
FILE: lalascan/libs/core/pluginmanager.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
from lalascan.libs.core.globaldata import conf, L
from lalascan.data.enum import CUSTOM_LOGGING
from lalascan.libs.core.common import readfile, multiple_replace
from lalascan.libs.core.settings import PLUGIN_SUFFIX
from lalascan.api.exception import LalascanFileNotFoundException, LalascanSystemException, LalascanValueError
from conf import PLUGINDIR
from .settings import PLUGIN_IMPORTDICT
from .settings import PLUGIN_CLASSNAME_REGEX
from .settings import PLUGIN_REGISTER_REGEX
from .settings import PLUGIN_REGISTER_STRING
import sys
import os
import re
import imp
import marshal
class PluginManager(object):
def __init__(self, audit = None):
self.__audit = audit
self.__all_plugin_name = set() #contains sqli,reflect_xss
self.__all_fplugin = set()
#或许所有的插件
self.__get_all_plugin()
def set_plugin(self):
"""
@function 设置载入的plugin
"""
if conf.plugins is not None:
if len(conf.plugins.split(",")) > 1:
for _ in conf.plugins.split(","):
plugin_name = _.strip(' ')
retval = self._load_plugin_by_name(plugin_name)
else:
plugin_name = conf.plugins
self._load_plugin_by_name(plugin_name)
else:
# all plugin load
# conf.pocFile = None
self._load_all_plugin()
def _load_all_plugin(self):
for plugin_name in self.__all_plugin_name:
try:
self._load_plugin_by_name(plugin_name)
except LalascanFileNotFoundException,e:
L.logger.log_error(str(e))
except LalascanSystemException,e:
L.logger.log_error(str(e))
except ImportError, ex:
errmsg = "%s register failed \"%s\"" % (plugin_name, str(ex))
L.logger.log_error(errmsg)
def _load_plugin_by_name(self, plugin_name):
try:
fplugin = self.__get_plugin_by_name(plugin_name)
plugin_module = plugin_name + PLUGIN_SUFFIX
retval = self.__load_plugin(plugin_module, fplugin)
#print retval[plugin_module]
if retval[plugin_module] != '':
importer = PluginImporter(plugin_name, retval[plugin_module])
importer.load_module(plugin_name)
except LalascanFileNotFoundException,e:
L.logger.log_error(str(e))
except LalascanSystemException,e:
L.logger.log_error(str(e))
except ImportError, ex:
errmsg = "%s register failed \"%s\"" % (plugin_name, str(ex))
L.logger.log_error(errmsg)
#logger.log(CUSTOM_LOGGING.ERROR, errMsg)
return
def __get_plugin_by_name(self, plugin_name):
for fplugin in self.__all_fplugin:
try:
plugin_module = plugin_name + PLUGIN_SUFFIX
if plugin_module == fplugin[fplugin.rindex('/') + 1:]:
return fplugin
except LalascanValueError:
pass
raise LalascanFileNotFoundException("%s plugin not found" % plugin_name)
def __get_all_plugin(self):
#for plugin_path in os.walk(PLUGINDIR):
plugin_path = [plugin for plugin in os.walk(PLUGINDIR)]
for plugin_folder, folder_list , fplugin_list in plugin_path:
for each_file in fplugin_list:
if each_file != '__init__.py' and '.pyc' not in each_file and each_file.endswith(PLUGIN_SUFFIX):
self.__all_plugin_name.add(each_file.strip(PLUGIN_SUFFIX))
self.__all_fplugin.add(os.path.join(plugin_folder, each_file))
def __load_plugin(self, plugin_name, fplugin):
try:
plugin_content = readfile(fplugin)
except LalascanSystemException:
raise LalascanSystemException("%s plugin file can not be read" % plugin_name)
if plugin_content is not None:
#TODO need check get_accept_type and run method
if not re.search(PLUGIN_REGISTER_REGEX, plugin_content):
#not register, plugin is enable
#className = self.__get_plugin_classname(plugin_content)
#plugin_content += PLUGIN_REGISTER_STRING.format(className)
warnmsg = "plugin: %s not register" % plugin_name
L.logger.log_warning(warnmsg)
retval = ''
else:
#retval = multiple_replace(plugin_content, PLUGIN_IMPORTDICT)
retval = plugin_content
return {plugin_name: retval}
def __get_plugin_classname(self, poc):
try:
className = re.search(PLUGIN_CLASSNAME_REGEX, poc).group(1)
except:
className = ""
return className
class PluginImporter(object):
"""
Use custom meta hook to import modules available as strings.
Cp. PEP 302 http://www.python.org/dev/peps/pep-0302/#specification-part-2-registering-hooks
"""
def __init__(self, fullname, contents):
self.fullname = fullname
self.contents = contents
def load_module(self, fullname):
if fullname in sys.modules:
return sys.modules[fullname]
mod = sys.modules.setdefault(fullname, imp.new_module(fullname))
mod.__file__ = "<%s>" % fullname
mod.__loader__ = self
if False: #conf.isPycFile
code = marshal.loads(self.contents[8:])
else:
code = compile(self.contents, mod.__file__, "exec")
exec code in mod.__dict__
return mod
@classmethod
def del_module(cls, modname):
from sys import modules
try:
thismod = modules[modname]
except KeyError:
raise ValueError(modname)
these_symbols = dir(thismod)
del modules[modname]
for mod in modules.values():
try:
delattr(mod, modname)
except AttributeError:
pass
================================================
FILE: lalascan/libs/core/pluginregister.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
from .globaldata import register_plugins
def reg_instance_plugin(plugin_class):
module = plugin_class.__module__.split('.')[-1]
if module in register_plugins:
return
register_plugins[module] = plugin_class()
================================================
FILE: lalascan/libs/core/report.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
from ...libs.core.globaldata import conf, vulresult, source_result, db_audit
from ...models.auditdb import AuditMysqlDB
from ...models.scan_vuldetail import ScanVulDetail
from ...data import Data
from ...data.resource.domain import Domain
from ...data.resource.ip import IP
from ...data.resource.url import BaseURL, URL
from ...data.vuln.vulnerability import WebVulnerability
from ...utils.console_utils import get_terminal_size, colorize_substring, colorize
from ...utils.mytime import MyTime
from ...utils import _str2bs64
from thirdparty_libs.texttable import Texttable
from thirdparty_libs.prettytable.prettytable import PrettyTable
import sys
from collections import defaultdict
class TextReport():
#--------------------------------------------------------------------------
def generate_report(self):
self.__show_data = True
self.__console = True
self.__color = True #Console.use_colors
self.__width = max(0, get_terminal_size()[0])
self.__fd = sys.stdout
self.__write_report()
#--------------------------------------------------------------------------
def __write_report(self):
# Header
print >>self.__fd, ""
print >>self.__fd, "--= %s =--" % self.__colorize("Report", "cyan")
print >>self.__fd, ""
# Summary
#start_time, stop_time, run_time = parse_audit_times( *get_audit_times() )
start_time, stop_time, run_time = MyTime.parse_audit_times(source_result.start_time, source_result.end_time)
#host_count = Database.count(Data.TYPE_RESOURCE, Domain.data_subtype)
#host_count += Database.count(Data.TYPE_RESOURCE, IP.data_subtype)
#vuln_count = Database.count(Data.TYPE_VULNERABILITY)
host_count = 2
#vuln_count = 3
print >>self.__fd, "-# %s #- " % self.__colorize("Summary", "yellow")
print >>self.__fd, ""
print >>self.__fd, "Audit started: %s" % self.__colorize(start_time, "yellow")
print >>self.__fd, "Audit ended: %s" % self.__colorize(stop_time, "yellow")
print >>self.__fd, "Execution time: %s" % self.__colorize(run_time, "yellow")
print >>self.__fd, ""
print >>self.__fd, "Scanned hosts: %s" % self.__colorize(str(host_count), "yellow")
#print >>self.__fd, "Vulnerabilities: %s" % self.__colorize(str(vuln_count), "red" if vuln_count else "yellow")
print >>self.__fd, ""
'''
# Audit scope
if self.__show_data or not self.__console:
table = Texttable()
scope_domains = conf.audit_scope.roots
if conf.audit_scope.addresses:
table.add_row(("IP addresses", conf.audit_scope.addresses))
if scope_domains:
table.add_row(("Domains", scope_domains))
if conf.audit_scope.web_pages:
table.add_row(("Web pages", conf.audit_scope.web_pages))
if table._rows:
self.__fix_table_width(table)
print >>self.__fd, "-# %s #- " % self.__colorize("Audit Scope", "yellow")
print >>self.__fd, ""
print >>self.__fd, table.draw()
print >>self.__fd, ""
'''
'''
# Discovered hosts
if self.__show_data:
need_header = True
for domain in self.__iterate(Data.TYPE_RESOURCE, Domain.data_subtype):
table = Texttable()
#self.__add_related(table, domain, Data.TYPE_INFORMATION, Geolocation.data_subtype, "Location")
#self.__add_related(table, domain, Data.TYPE_INFORMATION, WebServerFingerprint.data_subtype, "Web Server")
#self.__add_related(table, domain, Data.TYPE_INFORMATION, OSFingerprint.data_subtype, "OS Fingerprint")
if table._rows:
if need_header:
need_header = False
print >>self.__fd, "-# %s #- " % self.__colorize("Hosts", "yellow")
print >>self.__fd, ""
table.header(("Domain Name", domain.hostname))
self.__fix_table_width(table)
text = table.draw()
if self.__color:
text = colorize_substring(text, domain.hostname, "red" if domain.get_links(Data.TYPE_VULNERABILITY) else "green")
print >>self.__fd, text
print >>self.__fd, ""
for ip in self.__iterate(Data.TYPE_RESOURCE, IP.data_subtype):
table = Texttable()
self.__add_related(table, ip, Data.TYPE_RESOURCE, Domain.data_subtype, "Domain Name")
if table._rows:
if need_header:
need_header = False
print >>self.__fd, "-# %s #- " % self.__colorize("Hosts", "yellow")
print >>self.__fd, ""
table.header(("IP Address", ip.address))
self.__fix_table_width(table)
text = table.draw()
if self.__color:
text = colorize_substring(text, ip.address, "red" if ip.get_links(Data.TYPE_VULNERABILITY) else "green")
print >>self.__fd, text
print >>self.__fd, ""
# Web servers
if self.__show_data and 1:
print >>self.__fd, "-# %s #- " % self.__colorize("Web Servers", "yellow")
print >>self.__fd, ""
crawled = defaultdict(list)
vulnerable = []
for url in self.__iterate(Data.TYPE_RESOURCE, URL.data_subtype):
crawled[url.hostname].append(url.url)
if self.__color and url.get_links(Data.TYPE_VULNERABILITY):
vulnerable.append(url)
for url in self.__iterate(Data.TYPE_RESOURCE, BaseURL.data_subtype):
table = Texttable()
table.header(("Base URL", url.url))
#self.__add_related(table, url, Data.TYPE_INFORMATION, WebServerFingerprint.data_subtype, "Server")
#self.__add_related(table, url, Data.TYPE_INFORMATION, OSFingerprint.data_subtype, "Platform")
urls = crawled[url.hostname]
if urls:
urls.sort()
table.add_row(("Visited URLs", "\n".join(urls)))
if table._rows:
self.__fix_table_width(table)
text = table.draw()
if self.__color:
p = text.find("\n")
p = text.find("\n", p + 1)
p = text.find("\n", p + 1)
if p > 0:
text = colorize_substring(text[:p], url.url, "red" if url.get_links(Data.TYPE_VULNERABILITY) else "green") + text[p:]
for u in vulnerable:
if u != url.url:
text = colorize_substring(text, u, "red")
print >>self.__fd, text
print >>self.__fd, ""
'''
# Vulnerabilities
print >>self.__fd, "-# %s #- " % self.__colorize("Vulnerabilities", "yellow")
print >>self.__fd, ""
#count = Database.count(Data.TYPE_VULNERABILITY)
count = vulresult.qsize()
if count:
if self.__show_data:
print >>self.__fd, self.__colorize("%d vulnerabilities found!" % count, "red")
print >>self.__fd, ""
if vulresult.qsize() > 0:
table = Texttable()
table.add_row(["Vul Type", "Vul Url", "Vul Parameter", "Payload", "Method", "Risk Level"])
while vulresult.qsize() > 0:
_ = vulresult.get()
table.add_row([_.injection_type,
_.url,
_.vulparam_point,
_.payload,
_.vul_method,
_.vul_risk_desc]
)
#audit_db insert scan result into db
vul_detail = ScanVulDetail(st_id = source_result.task_id,
sli_id = _.vul_sli_id,
url = _.url,
vulparam_point = _.vulparam_point,
method = _.vul_method,
payload = _.payload,
get_param = None,
post_param = None,
ori_req_header = _str2bs64(_.vul_response.raw_request.headers.get_headers()),
ori_resp_header= _str2bs64(str(_.vul_response.headers.get_headers())),
ori_resp_body = _str2bs64(_.vul_response.data),
insert_time = MyTime.get_current_datetime()
)
db_audit.session.add(vul_detail)
db_audit.session.commit()
self.__fix_vul_table_width(table)
text = table.draw()
print >>self.__fd, text
print >>self.__fd, ""
else:
print >>self.__fd, self.__colorize("No vulnerabilities found.", "green")
print >>self.__fd, ""
#--------------------------------------------------------------------------
def __gather_vulnerable_resources(self, vuln):
vulnerable = []
visited = set()
queue = [vuln]
while queue:
data = queue.pop()
identity = data.identity
if identity not in visited:
visited.add(identity)
if data.data_type == Data.TYPE_RESOURCE:
vulnerable.append(str(data))
else:
queue.extend(data.linked_data)
visited.clear()
return vulnerable
#--------------------------------------------------------------------------
def __colorize(self, txt, level_or_color):
if self.__color:
return colorize(txt, level_or_color)
return txt
#--------------------------------------------------------------------------
def __fix_table_width(self, table):
if self.__width > 0:
if hasattr(table, "_hline_string"):
table._hline_string = "" # workaround for bug in texttable
assert all(len(x) == 2 for x in table._rows), table._rows
w = max( len(x[0]) for x in table._rows )
if table._header:
assert len(table._header) == 2, len(table._header)
w = max( w, len(table._header[0]) )
m = w + 8
if self.__width > m:
table.set_cols_width((w, self.__width - m))
def __fix_vul_table_width(self, table):
if self.__width > 0:
if hasattr(table, "_hline_string"):
table._hline_string = "" # workaround for bug in texttable
assert all(len(x) == 6 for x in table._rows), table._rows
w = max( len(x[0]) for x in table._rows )
if table._header:
assert len(table._header) == 6, len(table._header)
w = max( w, len(table._header[0]) )
m = w + 8
if self.__width > m:
vulurl_width = m + 40
parameter_width = 20
payload_width = 10
method_width = 10
risk_width = 10
table.set_cols_width((w, vulurl_width, parameter_width, payload_width, method_width, risk_width))
================================================
FILE: lalascan/libs/core/scope.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
__all__ = ["AuditScope"]
from lalascan.libs.net.web_utils import ParsedURL
from lalascan.data.resource.ip import IP
from lalascan.data.resource.domain import Domain
from lalascan.data.resource.url import URL, SpiderURL
from lalascan.api.exception import LalascanNotImplementedError
import re
from netaddr import IPNetwork, IPAddress
class AbstractScope(object):
'''
abstract scope base class
'''
def __init__(self):
raise LalascanNotImplementedError()
@property
def addresses(self):
raise LalascanNotImplementedError()
@property
def domains(self):
raise LalascanNotImplementedError()
@property
def target_url(self):
raise LalascanNotImplementedError()
def add_target(self):
raise LalascanNotImplementedError()
def get_target(self):
raise LalascanNotImplementedError()
def __str__(self):
return "<%s>" % self
def __contains__(self, target):
raise LalascanNotImplementedError()
def get_targets(self):
"""
Get the audit targets as Data objects.
:returns: Data objects.
:rtype: list(Data)
"""
result = []
result.extend( IP(address) for address in self.addresses )
result.extend( Domain(domain) for domain in self.domains )
result.extend( Domain(root) for root in self.roots )
result.extend( URL(url) for url in self.web_pages )
#----------ADD By BlackYe
result.extend( SpiderURL(url) for url in self.target_url)
return result
class AuditScope(AbstractScope):
_re_is_domain = re.compile(r"^[A-Za-z0-9][A-Za-z0-9\_\-\.]*[A-Za-z0-9]$")
def __init__(self):
self.__domains = set() # Domain names.
self.__roots = set() # Domain names for subdomain matching.
self.__addresses = set() # IP addresses.
self.__web_pages = set() # URLs.
self.__target_url = set()
#--------------------------------------------------------------------------
@property
def addresses(self):
return sorted(self.__addresses)
#--------------------------------------------------------------------------
@property
def domains(self):
return sorted(self.__domains)
#--------------------------------------------------------------------------
@property
def roots(self):
return sorted(self.__roots)
#--------------------------------------------------------------------------
@property
def web_pages(self):
return sorted(self.__web_pages)
# Add By BlackYe.
#--------------------------------------------------------------------------
@property
def target_url(self):
return sorted(self.__target_url)
def add_target(self, target):
try:
IP(target)
address = target
except Exception:
address = None
if address is not None:
# Keep the IP address.
self.__addresses.add(address)
# If it's an IP network...
else:
try:
network = IPNetwork(target)
except Exception:
##raise # XXX DEBUG
network = None
if network is not None:
# For each host IP address in range...
for address in network.iter_hosts():
address = str(address)
# Keep the IP address.
self.__addresses.add(address)
#domain
elif self._re_is_domain.match(target):
target = target.lower()
if target not in self.__domains:
# Keep the domain name.
self.__domains.add(target)
else:
try:
parsed_url = ParsedURL(target)
url = parsed_url.url
except Exception:
url = None
if url is not None:
self.__web_pages.add(url)
self.__target_url.add(url)
host = parsed_url.host
try:
if host.startswith("[") and host.endswith("]"):
IPAddress(host[1:-1], version=6)
host = host[1:-1]
else:
IPAddress(host)
self.__addresses.add(host)
except Exception:
##raise # XXX DEBUG
host = host.lower()
if host not in self.__domains:
self.__domains.add(host)
else:
raise ValueError("I don't know what to do with this: %s" % target)
#--------------------------------------------------------------------------
def __str__(self):
result = ["Audit scope:\n"]
addresses = self.addresses
if addresses:
result.append("\nIP addresses:\n")
for address in addresses:
result.append(" %s\n" % address)
domains = ["*." + domain for domain in self.roots]
domains.extend(self.domains)
if domains:
result.append("\nDomains:\n")
for domain in domains:
result.append(" %s\n" % domain)
web_pages = self.web_pages
if web_pages:
result.append("\nWeb pages:\n")
for url in web_pages:
result.append(" %s\n" % url)
return "".join(result)
class DummyScope (AbstractScope):
"""
Dummy scope tells you everything is in scope, all the time.
"""
def __init__(self):
pass
@property
def has_scope(self):
return False
@property
def addresses(self):
return []
@property
def domains(self):
return []
@property
def roots(self):
return []
@property
def web_pages(self):
return []
def get_targets(self):
return []
def __contains__(self, target):
return True
def __str__(self):
return (
"Audit scope:\n"
"\n"
"IP addresses:\n"
" *\n"
"\n"
"Domains:\n"
" *\n"
"\n"
"Web pages:\n"
" *\n"
)
================================================
FILE: lalascan/libs/core/settings.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
BANNER = '''
_ _
| | __ _| | __ _ ___ ___ __ _ _ __
| | / _` | |/ _` / __|/ __/ _` | '_ \\
| |__| (_| | | (_| \__ \ (_| (_| | | | |
|_____\__,_|_|\__,_|___/\___\__,_|_| |_|
LalaScan WebApplication vul scanner! '''
USAGE = "Fuck"
VERSION = "1.0"
UNICODE_ENCODING = "utf-8"
PLUGIN_IMPORTDICT = {
"from pocsuite.net import": "from pocsuite.lib.request.basic import",
"from pocsuite.poc import": "from pocsuite.lib.core.poc import",
"from pocsuite.utils import register": "from pocsuite.lib.core.register import registerPoc as register",
}
PLUGIN_REGISTER_STRING = "\nfrom lalascan.libs.core.plugin.pluginregister import reg_instance_plugin\nreg_instance_plugin({})"
PLUGIN_REGISTER_REGEX = "reg_instance_plugin\(.*\)"
PLUGIN_CLASSNAME_REGEX = "class\s+(.*?)\(PluginBase\)"
PLUGIN_SUFFIX = '.py'
NGX_HTTP_CODE = {
'NGX_HTTP_ERROR' : 500,
'NGX_HTTP_FORBIDDEN' : 403,
'NGX_HTTP_NOT_FOUND' : 404,
'NGX_HTTP_AUTH' : 401,
'NGX_HTTP_REDIRECT' : 301
}
================================================
FILE: lalascan/libs/core/singletonclass.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
"""
单例模式基类
"""
__author__ = 'BlackYe.'
class Singleton (object):
"""
Implementation of the Singleton pattern.
"""
_instance = None
def __new__(cls, *args, **kw):
# If the singleton has already been instanced, return it.
if cls._instance is not None:
return cls._instance
# Create the singleton's instance.
cls._instance = super(Singleton, cls).__new__(cls, *args, **kw)
# Call the constructor.
cls.__init__(cls._instance, *args, **kw)
# Delete the constructor so it won't be called again.
cls._instance.__init__ = object.__init__
cls.__init__ = object.__init__
# Return the instance.
return cls._instance
================================================
FILE: lalascan/libs/core/spider.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
from lalascan.libs.core.plugin import PluginBase
from lalascan.libs.core.pluginregister import reg_instance_plugin
from lalascan.libs.core.globaldata import L, conf
from lalascan.libs.net.web_utils import parse_url, argument_query, get_request
from lalascan.libs.net.web_mutants import payload_muntants
from lalascan.data.resource.url import URL, SpiderURL
from lalascan.utils.text_utils import to_utf8
from thirdparty_libs.wvs_spider.run import start_wvs_spider_dispatch
import json
def spider_task(audit_name):
cookie_param = None
cookie_dict = conf.cookie if conf is not None and conf.has_key('cookie') else None
m_url = conf.url
if cookie_dict != None:
if hasattr(cookie_dict, "iteritems"):
cookie_params = {
to_utf8(k): to_utf8(v) for k, v in cookie_dict.iteritems()
}
cookie_param = ';'.join(
'%s=%s' % (k ,v) for (k, v) in sorted(cookie_params.iteritems())
)
__ = start_wvs_spider_dispatch(m_url, audit_name, cookie_param, L.logger)
#__ = test_start_wvs_spider_dispatch('www.bbktel.com.cn_d2cc49d948a8589628d260faa6ba41a4')
json_content = json.loads(__)
for urls in json_content['info']:
#print item
L.logger.log_verbose("Web Spider:found url %s" % urls['fullurl'])
m_resource = URL(url = urls['fullurl'])
conf.targets.append(m_resource)
for item_url in urls['content']:
post_param = item_url['param_data']
if "AcunetixBoundary_" in post_param: #multipart/form-data
method = 'FILE_UPLOAD'
else:
method = item_url['method']
if method == "POST":
post_param_dict = argument_query(item_url['param_data'])
m_resource = URL(url = item_url['url'], method = "POST", post_params = post_param_dict, referer= urls['fullurl'])
else:
m_resource = URL(url = item_url['url'], method = method, referer = urls['fullurl'])
L.logger.log_verbose("Web Spider:found url %s" % item_url['url'])
conf.targets.append(m_resource)
================================================
FILE: lalascan/libs/core/threads.py
================================================
#!/usr/bin/env/python
#-*- coding:utf-8 -*-
__author__ = 'BlackYe.'
from lalascan.libs.core.plugin import PluginBase
from lalascan.libs.core.globaldata import vulresult
from lalascan.utils.text_utils import to_utf8
from lalascan.data.resource import Resource
import multiprocessing
import multiprocessing.pool
from multiprocessing import Process
from multiprocessing import cpu_count
import gevent
from gevent.pool import Pool
#from gevent.threadpool import ThreadPool
from gevent import monkey
monkey.patch_socket()
class NoDaemonProcess(multiprocessing.Process):
# make 'daemon' attribute always return False
def _get_daemon(self):
return False
def _set_daemon(self, value):
pass
daemon = property(_get_daemon, _set_daemon)
class MyResourcePool(multiprocessing.pool.Pool):
Process = NoDaemonProcess
# ------------------------------
class MyGeventPool(gevent.pool.Pool):
def _wait(self):
gevent.wait()
def plugin_run_thread(plugin_name, pluginheader, info, method, **kwargs):
#if issubclass(pluginheader, PluginBase):
#print '1'
p = pluginheader
print type(p)
p.run_plugin(info, resource_method = method , resource_param = kwargs)
def execute_plugin(register_plugins, m_resource):
pluginPool = MyGeventPool(30)
for key, plugin in register_plugins.iteritems():
##proPool.apply_async(plugin_run_thread, (key, plugin, m_resource))
if isinstance(m_resource, Resource):
if m_resource.has_url_params:
param_dict = m_resource.url_params
method = 'GET'
if m_resource.has_post_params:
param_dict = m_resource.post_params
method = 'POST'
for k, v in param_dict.iteritems():
param_key = to_utf8(k)
param_value = to_utf8(v)
pluginPool.spawn(plugin_run_thread, key, plugin, m_resource, method = method, param_key = param_key, param_value = param_value)
pluginPool.join()
================================================
FILE: lalascan/libs/net/__init__.py
================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Network protocols API.
"""
================================================
FILE: lalascan/libs/net/dns.py
================================================
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Required since "dns" is both an external module and the name of this file.
from __future__ import absolute_import
__license__ = """
GoLismero 2.0 - The web knife - Copyright (C) 2011-2014
Golismero project site: http://golismero-project.com
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""
__all__ = ["DNS"]
from ..data.information.dns import * # noqa
from ..data import LocalDataCache
from ...common import Singleton
import dns.query
import dns.resolver
import dns.reversename
import socket
from dns.zone import *
from netaddr import IPAddress
from netaddr.core import AddrFormatError
#------------------------------------------------------------------------------
class _DNS(Singleton):
# Some code borrowed from the dnsrecon project:
# https://github.com/darkoperator/dnsrecon
REQUEST_TIMEOUT = 2.0 # In seconds
# Public list of free DNS servers.
#
# This list was taken from:
#
# http://pcsupport.about.com/od/tipstricks/a/free-public-dns-servers.htm
#
PUBLIC_NAMESERVERS = [
# Level 3 (http://www.level3.com/)
"209.244.0.3",
"209.244.0.4",
# Google
"8.8.8.8",
"8.8.4.4",
# Security (http://www.securly.com/)
"184.169.143.224",
"184.169.161.155",
# Comodo Secure DNS (http://www.comodo.com/secure-dns/)
"8.26.56.26",
"8.20.247.20",
# OpenDNS Home (http://www.opendns.com/)
"208.67.222.222",
"208.67.220.220",
# DNS Advantage (http://www.neustar.biz/enterprise/dns-services/free-recursive-dns)
"156.154.70.1",
"156.154.71.1",
# Norton ConnectSafe (https://dns.norton.com/dnsweb/faq.do)
"198.153.192.40",
"198.153.194.40",
# SafeDNS (https://www.safedns.com/features/)
"195.46.39.39",
"195.46.39.40",
# OpenNIC (http://www.opennicproject.org/)
"74.207.247.4",
"64.0.55.201",
# Public -Root (http://public-root.com/root-server-check/index.htm)
"199.5.157.131",
"208.71.35.137",
# SmartViper (http://www.markosweb.com/free-dns/)
"208.76.50.50",
"208.76.51.51",
# Dyn (http://dyn.com/support/internet-guide-setup/)
"216.146.35.35",
"216.146.36.36",
# Hurricane Electric (http://he.net/)
"74.82.42.42",
# puntCAT (http://www.servidordenoms.cat/)
"109.69.8.51",
]
#--------------------------------------------------------------------------
def check_tcp_dns(self, address, dns_port=53):
"""
Function to check if a server is listening at port 53 TCP. This
will aid in IDS/IPS detection since a AXFR will not be tried if
TCP port 53 is found to be closed.
:param address: IP address or domain name.
:type address: str
:param dns_port: Port number to connect to the server.
:type dns_port: int
:return: True if server accepts TCP connections, False otherwise.
:rtype: bool
"""
if not isinstance(address, basestring):
raise TypeError("Expected basestring, got '%s'" % type(address))
if not isinstance(dns_port, int):
raise TypeError("Expected int, got '%s'" % type(dns_port))
if dns_port < 1:
raise ValueError("Port number must be greater than 0.")
s = socket.socket()
s.settimeout(self.REQUEST_TIMEOUT)
try:
s.connect((address, dns_port))
except Exception:
return False
else:
return True
finally:
s.close()
#--------------------------------------------------------------------------
def resolve(self, target, type, nameservers=None):
"""
Function for performing general resolution types.
Special type of register is "ALL", that returns all of the registers
returned by the query.
:param target: Name to resolve.
:type target: str
:param type: Type of query: ALL, A, AAAA, NS, PTR...
:type type: int | str
:param nameservers: Nameservers to use.
:type nameservers: list(str)
:return: DNS registers.
:rtype: list(DnsRegister)
"""
return self._make_request(type, target, nameservers)
#--------------------------------------------------------------------------
def get_a(self, host, nameservers=None, also_CNAME=False):
"""
Resolve the A records for a given host.
:param host: Target hostname.
:type host: str
:param nameservers: Nameservers to use.
:type nameservers: list(str)
:param also_CNAME: Set this var to True if you want to return also the CNAME Registers returned by the query.
:tyep algo_CNAME: bool
:return: Type A registers.
:rtype: list(DnsRegisterA)
"""
# Special case for localhost
if host.lower() == "localhost":
return [DnsRegisterA("127.0.0.1")]
r = self._make_request("A", host, nameservers, auto_resolve=not also_CNAME)
# Get all the register: CNAME and A
if also_CNAME:
m_return = []
if not isinstance(r, list):
m_return.extend(self._dnslib2register("ALL", r))
else:
m_return_extend = m_return.extend
for lr in r:
m_return_extend(self._dnslib2register("ALL", lr))
return m_return
else:
return r
#--------------------------------------------------------------------------
def get_aaaa(self, host, nameservers=None, also_CNAME=False):
"""
Resolve the A Record for a given host.
:param host: Target hostname.
:type host: str
:param nameservers: Nameservers to use.
:type nameservers: list(str)
:param also_CNAME: Set this var to True if you want to return also the CNAME Registers returned by the query.
:tyep algo_CNAME: bool
:return: AAAA registers.
:rtype: list(DnsRegisterAAAA)
"""
# Special case for localhost
if host.lower() == "localhost":
return [DnsRegisterAAAA("::1")]
r = self._make_request("AAAA", host, nameservers, auto_resolve=not also_CNAME)
if also_CNAME:
# Get all the register: CNAME and A
m_return = []
if not isinstance(r, list):
m_return.extend(self._dnslib2register("ALL", r))
else:
m_return_extend = m_return.extend
for lr in r:
m_return_extend(self._dnslib2register("ALL", lr))
return m_return
else:
return r
#--------------------------------------------------------------------------
def get_mx(self, host, nameservers=None):
"""
Resolve the MX records for a given host.
:param host: Target hostname.
:type host: str
:param nameservers: Nameservers to use.
:type nameservers: list(str)
:return: MX registers.
:rtype: list(DnsRegisterMX)
"""
return self._make_request("MX", host, nameservers)
#--------------------------------------------------------------------------
def get_ns(self, host, nameservers=None):
"""
Returns all NS records. Also returns the IP
address of the host both in IPv4 and IPv6.
:param host: Target hostname.
:type host: str
:param nameservers: Nameservers to use.
:type nameservers: list(str)
:return: NS registers.
:rtype: list(DnsRegisterNS)
"""
return self._make_request("NS", host, nameservers)
#--------------------------------------------------------------------------
def get_soa(self, host, nameservers=None):
"""
Returns all SOA records. Also returns the IP
address of the host both in IPv4 and IPv6.
:param host: Target hostname.
:type host: str
:param nameservers: Nameservers to use.
:type nameservers: list(str)
:return: SOA registers.
:rtype: list(DnsRegisterSOA)
"""
return self._make_request("SOA", host, nameservers)
#--------------------------------------------------------------------------
def get_spf(self, host, nameservers=None):
"""
Resolve SPF records.
:param host: the target to make the request.
:type host: str
:param nameservers: nameserver to use.
:type nameservers: list(str)
:return: SPF registers.
:rtype: list(DnsRegisterSPF)
"""
return self._make_request("SPF", host, nameservers)
#--------------------------------------------------------------------------
def get_txt(self, host, nameservers=None):
"""
Resolve TXT records.
:param host: Target hostname.
:type host: str
:param nameservers: Nameservers to use.
:type nameservers: list(str)
:return: TXT registers.
:rtype: list(DnsRegisterTXT)
"""
return self._make_request("TXT", host, nameservers)
#--------------------------------------------------------------------------
def get_ptr(self, ipaddress, nameservers=None):
"""
Resolve PTR records given it's IPv4 or IPv6 address.
:param ipaddress: Target IP address.
:type ipaddress: str
:param nameservers: Nameservers to use.
:type nameservers: list(str)
:return: PTR registers.
:rtype: list(DnsRegisterPTR)
"""
if not isinstance(ipaddress, basestring):
raise TypeError("Expected basestring, got '%s'" % type(ipaddress))
# Detect the IP address version
m_ipobj = None
try:
m_ipobj = IPAddress(ipaddress)
except AddrFormatError:
raise ValueError("Wrong IP address")
# Make the query
m_ip = str(dns.reversename.from_address(ipaddress))
# Get the IPs
if m_ip:
if m_ipobj.version == "4":
m_name = m_ip.replace(".in-addr.arpa.", "")
else:
m_name = m_ip.replace("ip6.arpa.", "")
return self._make_request("PTR", m_name, nameservers)
else:
return []
#--------------------------------------------------------------------------
def get_srv(self, host, nameservers=None):
"""
Function for resolving SRV Records.
:param host: Target hostname.
:type host: str
:param nameservers: Nameservers to use.
:type nameservers: list(str)
:return: SRV registers.
:rtype: list(DnsRegisterSRV)
"""
return self._make_request("SRV", host, nameservers)
#--------------------------------------------------------------------------
def get_nsec(self, host, nameservers=None):
"""
Function for querying for a NSEC record and retriving the rdata object.
This function is used mostly for performing a Zone Walk against a zone.
:param host: Target hostname.
:type host: str
:param nameservers: Nameservers to use.
:type nameservers: list(str)
:return: NSEC registers.
:rtype: list(DnsRegisterNSEC)
"""
return self._make_request("NSEC", host, nameservers)
#--------------------------------------------------------------------------
def zone_transfer(self, domain, nameservers = None, ns_allowed_zone_transfer=False):
"""
Function for testing for zone transfers on a given Domain.
:param domain: Target hostname.
:type domain: str
:param nameservers: Alternate nameservers.
:type nameservers: list(str)
:param ns_allowed_zone_transfer: is set to True, this funcion will return the list of
nameservers with zone transfer enabled.
:type ns_allowed_zone_transfer: bool
:return: If successful, a list of DnsRegister objects.
Otherwise, an empty list. If ns_allowed_zone_transfer is enabled, it will
return a tuple as format: (set(servers with zone transfer enabled), list(DnsRegister))
:rtype: list(DnsRegister) | (set(str), list(DnsRegister))
"""
if not isinstance(domain, basestring):
raise TypeError("Expected basestring, got '%s'" % type(domain))
if nameservers:
if isinstance(nameservers, list):
for n in nameservers:
if not isinstance(n, basestring):
raise TypeError("Expected basestring, got '%s'" % type(n))
else:
raise TypeError("Expected list, got '%s'" % type(nameservers))
# Results of zone transfer
zone_records = []
zone_records_append = zone_records.append
ns_zone_enabled = set()
# Availabe DNS servers
ns_records = None
# If nameservers specified -> use it
if nameservers:
ns_records = set(nameservers)
else: # Looking for nameservers for the domain
#Find NS for domains
ns_tmp = self.get_ns(domain)
#
# Check the input domain
#
# If name server of the domain is NOT empty -> the domain is NOT a nameserver
if ns_tmp:
# Mark for not tracking
map(LocalDataCache.on_autogeneration, ns_tmp)
# Store only the IP address of the DNS servers
l_dns = set()
l_dns_append = l_dns.add
for d in ns_tmp:
for t in self.get_ips(d):
l_dns_append(t.address)
# Mark for not tracking
LocalDataCache.on_autogeneration(t)
# Find SOA for Domain
for d in self.get_soa(domain):
for t in self.get_ips(d):
l_dns_append(t.address)
# Mark for not tracking
LocalDataCache.on_autogeneration(t)
# Mark for not tracking
LocalDataCache.on_autogeneration(d)
ns_records = l_dns
else:
# The domain is an DNS server
ns_records = set((domain,))
#
# Make the transfer for each NS Server
#
for ns_srv in ns_records:
if self.check_tcp_dns(ns_srv):
try:
zone = self._from_wire(dns.query.xfr(where=ns_srv, zone=domain, timeout=10))
# Store the ns used to the zone transfer
if ns_allowed_zone_transfer:
ns_zone_enabled.add(ns_srv)
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.SOA):
for rdata in rdataset:
zone_records_append(self._dnslib2register("SOA",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.NS):
for rdata in rdataset:
zone_records_append(self._dnslib2register("NS",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.TXT):
for rdata in rdataset:
zone_records_append(self._dnslib2register("TXT",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.SPF):
zone_records_append(self._dnslib2register("SPF",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.PTR):
for rdata in rdataset:
zone_records_append(self._dnslib2register("PTR",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.MX):
for rdata in rdataset:
zone_records_append(self._dnslib2register("MX",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.AAAA):
for rdata in rdataset:
zone_records_append(self._dnslib2register("AAAA",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.A):
for rdata in rdataset:
zone_records_append(self._dnslib2register("A",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.CNAME):
for rdata in rdataset:
zone_records_append(self._dnslib2register("CNAME",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.SRV):
for rdata in rdataset:
zone_records_append(self._dnslib2register("SRV",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.HINFO):
for rdata in rdataset:
zone_records_append(self._dnslib2register("HINFO",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.WKS):
for rdata in rdataset:
zone_records_append(self._dnslib2register("WKS",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.RP):
for rdata in rdataset:
zone_records_append(self._dnslib2register("RP",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.AFSDB):
for rdata in rdataset:
zone_records_append(self._dnslib2register("AFSDB",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.LOC):
for rdata in rdataset:
zone_records_append(self._dnslib2register("LOC",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.X25):
for rdata in rdataset:
zone_records_append(self._dnslib2register("X25",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.ISDN):
for rdata in rdataset:
zone_records_append(self._dnslib2register("ISDN",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.RT):
for rdata in rdataset:
zone_records_append(self._dnslib2register("X25",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.NSAP):
for rdata in rdataset:
zone_records_append(self._dnslib2register("NSAP",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.NAPTR):
for rdata in rdataset:
zone_records_append(self._dnslib2register("NAPTR",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.CERT):
for rdata in rdataset:
zone_records_append(self._dnslib2register("CERT",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.SIG):
for rdata in rdataset:
zone_records_append(self._dnslib2register("SIG",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.RRSIG):
for rdata in rdataset:
zone_records_append(self._dnslib2register("RRSIG",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.DNSKEY):
for rdata in rdataset:
zone_records_append(self._dnslib2register("DNSKEY",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.DS):
for rdata in rdataset:
zone_records_append(self._dnslib2register("DS",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.NSEC):
for rdata in rdataset:
zone_records_append(self._dnslib2register("NSEC",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.NSEC3):
for rdata in rdataset:
zone_records_append(self._dnslib2register("NSEC3",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.NSEC3PARAM):
for rdata in rdataset:
zone_records_append(self._dnslib2register("NSEC3PARAM",rdata))
for (name, rdataset) in zone.iterate_rdatasets(dns.rdatatype.IPSECKEY):
for rdata in rdataset:
zone_records_append(self._dnslib2register("IPSECKEY",rdata))
except:
pass
if ns_allowed_zone_transfer:
return (ns_zone_enabled, zone_records)
else:
return zone_records
#--------------------------------------------------------------------------
#
# Helpers
#
#--------------------------------------------------------------------------
#
# This method has been taken directly (with some changes) from dns recon project
#
def _from_wire(self, xfr, zone_factory=Zone, relativize=True):
"""
Method for turning returned data from a DNS AXFR to RRSET.
This method will not perform a check origin on the zone data
as the method included with dnspython.
"""
z = None
for r in xfr:
if z is None:
if relativize:
origin = r.origin
else:
origin = r.answer[0].name
rdclass = r.answer[0].rdclass
z = zone_factory(origin, rdclass, relativize=relativize)
for rrset in r.answer:
znode = z.nodes.get(rrset.name)
if not znode:
znode = z.node_factory()
z.nodes[rrset.name] = znode
zrds = znode.find_rdataset(rrset.rdclass, rrset.rdtype,
rrset.covers, True)
zrds.update_ttl(rrset.ttl)
for rd in rrset:
rd.choose_relativity(z.origin, relativize)
zrds.add(rd)
return z
#--------------------------------------------------------------------------
def get_ips(self, register):
"""
Get the list of IPs associated the register as parameter.
If you pass CNAME register, you get an A/AAAA register:
>> cname = DnsRegisterCNAME("myalias.mysite.com")
>> a = Dns.get_ips(cname)
>> print a
[<DnsRegisterA object at 0x103ad9a50>]
>> print a[0]
<DnsRegisterA object at 0x103ad9a50>
>> print a[0].target
127.0.0.1
:param register: A DNS Register.
Valid registers are: DnsRegisterA, DnsRegisterAAAA,
DnsRegisterCNAME DnsRegisterISDN, DnsRegisterNS,
DnsRegisterNSAP, DnsRegisterPTR, DnsRegisterSOA,
DnsRegisterSRV, DnsRegisterWKS, DnsRegisterX25
:type register: DnsRegister
:return: A list with the A and AAAA registers.
:rtype : list(DnsRegisterA|DnsRegisterAAAA)
"""
if not isinstance(register, DnsRegister):
raise TypeError("Expected DnsRegister, got '%s'" % type(register))
PROP = self.PROPERTIES_WITH_IP_ADDRESSES
if register.type not in PROP:
return []
if register.type in ("A", "AAAA"):
return [register]
m_return = []
target = getattr(register, PROP[register.type])
# IPv4 address
m_return.extend(self.get_a(target))
# IPv6 address
m_return.extend(self.get_aaaa(target))
return m_return
PROPERTIES_WITH_IP_ADDRESSES = {
"A":"target",
"AAAA":"target",
"CNAME":"target",
"ISDN":"address",
"NS":"target",
"NSAP":"address",
"PTR":"target",
"SOA":"mname",
"SRV":"target",
"WKS":"address",
"X25":"address"
}
#--------------------------------------------------------------------------
def _dnslib2register(self, type, answer_in):
"""
Creates a DnsRegister from a dnslib register.
Special type of register "ALL" that converts all the types of the
registers.
:param type: Type of response to get: A, AAAA, CNAME...
:type type: str
:param answer_in: Object with the answer from dnslib.
:type answer_in: dns.resolver.Answer
:return: DNS register.
:rtype: list(DnsRegister)
"""
m_return = []
m_return_append = m_return.append
if isinstance(answer_in, dns.resolver.Answer):
for ardata in answer_in.response.answer:
for rdata in ardata:
register_type = DnsRegister.id2name(rdata.rdtype)
# If register it different that we are looking for, skip it.
if type != register_type and type != "ALL":
continue
m_return_append(self.__dnsregister2golismeroregister(register_type, rdata))
else:
register_type = DnsRegister.id2name(answer_in.rdtype)
m_return_append(self.__dnsregister2golismeroregister(register_type, answer_in))
return m_return
#--------------------------------------------------------------------------
def __dnsregister2golismeroregister(self, register_type, answer):
"""
Transform a dnslib register into a DnsRegister.
:param register_type: Type of register.
:type register_type: str
:param answer: dnslib object with a DNS register data.
:type answer: object
:return: DNS register.
:rtype: DnsRegister
"""
m_return = None
if register_type == "A":
m_return = DnsRegisterA(answer.address)
elif register_type == "AAAA":
m_return = DnsRegisterAAAA(answer.address)
elif register_type == "AFSDB":
m_return = DnsRegisterAFSDB(answer.subtype, answer.hostname.to_text()[:-1])
elif register_type == "CERT":
m_return = DnsRegisterCERT(answer.algorithm,
answer.certificate,
answer.certificate_type,
answer.key_tag)
elif register_type == "CNAME":
m_return = DnsRegisterCNAME(answer.target.to_text()[:-1])
elif register_type == "DNSKEY":
m_return = DnsRegisterDNSKEY(answer.algorithm,
answer.flags,
dns.rdata._hexify(answer.key),
answer.protocol)
elif register_type == "DS":
m_return = DnsRegisterDS(answer.algorithm,
dns.rdata._hexify(answer.digest),
answer.digest_type,
answer.key_tag)
elif register_type == "HINFO":
m_return = DnsRegisterHINFO(answer.cpu,
answer.os)
elif register_type == "IPSECKEY":
m_return = DnsRegisterIPSECKEY(answer.algorithm,
answer.gateway,
answer.gateway_type,
answer.key,
answer.precedence)
elif register_type == "ISDN":
m_return = DnsRegisterISDN(answer.address,
answer.subaddress)
elif register_type == "LOC":
m_return = DnsRegisterLOC(answer.latitude,
answer.longitude,
answer.altitude,
answer.to_text())
elif register_type == "MX":
m_return = DnsRegisterMX(answer.exchange.to_text()[:-1],
answer.preference)
elif register_type == "NAPTR":
m_return = DnsRegisterNAPTR(answer.order,
answer.preference,
answer.regexp,
answer.replacement.to_text()[:-1],
answer.service)
elif register_type == "NS":
m_return = DnsRegisterNS(answer.target.to_text()[:-1])
elif register_type == "NSAP":
m_return = DnsRegisterNSAP(answer.address)
elif register_type == "NSEC":
m_return = DnsRegisterNSEC(answer.next.to_text()[:-1])
elif register_type == "NSEC3":
m_return = DnsRegisterNSEC3(answer.algorithm,
answer.flags,
answer.iterations,
dns.rdata._hexify(answer.salt))
elif register_type == "NSEC3PARAM":
m_return = DnsRegisterNSEC3PARAM(answer.algorithm,
answer.flags,
answer.iterations,
dns.rdata._hexify(answer.salt))
elif register_type == "PTR":
m_return = DnsRegisterPTR(answer.target.to_text()[:-1])
elif register_type == "RP":
m_return = DnsRegisterRP(answer.mbox.to_text()[:-1],
answer.txt.to_text()[:-1])
elif register_type == "RPSIG":
m_return = DnsRegisterRRSIG(answer.algorithm,
answer.expiration,
answer.interception,
answer.key_tag,
answer.labels,
answer.original_ttl,
answer.signer,
answer.type_coverded)
elif register_type == "SIG":
m_return = DnsRegisterSIG(answer.algorithm,
answer.expiration,
answer.interception,
answer.key_tag,
answer.labels,
answer.original_ttl,
answer.signer,
answer.type_coverded)
elif register_type == "SOA":
m_return = DnsRegisterSOA(answer.mname.to_text()[:-1],
answer.rname.to_text()[:-1],
answer.refresh,
answer.expire)
elif register_type == "SPF":
m_return = DnsRegisterSPF(answer.strings)
elif register_type == "SRV":
m_return = DnsRegisterSRV(answer.target.to_text()[:-1],
answer.priority,
answer.weight,
answer.port)
elif register_type == "TXT":
m_return = DnsRegisterTXT(answer.strings)
elif register_type == "WKS":
m_return = DnsRegisterWKS(answer.address,
answer.protocol,
answer.bitmap)
elif register_type == "X25":
m_return = DnsRegisterX25(answer.address)
else:
raise ValueError("DNS register type '%s' is incorrect." % register_type)
return m_return
#--------------------------------------------------------------------------
def _make_request(self, register_type, host, nameservers=None, auto_resolve=True):
"""
Make a request using dnslib, and return a DNS register.
:param: register_type: Type of query: A, AAAA, CNAME...
:type register_type: str
:param host: Target host for the request.
:type host: str
:param nameservers: Custom name servers.
:type nameservers: list(str)
:param auto_resolve: configure this function to transform de dnslib register to the golismero register.
:type auto_resolve: bool
:return: a list with the DnsRegisters. Returned list can be empty, if a error has occurred.
:type: list(DnsRegister)
"""
if not isinstance(register_type, basestring):
raise TypeError("Expected str, got '%s'" % type(type))
if not isinstance(host, basestring):
raise TypeError("Expected basestring, got '%s'" % type(host))
if nameservers:
if isinstance(nameservers, list):
for n in nameservers:
if not isinstance(n, basestring):
raise TypeError("Expected basestring, got '%s'" % type(n))
else:
raise TypeError("Expected list, got '%s'" % type(nameservers))
m_query_obj = None
if nameservers:
m_query_obj = dns.resolver.Resolver(configure=False)
m_query_obj.nameservers = nameservers
else:
m_query_obj = dns.resolver.Resolver(configure=True)
# Append the free public DNS servers for avoid errors when the DNS servers
# configured in /etc/resolv.conf fails.
m_query_obj.nameservers.extend(self.PUBLIC_NAMESERVERS)
# Set timeouts
m_query_obj.timeout = self.REQUEST_TIMEOUT
m_query_obj.lifetime = self.REQUEST_TIMEOUT
try:
answer = m_query_obj.query(host, register_type)
except Exception:
return []
if auto_resolve:
return self._dnslib2register(register_type, answer)
else:
return answer
# Instance the singleton.
DNS = _DNS()
================================================
FILE: lalascan/libs/net/http.py
================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
HTTP protocol API for GoLismero.
"""
__all__ = ["HTTP"]
from lalascan.api.exception import LalascanNetworkException, LalascanNetworkOutOfScope
from .web_utils import detect_auth_method, get_auth_obj
from ...data.http import HTTP_Request, HTTP_Response, HTTP_Raw_Request
from ...data.resource.url import URL
from ..core.singletonclass import Singleton
from ...libs.core.globaldata import conf
from hashlib import md5
from os import environ
from os.path import join
from requests import Session
from requests.cookies import cookiejar_from_dict
from requests.exceptions import RequestException
from socket import socket, error, getaddrinfo, SOCK_STREAM
from ssl import wrap_socket
from StringIO import StringIO
from time import time
#------------------------------------------------------------------------------
class _HTTP(Singleton):
"""
HTTP protocol API for GoLismero.
"""
#--------------------------------------------------------------------------
def __init__(self):
self.__session = None
#--------------------------------------------------------------------------
def _initialize(self):
"""
.. http request init
"""
# Start a new session.
self.__session = Session()
# Load the proxy settings.
if conf is not None and conf.has_key('proxy_addr') and conf.has_key('proxy_port'):
proxy_addr = conf.proxy_addr
if proxy_addr:
proxy_port = conf.proxy_port
if proxy_port:
proxy_addr = "%s:%s" % (proxy_addr, proxy_port)
'''
auth_user = Config.audit_config.proxy_user
auth_pass = Config.audit_config.proxy_pass
auth, _ = detect_auth_method(proxy_addr)
self.__session.auth = get_auth_obj(auth, auth_user, auth_pass)
'''
self.__session.proxies = {
"http": proxy_addr,
"https": proxy_addr,
"ftp": proxy_addr,
}
# Load the cookies.
if conf is not None and conf.has_key('cookie'):
cookie = conf.cookie
if cookie:
self.__session.cookies = cookiejar_from_dict(cookie)
# Set User Agent
if conf is not None and conf.has_key('user_agent'):
self.__user_agent = conf.user_agent
#--------------------------------------------------------------------------
def _finalize(self):
'''
clean session headers
:return:
'''
self.__session = None
#--------------------------------------------------------------------------
def get_url(self, url, method = "GET", callback = None, timeout = 30.0, allow_redirects = True):
"""
Send a simple HTTP request to the server and get the response back.
:param url: URL to request.
:type url: str
:param method: HTTP method.
:type method: str
:param callback: Callback function.
:type callback: callable
:param timeout: Timeout in seconds.
The minimum value is 0.5 and the maximum is 100.0. Any other values
will be silently converted to either one of them.
:type timeout: int | float
:param allow_redirects: True to follow redirections, False otherwise.
:type allow_redirects: bool
:returns: HTTP response, or None if the request was cancelled.
:rtype: HTTP_Response | None
:raises NetworkOutOfScope: The resource is out of the audit scope.
Note that this can happen even if the URL has been checked against
Config.audit_scope -- if the server responds with a
redirection against another URL that's out of scope.
:raises NetworkException: A network error occurred.
"""
request = HTTP_Request(url, method = method, user_agent=self.__user_agent)
return self.make_request(request, callback = callback, timeout = timeout, allow_redirects = allow_redirects)
#--------------------------------------------------------------------------
def make_request(self, request, callback = None, timeout = 30.0, allow_redirects = True):
"""
Send an HTTP request to the server and get the response back.
:param request: HTTP request to send.
:type request: HTTP_Request
:param callback: Callback function.
:type callback: callable
:param timeout: Timeout in seconds.
The minimum value is 0.5 and the maximum is 100.0. Any other values
will be silently converted to either one of them.
:type timeout: int | float
:param allow_redirects: True to follow redirections, False otherwise.
:type allow_redirects: bool
:returns: HTTP response, or None if the request was cancelled.
:rtype: HTTP_Response | None
:raises NetworkOutOfScope: The resource is out of the audit scope.
:raises NetworkException: A network error occurred.
"""
# Check initialization.
if self.__session is None:
self._initialize()
# Check the arguments.
if not isinstance(request, HTTP_Request):
raise TypeError("Expected HTTP_Request, got %r instead" % type(request))
if callback is not None and not callable(callback):
raise TypeError(
"Expected callable (function, class, instance with __call__),"
" got %r instead" % type(callback)
)
# Sanitize the timeout value.
if timeout:
timeout = float(timeout)
if timeout > 100.0:
timeout = 100.0
elif timeout < 0.5:
timeout = 0.5
else:
timeout = 0.5
# Filter the Host header to work around a Requests quirk.
headers = request.headers.to_dict()
try:
del headers['host']
except KeyError:
pass
# Send the request.
try:
t1 = time()
resp = self.__session.request(
method = request.method,
url = request.url,
headers = headers,
data = request.post_data,
##files = request.files, # not supported yet!
verify = False,
stream = True,
timeout = timeout,
allow_redirects = allow_redirects,
)
t2 = time()
except RequestException, e:
#print str(e)
raise LalascanNetworkException(str(e))
try:
# Get the response properties.
url = resp.url
status_code = str(resp.status_code)
content_type = resp.headers.get("Content-Type")
try:
content_length = int(resp.headers["Content-Length"])
except Exception:
content_length = None
# If the final URL is different from the request URL,
# abort if the new URL is out of scope.
if url != request.url:
raise LalascanNetworkOutOfScope("URL out of scope: %s" % url)
# Call the user-defined callback, and cancel if requested.
if callback is not None:
cont = callback(request, url, status_code, content_length, content_type)
if not cont:
return
# Autogenerate an URL object.
# XXX FIXME: the depth level is broken!!!
url_obj = None
if url != request.url:
url_obj = URL(
url = url,
method = request.method,
post_params = request.post_data,
referer = request.referer,
)
# Download the contents.
try:
t3 = time()
data = resp.content
t4 = time()
except RequestException, e:
raise LalascanNetworkException(str(e))
# Calculate the elapsed time.
elapsed = (t2 - t1) + (t4 - t3)
# Build an HTTP_Response object.
# Since the requests library won't let us access the raw
# response bytes, we have to "reconstruct" them.
response = HTTP_Response(
request = request,
status = status_code,
headers = resp.headers,
data = data,
elapsed = elapsed,
)
# Link it to the originating URL.
#if url_obj is not None:
# response.add_resource(url_obj)
# Return the HTTP_Response object.
return response
finally:
# Close the connection.
resp.close()
#--------------------------------------------------------------------------
def make_raw_request(self, raw_request, host, port = 80, proto = "http",
callback = None, timeout = 30.0):
"""
Send a raw HTTP request to the server and get the response back.
.. note: This method does not support the use of the cache or a proxy.
.. warning::
This method only returns the HTTP response headers, **NOT THE CONTENT**.
:param raw_request: Raw HTTP request to send.
:type raw_request: HTTP_Raw_Request
:param host: Hostname or IP address to connect to.
:type host: str
:param port: TCP port to connect to.
:type port: int
:param proto: Network protocol (that is, the URL scheme).
:type proto: str
:param callback: Callback function.
:type callback: callable
:param timeout: Timeout in seconds.
The minimum value is 0.5 and the maximum is 100.0. Any other values
will be silently converted to either one of them.
:type timeout: int | float
:param use_cache: Control the use of the cache.
Use True to force the use of the cache,
False to force not to use it,
or None for automatic.
:type use_cache: bool | None
:returns: HTTP response, or None if the request was cancelled.
:rtype: HTTP_Response | None
:raises NetworkOutOfScope: The resource is out of the audit scope.
:raises NetworkException: A network error occurred.
"""
# Abort if a proxy is configured, because we don't support this yet.
if conf.audit_config.proxy_addr:
raise NotImplementedError("Proxy not yet supported")
# Check the arguments.
if type(raw_request) is str:
raw_request = HTTP_Raw_Request(raw_request)
elif not isinstance(raw_request, HTTP_Raw_Request):
raise TypeError("Expected HTTP_Raw_Request, got %r instead" % type(raw_request))
if type(host) == unicode:
raise NotImplementedError("Unicode hostnames not yet supported")
if type(host) != str:
raise TypeError("Expected str, got %r instead" % type(host))
if proto not in ("http", "https"):
raise ValueError("Protocol must be 'http' or 'https', not %r" % proto)
if port is None:
if proto == "http":
port = 80
elif proto == "https":
port = 443
else:
assert False, "internal error!"
elif type(port) not in (int, long):
raise TypeError("Expected int, got %r instead" % type(port))
if port < 1 or port > 32767:
raise ValueError("Invalid port number: %d" % port)
if callback is not None and not callable(callback):
raise TypeError(
"Expected callable (function, class, instance with __call__),"
" got %r instead" % type(callback)
)
# Sanitize the timeout value.
if timeout:
timeout = float(timeout)
if timeout > 100.0:
timeout = 100.0
elif timeout < 0.5:
timeout = 0.5
else:
timeout = 0.5
# Resolve the hostname.
# FIXME: we're only using the first item, but we could use more
# than one, for example iterate through them if they fail.
family, socktype, proto, canonname, sockaddr = \
getaddrinfo(host, port, 0, SOCK_STREAM)[0]
# Start the timer.
t1 = time()
try:
s = socket(family, socktype, proto)
try:
s.settimeout(timeout)
s.connect(sockaddr)
try:
if proto == "https":
s = wrap_socket(s)
# Send the HTTP request.
s.sendall(raw_request.raw_request)
# Get the HTTP response headers.
raw_response = StringIO()
while True:
data = s.recv(1)
if not data:
raise LalascanNetworkException(
"Server has closed the connection")
raw_response.write(data)
if raw_response.getvalue().endswith("\r\n\r\n"):
break # full HTTP headers received
if len(raw_response.getvalue()) > 65536:
raise LalascanNetworkException(
"Response headers too long")
# Stop the timer.
t2 = time()
# Call the user-defined callback,
# and cancel if requested.
if callback is not None:
temp_request = HTTP_Raw_Request(
raw_request.raw_request)
temp_response = HTTP_Response(
temp_request,
raw_response = raw_response.getvalue()
)
cont = callback(temp_request, temp_response)
if not cont:
return
del temp_request
del temp_response
# Start the timer.
t3 = time()
# Download the contents.
#
#
#
# XXX TODO
#
#
#
# Stop the timer.
t4 = time()
# Return the HTTP_Response object.
return HTTP_Response(
request = raw_request,
raw_response = raw_response.getvalue(),
elapsed = (t2 - t1) + (t4 - t3),
)
# Close the connection and clean up the socket.
finally:
try:
s.shutdown(2)
except Exception:
pass
finally:
try:
s.close()
except Exception:
pass
# On socket errors, send an exception.
except error, e:
raise LalascanNetworkException(str(e))
#------------------------------------------------------------------------------
# Singleton pattern.
HTTP = _HTTP()
================================================
FILE: lalascan/libs/net/scraper.py
================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
URL scraping API.
This module contains utility functions to extract (scrape) URLs from data.
Currently only HTML and plain text data are supported.
"""
__all__ = [
# Generic entry point.
"extract",
# Specific parsers for each data format.
"extract_from_text",
"extract_from_h
gitextract_yawu4nrk/
├── .gitignore
├── README.md
├── bin/
│ └── __init__.py
├── cache/
│ ├── __init__.py
│ └── leakinfo.json
├── conf.py
├── lalascan/
│ ├── __init__.py
│ ├── api/
│ │ ├── __init__.py
│ │ ├── exception.py
│ │ ├── option.py
│ │ └── proxycrawl.py
│ ├── cache/
│ │ └── __init__.py
│ ├── data/
│ │ ├── __init__.py
│ │ ├── datatype.py
│ │ ├── enum.py
│ │ ├── http.py
│ │ ├── information/
│ │ │ ├── __init__.py
│ │ │ ├── banner.py
│ │ │ ├── html.py
│ │ │ ├── portscan.py
│ │ │ └── webservice.py
│ │ ├── resource/
│ │ │ ├── __init__.py
│ │ │ ├── domain.py
│ │ │ ├── ip.py
│ │ │ └── url.py
│ │ └── vuln/
│ │ ├── __init__.py
│ │ └── vulnerability.py
│ ├── launcher.py
│ ├── libs/
│ │ ├── __init__.py
│ │ ├── core/
│ │ │ ├── __init__.py
│ │ │ ├── common.py
│ │ │ ├── globaldata.py
│ │ │ ├── logger.py
│ │ │ ├── plugin.py
│ │ │ ├── pluginmanager.py
│ │ │ ├── pluginregister.py
│ │ │ ├── report.py
│ │ │ ├── scope.py
│ │ │ ├── settings.py
│ │ │ ├── singletonclass.py
│ │ │ ├── spider.py
│ │ │ └── threads.py
│ │ └── net/
│ │ ├── __init__.py
│ │ ├── dns.py
│ │ ├── http.py
│ │ ├── scraper.py
│ │ ├── web_mutants.py
│ │ └── web_utils.py
│ ├── models/
│ │ ├── __init__.py
│ │ ├── auditdb.py
│ │ ├── scan_task.py
│ │ └── scan_vuldetail.py
│ └── utils/
│ ├── __init__.py
│ ├── console_utils.py
│ ├── mymath.py
│ ├── mytime.py
│ └── text_utils.py
├── lalascan.py
├── requirement.txt
├── tests/
│ ├── __init__.py
│ └── unittest/
│ ├── __init__.py
│ ├── console_output.py
│ ├── db_test.py
│ ├── ip_resource.py
│ ├── scope_test.py
│ ├── t_attribdict.py
│ ├── t_pluginmanager.py
│ ├── test_func.py
│ └── thread_test.py
├── thirdparty_libs/
│ ├── __init__.py
│ ├── ansistrm/
│ │ ├── __init__.py
│ │ └── ansistrm.py
│ ├── argparse/
│ │ ├── __init__.py
│ │ └── argparse.py
│ ├── bind_sql_inject/
│ │ ├── __init__.py
│ │ ├── diff.py
│ │ ├── fuzzy_string_cmp.py
│ │ └── upper_bounds.py
│ ├── colorizer/
│ │ ├── __init__.py
│ │ ├── ansi.py
│ │ ├── ansitowin32.py
│ │ ├── initialise.py
│ │ ├── termcolor.py
│ │ ├── win32.py
│ │ └── winterm.py
│ ├── oset/
│ │ ├── LICENSE.txt
│ │ ├── __init__.py
│ │ ├── _abc.py
│ │ └── pyoset.py
│ ├── prettytable/
│ │ ├── CHANGELOG
│ │ ├── COPYING
│ │ ├── MANIFEST.in
│ │ ├── PKG-INFO
│ │ ├── README
│ │ ├── __init__.py
│ │ └── prettytable.py
│ ├── requests/
│ │ ├── __init__.py
│ │ ├── adapters.py
│ │ ├── api.py
│ │ ├── auth.py
│ │ ├── cacert.pem
│ │ ├── certs.py
│ │ ├── compat.py
│ │ ├── cookies.py
│ │ ├── exceptions.py
│ │ ├── hooks.py
│ │ ├── models.py
│ │ ├── packages/
│ │ │ ├── __init__.py
│ │ │ ├── charade/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── big5freq.py
│ │ │ │ ├── big5prober.py
│ │ │ │ ├── chardistribution.py
│ │ │ │ ├── charsetgroupprober.py
│ │ │ │ ├── charsetprober.py
│ │ │ │ ├── codingstatemachine.py
│ │ │ │ ├── compat.py
│ │ │ │ ├── constants.py
│ │ │ │ ├── cp949prober.py
│ │ │ │ ├── escprober.py
│ │ │ │ ├── escsm.py
│ │ │ │ ├── eucjpprober.py
│ │ │ │ ├── euckrfreq.py
│ │ │ │ ├── euckrprober.py
│ │ │ │ ├── euctwfreq.py
│ │ │ │ ├── euctwprober.py
│ │ │ │ ├── gb2312freq.py
│ │ │ │ ├── gb2312prober.py
│ │ │ │ ├── hebrewprober.py
│ │ │ │ ├── jisfreq.py
│ │ │ │ ├── jpcntx.py
│ │ │ │ ├── langbulgarianmodel.py
│ │ │ │ ├── langcyrillicmodel.py
│ │ │ │ ├── langgreekmodel.py
│ │ │ │ ├── langhebrewmodel.py
│ │ │ │ ├── langhungarianmodel.py
│ │ │ │ ├── langthaimodel.py
│ │ │ │ ├── latin1prober.py
│ │ │ │ ├── mbcharsetprober.py
│ │ │ │ ├── mbcsgroupprober.py
│ │ │ │ ├── mbcssm.py
│ │ │ │ ├── sbcharsetprober.py
│ │ │ │ ├── sbcsgroupprober.py
│ │ │ │ ├── sjisprober.py
│ │ │ │ ├── universaldetector.py
│ │ │ │ └── utf8prober.py
│ │ │ └── urllib3/
│ │ │ ├── __init__.py
│ │ │ ├── _collections.py
│ │ │ ├── connectionpool.py
│ │ │ ├── exceptions.py
│ │ │ ├── filepost.py
│ │ │ ├── packages/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── ordered_dict.py
│ │ │ │ ├── six.py
│ │ │ │ └── ssl_match_hostname/
│ │ │ │ └── __init__.py
│ │ │ ├── poolmanager.py
│ │ │ ├── request.py
│ │ │ ├── response.py
│ │ │ └── util.py
│ │ ├── sessions.py
│ │ ├── status_codes.py
│ │ ├── structures.py
│ │ └── utils.py
│ ├── requests_ntlm/
│ │ ├── __init__.py
│ │ ├── ntlm/
│ │ │ ├── HTTPNtlmAuthHandler.py
│ │ │ ├── U32.py
│ │ │ ├── __init__.py
│ │ │ ├── des.py
│ │ │ ├── des_c.py
│ │ │ ├── des_data.py
│ │ │ └── ntlm.py
│ │ └── requests_ntlm.py
│ ├── termcolor/
│ │ ├── __init__.py
│ │ └── termcolor.py
│ ├── texttable.py
│ ├── tldextract/
│ │ ├── .tld_set_snapshot
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── __init__.py
│ │ └── tldextract.py
│ ├── torndb.py
│ └── wvs_spider/
│ ├── __init__.py
│ ├── lib/
│ │ ├── __init__.py
│ │ └── config.py
│ ├── run.py
│ ├── wvs_celery_config.py
│ ├── wvs_console.py
│ ├── wvs_run.py
│ ├── wvs_tasks.py
│ └── xml2mysql.py
└── webservice/
└── lalascan_web/
├── app/
│ ├── __init__.py
│ ├── extensions/
│ │ ├── __init__.py
│ │ └── flask_paginate.py
│ ├── forms.py
│ ├── models/
│ │ ├── __init__.py
│ │ ├── leakinfo.py
│ │ ├── policy.py
│ │ ├── scanner.py
│ │ └── spider.py
│ ├── services.py
│ ├── static/
│ │ ├── css/
│ │ │ └── oneui.css
│ │ ├── fonts/
│ │ │ └── FontAwesome.otf
│ │ ├── img/
│ │ │ └── avatars/
│ │ │ └── readme.txt
│ │ ├── js/
│ │ │ ├── app.js
│ │ │ └── pages/
│ │ │ ├── base_comp_animations.js
│ │ │ ├── base_comp_calendar.js
│ │ │ ├── base_comp_charts.js
│ │ │ ├── base_comp_maps.js
│ │ │ ├── base_forms_validation.js
│ │ │ ├── base_forms_wizard.js
│ │ │ ├── base_pages_coming_soon.js
│ │ │ ├── base_pages_dashboard.js
│ │ │ ├── base_pages_lock.js
│ │ │ ├── base_pages_login.js
│ │ │ ├── base_pages_register.js
│ │ │ ├── base_pages_reminder.js
│ │ │ ├── base_tables_datatables.js
│ │ │ ├── base_ui_activity.js
│ │ │ ├── base_ui_icons.js
│ │ │ ├── base_ui_widgets.js
│ │ │ ├── frontend_contact.js
│ │ │ └── frontend_features.js
│ │ └── less/
│ │ ├── main.less
│ │ ├── mixins.less
│ │ ├── modules/
│ │ │ ├── base.bootstrap-overwrite.less
│ │ │ ├── base.bootstrap.less
│ │ │ ├── extend.animations.less
│ │ │ ├── extend.plugins.less
│ │ │ ├── icons.fontawesome.less
│ │ │ ├── icons.simplelineicons.less
│ │ │ ├── oneui.blocks.less
│ │ │ ├── oneui.forms.less
│ │ │ ├── oneui.images.less
│ │ │ ├── oneui.layout.less
│ │ │ ├── oneui.lists.less
│ │ │ ├── oneui.navigation.less
│ │ │ ├── oneui.print.less
│ │ │ ├── oneui.themes.less
│ │ │ └── oneui.utilities.less
│ │ ├── themes/
│ │ │ ├── amethyst.less
│ │ │ ├── city.less
│ │ │ ├── flat.less
│ │ │ ├── modern.less
│ │ │ └── smooth.less
│ │ └── variables.less
│ ├── templates/
│ │ ├── add_leakinfo.html
│ │ ├── add_task.html
│ │ ├── base.html
│ │ ├── detail.html
│ │ ├── leakinfo.html
│ │ ├── policy.html
│ │ └── scanner.html
│ ├── util.py
│ └── views/
│ ├── __init__.py
│ ├── login.py
│ └── webscan.py
├── config.py
├── manage.py
└── requirements.txt
SYMBOL INDEX (1664 symbols across 133 files)
FILE: lalascan.py
function parse_cmd_options (line 19) | def parse_cmd_options():
function initOptions (line 82) | def initOptions(inputOptions = AttribDict()):
function main (line 126) | def main():
FILE: lalascan/api/exception.py
class LalascanBaseException (line 22) | class LalascanBaseException(Exception):
class LalascanDataException (line 25) | class LalascanDataException(LalascanBaseException):
class LalascanSystemException (line 28) | class LalascanSystemException(LalascanBaseException):
class LalascanThreadException (line 31) | class LalascanThreadException(LalascanBaseException):
class LalascanNetworkException (line 34) | class LalascanNetworkException(LalascanBaseException):
class LalascanNetworkOutOfScope (line 41) | class LalascanNetworkOutOfScope(LalascanNetworkException):
class LalascanNotImplementedError (line 48) | class LalascanNotImplementedError(NotImplementedError):
class LalascanAttributeError (line 51) | class LalascanAttributeError(AttributeError):
class LalascanTypeError (line 54) | class LalascanTypeError(TypeError):
class LalascanValueError (line 57) | class LalascanValueError(ValueError):
class LalascanFileNotFoundException (line 60) | class LalascanFileNotFoundException(LalascanBaseException):
FILE: lalascan/api/option.py
function generate_leak_info (line 13) | def generate_leak_info():
function generate_vul_policy (line 24) | def generate_vul_policy():
function _sava_policy2db (line 28) | def _sava_policy2db():
FILE: lalascan/data/__init__.py
class Data (line 14) | class Data(object):
method __init__ (line 32) | def __init__(self):
method is_instance (line 36) | def is_instance(self, clazz):
FILE: lalascan/data/datatype.py
class AttribDict (line 12) | class AttribDict(dict):
method __init__ (line 21) | def __init__(self, indict=None, attribute=None):
method __getattr__ (line 34) | def __getattr__(self, item):
method __setattr__ (line 45) | def __setattr__(self, item, value):
method __getstate__ (line 62) | def __getstate__(self):
method __setstate__ (line 65) | def __setstate__(self, dict):
method __deepcopy__ (line 68) | def __deepcopy__(self, memo):
FILE: lalascan/data/enum.py
class CUSTOM_LOGGING (line 6) | class CUSTOM_LOGGING:
class RISK_LEVEL (line 13) | class RISK_LEVEL:
FILE: lalascan/data/http.py
class HTTP_Headers (line 20) | class HTTP_Headers (object):
method __init__ (line 36) | def __init__(self, raw_headers):
method from_items (line 47) | def from_items(items):
method parse_headers (line 91) | def parse_headers(raw_headers):
method __str__ (line 153) | def __str__(self):
method get_headers (line 157) | def get_headers(self):
method __repr__ (line 161) | def __repr__(self):
method to_tuple (line 166) | def to_tuple(self):
method to_dict (line 179) | def to_dict(self):
method __iter__ (line 192) | def __iter__(self):
method iteritems (line 205) | def iteritems(self):
method iterkeys (line 217) | def iterkeys(self):
method itervalues (line 229) | def itervalues(self):
method __getitem__ (line 241) | def __getitem__(self, key):
method get (line 267) | def get(self, name, default = None):
method __getslice__ (line 294) | def __getslice__(self, start = None, end = None):
method has_key (line 314) | def has_key(self, name):
method items (line 339) | def items(self):
method keys (line 351) | def keys(self):
method values (line 363) | def values(self):
class HTTP_Request (line 375) | class HTTP_Request (Capture):
method __init__ (line 406) | def __init__(self, url, headers = None, post_data = None, method = Non...
method method (line 542) | def method(self):
method url (line 550) | def url(self):
method protocol (line 558) | def protocol(self):
method version (line 566) | def version(self):
method headers (line 574) | def headers(self):
method post_data (line 582) | def post_data(self):
method parsed_url (line 593) | def parsed_url(self):
method request_uri (line 601) | def request_uri(self):
method hostname (line 609) | def hostname(self):
method user_agent (line 617) | def user_agent(self):
method user_agent (line 625) | def user_agent(self, user_agent):
method accept_language (line 636) | def accept_language(self):
method accept (line 644) | def accept(self):
method referer (line 652) | def referer(self):
method cookie (line 660) | def cookie(self):
method content_type (line 668) | def content_type(self):
method content_length (line 676) | def content_length(self):
class HTTP_Raw_Request (line 688) | class HTTP_Raw_Request (Capture):
method __init__ (line 697) | def __init__(self, raw_request):
method raw_request (line 708) | def raw_request(self):
class HTTP_Response (line 717) | class HTTP_Response (Capture):
method __init__ (line 730) | def __init__(self, request, **kwargs):
method elapsed (line 840) | def elapsed(self):
method elapsed (line 849) | def elapsed(self, elapsed):
method raw_response (line 861) | def raw_response(self):
method status (line 872) | def status(self):
method reason (line 880) | def reason(self):
method protocol (line 888) | def protocol(self):
method version (line 896) | def version(self):
method headers (line 904) | def headers(self):
method raw_headers (line 912) | def raw_headers(self):
method data (line 920) | def data(self):
method content_length (line 928) | def content_length(self):
method content_type (line 939) | def content_type(self):
method content_disposition (line 947) | def content_disposition(self):
method transport_encoding (line 956) | def transport_encoding(self):
method cookie (line 965) | def cookie(self):
method server (line 976) | def server(self):
method __parse_raw_response (line 986) | def __parse_raw_response(self, request):
method __reconstruct_raw_response (line 1042) | def __reconstruct_raw_response(self):
method __parse_raw_headers (line 1089) | def __parse_raw_headers(self):
method __reconstruct_raw_headers (line 1094) | def __reconstruct_raw_headers(self):
method raw_request (line 1100) | def raw_request(self):
FILE: lalascan/data/information/__init__.py
class Information (line 35) | class Information(Data):
class File (line 52) | class File(Information):
class Capture (line 62) | class Capture(Information):
class Fingerprint (line 72) | class Fingerprint(Information):
FILE: lalascan/data/information/banner.py
class Banner (line 21) | class Banner(Fingerprint):
method __init__ (line 30) | def __init__(self, host, banner, port):
method banner (line 75) | def banner(self):
method port (line 85) | def port(self):
method get_ip_addresses (line 94) | def get_ip_addresses(self):
method get_domains (line 107) | def get_domains(self):
method get_hosts (line 120) | def get_hosts(self):
FILE: lalascan/data/information/html.py
class HTML (line 16) | class HTML(File):
method __init__ (line 34) | def __init__(self, data):
method display_name (line 49) | def display_name(self):
method raw_data (line 55) | def raw_data(self):
method elements (line 65) | def elements(self):
method forms (line 75) | def forms(self):
method images (line 85) | def images(self):
method url_links (line 95) | def url_links(self):
method css_links (line 105) | def css_links(self):
method javascript_links (line 115) | def javascript_links(self):
method css_embedded (line 125) | def css_embedded(self):
method javascript_embedded (line 135) | def javascript_embedded(self):
method metas (line 145) | def metas(self):
method title (line 155) | def title(self):
method objects (line 165) | def objects(self):
FILE: lalascan/data/information/portscan.py
class PortScanFingerprint (line 16) | class PortScanFingerprint(Fingerprint):
method __init__ (line 22) | def __init__(self, ip, ports):
method address (line 64) | def address(self):
method ports (line 74) | def ports(self):
method __repr__ (line 85) | def __repr__(self):
method __str__ (line 92) | def __str__(self):
method display_name (line 98) | def display_name(self):
FILE: lalascan/data/information/webservice.py
class WebServiceFingerprint (line 11) | class WebServiceFingerprint(Fingerprint):
method __init__ (line 20) | def __init__(self, name, version, banner, canonical_name, related = No...
method __repr__ (line 76) | def __repr__(self):
method __str__ (line 85) | def __str__(self):
method to_dict (line 90) | def to_dict(self):
method display_properties (line 98) | def display_properties(self):
method name (line 111) | def name(self):
method version (line 121) | def version(self):
method banner (line 131) | def banner(self):
method canonical_name (line 142) | def canonical_name(self):
method others (line 155) | def others(self):
method others (line 166) | def others(self, others):
method related (line 189) | def related(self):
method related (line 199) | def related(self, related):
FILE: lalascan/data/resource/__init__.py
class Resource (line 14) | class Resource(Data):
FILE: lalascan/data/resource/domain.py
class Domain (line 20) | class Domain(Resource):
method __init__ (line 34) | def __init__(self, hostname):
method __str__ (line 74) | def __str__(self):
method __repr__ (line 79) | def __repr__(self):
method display_name (line 85) | def display_name(self):
method hostname (line 91) | def hostname(self):
method root (line 101) | def root(self):
method discovered (line 114) | def discovered(self):
class RootDomain (line 130) | class RootDomain(Domain):
method __init__ (line 141) | def __init__(self, hostname):
method __repr__ (line 153) | def __repr__(self):
method display_name (line 159) | def display_name(self):
method root (line 165) | def root(self):
method discovered (line 178) | def discovered(self):
FILE: lalascan/data/resource/ip.py
class IP (line 20) | class IP(Resource):
method __init__ (line 27) | def __init__(self, address):
method __str__ (line 56) | def __str__(self):
method __repr__ (line 61) | def __repr__(self):
method display_name (line 67) | def display_name(self):
method address (line 73) | def address(self):
method version (line 83) | def version(self):
FILE: lalascan/data/resource/url.py
class _AbstractURL (line 20) | class _AbstractURL(Resource):
method __init__ (line 30) | def __init__(self, url):
method url (line 62) | def url(self):
method parsed_url (line 73) | def parsed_url(self):
method hostname (line 81) | def hostname(self):
method path (line 89) | def path(self):
method is_https (line 97) | def is_https(self):
method __str__ (line 106) | def __str__(self):
method __repr__ (line 111) | def __repr__(self):
class URL (line 119) | class URL(_AbstractURL):
method __init__ (line 147) | def __init__(self, url, method = "GET", post_params = None, referer = ...
method __repr__ (line 255) | def __repr__(self):
method display_name (line 263) | def display_name(self):
method method (line 270) | def method(self):
method post_data (line 278) | def post_data(self):
method url_params (line 289) | def url_params(self):
method has_url_params (line 300) | def has_url_params(self):
method post_params (line 308) | def post_params(self):
method has_post_params (line 318) | def has_post_params(self):
method referer (line 326) | def referer(self):
method discovered (line 336) | def discovered(self):
class BaseURL (line 349) | class BaseURL(_AbstractURL):
method __init__ (line 373) | def __init__(self, url):
method display_name (line 400) | def display_name(self):
method discovered (line 406) | def discovered(self):
class FolderURL (line 416) | class FolderURL(_AbstractURL):
method __init__ (line 452) | def __init__(self, url):
method from_url (line 473) | def from_url(url):
method display_name (line 516) | def display_name(self):
method discovered (line 522) | def discovered(self):
class SpiderURL (line 534) | class SpiderURL(_AbstractURL):
method __init__ (line 558) | def __init__(self, url):
method display_name (line 571) | def display_name(self):
method discovered (line 577) | def discovered(self):
FILE: lalascan/data/vuln/vulnerability.py
class Vulnerability (line 34) | class Vulnerability(Data):
method __init__ (line 57) | def __init__(self, target, **kwargs):
class WebVulnerability (line 62) | class WebVulnerability(Vulnerability):
method __init__ (line 85) | def __init__(self, target, **kwargs):
method _sanitize_url (line 116) | def _sanitize_url(self, url, stacklevel = 2):
method _load_leakinfo (line 142) | def _load_leakinfo(self):
method __str__ (line 153) | def __str__(self):
method url (line 170) | def url(self):
method __get_default_text (line 179) | def __get_default_text(self, propname):
method injection_type (line 184) | def injection_type(self):
method get_injection_type_desc (line 203) | def get_injection_type_desc(self):
method vul_method (line 210) | def vul_method(self):
method vulparam_point (line 214) | def vulparam_point(self):
method payload (line 218) | def payload(self):
method vul_response (line 222) | def vul_response(self):
method vul_risk (line 226) | def vul_risk(self):
method vul_risk_desc (line 230) | def vul_risk_desc(self):
method vul_sli_id (line 234) | def vul_sli_id(self):
FILE: lalascan/launcher.py
function init (line 22) | def init():
function run (line 29) | def run():
function get_multiple_target (line 49) | def get_multiple_target():
function init_report (line 78) | def init_report():
function http_req_initoption (line 82) | def http_req_initoption():
function _set_http_useragnet (line 86) | def _set_http_useragnet():
function _set_http_cookie (line 89) | def _set_http_cookie():
function _set_http_referer (line 92) | def _set_http_referer():
function _set_http_proxy (line 95) | def _set_http_proxy():
function _set_http_timeout (line 98) | def _set_http_timeout():
function _set_task_id (line 102) | def _set_task_id(source_result, task_id):
FILE: lalascan/libs/core/common.py
function banner (line 30) | def banner():
function console_output (line 41) | def console_output(data, bold = True):
function _stdoutencode (line 61) | def _stdoutencode(data):
function _setColor (line 72) | def _setColor(message, bold=False):
function json_encode (line 100) | def json_encode(*args, **kwargs):
function json_decode (line 106) | def json_decode(*args, **kwargs):
function readfile (line 110) | def readfile(filename):
function multiple_replace (line 121) | def multiple_replace(text, adict):
function get_domain (line 131) | def get_domain(url):
function post_query (line 142) | def post_query(query):
function cookie_query (line 157) | def cookie_query(cookie_query):
function generate_audit_name (line 173) | def generate_audit_name(url):
FILE: lalascan/libs/core/globaldata.py
class L (line 23) | class L(object):
method set_logfilepath (line 27) | def set_logfilepath(cls, audit_name):
FILE: lalascan/libs/core/logger.py
class _ScanLog (line 55) | class _ScanLog(Singleton):
method __init__ (line 57) | def __init__(self, audit_name):
method log_verbose (line 66) | def log_verbose(self, msg):
method log_warning (line 69) | def log_warning(self, msg):
method log_success (line 72) | def log_success(self, msg):
method log_error (line 75) | def log_error(self, msg):
FILE: lalascan/libs/core/plugin.py
class PluginBase (line 17) | class PluginBase(object):
method __init__ (line 19) | def __init__(self):
method get_accepted_types (line 22) | def get_accepted_types(self):
method run (line 25) | def run(self, info):
method run_plugin (line 28) | def run_plugin(self, resource_input, resource_method , resource_param):
FILE: lalascan/libs/core/pluginmanager.py
class PluginManager (line 27) | class PluginManager(object):
method __init__ (line 29) | def __init__(self, audit = None):
method set_plugin (line 39) | def set_plugin(self):
method _load_all_plugin (line 57) | def _load_all_plugin(self):
method _load_plugin_by_name (line 70) | def _load_plugin_by_name(self, plugin_name):
method __get_plugin_by_name (line 95) | def __get_plugin_by_name(self, plugin_name):
method __get_all_plugin (line 106) | def __get_all_plugin(self):
method __load_plugin (line 116) | def __load_plugin(self, plugin_name, fplugin):
method __get_plugin_classname (line 143) | def __get_plugin_classname(self, poc):
class PluginImporter (line 151) | class PluginImporter(object):
method __init__ (line 158) | def __init__(self, fullname, contents):
method load_module (line 162) | def load_module(self, fullname):
method del_module (line 177) | def del_module(cls, modname):
FILE: lalascan/libs/core/pluginregister.py
function reg_instance_plugin (line 8) | def reg_instance_plugin(plugin_class):
FILE: lalascan/libs/core/report.py
class TextReport (line 26) | class TextReport():
method generate_report (line 29) | def generate_report(self):
method __write_report (line 38) | def __write_report(self):
method __gather_vulnerable_resources (line 208) | def __gather_vulnerable_resources(self, vuln):
method __colorize (line 225) | def __colorize(self, txt, level_or_color):
method __fix_table_width (line 231) | def __fix_table_width(self, table):
method __fix_vul_table_width (line 244) | def __fix_vul_table_width(self, table):
FILE: lalascan/libs/core/scope.py
class AbstractScope (line 17) | class AbstractScope(object):
method __init__ (line 21) | def __init__(self):
method addresses (line 25) | def addresses(self):
method domains (line 29) | def domains(self):
method target_url (line 33) | def target_url(self):
method add_target (line 36) | def add_target(self):
method get_target (line 40) | def get_target(self):
method __str__ (line 44) | def __str__(self):
method __contains__ (line 47) | def __contains__(self, target):
method get_targets (line 50) | def get_targets(self):
class AuditScope (line 66) | class AuditScope(AbstractScope):
method __init__ (line 70) | def __init__(self):
method addresses (line 79) | def addresses(self):
method domains (line 85) | def domains(self):
method roots (line 91) | def roots(self):
method web_pages (line 97) | def web_pages(self):
method target_url (line 104) | def target_url(self):
method add_target (line 108) | def add_target(self, target):
method __str__ (line 165) | def __str__(self):
class DummyScope (line 187) | class DummyScope (AbstractScope):
method __init__ (line 192) | def __init__(self):
method has_scope (line 196) | def has_scope(self):
method addresses (line 200) | def addresses(self):
method domains (line 204) | def domains(self):
method roots (line 208) | def roots(self):
method web_pages (line 212) | def web_pages(self):
method get_targets (line 215) | def get_targets(self):
method __contains__ (line 218) | def __contains__(self, target):
method __str__ (line 221) | def __str__(self):
FILE: lalascan/libs/core/singletonclass.py
class Singleton (line 11) | class Singleton (object):
method __new__ (line 17) | def __new__(cls, *args, **kw):
FILE: lalascan/libs/core/spider.py
function spider_task (line 20) | def spider_task(audit_name):
FILE: lalascan/libs/core/threads.py
class NoDaemonProcess (line 24) | class NoDaemonProcess(multiprocessing.Process):
method _get_daemon (line 26) | def _get_daemon(self):
method _set_daemon (line 28) | def _set_daemon(self, value):
class MyResourcePool (line 32) | class MyResourcePool(multiprocessing.pool.Pool):
class MyGeventPool (line 36) | class MyGeventPool(gevent.pool.Pool):
method _wait (line 38) | def _wait(self):
function plugin_run_thread (line 43) | def plugin_run_thread(plugin_name, pluginheader, info, method, **kwargs):
function execute_plugin (line 51) | def execute_plugin(register_plugins, m_resource):
FILE: lalascan/libs/net/dns.py
class _DNS (line 46) | class _DNS(Singleton):
method check_tcp_dns (line 116) | def check_tcp_dns(self, address, dns_port=53):
method resolve (line 153) | def resolve(self, target, type, nameservers=None):
method get_a (line 176) | def get_a(self, host, nameservers=None, also_CNAME=False):
method get_aaaa (line 215) | def get_aaaa(self, host, nameservers=None, also_CNAME=False):
method get_mx (line 255) | def get_mx(self, host, nameservers=None):
method get_ns (line 272) | def get_ns(self, host, nameservers=None):
method get_soa (line 290) | def get_soa(self, host, nameservers=None):
method get_spf (line 308) | def get_spf(self, host, nameservers=None):
method get_txt (line 325) | def get_txt(self, host, nameservers=None):
method get_ptr (line 342) | def get_ptr(self, ipaddress, nameservers=None):
method get_srv (line 381) | def get_srv(self, host, nameservers=None):
method get_nsec (line 398) | def get_nsec(self, host, nameservers=None):
method zone_transfer (line 416) | def zone_transfer(self, domain, nameservers = None, ns_allowed_zone_tr...
method _from_wire (line 641) | def _from_wire(self, xfr, zone_factory=Zone, relativize=True):
method get_ips (line 674) | def get_ips(self, register):
method _dnslib2register (line 737) | def _dnslib2register(self, type, answer_in):
method __dnsregister2golismeroregister (line 778) | def __dnsregister2golismeroregister(self, register_type, answer):
method _make_request (line 936) | def _make_request(self, register_type, host, nameservers=None, auto_re...
FILE: lalascan/libs/net/http.py
class _HTTP (line 30) | class _HTTP(Singleton):
method __init__ (line 37) | def __init__(self):
method _initialize (line 42) | def _initialize(self):
method _finalize (line 82) | def _finalize(self):
method get_url (line 92) | def get_url(self, url, method = "GET", callback = None, timeout = 30.0...
method make_request (line 127) | def make_request(self, request, callback = None, timeout = 30.0, allow...
method make_raw_request (line 271) | def make_raw_request(self, raw_request, host, port = 80, proto = "http",
FILE: lalascan/libs/net/scraper.py
function is_link (line 47) | def is_link(url, base_url):
function extract_from_text (line 82) | def extract_from_text(text, base_url = None, only_links = True):
function extract_forms_from_html (line 179) | def extract_forms_from_html(raw_html, base_url):
function extract_from_html (line 240) | def extract_from_html(raw_html, base_url, only_links = True):
function extract (line 360) | def extract(raw_data, content_type, base_url, only_links = True):
FILE: lalascan/libs/net/web_mutants.py
function payload_muntants (line 24) | def payload_muntants(url_info, payload = {}, bmethod = 'GET', exclude_cg...
function request_muntants (line 94) | def request_muntants(url, timeout = 30.0, allow_redirects = True, allow_...
function get_curmodule (line 103) | def get_curmodule():
FILE: lalascan/libs/net/web_utils.py
function generate_user_agent (line 88) | def generate_user_agent():
function data_from_http_response (line 97) | def data_from_http_response(response):
function get_request (line 163) | def get_request(url, timeout = 30.0, allow_redirects = True,
function fix_url (line 251) | def fix_url(url, base_url=None):
function check_auth (line 294) | def check_auth(url, user, password):
function get_auth_obj (line 344) | def get_auth_obj(method, user, password):
function detect_auth_method (line 382) | def detect_auth_method(url):
function split_hostname (line 418) | def split_hostname(hostname):
function generate_error_page_url (line 445) | def generate_error_page_url(url):
function get_error_page (line 467) | def get_error_page(url):
function parse_url (line 502) | def parse_url(url, base_url = None):
function urlparse (line 523) | def urlparse(url):
function urldefrag (line 526) | def urldefrag(url):
function urljoin (line 532) | def urljoin(base_url, url, allow_fragments = True):
function argument_query (line 544) | def argument_query(query_str):
class ParsedURL (line 566) | class ParsedURL (object):
method __init__ (line 681) | def __init__(self, url, base_url = None):
method __str__ (line 807) | def __str__(self):
method copy (line 812) | def copy(self):
method to_urlsplit (line 821) | def to_urlsplit(self):
method to_urlparse (line 834) | def to_urlparse(self):
method to_urllib3 (line 848) | def to_urllib3(self):
method match_extension (line 856) | def match_extension(self, extension,
method get_all_extensions (line 960) | def get_all_extensions(self, directory_allowed = True, double_allowed ...
method split_hostname (line 1024) | def split_hostname(self):
method url (line 1049) | def url(self):
method base_url (line 1060) | def base_url(self):
method request_uri (line 1070) | def request_uri(self):
method scheme (line 1086) | def scheme(self):
method scheme (line 1090) | def scheme(self, scheme):
method username (line 1102) | def username(self):
method username (line 1106) | def username(self, username):
method password (line 1114) | def password(self):
method password (line 1118) | def password(self, password):
method host (line 1126) | def host(self):
method host (line 1130) | def host(self, host):
method port (line 1142) | def port(self):
method port (line 1149) | def port(self, port):
method path (line 1157) | def path(self):
method path (line 1161) | def path(self, path):
method request_cgi (line 1174) | def request_cgi(self):
method fragment (line 1181) | def fragment(self):
method fragment (line 1185) | def fragment(self, fragment):
method query_char (line 1196) | def query_char(self):
method query_char (line 1200) | def query_char(self, query_char):
method query (line 1211) | def query(self):
method query (line 1224) | def query(self, query):
method query_params (line 1245) | def query_params(self):
method query_params (line 1249) | def query_params(self, query_params):
method all_extensions (line 1264) | def all_extensions(self):
method all_extensions (line 1297) | def all_extensions(self, extension):
method minimal_filebase (line 1306) | def minimal_filebase(self):
method minimal_filebase (line 1311) | def minimal_filebase(self, filebase):
method directory (line 1315) | def directory(self):
method directory (line 1319) | def directory(self, directory):
method filename (line 1326) | def filename(self):
method filename (line 1330) | def filename(self, filename):
method filebase (line 1334) | def filebase(self):
method filebase (line 1338) | def filebase(self, filebase):
method extension (line 1342) | def extension(self):
method extension (line 1346) | def extension(self, extension):
method netloc (line 1355) | def netloc(self):
method netloc (line 1370) | def netloc(self, netloc):
method auth (line 1395) | def auth(self):
method auth (line 1409) | def auth(self, auth):
method subdomain (line 1423) | def subdomain(self):
method subdomain (line 1427) | def subdomain(self, subdomain):
method domain (line 1432) | def domain(self):
method domain (line 1436) | def domain(self, domain):
method tld (line 1441) | def tld(self):
method tld (line 1445) | def tld(self, tld):
class HTMLElement (line 1451) | class HTMLElement (object):
method __init__ (line 1458) | def __init__(self, tag_name, attrs, content):
method __str__ (line 1478) | def __str__(self):
method tag_name (line 1484) | def tag_name(self):
method attrs (line 1494) | def attrs(self):
method content (line 1504) | def content(self):
class HTMLParser (line 1513) | class HTMLParser(object):
method __init__ (line 1545) | def __init__(self, data):
method __convert_to_HTMLElements (line 1596) | def __convert_to_HTMLElements(self, data):
method raw_data (line 1613) | def raw_data(self):
method elements (line 1623) | def elements(self):
method forms (line 1636) | def forms(self):
method images (line 1649) | def images(self):
method url_links (line 1662) | def url_links(self):
method css_links (line 1675) | def css_links(self):
method javascript_links (line 1688) | def javascript_links(self):
method css_embedded (line 1701) | def css_embedded(self):
method javascript_embedded (line 1714) | def javascript_embedded(self):
method metas (line 1727) | def metas(self):
method title (line 1740) | def title(self):
method objects (line 1753) | def objects(self):
FILE: lalascan/models/__init__.py
class _DBConfig (line 15) | class _DBConfig(Singleton):
method __init__ (line 17) | def __init__(self, max_overflow = 10):
FILE: lalascan/models/auditdb.py
class BaseDB (line 11) | class BaseDB(object):
method __enter__ (line 13) | def __enter__(self):
method __exit__ (line 16) | def __exit__(self, exc_type, exc_val, exc_tb):
method query (line 19) | def query(self):
method close (line 22) | def close(self):
class AuditMysqlDB (line 26) | class AuditMysqlDB(BaseDB):
method __init__ (line 29) | def __init__(self):
method __initdb (line 33) | def __initdb(self):
method query (line 37) | def query(self, sql):
method get_alldata (line 40) | def get_alldata(self, audit_table, **kwargs):
method close (line 51) | def close(self):
method __call__ (line 54) | def __call__(self, *args, **kwargs):
FILE: lalascan/models/scan_task.py
class ScanTask (line 10) | class ScanTask(BaseModel):
method __repr__ (line 21) | def __repr__(self):
FILE: lalascan/models/scan_vuldetail.py
class ScanVulDetail (line 11) | class ScanVulDetail(BaseModel):
method __repr__ (line 29) | def __repr__(self):
FILE: lalascan/utils/__init__.py
function _str2bs64 (line 8) | def _str2bs64(str):
FILE: lalascan/utils/console_utils.py
function get_terminal_size (line 40) | def get_terminal_size():
function _get_terminal_size_windows (line 56) | def _get_terminal_size_windows():
function _get_terminal_size_tput (line 80) | def _get_terminal_size_tput():
function _get_terminal_size_linux (line 95) | def _get_terminal_size_linux():
function colorize_substring (line 122) | def colorize_substring(text, substring, level_or_color):
function colorize (line 183) | def colorize(text, level_or_color):
FILE: lalascan/utils/mymath.py
class LalaMath (line 14) | class LalaMath(object):
method average (line 17) | def average(cls, values):
method stdev (line 34) | def stdev(cls, values):
FILE: lalascan/utils/mytime.py
class MyTime (line 15) | class MyTime(object):
method get_current_datetime (line 20) | def get_current_datetime(cls):
method parse_audit_times (line 25) | def parse_audit_times(cls, start_time, stop_time):
FILE: lalascan/utils/text_utils.py
function char_count (line 21) | def char_count(text):
function line_count (line 35) | def line_count(text):
function word_count (line 55) | def word_count(text):
function generate_random_string (line 69) | def generate_random_string(length = 30):
function uncamelcase (line 102) | def uncamelcase(string):
function hexdump (line 149) | def hexdump(s):
function to_utf8 (line 174) | def to_utf8(s):
function split_first (line 202) | def split_first(s, delims):
FILE: tests/unittest/db_test.py
function main (line 11) | def main():
FILE: tests/unittest/t_attribdict.py
class AttribDict (line 15) | class AttribDict(dict):
method __init__ (line 24) | def __init__(self, indict=None, attribute=None):
method __getattr__ (line 37) | def __getattr__(self, item):
method __setattr__ (line 49) | def __setattr__(self, item, value):
method __getstate__ (line 66) | def __getstate__(self):
method __setstate__ (line 69) | def __setstate__(self, dict):
method __deepcopy__ (line 72) | def __deepcopy__(self, memo):
function main (line 87) | def main():
FILE: tests/unittest/test_func.py
function f (line 8) | def f():
FILE: tests/unittest/thread_test.py
class NoDaemonProcess (line 23) | class NoDaemonProcess(multiprocessing.Process):
method _get_daemon (line 25) | def _get_daemon(self):
method _set_daemon (line 27) | def _set_daemon(self, value):
class MyPool (line 33) | class MyPool(multiprocessing.pool.Pool):
function procFunc (line 38) | def procFunc(url):
function process_url (line 52) | def process_url(url_list):
function main (line 61) | def main():
FILE: thirdparty_libs/ansistrm/ansistrm.py
class ColorizingStreamHandler (line 8) | class ColorizingStreamHandler(logging.StreamHandler):
method is_tty (line 43) | def is_tty(self):
method output_colorized (line 71) | def output_colorized(self, message):
method output_colorized (line 87) | def output_colorized(self, message):
method colorize (line 128) | def colorize(self, message, record):
method format (line 154) | def format(self, record):
FILE: thirdparty_libs/argparse/argparse.py
function sorted (line 114) | def sorted(iterable, reverse=False):
function _callable (line 122) | def _callable(obj):
class _AttributeHolder (line 139) | class _AttributeHolder(object):
method __repr__ (line 148) | def __repr__(self):
method _get_kwargs (line 157) | def _get_kwargs(self):
method _get_args (line 160) | def _get_args(self):
function _ensure_value (line 164) | def _ensure_value(namespace, name, value):
class HelpFormatter (line 174) | class HelpFormatter(object):
method __init__ (line 181) | def __init__(self,
method _indent (line 213) | def _indent(self):
method _dedent (line 217) | def _dedent(self):
class _Section (line 222) | class _Section(object):
method __init__ (line 224) | def __init__(self, formatter, parent, heading=None):
method format_help (line 230) | def format_help(self):
method _add_item (line 255) | def _add_item(self, func, args):
method start_section (line 261) | def start_section(self, heading):
method end_section (line 267) | def end_section(self):
method add_text (line 271) | def add_text(self, text):
method add_usage (line 275) | def add_usage(self, usage, actions, groups, prefix=None):
method add_argument (line 280) | def add_argument(self, action):
method add_arguments (line 298) | def add_arguments(self, actions):
method format_help (line 305) | def format_help(self):
method _join_parts (line 312) | def _join_parts(self, part_strings):
method _format_usage (line 317) | def _format_usage(self, usage, actions, groups, prefix):
method _format_actions_usage (line 409) | def _format_actions_usage(self, actions, groups):
method _format_text (line 505) | def _format_text(self, text):
method _format_action (line 512) | def _format_action(self, action):
method _format_action_invocation (line 559) | def _format_action_invocation(self, action):
method _metavar_formatter (line 582) | def _metavar_formatter(self, action, default_metavar):
method _format_args (line 598) | def _format_args(self, action, default_metavar):
method _expand_help (line 617) | def _expand_help(self, action):
method _iter_indented_subactions (line 630) | def _iter_indented_subactions(self, action):
method _split_lines (line 641) | def _split_lines(self, text, width):
method _fill_text (line 645) | def _fill_text(self, text, width, indent):
method _get_help_string (line 650) | def _get_help_string(self, action):
class RawDescriptionHelpFormatter (line 654) | class RawDescriptionHelpFormatter(HelpFormatter):
method _fill_text (line 661) | def _fill_text(self, text, width, indent):
class RawTextHelpFormatter (line 665) | class RawTextHelpFormatter(RawDescriptionHelpFormatter):
method _split_lines (line 672) | def _split_lines(self, text, width):
class ArgumentDefaultsHelpFormatter (line 676) | class ArgumentDefaultsHelpFormatter(HelpFormatter):
method _get_help_string (line 683) | def _get_help_string(self, action):
function _get_action_name (line 697) | def _get_action_name(argument):
class ArgumentError (line 710) | class ArgumentError(Exception):
method __init__ (line 717) | def __init__(self, argument, message):
method __str__ (line 721) | def __str__(self):
class ArgumentTypeError (line 730) | class ArgumentTypeError(Exception):
class Action (line 739) | class Action(_AttributeHolder):
method __init__ (line 790) | def __init__(self,
method _get_kwargs (line 812) | def _get_kwargs(self):
method __call__ (line 826) | def __call__(self, parser, namespace, values, option_string=None):
class _StoreAction (line 830) | class _StoreAction(Action):
method __init__ (line 832) | def __init__(self,
method __call__ (line 861) | def __call__(self, parser, namespace, values, option_string=None):
class _StoreConstAction (line 865) | class _StoreConstAction(Action):
method __init__ (line 867) | def __init__(self,
method __call__ (line 884) | def __call__(self, parser, namespace, values, option_string=None):
class _StoreTrueAction (line 888) | class _StoreTrueAction(_StoreConstAction):
method __init__ (line 890) | def __init__(self,
class _StoreFalseAction (line 905) | class _StoreFalseAction(_StoreConstAction):
method __init__ (line 907) | def __init__(self,
class _AppendAction (line 922) | class _AppendAction(Action):
method __init__ (line 924) | def __init__(self,
method __call__ (line 953) | def __call__(self, parser, namespace, values, option_string=None):
class _AppendConstAction (line 959) | class _AppendConstAction(Action):
method __init__ (line 961) | def __init__(self,
method __call__ (line 979) | def __call__(self, parser, namespace, values, option_string=None):
class _CountAction (line 985) | class _CountAction(Action):
method __init__ (line 987) | def __init__(self,
method __call__ (line 1001) | def __call__(self, parser, namespace, values, option_string=None):
class _HelpAction (line 1006) | class _HelpAction(Action):
method __init__ (line 1008) | def __init__(self,
method __call__ (line 1020) | def __call__(self, parser, namespace, values, option_string=None):
class _VersionAction (line 1025) | class _VersionAction(Action):
method __init__ (line 1027) | def __init__(self,
method __call__ (line 1041) | def __call__(self, parser, namespace, values, option_string=None):
class _SubParsersAction (line 1050) | class _SubParsersAction(Action):
class _ChoicesPseudoAction (line 1052) | class _ChoicesPseudoAction(Action):
method __init__ (line 1054) | def __init__(self, name, aliases, help):
method __init__ (line 1062) | def __init__(self,
method add_parser (line 1083) | def add_parser(self, name, **kwargs):
method _get_subactions (line 1106) | def _get_subactions(self):
method __call__ (line 1109) | def __call__(self, parser, namespace, values, option_string=None):
class FileType (line 1138) | class FileType(object):
method __init__ (line 1151) | def __init__(self, mode='r', bufsize=None):
method __call__ (line 1155) | def __call__(self, string):
method __repr__ (line 1177) | def __repr__(self):
class Namespace (line 1186) | class Namespace(_AttributeHolder):
method __init__ (line 1193) | def __init__(self, **kwargs):
method __eq__ (line 1199) | def __eq__(self, other):
method __ne__ (line 1202) | def __ne__(self, other):
method __contains__ (line 1205) | def __contains__(self, key):
class _ActionsContainer (line 1209) | class _ActionsContainer(object):
method __init__ (line 1211) | def __init__(self,
method register (line 1263) | def register(self, registry_name, value, object):
method _registry_get (line 1267) | def _registry_get(self, registry_name, value, default=None):
method set_defaults (line 1273) | def set_defaults(self, **kwargs):
method get_default (line 1282) | def get_default(self, dest):
method add_argument (line 1292) | def add_argument(self, *args, **kwargs):
method add_argument_group (line 1332) | def add_argument_group(self, *args, **kwargs):
method add_mutually_exclusive_group (line 1337) | def add_mutually_exclusive_group(self, **kwargs):
method _add_action (line 1342) | def _add_action(self, action):
method _remove_action (line 1363) | def _remove_action(self, action):
method _add_container_actions (line 1366) | def _add_container_actions(self, container):
method _get_positional_kwargs (line 1406) | def _get_positional_kwargs(self, dest, **kwargs):
method _get_optional_kwargs (line 1422) | def _get_optional_kwargs(self, *args, **kwargs):
method _pop_action_class (line 1457) | def _pop_action_class(self, kwargs, default=None):
method _get_handler (line 1461) | def _get_handler(self):
method _check_conflict (line 1470) | def _check_conflict(self, action):
method _handle_conflict_error (line 1484) | def _handle_conflict_error(self, action, conflicting_actions):
method _handle_conflict_resolve (line 1491) | def _handle_conflict_resolve(self, action, conflicting_actions):
class _ArgumentGroup (line 1506) | class _ArgumentGroup(_ActionsContainer):
method __init__ (line 1508) | def __init__(self, container, title=None, description=None, **kwargs):
method _add_action (line 1529) | def _add_action(self, action):
method _remove_action (line 1534) | def _remove_action(self, action):
class _MutuallyExclusiveGroup (line 1539) | class _MutuallyExclusiveGroup(_ArgumentGroup):
method __init__ (line 1541) | def __init__(self, container, required=False):
method _add_action (line 1546) | def _add_action(self, action):
method _remove_action (line 1554) | def _remove_action(self, action):
class ArgumentParser (line 1559) | class ArgumentParser(_AttributeHolder, _ActionsContainer):
method __init__ (line 1577) | def __init__(self,
method _get_kwargs (line 1658) | def _get_kwargs(self):
method add_subparsers (line 1673) | def add_subparsers(self, **kwargs):
method _add_action (line 1704) | def _add_action(self, action):
method _get_optional_actions (line 1711) | def _get_optional_actions(self):
method _get_positional_actions (line 1716) | def _get_positional_actions(self):
method parse_args (line 1724) | def parse_args(self, args=None, namespace=None):
method parse_known_args (line 1731) | def parse_known_args(self, args=None, namespace=None):
method _parse_known_args (line 1763) | def _parse_known_args(self, arg_strings, namespace):
method _read_args_from_files (line 2009) | def _read_args_from_files(self, arg_strings):
method convert_arg_line_to_args (line 2038) | def convert_arg_line_to_args(self, arg_line):
method _match_argument (line 2041) | def _match_argument(self, action, arg_strings_pattern):
method _match_arguments_partial (line 2060) | def _match_arguments_partial(self, actions, arg_strings_pattern):
method _parse_optional (line 2076) | def _parse_optional(self, arg_string):
method _get_option_tuples (line 2133) | def _get_option_tuples(self, option_string):
method _get_nargs_pattern (line 2177) | def _get_nargs_pattern(self, action):
method _get_values (line 2221) | def _get_values(self, action, arg_strings):
method _get_value (line 2270) | def _get_value(self, action, arg_string):
method _check_value (line 2295) | def _check_value(self, action, value):
method format_usage (line 2305) | def format_usage(self):
method format_help (line 2311) | def format_help(self):
method format_version (line 2334) | def format_version(self):
method _get_formatter (line 2344) | def _get_formatter(self):
method print_usage (line 2350) | def print_usage(self, file=None):
method print_help (line 2355) | def print_help(self, file=None):
method print_version (line 2360) | def print_version(self, file=None):
method _print_message (line 2368) | def _print_message(self, message, file=None):
method exit (line 2377) | def exit(self, status=0, message=None):
method error (line 2382) | def error(self, message):
FILE: thirdparty_libs/bind_sql_inject/diff.py
function diff (line 9) | def diff(a, b):
FILE: thirdparty_libs/bind_sql_inject/fuzzy_string_cmp.py
function relative_distance_boolean (line 11) | def relative_distance_boolean(a_str, b_str, threshold=0.6):
function fuzzy_equal (line 65) | def fuzzy_equal(a_str, b_str, threshold=0.6):
function fuzzy_not_equal (line 73) | def fuzzy_not_equal(a_str, b_str, threshold=0.6):
function relative_distance (line 81) | def relative_distance(a_str, b_str):
function _generate_upper_bounds (line 105) | def _generate_upper_bounds():
FILE: thirdparty_libs/colorizer/ansi.py
function code_to_chars (line 8) | def code_to_chars(code):
class AnsiCodes (line 11) | class AnsiCodes(object):
method __init__ (line 12) | def __init__(self, codes):
class AnsiFore (line 18) | class AnsiFore:
class AnsiBack (line 29) | class AnsiBack:
class AnsiStyle (line 40) | class AnsiStyle:
FILE: thirdparty_libs/colorizer/ansitowin32.py
function is_a_tty (line 14) | def is_a_tty(stream):
class StreamWrapper (line 18) | class StreamWrapper(object):
method __init__ (line 24) | def __init__(self, wrapped, converter):
method __getattr__ (line 30) | def __getattr__(self, name):
method write (line 33) | def write(self, text):
class AnsiToWin32 (line 37) | class AnsiToWin32(object):
method __init__ (line 45) | def __init__(self, wrapped, convert=None, strip=None, autoreset=False):
method should_wrap (line 74) | def should_wrap(self):
method get_win32_calls (line 85) | def get_win32_calls(self):
method write (line 113) | def write(self, text):
method reset_all (line 123) | def reset_all(self):
method write_and_convert (line 130) | def write_and_convert(self, text):
method write_plain_text (line 145) | def write_plain_text(self, text, start, end):
method convert_ansi (line 151) | def convert_ansi(self, paramstring, command):
method extract_params (line 157) | def extract_params(self, paramstring):
method call_win32 (line 165) | def call_win32(self, command, params):
FILE: thirdparty_libs/colorizer/initialise.py
function reset_all (line 16) | def reset_all():
function init (line 20) | def init(autoreset=False, convert=None, strip=None, wrap=True):
function deinit (line 37) | def deinit():
function reinit (line 42) | def reinit():
function wrap_stream (line 47) | def wrap_stream(stream, convert, strip, autoreset, wrap):
FILE: thirdparty_libs/colorizer/termcolor.py
function colored (line 86) | def colored(text, color=None, on_color=None, attrs=None):
function cprint (line 118) | def cprint(text, color=None, on_color=None, attrs=None, **kwargs):
FILE: thirdparty_libs/colorizer/win32.py
class COORD (line 26) | class COORD(Structure):
class SMALL_RECT (line 33) | class SMALL_RECT(Structure):
class CONSOLE_SCREEN_BUFFER_INFO (line 42) | class CONSOLE_SCREEN_BUFFER_INFO(Structure):
method __str__ (line 51) | def __str__(self):
function GetConsoleScreenBufferInfo (line 60) | def GetConsoleScreenBufferInfo(stream_id=STDOUT):
function SetConsoleTextAttribute (line 68) | def SetConsoleTextAttribute(stream_id, attrs):
function SetConsoleCursorPosition (line 73) | def SetConsoleCursorPosition(stream_id, position):
function FillConsoleOutputCharacter (line 90) | def FillConsoleOutputCharacter(stream_id, char, length, start):
function FillConsoleOutputAttribute (line 100) | def FillConsoleOutputAttribute(stream_id, attr, length, start):
FILE: thirdparty_libs/colorizer/winterm.py
class WinColor (line 6) | class WinColor(object):
class WinStyle (line 17) | class WinStyle(object):
class WinTerm (line 22) | class WinTerm(object):
method __init__ (line 24) | def __init__(self):
method get_attrs (line 31) | def get_attrs(self):
method set_attrs (line 34) | def set_attrs(self, value):
method reset_all (line 39) | def reset_all(self, on_stderr=None):
method fore (line 43) | def fore(self, fore=None, on_stderr=False):
method back (line 49) | def back(self, back=None, on_stderr=False):
method style (line 55) | def style(self, style=None, on_stderr=False):
method set_console (line 61) | def set_console(self, attrs=None, on_stderr=False):
method get_position (line 69) | def get_position(self, handle):
method set_cursor_position (line 77) | def set_cursor_position(self, position=None, on_stderr=False):
method cursor_up (line 87) | def cursor_up(self, num_rows=0, on_stderr=False):
method erase_data (line 97) | def erase_data(self, mode=0, on_stderr=False):
FILE: thirdparty_libs/oset/_abc.py
class _C (line 16) | class _C:
function abstractmethod (line 22) | def abstractmethod(funcobj):
class ABCMeta (line 43) | class ABCMeta(type):
method __new__ (line 64) | def __new__(mcls, name, bases, namespace):
method register (line 83) | def register(cls, subclass):
method _dump_registry (line 97) | def _dump_registry(cls, file=None):
method __instancecheck__ (line 106) | def __instancecheck__(cls, instance):
method __subclasscheck__ (line 126) | def __subclasscheck__(cls, subclass):
function _hasattr (line 166) | def _hasattr(C, attr):
class Sized (line 174) | class Sized:
method __len__ (line 178) | def __len__(self):
method __subclasshook__ (line 182) | def __subclasshook__(cls, C):
class Container (line 189) | class Container:
method __contains__ (line 193) | def __contains__(self, x):
method __subclasshook__ (line 197) | def __subclasshook__(cls, C):
class Iterable (line 204) | class Iterable:
method __iter__ (line 208) | def __iter__(self):
method __subclasshook__ (line 213) | def __subclasshook__(cls, C):
class Set (line 222) | class Set(Sized, Iterable, Container):
method __le__ (line 233) | def __le__(self, other):
method __lt__ (line 243) | def __lt__(self, other):
method __gt__ (line 248) | def __gt__(self, other):
method __ge__ (line 253) | def __ge__(self, other):
method __eq__ (line 258) | def __eq__(self, other):
method __ne__ (line 263) | def __ne__(self, other):
method _from_iterable (line 267) | def _from_iterable(cls, it):
method __and__ (line 275) | def __and__(self, other):
method isdisjoint (line 280) | def isdisjoint(self, other):
method __or__ (line 286) | def __or__(self, other):
method __sub__ (line 292) | def __sub__(self, other):
method __xor__ (line 300) | def __xor__(self, other):
method _hash (line 310) | def _hash(self):
class MutableSet (line 345) | class MutableSet(Set):
method add (line 348) | def add(self, value):
method discard (line 353) | def discard(self, value):
method remove (line 357) | def remove(self, value):
method pop (line 363) | def pop(self):
method clear (line 373) | def clear(self):
method __ior__ (line 381) | def __ior__(self, it):
method __iand__ (line 386) | def __iand__(self, it):
method __ixor__ (line 391) | def __ixor__(self, it):
method __isub__ (line 401) | def __isub__(self, it):
class OrderedSet (line 409) | class OrderedSet(MutableSet):
method __init__ (line 411) | def __init__(self, iterable=None):
method __len__ (line 418) | def __len__(self):
method __contains__ (line 421) | def __contains__(self, key):
method __getitem__ (line 424) | def __getitem__(self, key):
method add (line 427) | def add(self, key):
method discard (line 433) | def discard(self, key):
method __iter__ (line 439) | def __iter__(self):
method __reversed__ (line 446) | def __reversed__(self):
method pop (line 453) | def pop(self, last=True):
method __repr__ (line 460) | def __repr__(self):
method __eq__ (line 465) | def __eq__(self, other):
method __del__ (line 470) | def __del__(self):
FILE: thirdparty_libs/oset/pyoset.py
class OrderedSet (line 18) | class OrderedSet(MutableSet):
method __init__ (line 20) | def __init__(self, iterable=None):
method __len__ (line 27) | def __len__(self):
method __contains__ (line 30) | def __contains__(self, key):
method __getitem__ (line 33) | def __getitem__(self, key):
method add (line 36) | def add(self, key):
method discard (line 42) | def discard(self, key):
method __iter__ (line 48) | def __iter__(self):
method __reversed__ (line 55) | def __reversed__(self):
method pop (line 62) | def pop(self, last=True):
method __repr__ (line 69) | def __repr__(self):
method __eq__ (line 74) | def __eq__(self, other):
method __del__ (line 79) | def __del__(self):
FILE: thirdparty_libs/prettytable/prettytable.py
function _get_size (line 76) | def _get_size(text):
class PrettyTable (line 82) | class PrettyTable(object):
method __init__ (line 84) | def __init__(self, field_names=None, **kwargs):
method _unicode (line 177) | def _unicode(self, value):
method _justify (line 184) | def _justify(self, text, width, align):
method __getattr__ (line 205) | def __getattr__(self, name):
method __getitem__ (line 219) | def __getitem__(self, index):
method __str__ (line 236) | def __str__(self):
method __str__ (line 239) | def __str__(self):
method __unicode__ (line 242) | def __unicode__(self):
method _validate_option (line 256) | def _validate_option(self, option, val):
method _validate_field_names (line 286) | def _validate_field_names(self, val):
method _validate_header_style (line 304) | def _validate_header_style(self, val):
method _validate_align (line 310) | def _validate_align(self, val):
method _validate_valign (line 316) | def _validate_valign(self, val):
method _validate_nonnegative_int (line 322) | def _validate_nonnegative_int(self, name, val):
method _validate_true_or_false (line 328) | def _validate_true_or_false(self, name, val):
method _validate_int_format (line 334) | def _validate_int_format(self, name, val):
method _validate_float_format (line 343) | def _validate_float_format(self, name, val):
method _validate_function (line 356) | def _validate_function(self, name, val):
method _validate_hrules (line 362) | def _validate_hrules(self, name, val):
method _validate_vrules (line 368) | def _validate_vrules(self, name, val):
method _validate_field_name (line 374) | def _validate_field_name(self, name, val):
method _validate_all_field_names (line 380) | def _validate_all_field_names(self, name, val):
method _validate_single_char (line 387) | def _validate_single_char(self, name, val):
method _validate_attributes (line 393) | def _validate_attributes(self, name, val):
method _get_field_names (line 403) | def _get_field_names(self):
method _set_field_names (line 410) | def _set_field_names(self, val):
method _get_align (line 436) | def _get_align(self):
method _set_align (line 438) | def _set_align(self, val):
method _get_valign (line 444) | def _get_valign(self):
method _set_valign (line 446) | def _set_valign(self, val):
method _get_max_width (line 452) | def _get_max_width(self):
method _set_max_width (line 454) | def _set_max_width(self, val):
method _get_fields (line 460) | def _get_fields(self):
method _set_fields (line 467) | def _set_fields(self, val):
method _get_start (line 472) | def _get_start(self):
method _set_start (line 480) | def _set_start(self, val):
method _get_end (line 485) | def _get_end(self):
method _set_end (line 492) | def _set_end(self, val):
method _get_sortby (line 497) | def _get_sortby(self):
method _set_sortby (line 504) | def _set_sortby(self, val):
method _get_reversesort (line 509) | def _get_reversesort(self):
method _set_reversesort (line 516) | def _set_reversesort(self, val):
method _get_sort_key (line 521) | def _get_sort_key(self):
method _set_sort_key (line 528) | def _set_sort_key(self, val):
method _get_header (line 533) | def _get_header(self):
method _set_header (line 540) | def _set_header(self, val):
method _get_header_style (line 545) | def _get_header_style(self):
method _set_header_style (line 552) | def _set_header_style(self, val):
method _get_border (line 557) | def _get_border(self):
method _set_border (line 564) | def _set_border(self, val):
method _get_hrules (line 569) | def _get_hrules(self):
method _set_hrules (line 576) | def _set_hrules(self, val):
method _get_vrules (line 581) | def _get_vrules(self):
method _set_vrules (line 588) | def _set_vrules(self, val):
method _get_int_format (line 593) | def _get_int_format(self):
method _set_int_format (line 599) | def _set_int_format(self, val):
method _get_float_format (line 605) | def _get_float_format(self):
method _set_float_format (line 611) | def _set_float_format(self, val):
method _get_padding_width (line 617) | def _get_padding_width(self):
method _set_padding_width (line 624) | def _set_padding_width(self, val):
method _get_left_padding_width (line 629) | def _get_left_padding_width(self):
method _set_left_padding_width (line 636) | def _set_left_padding_width(self, val):
method _get_right_padding_width (line 641) | def _get_right_padding_width(self):
method _set_right_padding_width (line 648) | def _set_right_padding_width(self, val):
method _get_vertical_char (line 653) | def _get_vertical_char(self):
method _set_vertical_char (line 660) | def _set_vertical_char(self, val):
method _get_horizontal_char (line 666) | def _get_horizontal_char(self):
method _set_horizontal_char (line 673) | def _set_horizontal_char(self, val):
method _get_junction_char (line 679) | def _get_junction_char(self):
method _set_junction_char (line 686) | def _set_junction_char(self, val):
method _get_format (line 692) | def _get_format(self):
method _set_format (line 699) | def _set_format(self, val):
method _get_print_empty (line 704) | def _get_print_empty(self):
method _set_print_empty (line 711) | def _set_print_empty(self, val):
method _get_attributes (line 716) | def _get_attributes(self):
method _set_attributes (line 723) | def _set_attributes(self, val):
method _get_options (line 732) | def _get_options(self, kwargs):
method set_style (line 747) | def set_style(self, style):
method _set_default_style (line 760) | def _set_default_style(self):
method _set_msword_style (line 773) | def _set_msword_style(self):
method _set_columns_style (line 783) | def _set_columns_style(self):
method _set_random_style (line 791) | def _set_random_style(self):
method add_row (line 808) | def add_row(self, row):
method del_row (line 823) | def del_row(self, row_index):
method add_column (line 835) | def add_column(self, fieldname, column, align="c", valign="t"):
method clear_rows (line 860) | def clear_rows(self):
method clear (line 866) | def clear(self):
method copy (line 878) | def copy(self):
method _format_value (line 885) | def _format_value(self, field, value):
method _compute_widths (line 892) | def _compute_widths(self, rows, options):
method _get_padding_widths (line 906) | def _get_padding_widths(self, options):
method _get_rows (line 918) | def _get_rows(self, options):
method _format_row (line 938) | def _format_row(self, row, options):
method _format_rows (line 941) | def _format_rows(self, rows, options):
method get_string (line 948) | def get_string(self, **kwargs):
method _stringify_hrule (line 1009) | def _stringify_hrule(self, options):
method _stringify_header (line 1035) | def _stringify_header(self, options):
method _stringify_row (line 1082) | def _stringify_row(self, row, options):
method get_html_string (line 1158) | def get_html_string(self, **kwargs):
method _get_simple_html_string (line 1190) | def _get_simple_html_string(self, options):
method _get_formatted_html_string (line 1230) | def _get_formatted_html_string(self, options):
function _char_block_width (line 1294) | def _char_block_width(char):
function _str_block_width (line 1327) | def _str_block_width(val):
function from_csv (line 1335) | def from_csv(fp, field_names = None, **kwargs):
function from_db_cursor (line 1355) | def from_db_cursor(cursor, **kwargs):
class TableHandler (line 1364) | class TableHandler(HTMLParser):
method __init__ (line 1366) | def __init__(self, **kwargs):
method handle_starttag (line 1377) | def handle_starttag(self,tag, attrs):
method handle_endtag (line 1382) | def handle_endtag(self,tag):
method handle_data (line 1400) | def handle_data(self, data):
method generate_table (line 1403) | def generate_table(self, rows):
method make_fields_unique (line 1421) | def make_fields_unique(self, fields):
function from_html (line 1430) | def from_html(html_code, **kwargs):
function from_html_one (line 1440) | def from_html_one(html_code, **kwargs):
function main (line 1457) | def main():
FILE: thirdparty_libs/requests/__init__.py
class NullHandler (line 73) | class NullHandler(logging.Handler):
method emit (line 74) | def emit(self, record):
FILE: thirdparty_libs/requests/adapters.py
class BaseAdapter (line 33) | class BaseAdapter(object):
method __init__ (line 36) | def __init__(self):
method send (line 39) | def send(self):
method close (line 42) | def close(self):
class HTTPAdapter (line 46) | class HTTPAdapter(BaseAdapter):
method __init__ (line 69) | def __init__(self, pool_connections=DEFAULT_POOLSIZE,
method __getstate__ (line 83) | def __getstate__(self):
method __setstate__ (line 87) | def __setstate__(self, state):
method init_poolmanager (line 94) | def init_poolmanager(self, connections, maxsize, block=DEFAULT_POOLBLO...
method cert_verify (line 111) | def cert_verify(self, conn, url, verify, cert):
method build_response (line 148) | def build_response(self, req, resp):
method get_connection (line 184) | def get_connection(self, url, proxies=None):
method close (line 203) | def close(self):
method request_url (line 211) | def request_url(self, request, proxies):
method add_headers (line 234) | def add_headers(self, request, **kwargs):
method send (line 261) | def send(self, request, stream=False, timeout=None, verify=True, cert=...
FILE: thirdparty_libs/requests/api.py
function request (line 17) | def request(method, url, **kwargs):
function get (line 47) | def get(url, **kwargs):
function options (line 58) | def options(url, **kwargs):
function head (line 69) | def head(url, **kwargs):
function post (line 80) | def post(url, data=None, **kwargs):
function put (line 91) | def put(url, data=None, **kwargs):
function patch (line 102) | def patch(url, data=None, **kwargs):
function delete (line 113) | def delete(url, **kwargs):
FILE: thirdparty_libs/requests/auth.py
function _basic_auth_str (line 28) | def _basic_auth_str(username, password):
class AuthBase (line 34) | class AuthBase(object):
method __call__ (line 37) | def __call__(self, r):
class HTTPBasicAuth (line 41) | class HTTPBasicAuth(AuthBase):
method __init__ (line 43) | def __init__(self, username, password):
method __call__ (line 47) | def __call__(self, r):
class HTTPProxyAuth (line 52) | class HTTPProxyAuth(HTTPBasicAuth):
method __call__ (line 54) | def __call__(self, r):
class HTTPDigestAuth (line 59) | class HTTPDigestAuth(AuthBase):
method __init__ (line 61) | def __init__(self, username, password):
method build_digest_header (line 68) | def build_digest_header(self, method, url):
method handle_401 (line 146) | def handle_401(self, r, **kwargs):
method __call__ (line 172) | def __call__(self, r):
FILE: thirdparty_libs/requests/certs.py
function where (line 18) | def where():
FILE: thirdparty_libs/requests/cookies.py
class MockRequest (line 21) | class MockRequest(object):
method __init__ (line 33) | def __init__(self, request):
method get_type (line 38) | def get_type(self):
method get_host (line 41) | def get_host(self):
method get_origin_req_host (line 44) | def get_origin_req_host(self):
method get_full_url (line 47) | def get_full_url(self):
method is_unverifiable (line 50) | def is_unverifiable(self):
method has_header (line 53) | def has_header(self, name):
method get_header (line 56) | def get_header(self, name, default=None):
method add_header (line 59) | def add_header(self, key, val):
method add_unredirected_header (line 63) | def add_unredirected_header(self, name, value):
method get_new_headers (line 66) | def get_new_headers(self):
method unverifiable (line 70) | def unverifiable(self):
method origin_req_host (line 74) | def origin_req_host(self):
method host (line 78) | def host(self):
class MockResponse (line 82) | class MockResponse(object):
method __init__ (line 89) | def __init__(self, headers):
method info (line 96) | def info(self):
method getheaders (line 99) | def getheaders(self, name):
function extract_cookies_to_jar (line 103) | def extract_cookies_to_jar(jar, request, response):
function get_cookie_header (line 120) | def get_cookie_header(jar, request):
function remove_cookie_by_name (line 127) | def remove_cookie_by_name(cookiejar, name, domain=None, path=None):
class CookieConflictError (line 143) | class CookieConflictError(RuntimeError):
class RequestsCookieJar (line 148) | class RequestsCookieJar(cookielib.CookieJar, collections.MutableMapping):
method get (line 165) | def get(self, name, default=None, domain=None, path=None):
method set (line 174) | def set(self, name, value, **kwargs):
method keys (line 190) | def keys(self):
method values (line 198) | def values(self):
method items (line 206) | def items(self):
method list_domains (line 215) | def list_domains(self):
method list_paths (line 223) | def list_paths(self):
method multiple_domains (line 231) | def multiple_domains(self):
method get_dict (line 241) | def get_dict(self, domain=None, path=None):
method __getitem__ (line 251) | def __getitem__(self, name):
method __setitem__ (line 258) | def __setitem__(self, name, value):
method __delitem__ (line 265) | def __delitem__(self, name):
method set_cookie (line 269) | def set_cookie(self, cookie, *args, **kwargs):
method update (line 274) | def update(self, other):
method _find (line 282) | def _find(self, name, domain=None, path=None):
method _find_no_duplicates (line 295) | def _find_no_duplicates(self, name, domain=None, path=None):
method __getstate__ (line 313) | def __getstate__(self):
method __setstate__ (line 320) | def __setstate__(self, state):
method copy (line 326) | def copy(self):
function create_cookie (line 333) | def create_cookie(name, value, **kwargs):
function morsel_to_cookie (line 368) | def morsel_to_cookie(morsel):
function cookiejar_from_dict (line 395) | def cookiejar_from_dict(cookie_dict, cookiejar=None):
FILE: thirdparty_libs/requests/exceptions.py
class RequestException (line 12) | class RequestException(RuntimeError):
class HTTPError (line 17) | class HTTPError(RequestException):
method __init__ (line 20) | def __init__(self, *args, **kwargs):
class ConnectionError (line 26) | class ConnectionError(RequestException):
class SSLError (line 30) | class SSLError(ConnectionError):
class Timeout (line 34) | class Timeout(RequestException):
class URLRequired (line 38) | class URLRequired(RequestException):
class TooManyRedirects (line 42) | class TooManyRedirects(RequestException):
class MissingSchema (line 46) | class MissingSchema(RequestException, ValueError):
class InvalidSchema (line 50) | class InvalidSchema(RequestException, ValueError):
class InvalidURL (line 54) | class InvalidURL(RequestException, ValueError):
class ChunkedEncodingError (line 58) | class ChunkedEncodingError(RequestException):
FILE: thirdparty_libs/requests/hooks.py
function default_hooks (line 20) | def default_hooks():
function dispatch_hook (line 29) | def dispatch_hook(key, hooks, hook_data, **kwargs):
FILE: thirdparty_libs/requests/models.py
class RequestEncodingMixin (line 39) | class RequestEncodingMixin(object):
method path_url (line 41) | def path_url(self):
method _encode_params (line 62) | def _encode_params(data):
method _encode_files (line 89) | def _encode_files(files, data):
class RequestHooksMixin (line 140) | class RequestHooksMixin(object):
method register_hook (line 141) | def register_hook(self, event, hook):
method deregister_hook (line 149) | def deregister_hook(self, event, hook):
class Request (line 161) | class Request(RequestHooksMixin):
method __init__ (line 184) | def __init__(self,
method __repr__ (line 215) | def __repr__(self):
method prepare (line 218) | def prepare(self):
class PreparedRequest (line 235) | class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
method __init__ (line 254) | def __init__(self):
method prepare (line 266) | def prepare(self, method=None, url=None, headers=None, files=None,
method __repr__ (line 282) | def __repr__(self):
method copy (line 285) | def copy(self):
method prepare_method (line 294) | def prepare_method(self, method):
method prepare_url (line 300) | def prepare_url(self, url, params):
method prepare_headers (line 360) | def prepare_headers(self, headers):
method prepare_body (line 369) | def prepare_body(self, data, files):
method prepare_content_length (line 422) | def prepare_content_length(self, body):
method prepare_auth (line 434) | def prepare_auth(self, auth, url=''):
method prepare_cookies (line 456) | def prepare_cookies(self, cookies):
method prepare_hooks (line 469) | def prepare_hooks(self, hooks):
class Response (line 475) | class Response(object):
method __init__ (line 480) | def __init__(self):
method __repr__ (line 519) | def __repr__(self):
method __bool__ (line 522) | def __bool__(self):
method __nonzero__ (line 526) | def __nonzero__(self):
method __iter__ (line 530) | def __iter__(self):
method ok (line 535) | def ok(self):
method apparent_encoding (line 543) | def apparent_encoding(self):
method iter_content (line 548) | def iter_content(self, chunk_size=1, decode_unicode=False):
method iter_lines (line 585) | def iter_lines(self, chunk_size=ITER_CHUNK_SIZE, decode_unicode=None):
method content (line 612) | def content(self):
method text (line 636) | def text(self):
method json (line 668) | def json(self, **kwargs):
method links (line 685) | def links(self):
method raise_for_status (line 702) | def raise_for_status(self):
method close (line 716) | def close(self):
FILE: thirdparty_libs/requests/packages/charade/__init__.py
function detect (line 22) | def detect(aBuf):
FILE: thirdparty_libs/requests/packages/charade/big5prober.py
class Big5Prober (line 34) | class Big5Prober(MultiByteCharSetProber):
method __init__ (line 35) | def __init__(self):
method get_charset_name (line 41) | def get_charset_name(self):
FILE: thirdparty_libs/requests/packages/charade/chardistribution.py
class CharDistributionAnalysis (line 46) | class CharDistributionAnalysis:
method __init__ (line 47) | def __init__(self):
method reset (line 59) | def reset(self):
method feed (line 68) | def feed(self, aBuf, aCharLen):
method get_confidence (line 82) | def get_confidence(self):
method got_enough_data (line 98) | def got_enough_data(self):
method get_order (line 103) | def get_order(self, aBuf):
class EUCTWDistributionAnalysis (line 111) | class EUCTWDistributionAnalysis(CharDistributionAnalysis):
method __init__ (line 112) | def __init__(self):
method get_order (line 118) | def get_order(self, aBuf):
class EUCKRDistributionAnalysis (line 130) | class EUCKRDistributionAnalysis(CharDistributionAnalysis):
method __init__ (line 131) | def __init__(self):
method get_order (line 137) | def get_order(self, aBuf):
class GB2312DistributionAnalysis (line 149) | class GB2312DistributionAnalysis(CharDistributionAnalysis):
method __init__ (line 150) | def __init__(self):
method get_order (line 156) | def get_order(self, aBuf):
class Big5DistributionAnalysis (line 168) | class Big5DistributionAnalysis(CharDistributionAnalysis):
method __init__ (line 169) | def __init__(self):
method get_order (line 175) | def get_order(self, aBuf):
class SJISDistributionAnalysis (line 190) | class SJISDistributionAnalysis(CharDistributionAnalysis):
method __init__ (line 191) | def __init__(self):
method get_order (line 197) | def get_order(self, aBuf):
class EUCJPDistributionAnalysis (line 215) | class EUCJPDistributionAnalysis(CharDistributionAnalysis):
method __init__ (line 216) | def __init__(self):
method get_order (line 222) | def get_order(self, aBuf):
FILE: thirdparty_libs/requests/packages/charade/charsetgroupprober.py
class CharSetGroupProber (line 33) | class CharSetGroupProber(CharSetProber):
method __init__ (line 34) | def __init__(self):
method reset (line 40) | def reset(self):
method get_charset_name (line 50) | def get_charset_name(self):
method feed (line 58) | def feed(self, aBuf):
method get_confidence (line 78) | def get_confidence(self):
FILE: thirdparty_libs/requests/packages/charade/charsetprober.py
class CharSetProber (line 33) | class CharSetProber:
method __init__ (line 34) | def __init__(self):
method reset (line 37) | def reset(self):
method get_charset_name (line 40) | def get_charset_name(self):
method feed (line 43) | def feed(self, aBuf):
method get_state (line 46) | def get_state(self):
method get_confidence (line 49) | def get_confidence(self):
method filter_high_bit_only (line 52) | def filter_high_bit_only(self, aBuf):
method filter_without_english_letters (line 56) | def filter_without_english_letters(self, aBuf):
method filter_with_english_letters (line 60) | def filter_with_english_letters(self, aBuf):
FILE: thirdparty_libs/requests/packages/charade/codingstatemachine.py
class CodingStateMachine (line 32) | class CodingStateMachine:
method __init__ (line 33) | def __init__(self, sm):
method reset (line 39) | def reset(self):
method next_state (line 42) | def next_state(self, c):
method get_current_charlen (line 57) | def get_current_charlen(self):
method get_coding_state_machine (line 60) | def get_coding_state_machine(self):
FILE: thirdparty_libs/requests/packages/charade/compat.py
function wrap_ord (line 30) | def wrap_ord(a):
FILE: thirdparty_libs/requests/packages/charade/cp949prober.py
class CP949Prober (line 34) | class CP949Prober(MultiByteCharSetProber):
method __init__ (line 35) | def __init__(self):
method get_charset_name (line 43) | def get_charset_name(self):
FILE: thirdparty_libs/requests/packages/charade/escprober.py
class EscCharSetProber (line 36) | class EscCharSetProber(CharSetProber):
method __init__ (line 37) | def __init__(self):
method reset (line 47) | def reset(self):
method get_charset_name (line 57) | def get_charset_name(self):
method get_confidence (line 60) | def get_confidence(self):
method feed (line 66) | def feed(self, aBuf):
FILE: thirdparty_libs/requests/packages/charade/eucjpprober.py
class EUCJPProber (line 37) | class EUCJPProber(MultiByteCharSetProber):
method __init__ (line 38) | def __init__(self):
method reset (line 45) | def reset(self):
method get_charset_name (line 49) | def get_charset_name(self):
method feed (line 52) | def feed(self, aBuf):
method get_confidence (line 87) | def get_confidence(self):
FILE: thirdparty_libs/requests/packages/charade/euckrprober.py
class EUCKRProber (line 34) | class EUCKRProber(MultiByteCharSetProber):
method __init__ (line 35) | def __init__(self):
method get_charset_name (line 41) | def get_charset_name(self):
FILE: thirdparty_libs/requests/packages/charade/euctwprober.py
class EUCTWProber (line 33) | class EUCTWProber(MultiByteCharSetProber):
method __init__ (line 34) | def __init__(self):
method get_charset_name (line 40) | def get_charset_name(self):
FILE: thirdparty_libs/requests/packages/charade/gb2312prober.py
class GB2312Prober (line 33) | class GB2312Prober(MultiByteCharSetProber):
method __init__ (line 34) | def __init__(self):
method get_charset_name (line 40) | def get_charset_name(self):
FILE: thirdparty_libs/requests/packages/charade/hebrewprober.py
class HebrewProber (line 155) | class HebrewProber(CharSetProber):
method __init__ (line 156) | def __init__(self):
method reset (line 162) | def reset(self):
method set_model_probers (line 172) | def set_model_probers(self, logicalProber, visualProber):
method is_final (line 176) | def is_final(self, c):
method is_non_final (line 180) | def is_non_final(self, c):
method feed (line 193) | def feed(self, aBuf):
method get_charset_name (line 252) | def get_charset_name(self):
method get_state (line 278) | def get_state(self):
FILE: thirdparty_libs/requests/packages/charade/jpcntx.py
class JapaneseContextAnalysis (line 123) | class JapaneseContextAnalysis:
method __init__ (line 124) | def __init__(self):
method reset (line 127) | def reset(self):
method feed (line 139) | def feed(self, aBuf, aLen):
method got_enough_data (line 166) | def got_enough_data(self):
method get_confidence (line 169) | def get_confidence(self):
method get_order (line 176) | def get_order(self, aBuf):
class SJISContextAnalysis (line 179) | class SJISContextAnalysis(JapaneseContextAnalysis):
method get_order (line 180) | def get_order(self, aBuf):
class EUCJPContextAnalysis (line 198) | class EUCJPContextAnalysis(JapaneseContextAnalysis):
method get_order (line 199) | def get_order(self, aBuf):
FILE: thirdparty_libs/requests/packages/charade/latin1prober.py
class Latin1Prober (line 97) | class Latin1Prober(CharSetProber):
method __init__ (line 98) | def __init__(self):
method reset (line 102) | def reset(self):
method get_charset_name (line 107) | def get_charset_name(self):
method feed (line 110) | def feed(self, aBuf):
method get_confidence (line 124) | def get_confidence(self):
FILE: thirdparty_libs/requests/packages/charade/mbcharsetprober.py
class MultiByteCharSetProber (line 35) | class MultiByteCharSetProber(CharSetProber):
method __init__ (line 36) | def __init__(self):
method reset (line 42) | def reset(self):
method get_charset_name (line 50) | def get_charset_name(self):
method feed (line 53) | def feed(self, aBuf):
method get_confidence (line 85) | def get_confidence(self):
FILE: thirdparty_libs/requests/packages/charade/mbcsgroupprober.py
class MBCSGroupProber (line 41) | class MBCSGroupProber(CharSetGroupProber):
method __init__ (line 42) | def __init__(self):
FILE: thirdparty_libs/requests/packages/charade/sbcharsetprober.py
class SingleByteCharSetProber (line 44) | class SingleByteCharSetProber(CharSetProber):
method __init__ (line 45) | def __init__(self, model, reversed=False, nameProber=None):
method reset (line 54) | def reset(self):
method get_charset_name (line 64) | def get_charset_name(self):
method feed (line 70) | def feed(self, aBuf):
method get_confidence (line 112) | def get_confidence(self):
FILE: thirdparty_libs/requests/packages/charade/sbcsgroupprober.py
class SBCSGroupProber (line 42) | class SBCSGroupProber(CharSetGroupProber):
method __init__ (line 43) | def __init__(self):
FILE: thirdparty_libs/requests/packages/charade/sjisprober.py
class SJISProber (line 37) | class SJISProber(MultiByteCharSetProber):
method __init__ (line 38) | def __init__(self):
method reset (line 45) | def reset(self):
method get_charset_name (line 49) | def get_charset_name(self):
method feed (line 52) | def feed(self, aBuf):
method get_confidence (line 88) | def get_confidence(self):
FILE: thirdparty_libs/requests/packages/charade/universaldetector.py
class UniversalDetector (line 44) | class UniversalDetector:
method __init__ (line 45) | def __init__(self):
method reset (line 52) | def reset(self):
method feed (line 64) | def feed(self, aBuf):
method close (line 136) | def close(self):
FILE: thirdparty_libs/requests/packages/charade/utf8prober.py
class UTF8Prober (line 36) | class UTF8Prober(CharSetProber):
method __init__ (line 37) | def __init__(self):
method reset (line 42) | def reset(self):
method get_charset_name (line 47) | def get_charset_name(self):
method feed (line 50) | def feed(self, aBuf):
method get_confidence (line 69) | def get_confidence(self):
FILE: thirdparty_libs/requests/packages/urllib3/__init__.py
class NullHandler (line 34) | class NullHandler(logging.Handler):
method emit (line 35) | def emit(self, record):
function add_stderr_logger (line 40) | def add_stderr_logger(level=logging.DEBUG):
FILE: thirdparty_libs/requests/packages/urllib3/_collections.py
class RecentlyUsedContainer (line 22) | class RecentlyUsedContainer(MutableMapping):
method __init__ (line 38) | def __init__(self, maxsize=10, dispose_func=None):
method __getitem__ (line 45) | def __getitem__(self, key):
method __setitem__ (line 52) | def __setitem__(self, key, value):
method __delitem__ (line 67) | def __delitem__(self, key):
method __len__ (line 74) | def __len__(self):
method __iter__ (line 78) | def __iter__(self):
method clear (line 81) | def clear(self):
method keys (line 92) | def keys(self):
FILE: thirdparty_libs/requests/packages/urllib3/connectionpool.py
class BaseSSLError (line 30) | class BaseSSLError(BaseException):
class VerifiedHTTPSConnection (line 77) | class VerifiedHTTPSConnection(HTTPSConnection):
method set_cert (line 86) | def set_cert(self, key_file=None, cert_file=None,
method connect (line 97) | def connect(self):
class ConnectionPool (line 122) | class ConnectionPool(object):
method __init__ (line 131) | def __init__(self, host, port=None):
method __str__ (line 135) | def __str__(self):
class HTTPConnectionPool (line 140) | class HTTPConnectionPool(ConnectionPool, RequestMethods):
method __init__ (line 181) | def __init__(self, host, port=None, strict=False, timeout=None, maxsiz...
method _new_conn (line 199) | def _new_conn(self):
method _get_conn (line 210) | def _get_conn(self, timeout=None):
method _put_conn (line 243) | def _put_conn(self, conn):
method _make_request (line 271) | def _make_request(self, conn, method, url, timeout=_Default,
method close (line 302) | def close(self):
method is_same_host (line 318) | def is_same_host(self, url):
method urlopen (line 335) | def urlopen(self, method, url, body=None, headers=None, retries=3,
class HTTPSConnectionPool (line 506) | class HTTPSConnectionPool(HTTPConnectionPool):
method __init__ (line 526) | def __init__(self, host, port=None,
method _new_conn (line 544) | def _new_conn(self):
function connection_from_url (line 574) | def connection_from_url(url, **kw):
FILE: thirdparty_libs/requests/packages/urllib3/exceptions.py
class HTTPError (line 10) | class HTTPError(Exception):
class PoolError (line 15) | class PoolError(HTTPError):
method __init__ (line 17) | def __init__(self, pool, message):
method __reduce__ (line 21) | def __reduce__(self):
class RequestError (line 26) | class RequestError(PoolError):
method __init__ (line 28) | def __init__(self, pool, url, message):
method __reduce__ (line 32) | def __reduce__(self):
class SSLError (line 37) | class SSLError(HTTPError):
class DecodeError (line 42) | class DecodeError(HTTPError):
class MaxRetryError (line 49) | class MaxRetryError(RequestError):
method __init__ (line 52) | def __init__(self, pool, url, reason=None):
class HostChangedError (line 64) | class HostChangedError(RequestError):
method __init__ (line 67) | def __init__(self, pool, url, retries=3):
class TimeoutError (line 73) | class TimeoutError(RequestError):
class EmptyPoolError (line 78) | class EmptyPoolError(PoolError):
class ClosedPoolError (line 83) | class ClosedPoolError(PoolError):
class LocationParseError (line 88) | class LocationParseError(ValueError, HTTPError):
method __init__ (line 91) | def __init__(self, location):
FILE: thirdparty_libs/requests/packages/urllib3/filepost.py
function choose_boundary (line 19) | def choose_boundary():
function get_content_type (line 26) | def get_content_type(filename):
function iter_fields (line 30) | def iter_fields(fields):
function encode_multipart_formdata (line 42) | def encode_multipart_formdata(fields, boundary=None):
FILE: thirdparty_libs/requests/packages/urllib3/packages/ordered_dict.py
class OrderedDict (line 17) | class OrderedDict(dict):
method __init__ (line 29) | def __init__(self, *args, **kwds):
method __setitem__ (line 45) | def __setitem__(self, key, value, dict_setitem=dict.__setitem__):
method __delitem__ (line 55) | def __delitem__(self, key, dict_delitem=dict.__delitem__):
method __iter__ (line 64) | def __iter__(self):
method __reversed__ (line 72) | def __reversed__(self):
method clear (line 80) | def clear(self):
method popitem (line 92) | def popitem(self, last=True):
method keys (line 117) | def keys(self):
method values (line 121) | def values(self):
method items (line 125) | def items(self):
method iterkeys (line 129) | def iterkeys(self):
method itervalues (line 133) | def itervalues(self):
method iteritems (line 138) | def iteritems(self):
method update (line 143) | def update(*args, **kwds):
method pop (line 178) | def pop(self, key, default=__marker):
method setdefault (line 191) | def setdefault(self, key, default=None):
method __repr__ (line 198) | def __repr__(self, _repr_running={}):
method __reduce__ (line 211) | def __reduce__(self):
method copy (line 221) | def copy(self):
method fromkeys (line 226) | def fromkeys(cls, iterable, value=None):
method __eq__ (line 236) | def __eq__(self, other):
method __ne__ (line 245) | def __ne__(self, other):
method viewkeys (line 250) | def viewkeys(self):
method viewvalues (line 254) | def viewvalues(self):
method viewitems (line 258) | def viewitems(self):
FILE: thirdparty_libs/requests/packages/urllib3/packages/six.py
class X (line 53) | class X(object):
method __len__ (line 54) | def __len__(self):
function _add_doc (line 67) | def _add_doc(func, doc):
function _import_module (line 72) | def _import_module(name):
class _LazyDescr (line 78) | class _LazyDescr(object):
method __init__ (line 80) | def __init__(self, name):
method __get__ (line 83) | def __get__(self, obj, tp):
class MovedModule (line 91) | class MovedModule(_LazyDescr):
method __init__ (line 93) | def __init__(self, name, old, new=None):
method _resolve (line 102) | def _resolve(self):
class MovedAttribute (line 106) | class MovedAttribute(_LazyDescr):
method __init__ (line 108) | def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):
method _resolve (line 126) | def _resolve(self):
class _MovedItems (line 132) | class _MovedItems(types.ModuleType):
function add_move (line 189) | def add_move(move):
function remove_move (line 194) | def remove_move(name):
function advance_iterator (line 230) | def advance_iterator(it):
function get_unbound_function (line 236) | def get_unbound_function(unbound):
function callable (line 241) | def callable(obj):
function get_unbound_function (line 244) | def get_unbound_function(unbound):
class Iterator (line 247) | class Iterator(object):
method next (line 249) | def next(self):
function iterkeys (line 263) | def iterkeys(d):
function itervalues (line 267) | def itervalues(d):
function iteritems (line 271) | def iteritems(d):
function b (line 277) | def b(s):
function u (line 279) | def u(s):
function int2byte (line 282) | def int2byte(i):
function b (line 291) | def b(s):
function u (line 293) | def u(s):
function reraise (line 307) | def reraise(tp, value, tb=None):
function exec_ (line 317) | def exec_(code, globs=None, locs=None):
function print_ (line 335) | def print_(*args, **kwargs):
function with_metaclass (line 383) | def with_metaclass(meta, base=object):
FILE: thirdparty_libs/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py
class CertificateError (line 7) | class CertificateError(ValueError):
function _dnsname_to_pat (line 10) | def _dnsname_to_pat(dn):
function match_hostname (line 23) | def match_hostname(cert, hostname):
FILE: thirdparty_libs/requests/packages/urllib3/poolmanager.py
class PoolManager (line 35) | class PoolManager(RequestMethods):
method __init__ (line 63) | def __init__(self, num_pools=10, headers=None, **connection_pool_kw):
method _new_pool (line 69) | def _new_pool(self, scheme, host, port):
method clear (line 86) | def clear(self):
method connection_from_host (line 95) | def connection_from_host(self, host, port=None, scheme='http'):
method connection_from_url (line 119) | def connection_from_url(self, url):
method urlopen (line 131) | def urlopen(self, method, url, redirect=True, **kw):
class ProxyManager (line 167) | class ProxyManager(RequestMethods):
method __init__ (line 174) | def __init__(self, proxy_pool):
method _set_proxy_headers (line 177) | def _set_proxy_headers(self, url, headers=None):
method urlopen (line 193) | def urlopen(self, method, url, **kw):
function proxy_from_url (line 200) | def proxy_from_url(url, **pool_kw):
FILE: thirdparty_libs/requests/packages/urllib3/request.py
class RequestMethods (line 18) | class RequestMethods(object):
method __init__ (line 50) | def __init__(self, headers=None):
method urlopen (line 53) | def urlopen(self, method, url, body=None, headers=None,
method request (line 59) | def request(self, method, url, fields=None, headers=None, **urlopen_kw):
method request_encode_url (line 81) | def request_encode_url(self, method, url, fields=None, **urlopen_kw):
method request_encode_body (line 90) | def request_encode_body(self, method, url, fields=None, headers=None,
FILE: thirdparty_libs/requests/packages/urllib3/response.py
class DeflateDecoder (line 20) | class DeflateDecoder(object):
method __init__ (line 22) | def __init__(self):
method __getattr__ (line 27) | def __getattr__(self, name):
method decompress (line 30) | def decompress(self, data):
function _get_decoder (line 46) | def _get_decoder(mode):
class HTTPResponse (line 53) | class HTTPResponse(io.IOBase):
method __init__ (line 78) | def __init__(self, body='', headers=None, status=0, version=0, reason=...
method get_redirect_location (line 102) | def get_redirect_location(self):
method release_conn (line 115) | def release_conn(self):
method data (line 123) | def data(self):
method read (line 131) | def read(self, amt=None, decode_content=None, cache_content=False):
method stream (line 207) | def stream(self, amt=2**16, decode_content=None):
method from_httplib (line 231) | def from_httplib(ResponseCls, r, **response_kw):
method getheaders (line 264) | def getheaders(self):
method getheader (line 267) | def getheader(self, name, default=None):
method close (line 271) | def close(self):
method closed (line 276) | def closed(self):
method fileno (line 286) | def fileno(self):
method flush (line 295) | def flush(self):
method readable (line 299) | def readable(self):
FILE: thirdparty_libs/requests/packages/urllib3/util.py
class Url (line 38) | class Url(namedtuple('Url', ['scheme', 'auth', 'host', 'port', 'path', '...
method __new__ (line 45) | def __new__(cls, scheme=None, auth=None, host=None, port=None, path=No...
method hostname (line 49) | def hostname(self):
method request_uri (line 54) | def request_uri(self):
method netloc (line 64) | def netloc(self):
function split_first (line 71) | def split_first(s, delims):
function parse_url (line 104) | def parse_url(url):
function get_host (line 184) | def get_host(url):
function make_headers (line 192) | def make_headers(keep_alive=None, accept_encoding=None, user_agent=None,
function is_connection_dropped (line 244) | def is_connection_dropped(conn): # Platform-specific
function resolve_cert_reqs (line 276) | def resolve_cert_reqs(candidate):
function resolve_ssl_version (line 299) | def resolve_ssl_version(candidate):
function assert_fingerprint (line 315) | def assert_fingerprint(cert, fingerprint):
function is_fp_closed (line 351) | def is_fp_closed(obj):
function ssl_wrap_socket (line 367) | def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None,
function ssl_wrap_socket (line 394) | def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None,
FILE: thirdparty_libs/requests/sessions.py
function merge_setting (line 37) | def merge_setting(request_setting, session_setting, dict_class=OrderedDi...
class SessionRedirectMixin (line 68) | class SessionRedirectMixin(object):
method resolve_redirects (line 69) | def resolve_redirects(self, resp, req, stream=False, timeout=None,
class Session (line 156) | class Session(SessionRedirectMixin):
method __init__ (line 174) | def __init__(self):
method __enter__ (line 225) | def __enter__(self):
method __exit__ (line 228) | def __exit__(self, *args):
method prepare_request (line 231) | def prepare_request(self, request):
method request (line 271) | def request(self, method, url,
method get (line 364) | def get(self, url, **kwargs):
method options (line 374) | def options(self, url, **kwargs):
method head (line 384) | def head(self, url, **kwargs):
method post (line 394) | def post(self, url, data=None, **kwargs):
method put (line 404) | def put(self, url, data=None, **kwargs):
method patch (line 414) | def patch(self, url, data=None, **kwargs):
method delete (line 424) | def delete(self, url, **kwargs):
method send (line 433) | def send(self, request, **kwargs):
method get_adapter (line 491) | def get_adapter(self, url):
method close (line 501) | def close(self):
method mount (line 506) | def mount(self, prefix, adapter):
method __getstate__ (line 515) | def __getstate__(self):
method __setstate__ (line 518) | def __setstate__(self, state):
function session (line 523) | def session():
FILE: thirdparty_libs/requests/structures.py
class IteratorProxy (line 16) | class IteratorProxy(object):
method __init__ (line 18) | def __init__(self, i):
method __iter__ (line 22) | def __iter__(self):
method __len__ (line 25) | def __len__(self):
method read (line 33) | def read(self, n):
class CaseInsensitiveDict (line 37) | class CaseInsensitiveDict(collections.MutableMapping):
method __init__ (line 65) | def __init__(self, data=None, **kwargs):
method __setitem__ (line 71) | def __setitem__(self, key, value):
method __getitem__ (line 76) | def __getitem__(self, key):
method __delitem__ (line 79) | def __delitem__(self, key):
method __iter__ (line 82) | def __iter__(self):
method __len__ (line 85) | def __len__(self):
method lower_items (line 88) | def lower_items(self):
method __eq__ (line 96) | def __eq__(self, other):
method copy (line 105) | def copy(self):
method __repr__ (line 108) | def __repr__(self):
class LookupDict (line 112) | class LookupDict(dict):
method __init__ (line 115) | def __init__(self, name=None):
method __repr__ (line 119) | def __repr__(self):
method __getitem__ (line 122) | def __getitem__(self, key):
method get (line 127) | def get(self, key, default=None):
FILE: thirdparty_libs/requests/utils.py
function dict_to_sequence (line 36) | def dict_to_sequence(d):
function super_len (line 45) | def super_len(o):
function get_netrc_auth (line 54) | def get_netrc_auth(url):
function guess_filename (line 90) | def guess_filename(obj):
function from_key_val_list (line 97) | def from_key_val_list(value):
function to_key_val_list (line 120) | def to_key_val_list(value):
function parse_list_header (line 146) | def parse_list_header(value):
function parse_dict_header (line 177) | def parse_dict_header(value):
function unquote_header_value (line 211) | def unquote_header_value(value, is_filename=False):
function dict_from_cookiejar (line 235) | def dict_from_cookiejar(cj):
function add_dict_to_cookiejar (line 249) | def add_dict_to_cookiejar(cj, cookie_dict):
function get_encodings_from_content (line 261) | def get_encodings_from_content(content):
function get_encoding_from_headers (line 272) | def get_encoding_from_headers(headers):
function stream_decode_response_unicode (line 292) | def stream_decode_response_unicode(iterator, r):
function iter_slices (line 310) | def iter_slices(string, slice_length):
function get_unicode_from_response (line 318) | def get_unicode_from_response(r):
function unquote_unreserved (line 357) | def unquote_unreserved(uri):
function requote_uri (line 375) | def requote_uri(uri):
function get_environ_proxies (line 387) | def get_environ_proxies(url):
function default_user_agent (line 419) | def default_user_agent():
function default_headers (line 450) | def default_headers():
function parse_header_links (line 458) | def parse_header_links(value):
function guess_json_utf (line 498) | def guess_json_utf(data):
function prepend_scheme_if_needed (line 527) | def prepend_scheme_if_needed(url, new_scheme):
function get_auth_from_url (line 541) | def get_auth_from_url(url):
FILE: thirdparty_libs/requests_ntlm/ntlm/HTTPNtlmAuthHandler.py
class AbstractNtlmAuthHandler (line 20) | class AbstractNtlmAuthHandler:
method __init__ (line 21) | def __init__(self, password_mgr=None, debuglevel=0):
method set_http_debuglevel (line 36) | def set_http_debuglevel(self, level):
method http_error_authentication_required (line 39) | def http_error_authentication_required(self, auth_header_field, req, f...
method retry_using_http_NTLM_auth (line 46) | def retry_using_http_NTLM_auth(self, req, auth_header_field, realm, he...
class HTTPNtlmAuthHandler (line 116) | class HTTPNtlmAuthHandler(AbstractNtlmAuthHandler, urllib2.BaseHandler):
method http_error_401 (line 120) | def http_error_401(self, req, fp, code, msg, headers):
class ProxyNtlmAuthHandler (line 124) | class ProxyNtlmAuthHandler(AbstractNtlmAuthHandler, urllib2.BaseHandler):
method http_error_407 (line 131) | def http_error_407(self, req, fp, code, msg, headers):
FILE: thirdparty_libs/requests_ntlm/ntlm/U32.py
function norm (line 20) | def norm(n):
class U32 (line 24) | class U32:
method __init__ (line 27) | def __init__(self, value = 0):
method set (line 30) | def set(self, value = 0):
method __repr__ (line 33) | def __repr__(self):
method __long__ (line 36) | def __long__(self): return long(norm(self.v))
method __int__ (line 37) | def __int__(self): return int(norm(self.v))
method __chr__ (line 38) | def __chr__(self): return chr(norm(self.v))
method __add__ (line 40) | def __add__(self, b):
method __sub__ (line 45) | def __sub__(self, b):
method __mul__ (line 52) | def __mul__(self, b):
method __div__ (line 57) | def __div__(self, b):
method __mod__ (line 62) | def __mod__(self, b):
method __neg__ (line 67) | def __neg__(self): return U32(self.v)
method __pos__ (line 68) | def __pos__(self): return U32(self.v)
method __abs__ (line 69) | def __abs__(self): return U32(self.v)
method __invert__ (line 71) | def __invert__(self):
method __lshift__ (line 76) | def __lshift__(self, b):
method __rshift__ (line 81) | def __rshift__(self, b):
method __and__ (line 86) | def __and__(self, b):
method __or__ (line 91) | def __or__(self, b):
method __xor__ (line 96) | def __xor__(self, b):
method __not__ (line 101) | def __not__(self):
method truth (line 104) | def truth(self):
method __cmp__ (line 107) | def __cmp__(self, b):
method __nonzero__ (line 112) | def __nonzero__(self):
FILE: thirdparty_libs/requests_ntlm/ntlm/des.py
class DES (line 20) | class DES:
method __init__ (line 25) | def __init__(self, key_str):
method encrypt (line 35) | def encrypt(self, plain_text):
method decrypt (line 40) | def decrypt(self, crypted_text):
function str_to_key56 (line 51) | def str_to_key56(key_str):
function key56_to_key64 (line 64) | def key56_to_key64(key_56):
function set_key_odd_parity (line 83) | def set_key_odd_parity(key):
FILE: thirdparty_libs/requests_ntlm/ntlm/des_c.py
function c2l (line 23) | def c2l(c):
function c2ln (line 31) | def c2ln(c,l1,l2,n):
function l2c (line 62) | def l2c(l):
function n2l (line 71) | def n2l(c, l):
function l2n (line 79) | def l2n(l, c):
function l2cn (line 88) | def l2cn(l1, l2, c, n):
function D_ENCRYPT (line 123) | def D_ENCRYPT(tup, u, t, s):
function PERM_OP (line 141) | def PERM_OP (tup, n, m):
function HPERM_OP (line 149) | def HPERM_OP (tup, n, m):
class DES (line 158) | class DES:
method __init__ (line 161) | def __init__(self, key_str):
method decrypt (line 169) | def decrypt(self, str):
method encrypt (line 179) | def encrypt(self, str):
function des_encript (line 194) | def des_encript(input, ks, encrypt):
function des_ecb_encrypt (line 251) | def des_ecb_encrypt(input, ks, encrypt):
function des_set_key (line 273) | def des_set_key(key):
FILE: thirdparty_libs/requests_ntlm/ntlm/ntlm.py
function dump_NegotiateFlags (line 110) | def dump_NegotiateFlags(NegotiateFlags):
function create_NTLM_NEGOTIATE_MESSAGE (line 176) | def create_NTLM_NEGOTIATE_MESSAGE(user, type1_flags=NTLM_TYPE1_FLAGS):
function parse_NTLM_CHALLENGE_MESSAGE (line 217) | def parse_NTLM_CHALLENGE_MESSAGE(msg2):
function create_NTLM_AUTHENTICATE_MESSAGE (line 247) | def create_NTLM_AUTHENTICATE_MESSAGE(nonce, user, domain, password, Nego...
function calc_resp (line 336) | def calc_resp(password_hash, server_challenge):
function ComputeResponse (line 359) | def ComputeResponse(ResponseKeyNT, ResponseKeyLM, ServerChallenge, Serve...
function ntlm2sr_calc_resp (line 371) | def ntlm2sr_calc_resp(ResponseKeyNT, ServerChallenge, ClientChallenge='\...
function create_LM_hashed_password_v1 (line 378) | def create_LM_hashed_password_v1(passwd):
function create_NT_hashed_password_v1 (line 402) | def create_NT_hashed_password_v1(passwd, user=None, domain=None):
function create_NT_hashed_password_v2 (line 411) | def create_NT_hashed_password_v2(passwd, user, domain):
function create_sessionbasekey (line 418) | def create_sessionbasekey(password):
function ByteToHex (line 422) | def ByteToHex( byteStr ):
function HexToByte (line 428) | def HexToByte( hexStr ):
FILE: thirdparty_libs/requests_ntlm/requests_ntlm.py
class HttpNtlmAuth (line 6) | class HttpNtlmAuth(AuthBase):
method __init__ (line 9) | def __init__(self, username, password):
method retry_using_http_NTLM_auth (line 25) | def retry_using_http_NTLM_auth(self, auth_header_field, auth_header, r...
method response_hook (line 59) | def response_hook(self,r):
method __call__ (line 70) | def __call__(self,r):
FILE: thirdparty_libs/termcolor/termcolor.py
function colored (line 86) | def colored(text, color=None, on_color=None, attrs=None):
function cprint (line 118) | def cprint(text, color=None, on_color=None, attrs=None, **kwargs):
FILE: thirdparty_libs/texttable.py
function len (line 112) | def len(iterable):
class ArraySizeError (line 123) | class ArraySizeError(Exception):
method __init__ (line 127) | def __init__(self, msg):
method __str__ (line 131) | def __str__(self):
class bcolors (line 134) | class bcolors:
function bcolors_public_props (line 143) | def bcolors_public_props():
function get_color_string (line 146) | def get_color_string(type, string):
class Texttable (line 152) | class Texttable:
method __init__ (line 159) | def __init__(self, max_width=80):
method reset (line 176) | def reset(self):
method set_chars (line 187) | def set_chars(self, array):
method set_deco (line 205) | def set_deco(self, deco):
method set_cols_align (line 224) | def set_cols_align(self, array):
method set_cols_valign (line 237) | def set_cols_valign(self, array):
method set_cols_dtype (line 250) | def set_cols_dtype(self, array):
method set_cols_width (line 267) | def set_cols_width(self, array):
method set_precision (line 285) | def set_precision(self, width):
method header (line 297) | def header(self, array):
method add_row (line 304) | def add_row(self, array):
method add_rows (line 320) | def add_rows(self, rows, header=True):
method draw (line 341) | def draw(self):
method _str (line 368) | def _str(self, i, x):
method _check_row_size (line 402) | def _check_row_size(self, array):
method _has_vlines (line 411) | def _has_vlines(self):
method _has_hlines (line 417) | def _has_hlines(self):
method _has_border (line 423) | def _has_border(self):
method _has_header (line 429) | def _has_header(self):
method _hline_header (line 435) | def _hline_header(self):
method _hline (line 441) | def _hline(self):
method _build_hline (line 449) | def _build_hline(self, is_header=False):
method _len_cell (line 469) | def _len_cell(self, cell):
method _compute_cols_width (line 493) | def _compute_cols_width(self):
method _check_align (line 519) | def _check_align(self):
method _draw_line (line 528) | def _draw_line(self, line, isheader=False):
method _splitit (line 575) | def _splitit(self, line, isheader):
FILE: thirdparty_libs/tldextract/tldextract.py
class pkg_resources (line 39) | class pkg_resources(object):
method resource_stream (line 44) | def resource_stream(cls, package, resource_name):
class ExtractResult (line 67) | class ExtractResult(tuple):
method __new__ (line 72) | def __new__(_cls, subdomain, domain, suffix):
method _make (line 77) | def _make(cls, iterable, new=tuple.__new__, len=len):
method __repr__ (line 84) | def __repr__(self):
method _asdict (line 88) | def _asdict(self):
method _replace (line 94) | def _replace(_self, **kwds):
method __getnewargs__ (line 101) | def __getnewargs__(self):
method tld (line 110) | def tld(self):
method registered_domain (line 115) | def registered_domain(self):
class TLDExtract (line 128) | class TLDExtract(object):
method __init__ (line 129) | def __init__(self, fetch=True, cache_file=''):
method __call__ (line 149) | def __call__(self, url):
method update (line 182) | def update(self, fetch_now=False):
method _get_tld_extractor (line 189) | def _get_tld_extractor(self):
function extract (line 239) | def extract(url):
function update (line 243) | def update(*args, **kwargs):
function _fetch_page (line 246) | def _fetch_page(url):
function _PublicSuffixListSource (line 253) | def _PublicSuffixListSource():
class _PublicSuffixListTLDExtractor (line 260) | class _PublicSuffixListTLDExtractor(object):
method __init__ (line 261) | def __init__(self, tlds):
method extract (line 264) | def extract(self, netloc):
function main (line 283) | def main():
FILE: thirdparty_libs/torndb.py
class Connection (line 49) | class Connection(object):
method __init__ (line 66) | def __init__(self, host, database, user=None, password=None,
method __del__ (line 104) | def __del__(self):
method close (line 107) | def close(self):
method reconnect (line 113) | def reconnect(self):
method iter (line 119) | def iter(self, query, *parameters, **kwparameters):
method query (line 131) | def query(self, query, *parameters, **kwparameters):
method get (line 141) | def get(self, query, *parameters, **kwparameters):
method execute (line 156) | def execute(self, query, *parameters, **kwparameters):
method execute_lastrowid (line 160) | def execute_lastrowid(self, query, *parameters, **kwparameters):
method execute_rowcount (line 169) | def execute_rowcount(self, query, *parameters, **kwparameters):
method executemany (line 178) | def executemany(self, query, parameters):
method executemany_lastrowid (line 184) | def executemany_lastrowid(self, query, parameters):
method executemany_rowcount (line 195) | def executemany_rowcount(self, query, parameters):
method _ensure_connected (line 212) | def _ensure_connected(self):
method _cursor (line 223) | def _cursor(self):
method _execute (line 227) | def _execute(self, cursor, query, parameters, kwparameters):
method insert_by_dict (line 235) | def insert_by_dict(self, tablename, rowdict, replace=False):
class Row (line 264) | class Row(dict):
method __getattr__ (line 266) | def __getattr__(self, name):
FILE: thirdparty_libs/wvs_spider/run.py
function start_wvs_spider_dispatch (line 32) | def start_wvs_spider_dispatch(target, audit_name, cookie, Logger):
function test_start_wvs_spider_dispatch (line 44) | def test_start_wvs_spider_dispatch(keys):
function get_save_crawl_folder_name (line 47) | def get_save_crawl_folder_name(domain):
function get_crawl_domain (line 56) | def get_crawl_domain(url):
function wait_parse_result_by_redis (line 62) | def wait_parse_result_by_redis(keys):
function wait_parse_result (line 75) | def wait_parse_result(keys):
FILE: thirdparty_libs/wvs_spider/wvs_console.py
class WVSSpider (line 13) | class WVSSpider(threading.Thread):
method __init__ (line 15) | def __init__(self, url, keys, cookie = 'None'):
method _set_crawl_setting_template (line 21) | def _set_crawl_setting_template(self):
method _get_wvs_console_path (line 42) | def _get_wvs_console_path(self):
method get_run_cmd (line 45) | def get_run_cmd(self):
method run (line 57) | def run(self):
function main (line 66) | def main():
FILE: thirdparty_libs/wvs_spider/wvs_run.py
function do_wvs_crawl (line 12) | def do_wvs_crawl(target, keys, cookie):
function main (line 21) | def main():
FILE: thirdparty_libs/wvs_spider/wvs_tasks.py
function wvs_spider_dispatch (line 16) | def wvs_spider_dispatch(url, keys, cookie):
FILE: thirdparty_libs/wvs_spider/xml2mysql.py
class MySQLBase (line 27) | class MySQLBase(object):
method __init__ (line 39) | def __init__(self, dbconfig):
method query (line 56) | def query(self,sql):
method update (line 67) | def update(self,sql):
method insert (line 79) | def insert(self,sql):
method fetchAllRows (line 92) | def fetchAllRows(self):
method fetchOneRow (line 96) | def fetchOneRow(self):
method getRowCount (line 100) | def getRowCount(self):
method commit (line 104) | def commit(self):
method rollback (line 108) | def rollback(self):
method __del__ (line 112) | def __del__(self):
method close (line 120) | def close(self):
class CrawlDB (line 125) | class CrawlDB(MySQLBase):
method __init__ (line 127) | def __init__(self):
class CrawlFileMonitor (line 131) | class CrawlFileMonitor(FileSystemEventHandler):
method __init__ (line 133) | def __init__(self):
method on_created (line 137) | def on_created(self, event):
class CrawlXML (line 154) | class CrawlXML(object):
method __init__ (line 159) | def __init__(self, filepath = CRAWL_FILENAME):
method xml_unescape (line 169) | def xml_unescape(self, content):
method __get_node_text (line 173) | def __get_node_text(self, node):
method __get_node_tag (line 181) | def __get_node_tag(self, node):
method __get_domain (line 189) | def __get_domain(self):
method _parse_domain (line 195) | def _parse_domain(self):
method __get_sitefile_object (line 203) | def __get_sitefile_object(self):
method xml2mysql (line 231) | def xml2mysql(self):
function monitor (line 275) | def monitor(path):
function main (line 288) | def main():
FILE: webservice/lalascan_web/app/__init__.py
function create_app (line 12) | def create_app(object_name):
FILE: webservice/lalascan_web/app/extensions/flask_paginate.py
function get_page_args (line 94) | def get_page_args():
class Pagination (line 109) | class Pagination(object):
method __init__ (line 112) | def __init__(self, found=0, **kwargs):
method page_href (line 217) | def page_href(self, page):
method init_values (line 230) | def init_values(self):
method prev_page (line 249) | def prev_page(self):
method next_page (line 258) | def next_page(self):
method first_page (line 266) | def first_page(self):
method last_page (line 274) | def last_page(self):
method pages (line 282) | def pages(self):
method single_page (line 318) | def single_page(self, page):
method _get_single_page_link (line 330) | def _get_single_page_link(self):
method links (line 343) | def links(self):
method info (line 365) | def info(self):
FILE: webservice/lalascan_web/app/forms.py
class LeakInfoForm (line 12) | class LeakInfoForm(Form):
FILE: webservice/lalascan_web/app/models/leakinfo.py
class SLeakInfo (line 8) | class SLeakInfo(db.Model):
method to_dict (line 21) | def to_dict(self, **kwargs):
class SPluginType (line 34) | class SPluginType(db.Model):
method get_plugin_name (line 42) | def get_plugin_name(self):
FILE: webservice/lalascan_web/app/models/policy.py
class SLeakPolicy (line 11) | class SLeakPolicy(db.Model):
method to_dict (line 24) | def to_dict(self):
FILE: webservice/lalascan_web/app/models/scanner.py
class STarget (line 8) | class STarget(db.Model):
method to_dict (line 20) | def to_dict(self):
class SVulDetail (line 31) | class SVulDetail(db.Model):
class Scanner (line 51) | class Scanner(object):
method __init__ (line 53) | def __init__(self, **kwargs):
method add_risk_cnt (line 67) | def add_risk_cnt(self, risk_level):
FILE: webservice/lalascan_web/app/services.py
class PolicyService (line 14) | class PolicyService(object):
method get_policy (line 17) | def get_policy():
method get_policy_cnt (line 22) | def get_policy_cnt():
method get_policy_by_leakinfo (line 26) | def get_policy_by_leakinfo(offset, per_page):
method get_leakinfo (line 30) | def get_leakinfo(offset, per_page):
method get_leakinfo_cnt (line 35) | def get_leakinfo_cnt():
method get_plugin_type (line 39) | def get_plugin_type():
method add_leakinfo (line 45) | def add_leakinfo(**kwargs):
method del_leakinfo (line 58) | def del_leakinfo(leak_id):
class VulDetailInfo (line 65) | class VulDetailInfo(object):
method get_scan_task (line 68) | def get_scan_task():
FILE: webservice/lalascan_web/app/static/js/pages/base_comp_charts.js
function getRandomData (line 354) | function getRandomData() { // Random data generator
function updateChartLive (line 379) | function updateChartLive() { // Update live chart
FILE: webservice/lalascan_web/app/util.py
class RETCODE (line 7) | class RETCODE:
FILE: webservice/lalascan_web/app/views/login.py
function index (line 12) | def index():
function login (line 16) | def login():
FILE: webservice/lalascan_web/app/views/webscan.py
function index (line 20) | def index():
function show_vuldetail (line 28) | def show_vuldetail(page):
function add_task (line 95) | def add_task():
function show_leakinfo (line 102) | def show_leakinfo(page):
function add_leakinfo (line 122) | def add_leakinfo():
function leak_add (line 127) | def leak_add():
function delete_leakinfo (line 148) | def delete_leakinfo():
function show_policys (line 159) | def show_policys(page):
function get_css_framework (line 178) | def get_css_framework():
function get_link_size (line 181) | def get_link_size():
function show_single_page_or_not (line 184) | def show_single_page_or_not():
function get_pagination (line 187) | def get_pagination(**kwargs):
Condensed preview — 258 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,711K chars).
[
{
"path": ".gitignore",
"chars": 642,
"preview": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\n"
},
{
"path": "README.md",
"chars": 1465,
"preview": "\r\nWhat's lalascan?\r\n=================================== \r\n"
},
{
"path": "bin/__init__.py",
"chars": 69,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n"
},
{
"path": "cache/__init__.py",
"chars": 69,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n"
},
{
"path": "cache/leakinfo.json",
"chars": 2452,
"preview": "{\"sqli\":\n {\"risk_level\": 4,\n \"description\": \"\\u6076\\u610f\\u7528\\u6237\\u53ef\\u4ee5\\u5229\\u7528\\u8be5\\u6f0f\\u6d"
},
{
"path": "conf.py",
"chars": 735,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nimport os\nimport sys\n\nimport sys\n\n\ndirname_path_fu"
},
{
"path": "lalascan/__init__.py",
"chars": 69,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n"
},
{
"path": "lalascan/api/__init__.py",
"chars": 69,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n"
},
{
"path": "lalascan/api/exception.py",
"chars": 1333,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nException Base class\n\"\"\"\n\n__all__ = [\"LalascanBaseException\",\n "
},
{
"path": "lalascan/api/option.py",
"chars": 1681,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom lalascan.models.auditdb import AuditMysqlDB\nf"
},
{
"path": "lalascan/api/proxycrawl.py",
"chars": 70,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n"
},
{
"path": "lalascan/cache/__init__.py",
"chars": 69,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n"
},
{
"path": "lalascan/data/__init__.py",
"chars": 1075,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n__all__ = [\n\n # Base class for all data objects"
},
{
"path": "lalascan/data/datatype.py",
"chars": 2150,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nimport copy\nimport types\n\nfrom lalascan.api.except"
},
{
"path": "lalascan/data/enum.py",
"chars": 258,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nclass CUSTOM_LOGGING:\n SYSINFO = 9\n SUCCESS "
},
{
"path": "lalascan/data/http.py",
"chars": 33392,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nHTTP requests and responses.\n\"\"\"\n\n__all__ = [\"HTTP_Request\", \"HTTP_Re"
},
{
"path": "lalascan/data/information/__init__.py",
"chars": 2309,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nInformation types.\n\"\"\"\n\n__license__ = \"\"\"\nGoLismero 2.0 - The web kni"
},
{
"path": "lalascan/data/information/banner.py",
"chars": 3469,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nService banner.\n\"\"\"\n\n\n__all__ = [\"Banner\"]\n\nfrom . import Fingerprint"
},
{
"path": "lalascan/data/information/html.py",
"chars": 4161,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nHTML document.\n\"\"\"\n\n__all__ = [\"HTML\"]\n\nfrom lalascan.data.informatio"
},
{
"path": "lalascan/data/information/portscan.py",
"chars": 3133,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nPortscan results.\n\"\"\"\n\n__all__ = [\"Portscan\"]\n\nfrom . import Fingerpr"
},
{
"path": "lalascan/data/information/webservice.py",
"chars": 6921,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n\nfrom . import Fingerprint\nfrom ...utils.text_util"
},
{
"path": "lalascan/data/resource/__init__.py",
"chars": 341,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nResource types.\n\"\"\"\n\n__all__ = [\"Resource\"]\n\nfrom .. import Data\n\n\n#-"
},
{
"path": "lalascan/data/resource/domain.py",
"chars": 4878,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nDomain name.\n\"\"\"\n\n__all__ = [\"Domain\", \"RootDomain\"]\n\nfrom . import R"
},
{
"path": "lalascan/data/resource/ip.py",
"chars": 2207,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nIP address.\n\"\"\"\n\n__all__ = [\"IP\"]\n\nfrom . import Resource\nfrom ...uti"
},
{
"path": "lalascan/data/resource/url.py",
"chars": 17413,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nUniversal Resource Locator (URL).\n\"\"\"\n\n__all__ = [\"BaseURL\", \"FolderU"
},
{
"path": "lalascan/data/vuln/__init__.py",
"chars": 71,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n__author__ = 'BlackYe.'\n"
},
{
"path": "lalascan/data/vuln/vulnerability.py",
"chars": 7001,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nVulnerability types.\n\"\"\"\n\n__author__ = 'BlackYe.'\n\n__all__ = [\n \"V"
},
{
"path": "lalascan/launcher.py",
"chars": 2991,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom lalascan.libs.core.pluginmanager import Plugi"
},
{
"path": "lalascan/libs/__init__.py",
"chars": 69,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n"
},
{
"path": "lalascan/libs/core/__init__.py",
"chars": 69,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n"
},
{
"path": "lalascan/libs/core/common.py",
"chars": 5046,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nimport os\n\n\nfrom lalascan.api.exception import Lal"
},
{
"path": "lalascan/libs/core/globaldata.py",
"chars": 941,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n'''\nglobal var data\n'''\n\nfrom lalascan.libs.core.l"
},
{
"path": "lalascan/libs/core/logger.py",
"chars": 2320,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimp"
},
{
"path": "lalascan/libs/core/plugin.py",
"chars": 1843,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom lalascan.api.exception import LalascanNotImpl"
},
{
"path": "lalascan/libs/core/pluginmanager.py",
"chars": 6104,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n\nfrom lalascan.libs.core.globaldata import conf, L"
},
{
"path": "lalascan/libs/core/pluginregister.py",
"chars": 300,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom .globaldata import register_plugins\n\ndef reg_"
},
{
"path": "lalascan/libs/core/report.py",
"chars": 12106,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom ...libs.core.globaldata import conf, vulresul"
},
{
"path": "lalascan/libs/core/scope.py",
"chars": 6508,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n__all__ = [\"AuditScope\"]\n\nfrom lalascan.libs.net.w"
},
{
"path": "lalascan/libs/core/settings.py",
"chars": 1085,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n\n\nBANNER = '''\n _ _\n| | __ _| | __ _ _"
},
{
"path": "lalascan/libs/core/singletonclass.py",
"chars": 779,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n\"\"\"\n 单例模式基类\n\"\"\"\n\n__author__ = 'BlackYe.'\n\n\nclass Singleton (object):\n \"\""
},
{
"path": "lalascan/libs/core/spider.py",
"chars": 2242,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom lalascan.libs.core.plugin import PluginBase\nf"
},
{
"path": "lalascan/libs/core/threads.py",
"chars": 2022,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom lalascan.libs.core.plugin import PluginBase\nf"
},
{
"path": "lalascan/libs/net/__init__.py",
"chars": 77,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nNetwork protocols API.\n\"\"\""
},
{
"path": "lalascan/libs/net/dns.py",
"chars": 35704,
"preview": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# Required since \"dns\" is both an external module and the name of this file.\n"
},
{
"path": "lalascan/libs/net/http.py",
"chars": 15795,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nHTTP protocol API for GoLismero.\n\"\"\"\n\n__all__ = [\"HTTP\"]\n\nfrom lalasc"
},
{
"path": "lalascan/libs/net/scraper.py",
"chars": 12103,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nURL scraping API.\n\nThis module contains utility functions to extract "
},
{
"path": "lalascan/libs/net/web_mutants.py",
"chars": 4159,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n\"\"\"\nWeb muntants API.\n\nPackage payload to URL request, and Get Response inf"
},
{
"path": "lalascan/libs/net/web_utils.py",
"chars": 56927,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nWeb utilities API.\n\"\"\"\n\n__all__ = [\n \"download\", \"data_from_http_r"
},
{
"path": "lalascan/models/__init__.py",
"chars": 756,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom lalascan.libs.core.singletonclass import Sing"
},
{
"path": "lalascan/models/auditdb.py",
"chars": 1524,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom lalascan.api.exception import LalascanNotImpl"
},
{
"path": "lalascan/models/scan_task.py",
"chars": 606,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom . import BaseModel\n\nfrom sqlalchemy import Co"
},
{
"path": "lalascan/models/scan_vuldetail.py",
"chars": 974,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom . import BaseModel\n\nfrom sqlalchemy import Co"
},
{
"path": "lalascan/utils/__init__.py",
"chars": 138,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nimport base64\n\ndef _str2bs64(str):\n return base"
},
{
"path": "lalascan/utils/console_utils.py",
"chars": 6490,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom thirdparty_libs.colorizer import colored\n\n# C"
},
{
"path": "lalascan/utils/mymath.py",
"chars": 1278,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n'''\nMath Common Class\n'''\n\nfrom lalascan.api.excep"
},
{
"path": "lalascan/utils/mytime.py",
"chars": 1707,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n\"\"\"\n封装常用的时间函数\n\"\"\"\n\n__author__ = 'BlackYe.'\n\nfrom lalascan.api.exception imp"
},
{
"path": "lalascan/utils/text_utils.py",
"chars": 6571,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nText manipulation utilities.\n\"\"\"\n\n__all__ = [\n \"char_count\", \"line"
},
{
"path": "lalascan.py",
"chars": 5037,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom thirdparty_libs.argparse import argparse\nfrom"
},
{
"path": "requirement.txt",
"chars": 143,
"preview": "futures\nargparse\nbeautifulsoup4\nnetaddr\npython-nmap\ndnspython\nrequests\nparamiko\npymongo\neasywebdav\npyquery\nPyYAML\nre2\nce"
},
{
"path": "tests/__init__.py",
"chars": 69,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n"
},
{
"path": "tests/unittest/__init__.py",
"chars": 69,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n"
},
{
"path": "tests/unittest/console_output.py",
"chars": 464,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n\nimport sys\nsys.path.append(\"/root/python/lalascan"
},
{
"path": "tests/unittest/db_test.py",
"chars": 482,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nimport sys\nsys.path.append(\"/root/python/lalascan-"
},
{
"path": "tests/unittest/ip_resource.py",
"chars": 253,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n\nimport os, sys\n\nsys.path.append(\"/root/python/lal"
},
{
"path": "tests/unittest/scope_test.py",
"chars": 348,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nimport sys\nsys.path.append(\"/root/python/lalascan-"
},
{
"path": "tests/unittest/t_attribdict.py",
"chars": 2543,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nCopyright (c) 2014-2016 pocsuite developers (https://seebug.org)\nSee "
},
{
"path": "tests/unittest/t_pluginmanager.py",
"chars": 2719,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n\nimport sys\nsys.path.append(\"/root/python/lalascan"
},
{
"path": "tests/unittest/test_func.py",
"chars": 194,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n\n\ndef f():\n\n s = ['']\n def g():\n s[0]"
},
{
"path": "tests/unittest/thread_test.py",
"chars": 2238,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nimport multiprocessing\nimport multiprocessing.pool"
},
{
"path": "thirdparty_libs/__init__.py",
"chars": 69,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n"
},
{
"path": "thirdparty_libs/ansistrm/__init__.py",
"chars": 170,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nCopyright (c) 2014-2015 pocsuite developers (http://seebug.org)\nSee t"
},
{
"path": "thirdparty_libs/ansistrm/ansistrm.py",
"chars": 4817,
"preview": "#\n# Copyright (C) 2010-2012 Vinay Sajip. All rights reserved. Licensed under the new BSD license.\n#\nimport logging\nimpor"
},
{
"path": "thirdparty_libs/argparse/__init__.py",
"chars": 46,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n"
},
{
"path": "thirdparty_libs/argparse/argparse.py",
"chars": 89214,
"preview": "# Author: Steven J. Bethard <steven.bethard@gmail.com>.\n# Maintainer: Thomas Waldmann <tw@waldmann-edv.de>\n\n\"\"\"Command-l"
},
{
"path": "thirdparty_libs/bind_sql_inject/__init__.py",
"chars": 69,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n"
},
{
"path": "thirdparty_libs/bind_sql_inject/diff.py",
"chars": 1111,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nimport difflib\n\n\ndef diff(a, b):\n \"\"\"\n :para"
},
{
"path": "thirdparty_libs/bind_sql_inject/fuzzy_string_cmp.py",
"chars": 5044,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nimport difflib\nimport pprint\n\nfrom upper_bounds im"
},
{
"path": "thirdparty_libs/bind_sql_inject/upper_bounds.py",
"chars": 29390,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nUPPER_BOUNDS = [(1.0, 1.0),\n (1.025"
},
{
"path": "thirdparty_libs/colorizer/__init__.py",
"chars": 169,
"preview": "from .initialise import init, deinit, reinit\nfrom .ansi import Fore, Back, Style\nfrom .ansitowin32 import AnsiToWin32\nfr"
},
{
"path": "thirdparty_libs/colorizer/ansi.py",
"chars": 1013,
"preview": "'''\r\nThis module generates ANSI character codes to printing colors to terminals.\r\nSee: http://en.wikipedia.org/wiki/ANSI"
},
{
"path": "thirdparty_libs/colorizer/ansitowin32.py",
"chars": 6736,
"preview": "\r\nimport re\r\nimport sys\r\n\r\nfrom .ansi import AnsiFore, AnsiBack, AnsiStyle, Style\r\nfrom .winterm import WinTerm, WinColo"
},
{
"path": "thirdparty_libs/colorizer/initialise.py",
"chars": 1277,
"preview": "import atexit\r\nimport sys\r\n\r\nfrom .ansitowin32 import AnsiToWin32\r\n\r\n\r\norig_stdout = sys.stdout\r\norig_stderr = sys.stder"
},
{
"path": "thirdparty_libs/colorizer/termcolor.py",
"chars": 5044,
"preview": "# coding: utf-8\n# Copyright (c) 2008-2011 Volvox Development Team\n#\n# Permission is hereby granted, free of charge, to a"
},
{
"path": "thirdparty_libs/colorizer/win32.py",
"chars": 3779,
"preview": "\r\n# from winbase.h\r\nSTDOUT = -11\r\nSTDERR = -12\r\n\r\ntry:\r\n from ctypes import windll\r\nexcept ImportError:\r\n windll ="
},
{
"path": "thirdparty_libs/colorizer/winterm.py",
"chars": 4252,
"preview": "\r\nfrom . import win32\r\n\r\n\r\n# from wincon.h\r\nclass WinColor(object):\r\n BLACK = 0\r\n BLUE = 1\r\n GREEN = 2\r\n"
},
{
"path": "thirdparty_libs/oset/LICENSE.txt",
"chars": 1472,
"preview": "License\n=======\n\nCopyright (c) 2009, Raymond Hettinger, and others\nAll rights reserved.\n\nPackage structured based on the"
},
{
"path": "thirdparty_libs/oset/__init__.py",
"chars": 56,
"preview": "\"\"\"Main Ordered Set module \"\"\"\n\nfrom pyoset import oset\n"
},
{
"path": "thirdparty_libs/oset/_abc.py",
"chars": 14740,
"preview": "#!/usr/bin/env python\n# -*- mode:python; tab-width: 2; coding: utf-8 -*-\n\n\"\"\"Partially backported python ABC classes\"\"\"\n"
},
{
"path": "thirdparty_libs/oset/pyoset.py",
"chars": 2192,
"preview": "#!/usr/bin/env python\n# -*- mode:python; tab-width: 2; coding: utf-8 -*-\n\n\"\"\"Partially backported python ABC classes\"\"\"\n"
},
{
"path": "thirdparty_libs/prettytable/CHANGELOG",
"chars": 6992,
"preview": "########## PrettyTable 0.7 - Feb 17, 2013 ###########\n\n* Improved Python 2 and 3 compatibility (2.4-3.2).\n* Improved sup"
},
{
"path": "thirdparty_libs/prettytable/COPYING",
"chars": 1613,
"preview": "# Copyright (c) 2009-2013 Luke Maurits <luke@maurits.id.au>\n# All rights reserved.\n# With contributions from:\n# * Chris"
},
{
"path": "thirdparty_libs/prettytable/MANIFEST.in",
"chars": 77,
"preview": "include COPYING\ninclude CHANGELOG\ninclude README\ninclude prettytable_test.py\n"
},
{
"path": "thirdparty_libs/prettytable/PKG-INFO",
"chars": 710,
"preview": "Metadata-Version: 1.0\nName: prettytable\nVersion: 0.7.2\nSummary: A simple Python library for easily displaying tabular da"
},
{
"path": "thirdparty_libs/prettytable/README",
"chars": 17853,
"preview": "TUTORIAL ON HOW TO USE THE PRETTYTABLE 0.6+ API\n\n*** This tutorial is distributed with PrettyTable and is meant to serve"
},
{
"path": "thirdparty_libs/prettytable/__init__.py",
"chars": 170,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nCopyright (c) 2014-2015 pocsuite developers (http://seebug.org)\nSee t"
},
{
"path": "thirdparty_libs/prettytable/prettytable.py",
"chars": 54204,
"preview": "#!/usr/bin/env python\n#\n# Copyright (c) 2009-2013, Luke Maurits <luke@maurits.id.au>\n# All rights reserved.\n# With contr"
},
{
"path": "thirdparty_libs/requests/__init__.py",
"chars": 1863,
"preview": "# -*- coding: utf-8 -*-\n\n# __\n# /__) _ _ _ _ _/ _\n# / ( (- (/ (/ (- _) / _)\n# /\n\n\"\"\"\nrequests "
},
{
"path": "thirdparty_libs/requests/adapters.py",
"chars": 12304,
"preview": "# -*- coding: utf-8 -*-\n\n\"\"\"\nrequests.adapters\n~~~~~~~~~~~~~~~~~\n\nThis module contains the transport adapters that Reque"
},
{
"path": "thirdparty_libs/requests/api.py",
"chars": 4333,
"preview": "# -*- coding: utf-8 -*-\n\n\"\"\"\nrequests.api\n~~~~~~~~~~~~\n\nThis module implements the Requests API.\n\n:copyright: (c) 2012 b"
},
{
"path": "thirdparty_libs/requests/auth.py",
"chars": 5531,
"preview": "# -*- coding: utf-8 -*-\n\n\"\"\"\nrequests.auth\n~~~~~~~~~~~~~\n\nThis module contains the authentication handlers for Requests."
},
{
"path": "thirdparty_libs/requests/cacert.pem",
"chars": 211054,
"preview": "##\n## ca-bundle.crt -- Bundle of CA Root Certificates\n##\n## Certificate data from Mozilla as of: Wed Jan 18 00:04:16 201"
},
{
"path": "thirdparty_libs/requests/certs.py",
"chars": 544,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ncerts.py\n~~~~~~~~\n\nThis module returns the preferred default CA certi"
},
{
"path": "thirdparty_libs/requests/compat.py",
"chars": 2567,
"preview": "# -*- coding: utf-8 -*-\n\n\"\"\"\npythoncompat\n\"\"\"\n\nfrom .packages import charade as chardet\n\nimport sys\n\n# -------\n# Pythons"
},
{
"path": "thirdparty_libs/requests/cookies.py",
"chars": 14678,
"preview": "# -*- coding: utf-8 -*-\n\n\"\"\"\nCompatibility code to be able to use `cookielib.CookieJar` with requests.\n\nrequests.utils i"
},
{
"path": "thirdparty_libs/requests/exceptions.py",
"chars": 1368,
"preview": "# -*- coding: utf-8 -*-\n\n\"\"\"\nrequests.exceptions\n~~~~~~~~~~~~~~~~~~~\n\nThis module contains the set of Requests' exceptio"
},
{
"path": "thirdparty_libs/requests/hooks.py",
"chars": 820,
"preview": "# -*- coding: utf-8 -*-\n\n\"\"\"\nrequests.hooks\n~~~~~~~~~~~~~~\n\nThis module provides the capabilities for the Requests hooks"
},
{
"path": "thirdparty_libs/requests/models.py",
"chars": 23120,
"preview": "# -*- coding: utf-8 -*-\n\n\"\"\"\nrequests.models\n~~~~~~~~~~~~~~~\n\nThis module contains the primary objects that power Reques"
},
{
"path": "thirdparty_libs/requests/packages/__init__.py",
"chars": 62,
"preview": "from __future__ import absolute_import\n\nfrom . import urllib3\n"
},
{
"path": "thirdparty_libs/requests/packages/charade/__init__.py",
"chars": 1327,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# This library is free software; you can redistri"
},
{
"path": "thirdparty_libs/requests/packages/charade/big5freq.py",
"chars": 82594,
"preview": "######################## BEGIN LICENSE BLOCK ########################\n# The Original Code is Mozilla Communicator client"
},
{
"path": "thirdparty_libs/requests/packages/charade/big5prober.py",
"chars": 1726,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Communicator clien"
},
{
"path": "thirdparty_libs/requests/packages/charade/chardistribution.py",
"chars": 9457,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Communicator clien"
},
{
"path": "thirdparty_libs/requests/packages/charade/charsetgroupprober.py",
"chars": 3897,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Communicator clien"
},
{
"path": "thirdparty_libs/requests/packages/charade/charsetprober.py",
"chars": 1902,
"preview": "######################## BEGIN LICENSE BLOCK ########################\n# The Original Code is Mozilla Universal charset d"
},
{
"path": "thirdparty_libs/requests/packages/charade/codingstatemachine.py",
"chars": 2379,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is mozilla.org code.\r\n#\r\n# Th"
},
{
"path": "thirdparty_libs/requests/packages/charade/compat.py",
"chars": 1157,
"preview": "######################## BEGIN LICENSE BLOCK ########################\n# Contributor(s):\n# Ian Cordasco - port to Pytho"
},
{
"path": "thirdparty_libs/requests/packages/charade/constants.py",
"chars": 1374,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Universal charset "
},
{
"path": "thirdparty_libs/requests/packages/charade/cp949prober.py",
"chars": 1826,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is mozilla.org code.\r\n#\r\n# Th"
},
{
"path": "thirdparty_libs/requests/packages/charade/escprober.py",
"chars": 3273,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is mozilla.org code.\r\n#\r\n# Th"
},
{
"path": "thirdparty_libs/requests/packages/charade/escsm.py",
"chars": 8081,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is mozilla.org code.\r\n#\r\n# Th"
},
{
"path": "thirdparty_libs/requests/packages/charade/eucjpprober.py",
"chars": 3768,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is mozilla.org code.\r\n#\r\n# Th"
},
{
"path": "thirdparty_libs/requests/packages/charade/euckrfreq.py",
"chars": 45978,
"preview": "######################## BEGIN LICENSE BLOCK ########################\n# The Original Code is Mozilla Communicator client"
},
{
"path": "thirdparty_libs/requests/packages/charade/euckrprober.py",
"chars": 1717,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is mozilla.org code.\r\n#\r\n# Th"
},
{
"path": "thirdparty_libs/requests/packages/charade/euctwfreq.py",
"chars": 34872,
"preview": "######################## BEGIN LICENSE BLOCK ########################\n# The Original Code is Mozilla Communicator client"
},
{
"path": "thirdparty_libs/requests/packages/charade/euctwprober.py",
"chars": 1717,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is mozilla.org code.\r\n#\r\n# Th"
},
{
"path": "thirdparty_libs/requests/packages/charade/gb2312freq.py",
"chars": 36011,
"preview": "######################## BEGIN LICENSE BLOCK ########################\n# The Original Code is Mozilla Communicator client"
},
{
"path": "thirdparty_libs/requests/packages/charade/gb2312prober.py",
"chars": 1722,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is mozilla.org code.\r\n#\r\n# Th"
},
{
"path": "thirdparty_libs/requests/packages/charade/hebrewprober.py",
"chars": 13642,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Universal charset "
},
{
"path": "thirdparty_libs/requests/packages/charade/jisfreq.py",
"chars": 47315,
"preview": "######################## BEGIN LICENSE BLOCK ########################\n# The Original Code is Mozilla Communicator client"
},
{
"path": "thirdparty_libs/requests/packages/charade/jpcntx.py",
"chars": 19323,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Communicator clien"
},
{
"path": "thirdparty_libs/requests/packages/charade/langbulgarianmodel.py",
"chars": 13013,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Communicator clien"
},
{
"path": "thirdparty_libs/requests/packages/charade/langcyrillicmodel.py",
"chars": 18054,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Communicator clien"
},
{
"path": "thirdparty_libs/requests/packages/charade/langgreekmodel.py",
"chars": 12853,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Communicator clien"
},
{
"path": "thirdparty_libs/requests/packages/charade/langhebrewmodel.py",
"chars": 11519,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Universal charset "
},
{
"path": "thirdparty_libs/requests/packages/charade/langhungarianmodel.py",
"chars": 12761,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Communicator clien"
},
{
"path": "thirdparty_libs/requests/packages/charade/langthaimodel.py",
"chars": 11475,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Communicator clien"
},
{
"path": "thirdparty_libs/requests/packages/charade/latin1prober.py",
"chars": 5380,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Universal charset "
},
{
"path": "thirdparty_libs/requests/packages/charade/mbcharsetprober.py",
"chars": 3354,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Universal charset "
},
{
"path": "thirdparty_libs/requests/packages/charade/mbcsgroupprober.py",
"chars": 2021,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Universal charset "
},
{
"path": "thirdparty_libs/requests/packages/charade/mbcssm.py",
"chars": 20183,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is mozilla.org code.\r\n#\r\n# Th"
},
{
"path": "thirdparty_libs/requests/packages/charade/sbcharsetprober.py",
"chars": 4913,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Universal charset "
},
{
"path": "thirdparty_libs/requests/packages/charade/sbcsgroupprober.py",
"chars": 3360,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Universal charset "
},
{
"path": "thirdparty_libs/requests/packages/charade/sjisprober.py",
"chars": 3825,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is mozilla.org code.\r\n#\r\n# Th"
},
{
"path": "thirdparty_libs/requests/packages/charade/universaldetector.py",
"chars": 7030,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is Mozilla Universal charset "
},
{
"path": "thirdparty_libs/requests/packages/charade/utf8prober.py",
"chars": 2728,
"preview": "######################## BEGIN LICENSE BLOCK ########################\r\n# The Original Code is mozilla.org code.\r\n#\r\n# Th"
},
{
"path": "thirdparty_libs/requests/packages/urllib3/__init__.py",
"chars": 1692,
"preview": "# urllib3/__init__.py\n# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)\n#\n# This module is par"
},
{
"path": "thirdparty_libs/requests/packages/urllib3/_collections.py",
"chars": 2898,
"preview": "# urllib3/_collections.py\n# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)\n#\n# This module is"
},
{
"path": "thirdparty_libs/requests/packages/urllib3/connectionpool.py",
"chars": 21557,
"preview": "# urllib3/connectionpool.py\n# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)\n#\n# This module "
},
{
"path": "thirdparty_libs/requests/packages/urllib3/exceptions.py",
"chars": 2557,
"preview": "# urllib3/exceptions.py\n# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)\n#\n# This module is p"
},
{
"path": "thirdparty_libs/requests/packages/urllib3/filepost.py",
"chars": 3049,
"preview": "# urllib3/filepost.py\n# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)\n#\n# This module is par"
},
{
"path": "thirdparty_libs/requests/packages/urllib3/packages/__init__.py",
"chars": 74,
"preview": "from __future__ import absolute_import\n\nfrom . import ssl_match_hostname\n\n"
},
{
"path": "thirdparty_libs/requests/packages/urllib3/packages/ordered_dict.py",
"chars": 8936,
"preview": "# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.\n# Passes Python2.7's test suite and i"
},
{
"path": "thirdparty_libs/requests/packages/urllib3/packages/six.py",
"chars": 11628,
"preview": "\"\"\"Utilities for writing code that runs on Python 2 and 3\"\"\"\n\n#Copyright (c) 2010-2011 Benjamin Peterson\n\n#Permission is"
},
{
"path": "thirdparty_libs/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py",
"chars": 2174,
"preview": "\"\"\"The match_hostname() function from Python 3.2, essential when using SSL.\"\"\"\n\nimport re\n\n__version__ = '3.2.2'\n\nclass "
},
{
"path": "thirdparty_libs/requests/packages/urllib3/poolmanager.py",
"chars": 6760,
"preview": "# urllib3/poolmanager.py\n# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)\n#\n# This module is "
},
{
"path": "thirdparty_libs/requests/packages/urllib3/request.py",
"chars": 5874,
"preview": "# urllib3/request.py\n# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)\n#\n# This module is part"
},
{
"path": "thirdparty_libs/requests/packages/urllib3/response.py",
"chars": 10098,
"preview": "# urllib3/response.py\n# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)\n#\n# This module is par"
},
{
"path": "thirdparty_libs/requests/packages/urllib3/util.py",
"chars": 11532,
"preview": "# urllib3/util.py\n# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)\n#\n# This module is part of"
},
{
"path": "thirdparty_libs/requests/sessions.py",
"chars": 18434,
"preview": "# -*- coding: utf-8 -*-\n\n\"\"\"\nrequests.session\n~~~~~~~~~~~~~~~~\n\nThis module provides a Session object to manage and pers"
},
{
"path": "thirdparty_libs/requests/status_codes.py",
"chars": 3132,
"preview": "# -*- coding: utf-8 -*-\n\nfrom .structures import LookupDict\n\n_codes = {\n\n # Informational.\n 100: ('continue',),\n "
},
{
"path": "thirdparty_libs/requests/structures.py",
"chars": 3575,
"preview": "# -*- coding: utf-8 -*-\n\n\"\"\"\nrequests.structures\n~~~~~~~~~~~~~~~~~~~\n\nData structures that power Requests.\n\n\"\"\"\n\nimport "
},
{
"path": "thirdparty_libs/requests/utils.py",
"chars": 16388,
"preview": "# -*- coding: utf-8 -*-\n\n\"\"\"\nrequests.utils\n~~~~~~~~~~~~~~\n\nThis module provides utility functions that are used within "
},
{
"path": "thirdparty_libs/requests_ntlm/__init__.py",
"chars": 64,
"preview": "from requests_ntlm import HttpNtlmAuth\n\n__all__ = [HttpNtlmAuth]"
},
{
"path": "thirdparty_libs/requests_ntlm/ntlm/HTTPNtlmAuthHandler.py",
"chars": 7217,
"preview": "# This library is free software: you can redistribute it and/or\r\n# modify it under the terms of the GNU Lesser General P"
},
{
"path": "thirdparty_libs/requests_ntlm/ntlm/U32.py",
"chars": 3043,
"preview": "# This file is part of 'NTLM Authorization Proxy Server' http://sourceforge.net/projects/ntlmaps/\r\n# Copyright 2001 Dmit"
},
{
"path": "thirdparty_libs/requests_ntlm/ntlm/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "thirdparty_libs/requests_ntlm/ntlm/des.py",
"chars": 3217,
"preview": "# This file is part of 'NTLM Authorization Proxy Server' http://sourceforge.net/projects/ntlmaps/\r\n# Copyright 2001 Dmit"
},
{
"path": "thirdparty_libs/requests_ntlm/ntlm/des_c.py",
"chars": 9536,
"preview": "# This file is part of 'NTLM Authorization Proxy Server' http://sourceforge.net/projects/ntlmaps/\r\n# Copyright 2001 Dmit"
},
{
"path": "thirdparty_libs/requests_ntlm/ntlm/des_data.py",
"chars": 19997,
"preview": "# This file is part of 'NTLM Authorization Proxy Server' http://sourceforge.net/projects/ntlmaps/\r\n# Copyright 2001 Dmit"
},
{
"path": "thirdparty_libs/requests_ntlm/ntlm/ntlm.py",
"chars": 23195,
"preview": "# This library is free software: you can redistribute it and/or\r\n# modify it under the terms of the GNU Lesser General P"
},
{
"path": "thirdparty_libs/requests_ntlm/requests_ntlm.py",
"chars": 2752,
"preview": "from requests.auth import AuthBase\nfrom requests.adapters import HTTPAdapter\nfrom .ntlm import ntlm\n\n\nclass HttpNtlmAuth"
},
{
"path": "thirdparty_libs/termcolor/__init__.py",
"chars": 170,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nCopyright (c) 2014-2015 pocsuite developers (http://seebug.org)\nSee t"
},
{
"path": "thirdparty_libs/termcolor/termcolor.py",
"chars": 5043,
"preview": "# coding: utf-8\n# Copyright (c) 2008-2011 Volvox Development Team\n#\n# Permission is hereby granted, free of charge, to a"
},
{
"path": "thirdparty_libs/texttable.py",
"chars": 20743,
"preview": "#!/usr/bin/env python\n#\n# texttable - module for creating simple ASCII tables\n# Copyright (C) 2003-2011 Gerome Fournier "
},
{
"path": "thirdparty_libs/tldextract/.tld_set_snapshot",
"chars": 78552,
"preview": "c__builtin__\nfrozenset\np1\n((lp2\nVnaustdal.no\np3\naVmed.ht\np4\naVpodlasie.pl\np5\naVcarraramassa.it\np6\naVworkshop.museum\np7\na"
},
{
"path": "thirdparty_libs/tldextract/LICENSE",
"chars": 1458,
"preview": "Copyright (c) 2013, John Kurkowski\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or with"
},
{
"path": "thirdparty_libs/tldextract/README.md",
"chars": 4173,
"preview": "# Python Module\n\n`tldextract` accurately separates the gTLD or ccTLD (generic or country code\ntop-level domain) from the"
},
{
"path": "thirdparty_libs/tldextract/__init__.py",
"chars": 65,
"preview": "from .tldextract import extract, TLDExtract\n\n__version__ = \"1.2\"\n"
},
{
"path": "thirdparty_libs/tldextract/tldextract.py",
"chars": 11070,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"`tldextract` accurately separates the gTLD or ccTLD (generic or country code\ntop-level domain"
},
{
"path": "thirdparty_libs/torndb.py",
"chars": 10735,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2009 Facebook\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); yo"
},
{
"path": "thirdparty_libs/wvs_spider/__init__.py",
"chars": 69,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n"
},
{
"path": "thirdparty_libs/wvs_spider/lib/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "thirdparty_libs/wvs_spider/lib/config.py",
"chars": 412,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nWVS_INSTALL_PATH = 'D:/Acunetix/Web Vulnerability "
},
{
"path": "thirdparty_libs/wvs_spider/run.py",
"chars": 2777,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n\n__all__ = []\n\n\n#---------------------------------"
},
{
"path": "thirdparty_libs/wvs_spider/wvs_celery_config.py",
"chars": 800,
"preview": "# celeryconfig.py\n# coding=utf-8\n\nfrom lib.config import REDIS_PWD, REDIS_SERVER, REDIS_PORT\n\nBROKER_URL = 'redis://:{0}"
},
{
"path": "thirdparty_libs/wvs_spider/wvs_console.py",
"chars": 3160,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nimport os, datetime, time, urllib, random, hashlib"
},
{
"path": "thirdparty_libs/wvs_spider/wvs_run.py",
"chars": 586,
"preview": "#!/usr/bin/env python\n#-*- coding:utf-8 -*-\n\n\nimport sys\nimport optparse\n\n#from thirdparty_libs.wvs_spider.wvs_console i"
},
{
"path": "thirdparty_libs/wvs_spider/wvs_tasks.py",
"chars": 636,
"preview": "#!/usr/bin/env python\n#-*- coding:utf-8 -*-\n\n\nfrom celery import Celery\nimport subprocess\n\n'''\ncelery -A wvs_tasks worke"
},
{
"path": "thirdparty_libs/wvs_spider/xml2mysql.py",
"chars": 9662,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom HTMLParser import HTMLParser\nfrom xml.etree i"
},
{
"path": "webservice/lalascan_web/app/__init__.py",
"chars": 538,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n\nfrom flask import Flask\nfrom flask.ext.login impo"
},
{
"path": "webservice/lalascan_web/app/extensions/__init__.py",
"chars": 69,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n"
},
{
"path": "webservice/lalascan_web/app/extensions/flask_paginate.py",
"chars": 13862,
"preview": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\n flask_paginate\n ~~~~~~~~~~~~~~~~~~\n\n Adds pagination suppor"
},
{
"path": "webservice/lalascan_web/app/forms.py",
"chars": 1068,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom flask_wtf import Form\nfrom wtforms import Str"
},
{
"path": "webservice/lalascan_web/app/models/__init__.py",
"chars": 160,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\n\nfrom flask.ext.sqlalchemy import SQLAlchemy\n\ndb ="
},
{
"path": "webservice/lalascan_web/app/models/leakinfo.py",
"chars": 1209,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom . import db\n\nclass SLeakInfo(db.Model):\n\n\n "
},
{
"path": "webservice/lalascan_web/app/models/policy.py",
"chars": 990,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom . import db\n\nfrom datetime import datetime\n\n\n"
},
{
"path": "webservice/lalascan_web/app/models/scanner.py",
"chars": 2307,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom . import db\n\nclass STarget(db.Model):\n\n __"
},
{
"path": "webservice/lalascan_web/app/models/spider.py",
"chars": 69,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n"
},
{
"path": "webservice/lalascan_web/app/services.py",
"chars": 2403,
"preview": "#!/usr/bin/env/python\n#-*- coding:utf-8 -*-\n\n__author__ = 'BlackYe.'\n\nfrom models.policy import SLeakPolicy\nfrom models."
},
{
"path": "webservice/lalascan_web/app/static/css/oneui.css",
"chars": 360794,
"preview": "/*!\r\n* OneUI - v1.0 - Auto-compiled on 2015-06-12 - Copyright 2015 \r\n* @author pixelcave\r\n*/\n/*\n * Bootstrap v3.3.4 (htt"
}
]
// ... and 58 more files (download for full content)
About this extraction
This page contains the full source code of the blackye/lalascan GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 258 files (2.5 MB), approximately 657.2k tokens, and a symbol index with 1664 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.