├── .gitignore ├── README.md ├── doc ├── 0.png ├── 1.jpg ├── 1.png ├── pbscan使用文档.md └── pbscan脑图.png ├── pbscan-api ├── README.md ├── core │ ├── UserConfigPro.json │ ├── __init__.py │ ├── bottle$py.class │ ├── bottle.py │ ├── burp-loader-keygen.jar │ ├── burp.json │ ├── burpsuite_pro_v1.7.32.jar │ ├── carbonator.py │ ├── colorprint$py.class │ ├── colorprint.py │ ├── jython-standalone-2.7.0.jar │ ├── parsexml.py │ ├── proxy.json │ └── thirdpart │ │ ├── Paste-3.0.5 │ │ ├── MANIFEST.in │ │ ├── PKG-INFO │ │ ├── Paste.egg-info │ │ │ ├── PKG-INFO │ │ │ ├── SOURCES.txt │ │ │ ├── dependency_links.txt │ │ │ ├── entry_points.txt │ │ │ ├── namespace_packages.txt │ │ │ ├── not-zip-safe │ │ │ ├── requires.txt │ │ │ └── top_level.txt │ │ ├── README.rst │ │ ├── docs │ │ │ ├── DeveloperGuidelines.txt │ │ │ ├── StyleGuide.txt │ │ │ ├── _static │ │ │ │ ├── default.css │ │ │ │ └── paste.css │ │ │ ├── community │ │ │ │ ├── index.txt │ │ │ │ ├── mailing-list.txt │ │ │ │ └── repository.txt │ │ │ ├── conf.py │ │ │ ├── developer-features.txt │ │ │ ├── do-it-yourself-framework.txt │ │ │ ├── download │ │ │ │ └── index.txt │ │ │ ├── future.txt │ │ │ ├── include │ │ │ │ ├── contact.txt │ │ │ │ └── reference_header.txt │ │ │ ├── index.txt │ │ │ ├── license.txt │ │ │ ├── modules │ │ │ │ ├── auth.auth_tkt.txt │ │ │ │ ├── auth.basic.txt │ │ │ │ ├── auth.cas.txt │ │ │ │ ├── auth.cookie.txt │ │ │ │ ├── auth.digest.txt │ │ │ │ ├── auth.form.txt │ │ │ │ ├── auth.grantip.txt │ │ │ │ ├── auth.multi.txt │ │ │ │ ├── cascade.txt │ │ │ │ ├── cgiapp.txt │ │ │ │ ├── cgitb_catcher.txt │ │ │ │ ├── debug.debugapp.txt │ │ │ │ ├── debug.fsdiff.txt │ │ │ │ ├── debug.prints.txt │ │ │ │ ├── debug.profile.txt │ │ │ │ ├── debug.watchthreads.txt │ │ │ │ ├── debug.wdg_validate.txt │ │ │ │ ├── errordocument.txt │ │ │ │ ├── evalexception.txt │ │ │ │ ├── exceptions.txt │ │ │ │ ├── fileapp.txt │ │ │ │ ├── fixture.txt │ │ │ │ ├── gzipper.txt │ │ │ │ ├── httpexceptions.txt │ │ │ │ ├── httpheaders.txt │ │ │ │ ├── httpserver.txt │ │ │ │ ├── lint.txt │ │ │ │ ├── pony.txt │ │ │ │ ├── progress.txt │ │ │ │ ├── proxy.txt │ │ │ │ ├── recursive.txt │ │ │ │ ├── registry.txt │ │ │ │ ├── reloader.txt │ │ │ │ ├── request.txt │ │ │ │ ├── response.txt │ │ │ │ ├── session.txt │ │ │ │ ├── transaction.txt │ │ │ │ ├── translogger.txt │ │ │ │ ├── url.txt │ │ │ │ ├── urlmap.txt │ │ │ │ ├── urlparser.txt │ │ │ │ ├── util.import_string.txt │ │ │ │ ├── util.multidict.txt │ │ │ │ ├── wsgilib.txt │ │ │ │ └── wsgiwrappers.txt │ │ │ ├── news.txt │ │ │ ├── paste-httpserver-threadpool.txt │ │ │ ├── test_server.ini │ │ │ ├── testing-applications.txt │ │ │ ├── url-parsing-with-wsgi.txt │ │ │ └── web │ │ │ │ ├── default-site.css │ │ │ │ ├── site.js │ │ │ │ └── style.css │ │ ├── paste │ │ │ ├── __init__$py.class │ │ │ ├── __init__.py │ │ │ ├── auth │ │ │ │ ├── __init__.py │ │ │ │ ├── auth_tkt.py │ │ │ │ ├── basic.py │ │ │ │ ├── cas.py │ │ │ │ ├── cookie.py │ │ │ │ ├── digest.py │ │ │ │ ├── form.py │ │ │ │ ├── grantip.py │ │ │ │ ├── multi.py │ │ │ │ └── open_id.py │ │ │ ├── cascade.py │ │ │ ├── cgiapp.py │ │ │ ├── cgitb_catcher.py │ │ │ ├── config.py │ │ │ ├── cowbell │ │ │ │ ├── __init__.py │ │ │ │ ├── bell-ascending.png │ │ │ │ └── bell-descending.png │ │ │ ├── debug │ │ │ │ ├── __init__.py │ │ │ │ ├── debugapp.py │ │ │ │ ├── doctest_webapp.py │ │ │ │ ├── fsdiff.py │ │ │ │ ├── prints.py │ │ │ │ ├── profile.py │ │ │ │ ├── testserver.py │ │ │ │ ├── watchthreads.py │ │ │ │ └── wdg_validate.py │ │ │ ├── errordocument.py │ │ │ ├── evalexception │ │ │ │ ├── __init__.py │ │ │ │ ├── evalcontext.py │ │ │ │ ├── media │ │ │ │ │ ├── MochiKit.packed.js │ │ │ │ │ ├── debug.js │ │ │ │ │ ├── minus.jpg │ │ │ │ │ └── plus.jpg │ │ │ │ └── middleware.py │ │ │ ├── exceptions │ │ │ │ ├── __init__.py │ │ │ │ ├── collector.py │ │ │ │ ├── errormiddleware.py │ │ │ │ ├── formatter.py │ │ │ │ ├── reporter.py │ │ │ │ └── serial_number_generator.py │ │ │ ├── fileapp.py │ │ │ ├── fixture.py │ │ │ ├── flup_session.py │ │ │ ├── gzipper.py │ │ │ ├── home │ │ │ │ └── lj │ │ │ │ │ └── .jython-cache │ │ │ │ │ └── classes │ │ │ │ │ └── __init__$py.class │ │ │ ├── httpexceptions.py │ │ │ ├── httpheaders.py │ │ │ ├── httpserver$py.class │ │ │ ├── httpserver.py │ │ │ ├── lint.py │ │ │ ├── modpython.py │ │ │ ├── pony.py │ │ │ ├── progress.py │ │ │ ├── proxy.py │ │ │ ├── recursive.py │ │ │ ├── registry.py │ │ │ ├── reloader.py │ │ │ ├── request.py │ │ │ ├── response.py │ │ │ ├── session.py │ │ │ ├── transaction.py │ │ │ ├── translogger$py.class │ │ │ ├── translogger.py │ │ │ ├── url.py │ │ │ ├── urlmap.py │ │ │ ├── urlparser.py │ │ │ ├── util │ │ │ │ ├── PySourceColor.py │ │ │ │ ├── __init__$py.class │ │ │ │ ├── __init__.py │ │ │ │ ├── classinit.py │ │ │ │ ├── classinstance.py │ │ │ │ ├── converters$py.class │ │ │ │ ├── converters.py │ │ │ │ ├── dateinterval.py │ │ │ │ ├── datetimeutil.py │ │ │ │ ├── filemixin.py │ │ │ │ ├── finddata.py │ │ │ │ ├── findpackage.py │ │ │ │ ├── html.py │ │ │ │ ├── import_string.py │ │ │ │ ├── intset.py │ │ │ │ ├── ip4.py │ │ │ │ ├── killthread$py.class │ │ │ │ ├── killthread.py │ │ │ │ ├── looper.py │ │ │ │ ├── mimeparse.py │ │ │ │ ├── multidict.py │ │ │ │ ├── quoting.py │ │ │ │ ├── scgiserver.py │ │ │ │ ├── template.py │ │ │ │ ├── threadedprint.py │ │ │ │ └── threadinglocal.py │ │ │ ├── wsgilib.py │ │ │ └── wsgiwrappers.py │ │ ├── regen-docs │ │ ├── setup.cfg │ │ ├── setup.py │ │ ├── tests │ │ │ ├── __init__.py │ │ │ ├── cgiapp_data │ │ │ │ ├── error.cgi │ │ │ │ ├── form.cgi │ │ │ │ ├── ok.cgi │ │ │ │ └── stderr.cgi │ │ │ ├── template.txt │ │ │ ├── test_auth │ │ │ │ ├── __init__.py │ │ │ │ ├── test_auth_cookie.py │ │ │ │ └── test_auth_digest.py │ │ │ ├── test_cgiapp.py │ │ │ ├── test_cgitb_catcher.py │ │ │ ├── test_config.py │ │ │ ├── test_doctests.py │ │ │ ├── test_errordocument.py │ │ │ ├── test_exceptions │ │ │ │ ├── __init__.py │ │ │ │ ├── test_error_middleware.py │ │ │ │ ├── test_formatter.py │ │ │ │ ├── test_httpexceptions.py │ │ │ │ └── test_reporter.py │ │ │ ├── test_fileapp.py │ │ │ ├── test_fixture.py │ │ │ ├── test_grantip.py │ │ │ ├── test_gzipper.py │ │ │ ├── test_httpheaders.py │ │ │ ├── test_httpserver.py │ │ │ ├── test_import_string.py │ │ │ ├── test_multidict.py │ │ │ ├── test_profilemiddleware.py │ │ │ ├── test_proxy.py │ │ │ ├── test_recursive.py │ │ │ ├── test_registry.py │ │ │ ├── test_request.py │ │ │ ├── test_request_form.py │ │ │ ├── test_response.py │ │ │ ├── test_session.py │ │ │ ├── test_urlmap.py │ │ │ ├── test_urlparser.py │ │ │ ├── test_util │ │ │ │ ├── __init__.py │ │ │ │ ├── test_datetimeutil.py │ │ │ │ ├── test_mimeparse.py │ │ │ │ └── test_quoting.py │ │ │ ├── test_wsgilib.py │ │ │ ├── test_wsgiwrappers.py │ │ │ └── urlparser_data │ │ │ │ ├── __init__.py │ │ │ │ ├── deep │ │ │ │ └── sub │ │ │ │ │ └── Main.txt │ │ │ │ ├── find_file │ │ │ │ └── index.txt │ │ │ │ ├── hook │ │ │ │ ├── __init__.py │ │ │ │ ├── app.py │ │ │ │ └── index.py │ │ │ │ ├── not_found │ │ │ │ ├── __init__.py │ │ │ │ ├── recur │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── isfound.txt │ │ │ │ ├── simple │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── found.txt │ │ │ │ └── user │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── list.py │ │ │ │ ├── python │ │ │ │ ├── __init__.py │ │ │ │ ├── simpleapp.py │ │ │ │ ├── stream.py │ │ │ │ └── sub │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── simpleapp.py │ │ │ │ └── secured.txt │ │ └── tox.ini │ │ ├── __init__.py │ │ ├── bottle$py.class │ │ ├── bottle.py │ │ ├── lession1.py │ │ ├── lession2.py │ │ ├── pika │ │ ├── __init__$py.class │ │ ├── __init__.py │ │ ├── adapters │ │ │ ├── __init__$py.class │ │ │ ├── __init__.py │ │ │ ├── asyncio_connection$py.class │ │ │ ├── asyncio_connection.py │ │ │ ├── base_connection$py.class │ │ │ ├── base_connection.py │ │ │ ├── blocking_connection$py.class │ │ │ ├── blocking_connection.py │ │ │ ├── select_connection$py.class │ │ │ ├── select_connection.py │ │ │ ├── tornado_connection$py.class │ │ │ ├── tornado_connection.py │ │ │ ├── twisted_connection$py.class │ │ │ └── twisted_connection.py │ │ ├── amqp_object$py.class │ │ ├── amqp_object.py │ │ ├── callback$py.class │ │ ├── callback.py │ │ ├── channel$py.class │ │ ├── channel.py │ │ ├── compat$py.class │ │ ├── compat.py │ │ ├── connection$py.class │ │ ├── connection.py │ │ ├── credentials$py.class │ │ ├── credentials.py │ │ ├── data$py.class │ │ ├── data.py │ │ ├── exceptions$py.class │ │ ├── exceptions.py │ │ ├── frame$py.class │ │ ├── frame.py │ │ ├── heartbeat$py.class │ │ ├── heartbeat.py │ │ ├── home │ │ │ └── lj │ │ │ │ └── .jython-cache │ │ │ │ └── classes │ │ │ │ └── __init__$py.class │ │ ├── spec$py.class │ │ ├── spec.py │ │ ├── tcp_socket_opts$py.class │ │ ├── tcp_socket_opts.py │ │ ├── utils$py.class │ │ └── utils.py │ │ └── six-1.12.0 │ │ ├── CHANGES │ │ ├── LICENSE │ │ ├── MANIFEST.in │ │ ├── PKG-INFO │ │ ├── README.rst │ │ ├── documentation │ │ ├── Makefile │ │ ├── conf.py │ │ └── index.rst │ │ ├── setup.cfg │ │ ├── setup.py │ │ ├── six$py.class │ │ ├── six.egg-info │ │ ├── PKG-INFO │ │ ├── SOURCES.txt │ │ ├── dependency_links.txt │ │ └── top_level.txt │ │ ├── six.py │ │ └── test_six.py ├── pbscan.py └── test │ ├── data.txt │ └── testburpapi.py ├── pbscan-server ├── README.md ├── config.py ├── consumer.py ├── lib │ ├── __init__.py │ ├── db │ │ ├── __init__.py │ │ └── mysql.py │ ├── hack_sqlmapapi.py │ ├── http │ │ ├── __init__.py │ │ ├── basic.py │ │ └── parse_request.py │ ├── poc │ │ ├── __init__.py │ │ ├── scan_fi.py │ │ ├── scan_sqli.py │ │ └── scan_xss.py │ └── utils │ │ ├── __init__.py │ │ ├── basic.py │ │ ├── colorprint.py │ │ └── pika_mq.py ├── parser │ ├── parser_mitmproxy.py │ └── proxy_mitmproxy.py ├── producer.py └── test │ ├── data.txt │ ├── test_mitmproxy.py │ ├── testdb.py │ ├── testhash.py │ ├── testmq.py │ ├── testproducerapi.py │ └── testrule.py ├── pbscan_supervisor.conf ├── sql.sql └── start.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .git 2 | .idea 3 | .phpintel 4 | *.pyc 5 | output 6 | *.out 7 | *.log 8 | *.html 9 | 文档 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pbscan 2 | 基于burpsuite headless 的代理式被动扫描系统 3 | 4 | 5 | ## 现有burp批量扫描工具 6 | ### headless burpsuite 7 | 无头burpsuite, 即没有图形界面的burpsuite,可以再服务器上面运行. 8 | 9 | 已有工具: 10 | headless-burp-scanner: https://github.com/NetsOSS/headless-burp 11 | carbonator: https://github.com/integrissecurity/carbonator 12 | 13 | carbonator 提供参数 14 | ``` 15 | optional arguments: 16 | -h, --help show this help message and exit 17 | -host HOST Enter an IP address or Domain name 18 | -saveState Save Burpsuite State 19 | -enableBing Enable Bing Reverse IP 20 | -enableGoogle Enable Google Search 21 | -file FILE File containing Domain names or IP addresses 22 | -headless Run Burp headless 23 | ``` 24 | 扫描方式: 发送url->spider->scanner 去扫描。 25 | 26 | ### burpsuite2.0 restful api 27 | 28 | curl -vgw "\n" -X POST 'http://localhost:1337/v0.1/scan' -d '{"scan_callback":{"url":"http://123.206.65.167:2000"},"scan_configurations":[{"name":"myburp","type":"NamedConfiguration"}],"scope":{"include":[{"rule":"http://localhost:82/*","type":"SimpleScopeDef"}]},"urls":["http://localhost:82/myctf/xss/xss.php?d=1&x=1"]}' 29 | 30 | ![](./1.png) 31 | 32 | 扫描方式: 输入url->spider(模拟表单登陆)->scanner 扫描。 33 | 34 | 35 | 缺点: 可以看到上面两种支持burpsuite 批量扫描模式都是输入url->爬虫->scanner扫描, 无法满足带cookie 的一些站点扫描,而且加上spider爬虫爬取后的链接数量不易控制。 36 | 37 | 38 | ## pbscan功能 39 | 40 | ![](./doc/0.png) 41 | 42 | - [x] 再carbonator的基础上进行开发,通过内置bottle服务器实现burpsuite 1.7的扫描api接口 43 | - [x] 扫描接口可以实现发送数据包直接到scanner去扫描,无需经过spider, 自带cookie扫描。 44 | - [x] 自定义burpsuite扫描插入点(目前只扫描get和post参数), 自定义burpsuite扫描漏洞(去掉一些不重要的漏洞比如明文传送,HTML未设置字符集等) 45 | - [x] 通过接口可以实时获取扫描结果。 46 | - [x] 使用rabbitmq+pika 实现消息队列,每个数据包都有一个token和rid标识,支持多人共同扫描。 47 | - [x] 可以支持同时开多个headless burpsuite 来扫描以加快扫描速率。 48 | - [x] 支持burpsuite 报表结果显示,用thinkphp写的展示平台来进行结果展示。 49 | - [x] 利用burp插件或chrome插件来进行代理获取数据包,可以实现代理式被动扫描。 50 | 51 | ## 安装使用 52 | 1. 依赖安装 53 | ``` 54 | wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc 55 | sudo apt-key add rabbitmq-signing-key-public.asc 56 | sudo apt-get update 57 | sudo apt-get install rabbitmq-server 58 | pip install pika 59 | pip install gevent 60 | pip install MySQL-python 61 | ``` 62 | 2. 导入数据库sql.sql, 修改pbscan-server/config.py 中的配置信息 63 | 64 | 3. 部署运行, 有两种方式可以集中部署,一个是通过supervisor的方式来部署,另一个是直接用nohup后台进程运行。 65 | 66 | **supervisor部署** 67 | ``` 68 | #先安装supervisor软件: 69 | apt-get install supervisor 70 | pip install supervisor 71 | 72 | # 修改pbscan_supervisor.conf的路径, 启动supervisor 73 | cp pbscan_supervisor.conf /etc/supervisor/conf.d 74 | supervisord 75 | supervisorctl update 76 | supervisorctl status 77 | ``` 78 | 79 | **使用nohup后台部署** 80 | ``` 81 | bash start.sh 82 | ``` 83 | 84 | 如果只想要api的接口,也可以单独运行pbscan-api。 85 | 86 | ## api扫描接口 87 | ![](./doc/1.jpg) 88 | 获取结果显示: 89 | ``` 90 | [ 91 | { 92 | u'insert_point': 3, 93 | u'issues_num': 0, 94 | u'request_num': 122, 95 | u'rid': u'4b397ed50505b5e7c406ef9776b00b766203159e', 96 | u'scanTime': u'2019-01-15 17:36:24', 97 | u'scanUrl': u'GET xx.cn:80/profile/managetag?page=1&qid=2619946579', 98 | u'status': u'50% complete', 99 | u'token': u'6465fkfljalfj5456' 100 | }, 101 | { 102 | u'insert_point': 3, 103 | u'issues_num': 0, 104 | u'request_num': 99, 105 | u'rid': u'4b397ed50505b5e7c406ef9776b00b766203159e', 106 | u'scanTime': u'2019-01-15 17:36:26', 107 | u'scanUrl': u'GET xx.cn:80/profile/managetag?page=1&qid=2619946579', 108 | u'status': u'50% complete', 109 | u'token': u'6465fkfljalfj5456' 110 | } 111 | ] 112 | ``` -------------------------------------------------------------------------------- /doc/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/doc/0.png -------------------------------------------------------------------------------- /doc/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/doc/1.jpg -------------------------------------------------------------------------------- /doc/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/doc/1.png -------------------------------------------------------------------------------- /doc/pbscan使用文档.md: -------------------------------------------------------------------------------- 1 | # pbscan 2 | 3 | passive scan by headless burpsuite 4 | 5 | 基于headless burpsuite 的被动扫描工具 6 | 7 | 8 | ## 环境 9 | 如果自己有burpsuite 环境,则直接安装carbonator.py 这个插件即可,如果没有burpsuite插件环境,可以将UserConfigPro.json 加入到`C:\Users\xx\AppData\Roaming\BurpSuite` 目录下 10 | 11 | rabbitmq+pika 12 | ``` 13 | wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc 14 | sudo apt-key add rabbitmq-signing-key-public.asc 15 | sudo apt-get update 16 | sudo apt-get install rabbitmq-server 17 | pip install pika 18 | pip install gevent 19 | pip install MySQL-python 20 | ``` 21 | ## usage 22 | ### pbscan 启动 23 | 24 | ``` 25 | usage: pbscan.py [-h] [-f F] [-headless] [-debug] [-proxy] [-auto AUTO] 26 | 27 | Burp automator 28 | 29 | optional arguments: 30 | -h, --help show this help message and exit 31 | -f F File containing Domain names or IP addresses 32 | -headless Run Burp headless 33 | -debug debug 34 | -proxy open proxy 35 | -auto AUTO auto 36 | ``` 37 | 38 | 直接读取data.txt 里面的数据包来发送到burpsuite去扫描。 39 | 40 | python pbscan.py -f data.txt [-headless] 41 | 42 | 在服务端运行pbscan.py , 使用-headless无头模式运行burpsuite, 监听8083端口, 接收传过来的数据包。 43 | 44 | python pbscan.py -auto=8083 -headless 45 | 46 | 在服务端运行生产者脚本,开启扫描api, 负责监听7001端口(自己修改), 47 | 48 | python producer.py -auto 49 | 50 | 在服务端运行消费者脚本,burp=8083表示选择开放8083端口的burpsuite进行消费扫描。 51 | 52 | python consumer.py burp=8083 53 | 54 | 只介绍这三个常见命令,其他命令自己看下脚本就明白怎么用了。 55 | 56 | 57 | 客户端安需要一个流量转发插件,可以用chrome插件,burp插件. 58 | 59 | ### cli command 60 | 切换到core目录,执行以下命令 61 | 62 | headless mode: 63 | 64 | java -jar -Xbootclasspath/p:burp-loader-keygen.jar -Djava.awt.headless=true burpsuite_pro_v1.7.32.jar --config-file=burp.json --user-config-file=UserConfigPro.json -f=../data.txt 65 | 66 | 67 | normal mode: 68 | 69 | java -jar -Xbootclasspath/p:burp-loader-keygen.jar burpsuite_pro_v1.7.32.jar --config-file=burp.json --user-config-file=UserConfigPro.json -f=../data.txt 70 | 71 | 参数解析: 72 | ``` 73 | -Xbootclasspath/p:burp-loader-keygen.jar: 从burp-loader-keygen.jar启动burpsuite 74 | -Djava.awt.headless=true: 使用headless mode 75 | --config-file=burp.json: 加载burpsuite的扫描配置文件 76 | --config-file=UserConfigPro.json: 加载burpsuite 的插件配置文件 77 | ``` 78 | 79 | ## 功能 80 | - [x] 读取数据包发送到scanner扫描(normal/headless mode) 81 | - [x] 代理监听数据包并且保存到日志 82 | - [x] 数据包以及结果存入数据库 83 | 84 | 85 | ## Thinks 86 | 87 | 服务端数据库设计和入库部分参考了 安全小飞侠的NagaScan的设计 88 | 89 | burpsuite扫描插件二次开发于carbonator插件 -------------------------------------------------------------------------------- /doc/pbscan脑图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/doc/pbscan脑图.png -------------------------------------------------------------------------------- /pbscan-api/README.md: -------------------------------------------------------------------------------- 1 | # pbscan burpsuite api 2 | 3 | ## Usage 4 | burp会监听8083端口,并且开放两个api 5 | 6 | 1. 发送扫描结果api 7 | 8 | http://localhost:8083/scan/ 9 | - get参数: 用户token 10 | - post参数: 数据包(不需要参数) 11 | - return: 12 | 13 | 2. 获取扫描结果api 14 | 15 | http://localhost:8083/get/status/ 16 | 17 | - get参数: 用户token 18 | - return: 进度或者扫描结果 19 | 20 | 测试api的脚本 21 | 22 | cd test 23 | python testburpapi.py scan 24 | python testburpapi.py get 25 | 26 | 默认读取data.txt中的数据包发送进行扫描。 27 | 28 | ### pbscan命令 29 | ``` 30 | usage: pbscan.py [-h] [-f F] [-headless] [-debug] [-proxy] [-auto AUTO] 31 | 32 | Burp automator 33 | 34 | optional arguments: 35 | -h, --help show this help message and exit 36 | -f F File containing Domain names or IP addresses 37 | -headless Run Burp headless 38 | -debug debug 39 | -proxy open proxy 40 | -auto AUTO auto 41 | ``` 42 | 43 | 直接读取data.txt 里面的数据包来发送到burpsuite去扫描。 44 | 45 | python pbscan.py -f data.txt [-headless] -debug 46 | 47 | 在服务端运行pbscan.py , 使用-headless无头模式运行burpsuite, 监听8083端口, 接收传过来的数据包。 48 | 49 | python pbscan.py -auto=8083 -headless 50 | 51 | 52 | 53 | ### headless cli command 54 | 切换到core目录,执行以下命令 55 | 56 | headless mode: 57 | 58 | java -jar -Xbootclasspath/p:burp-loader-keygen.jar -Djava.awt.headless=true burpsuite_pro_v1.7.32.jar --config-file=burp.json --user-config-file=UserConfigPro.json -f=../data.txt 59 | 60 | 61 | normal mode: 62 | 63 | java -jar -Xbootclasspath/p:burp-loader-keygen.jar burpsuite_pro_v1.7.32.jar --config-file=burp.json --user-config-file=UserConfigPro.json -f=../data.txt 64 | 65 | 参数解析: 66 | ``` 67 | -Xbootclasspath/p:burp-loader-keygen.jar: 从burp-loader-keygen.jar启动burpsuite 68 | -Djava.awt.headless=true: 使用headless mode 69 | --config-file=burp.json: 加载burpsuite的扫描配置文件 70 | --config-file=UserConfigPro.json: 加载burpsuite 的插件配置文件 71 | ``` 72 | 73 | ## 功能 74 | - [x] 读取数据包发送到scanner扫描(normal/headless mode) 75 | - [x] 代理监听数据包并且保存到日志 76 | - [x] 数据包以及结果存入数据库 77 | 78 | 79 | ## Thinks 80 | 81 | 服务端数据库设计和入库部分参考了 安全小飞侠的NagaScan的设计 82 | 83 | burpsuite扫描插件二次开发于carbonator插件 -------------------------------------------------------------------------------- /pbscan-api/core/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/__init__.py -------------------------------------------------------------------------------- /pbscan-api/core/bottle$py.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/bottle$py.class -------------------------------------------------------------------------------- /pbscan-api/core/burp-loader-keygen.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/burp-loader-keygen.jar -------------------------------------------------------------------------------- /pbscan-api/core/burpsuite_pro_v1.7.32.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/burpsuite_pro_v1.7.32.jar -------------------------------------------------------------------------------- /pbscan-api/core/colorprint$py.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/colorprint$py.class -------------------------------------------------------------------------------- /pbscan-api/core/colorprint.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding:utf-8 3 | 4 | import random 5 | import time 6 | 7 | 8 | class ColorPrinter: 9 | 10 | def print_black_text(self, content): # 200 11 | message = "\033[0;30m%s\033[0m" % (content) 12 | return message 13 | 14 | def print_red_text(self, content): # 200 15 | message = "\033[1;31m%s\033[0m" % (content) 16 | return message 17 | 18 | def print_green_text(self, content): # 200 19 | message = "\033[1;32m%s\033[0m" % (content) 20 | return message 21 | 22 | def print_yellow_text(self, content): # 40x 23 | message = "\033[1;33m%s\033[0;m" % (content) 24 | return message 25 | 26 | def print_blue_text(self, content): # 40x 27 | message = "\033[1;34m%s\033[0;m" % (content) 28 | return message 29 | 30 | def print_magenta_text(self, content): # 30x 31 | message = "\033[1;35m%s\033[0;m" % (content) 32 | return message 33 | 34 | def print_cyan_text(self, content): # 30x 35 | message = "\033[1;36m%s\033[0;m" % (content) 36 | return message 37 | 38 | def print_white_text(self, content): # 30x 39 | message = "\033[1;37m%s\033[0;m" % (content) 40 | return message 41 | 42 | def print_reset_text(self, content): # 30x 43 | message = "\033[1;38m%s\033[0;m" % (content) 44 | return message 45 | 46 | 47 | def print_random_text(content): 48 | output = ColorPrinter() 49 | colors = {31: 'red', 32: 'green', 33: 'yellow', 34: 'blue', 35: 'magenta', 36: 'cyan', 37: 'white'} # 抛弃了黑色 50 | color = colors[random.randint(31, 37)] 51 | # print color 52 | getattr(output, 'print_%s_text' % color)(content) 53 | 54 | 55 | log_colors = { 56 | 'DEBUG': 'cyan', 57 | 'INFO': 'green', 58 | 'WARNING': 'yellow', 59 | 'ERROR': 'red', 60 | 'CRITICAL': 'white' 61 | } 62 | 63 | 64 | def log(F): 65 | output = ColorPrinter() 66 | def wrapper(*args, **kwargs): 67 | content = F(*args, **kwargs) 68 | FORMAT = "{time} [{level}] ".format(time=time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())), 69 | level=F.__name__.upper()) 70 | content = FORMAT + content 71 | if F.__name__ == 'info': 72 | return getattr(output, 'print_%s_text' % log_colors['INFO'])(content) 73 | elif F.__name__ == 'debug': 74 | return getattr(output, 'print_%s_text' % log_colors['DEBUG'])(content) 75 | elif F.__name__ == 'warning': 76 | return getattr(output, 'print_%s_text' % log_colors['WARNING'])(content) 77 | elif F.__name__ == 'error': 78 | return getattr(output, 'print_%s_text' % log_colors['ERROR'])(content) 79 | elif F.__name__ == 'critical': 80 | return getattr(output, 'print_%s_text' % log_colors['CRITICAL'])(content) 81 | 82 | return wrapper 83 | 84 | 85 | class Logger: 86 | @log 87 | def info(self, content): 88 | return content 89 | 90 | @log 91 | def debug(self, content): 92 | return content 93 | 94 | @log 95 | def error(self, content): 96 | return content 97 | 98 | @log 99 | def warning(self, content): 100 | return content 101 | 102 | @log 103 | def critical(self, content): 104 | return content 105 | 106 | 107 | if __name__ == '__main__': 108 | logger = Logger() 109 | print logger.info('xx') 110 | -------------------------------------------------------------------------------- /pbscan-api/core/jython-standalone-2.7.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/jython-standalone-2.7.0.jar -------------------------------------------------------------------------------- /pbscan-api/core/parsexml.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | import sys 4 | import xml.etree.ElementTree as ET 5 | 6 | #!/usr/bin/env python 7 | #coding:utf-8 8 | 9 | import pymongo 10 | import copy 11 | import traceback 12 | dsn = "mongodb://localhost:27017/" 13 | dbname = 'burp' 14 | collection = 'scan_result' 15 | 16 | class Mongo: 17 | def __init__(self,dsn): 18 | myclient = pymongo.MongoClient(dsn) 19 | self.mydb = myclient[dbname] #数据库 20 | self.mycol = self.mydb[collection] #sites collections 21 | 22 | def insert_one(self,data): 23 | try: 24 | x = self.mycol.insert_one(data) #插入文档(记录) 25 | print('insert success:'+x.inserted_id) 26 | except Exception as e: 27 | #print traceback.print_exc()f 28 | print(e) 29 | 30 | def insert_many(self,datalist): 31 | for data in datalist: 32 | self.insert_one(data) 33 | #print(x.inserted_ids) 34 | 35 | def find(self,condition,limit=100): 36 | return self.mycol.find(condition).limit(limit) 37 | 38 | 39 | def xml_parser(xmlfile): 40 | data = {} 41 | data_list = [] 42 | tree = ET.parse(xmlfile) 43 | root = tree.getroot()# 获取根元素 44 | for info in root.findall('issue'): #查找所有info元素 45 | #print info 46 | tmp = {} 47 | for child in info: #对每个info元素遍历属性和子节 48 | if child.tag == 'serialNumber': 49 | data['_id'] = child.text 50 | data[child.tag] = child.text 51 | 52 | tmp = copy.deepcopy(data) #dict sd 53 | data_list.append(tmp) 54 | 55 | 56 | #print data_list 57 | return data_list 58 | 59 | datalist = xml_parser(sys.argv[-1]) 60 | 61 | 62 | mongo = Mongo(dsn) 63 | mongo.insert_many(datalist) 64 | 65 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include docs *.txt *.css *.js 2 | include docs/_templates/*.html 3 | include docs/conf.py 4 | include docs/test_server.ini 5 | include regen-docs 6 | include tox.ini 7 | recursive-exclude docs/_build/_sources * 8 | recursive-include docs/_build *.html 9 | recursive-include tests *.txt *.py *.cgi *.html 10 | recursive-include paste *.js *.jpg *.png 11 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/Paste.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/Paste.egg-info/entry_points.txt: -------------------------------------------------------------------------------- 1 | 2 | [paste.app_factory] 3 | cgi = paste.cgiapp:make_cgi_application [subprocess] 4 | static = paste.urlparser:make_static 5 | pkg_resources = paste.urlparser:make_pkg_resources 6 | urlparser = paste.urlparser:make_url_parser 7 | proxy = paste.proxy:make_proxy 8 | test = paste.debug.debugapp:make_test_app 9 | test_slow = paste.debug.debugapp:make_slow_app 10 | transparent_proxy = paste.proxy:make_transparent_proxy 11 | watch_threads = paste.debug.watchthreads:make_watch_threads 12 | 13 | [paste.composite_factory] 14 | urlmap = paste.urlmap:urlmap_factory 15 | cascade = paste.cascade:make_cascade 16 | 17 | [paste.filter_app_factory] 18 | error_catcher = paste.exceptions.errormiddleware:make_error_middleware 19 | cgitb = paste.cgitb_catcher:make_cgitb_middleware 20 | flup_session = paste.flup_session:make_session_middleware [Flup] 21 | gzip = paste.gzipper:make_gzip_middleware 22 | httpexceptions = paste.httpexceptions:make_middleware 23 | lint = paste.lint:make_middleware 24 | printdebug = paste.debug.prints:PrintDebugMiddleware 25 | profile = paste.debug.profile:make_profile_middleware [hotshot] 26 | recursive = paste.recursive:make_recursive_middleware 27 | # This isn't good enough to deserve the name egg:Paste#session: 28 | paste_session = paste.session:make_session_middleware 29 | wdg_validate = paste.debug.wdg_validate:make_wdg_validate_middleware [subprocess] 30 | evalerror = paste.evalexception.middleware:make_eval_exception 31 | auth_tkt = paste.auth.auth_tkt:make_auth_tkt_middleware 32 | auth_basic = paste.auth.basic:make_basic 33 | auth_digest = paste.auth.digest:make_digest 34 | auth_form = paste.auth.form:make_form 35 | grantip = paste.auth.grantip:make_grantip 36 | openid = paste.auth.open_id:make_open_id_middleware [openid] 37 | pony = paste.pony:make_pony 38 | cowbell = paste.cowbell:make_cowbell 39 | errordocument = paste.errordocument:make_errordocument 40 | auth_cookie = paste.auth.cookie:make_auth_cookie 41 | translogger = paste.translogger:make_filter 42 | config = paste.config:make_config_filter 43 | registry = paste.registry:make_registry_manager 44 | 45 | [paste.server_runner] 46 | http = paste.httpserver:server_runner 47 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/Paste.egg-info/namespace_packages.txt: -------------------------------------------------------------------------------- 1 | paste 2 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/Paste.egg-info/not-zip-safe: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/Paste.egg-info/requires.txt: -------------------------------------------------------------------------------- 1 | six>=1.4.0 2 | 3 | [Flup] 4 | flup 5 | 6 | [Paste] 7 | 8 | [hotshot] 9 | 10 | [openid] 11 | python-openid 12 | 13 | [subprocess] 14 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/Paste.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | paste 2 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/README.rst: -------------------------------------------------------------------------------- 1 | 2 | *Paste is in maintenance mode and recently moved from bitbucket to github. 3 | Patches are accepted to keep it on life support, but for the most part, please 4 | consider using other options.* 5 | 6 | Paste provides several pieces of "middleware" (or filters) that can be nested 7 | to build web applications. Each piece of middleware uses the WSGI (`PEP 333`_) 8 | interface, and should be compatible with other middleware based on those 9 | interfaces. 10 | 11 | .. _PEP 333: http://www.python.org/dev/peps/pep-0333.html 12 | 13 | * `Paste project at GitHub (source code, bug tracker) 14 | `_ 15 | * `Paste on the Python Cheeseshop (PyPI) 16 | `_ 17 | * `Paste on Read the Docs 18 | `_ 19 | 20 | See also: 21 | 22 | * `WebOb `_ 23 | 24 | Includes these features... 25 | 26 | Testing 27 | ------- 28 | 29 | * A fixture for testing WSGI applications conveniently and in-process, 30 | in ``paste.fixture`` 31 | 32 | * A fixture for testing command-line applications, also in 33 | ``paste.fixture`` 34 | 35 | * Check components for WSGI-compliance in ``paste.lint`` 36 | 37 | Dispatching 38 | ----------- 39 | 40 | * Chain and cascade WSGI applications (returning the first non-error 41 | response) in ``paste.cascade`` 42 | 43 | * Dispatch to several WSGI applications based on URL prefixes, in 44 | ``paste.urlmap`` 45 | 46 | * Allow applications to make subrequests and forward requests 47 | internally, in ``paste.recursive`` 48 | 49 | Web Application 50 | --------------- 51 | 52 | * Run CGI programs as WSGI applications in ``paste.cgiapp`` 53 | 54 | * Traverse files and load WSGI applications from ``.py`` files (or 55 | static files), in ``paste.urlparser`` 56 | 57 | * Serve static directories of files, also in ``paste.urlparser``; also 58 | in that module serving from Egg resources using ``pkg_resources``. 59 | 60 | Tools 61 | ----- 62 | 63 | * Catch HTTP-related exceptions (e.g., ``HTTPNotFound``) and turn them 64 | into proper responses in ``paste.httpexceptions`` 65 | 66 | * Several authentication techniques, including HTTP (Basic and 67 | Digest), signed cookies, and CAS single-signon, in the 68 | ``paste.auth`` package. 69 | 70 | * Create sessions in ``paste.session`` and ``paste.flup_session`` 71 | 72 | * Gzip responses in ``paste.gzip`` 73 | 74 | * A wide variety of routines for manipulating WSGI requests and 75 | producing responses, in ``paste.request``, ``paste.response`` and 76 | ``paste.wsgilib`` 77 | 78 | Debugging Filters 79 | ----------------- 80 | 81 | * Catch (optionally email) errors with extended tracebacks (using 82 | Zope/ZPT conventions) in ``paste.exceptions`` 83 | 84 | * Catch errors presenting a `cgitb 85 | `_-based 86 | output, in ``paste.cgitb_catcher``. 87 | 88 | * Profile each request and append profiling information to the HTML, 89 | in ``paste.debug.profile`` 90 | 91 | * Capture ``print`` output and present it in the browser for 92 | debugging, in ``paste.debug.prints`` 93 | 94 | * Validate all HTML output from applications using the `WDG Validator 95 | `_, appending any errors 96 | or warnings to the page, in ``paste.debug.wdg_validator`` 97 | 98 | Other Tools 99 | ----------- 100 | 101 | * A file monitor to allow restarting the server when files have been 102 | updated (for automatic restarting when editing code) in 103 | ``paste.reloader`` 104 | 105 | * A class for generating and traversing URLs, and creating associated 106 | HTML code, in ``paste.url`` 107 | 108 | The official development repo is at https://github.com/cdent/paste. 109 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/StyleGuide.txt: -------------------------------------------------------------------------------- 1 | +++++++++++++++++++ 2 | Paste Style Guide 3 | +++++++++++++++++++ 4 | 5 | Generally you should follow the recommendations in `PEP 8`_, the 6 | Python Style Guide. Some things to take particular note of: 7 | 8 | .. _PEP 8: http://www.python.org/peps/pep-0008.html 9 | 10 | * **No tabs**. Not anywhere. Always indent with 4 spaces. 11 | 12 | * I don't stress too much on line length. But try to break lines up 13 | by grouping with parenthesis instead of with backslashes (if you 14 | can). Do asserts like:: 15 | 16 | assert some_condition(a, b), ( 17 | "Some condition failed, %r isn't right!" % a) 18 | 19 | * But if you are having problems with line length, maybe you should 20 | just break the expression up into multiple statements. 21 | 22 | * Blank lines between methods, unless they are very small and closely 23 | bound to each other. 24 | 25 | * Don't use the form ``condition and trueValue or falseValue``. Break 26 | it out and use a variable. 27 | 28 | * I (Ian Bicking) am very picky about whitespace. There's one and 29 | only one right way to do it. Good examples:: 30 | 31 | short = 3 32 | longerVar = 4 33 | 34 | if x == 4: 35 | do stuff 36 | 37 | func(arg1='a', arg2='b') 38 | func((a + b)*10) 39 | 40 | **Bad** examples:: 41 | 42 | short =3 43 | longerVar=4 44 | 45 | if x==4: do stuff 46 | 47 | func(arg1 = 'a', arg2 = 'b') 48 | func(a,b) 49 | func( a, b ) 50 | [ 1, 2, 3 ] 51 | 52 | If the whitespace isn't right, it'll annoy me and I'll feel a need 53 | to fix it. Really, this whitespace stuff shouldn't be that 54 | controversial should it? Some particular points that I feel 55 | strongly about: 56 | 57 | * No space after a function name (bad: ``func (arg)``). 58 | * No space after or before a parenthesis (bad: ``func( arg )``). 59 | * Always one space after a comma (bad: ``func(a,b)``). 60 | 61 | * Use ``@@`` to mark something that is suboptimal, or where you have a 62 | concern that it's not right. Try to also date it and put your 63 | username there. 64 | 65 | * Docstrings are good. They should look like:: 66 | 67 | class AClass(object): 68 | """ 69 | doc string... 70 | """ 71 | 72 | Don't use single quotes (''') -- they tend to cause problems in 73 | Emacs. Don't bother trying make the string less vertically compact. 74 | 75 | * Comments go right before the thing they are commenting on. 76 | 77 | * Methods never, ever, ever start with capital letters. Generally 78 | only classes are capitalized. But definitely never methods. 79 | 80 | * Use ``cls`` to refer to a class. Use ``meta`` to refer to a 81 | metaclass (which also happens to be a class, but calling a metaclass 82 | ``cls`` will be confusing). 83 | 84 | * Use ``isinstance`` instead of comparing types. E.g.:: 85 | 86 | if isinstance(var, str): ... 87 | # Bad: 88 | if type(var) is StringType: ... 89 | 90 | * Never, ever use two leading underscores. This is annoyingly 91 | private. If name clashes are a concern, use explicit name mangling 92 | instead (e.g., ``_MyThing_blahblah``). This is essentially the same 93 | thing as double-underscore, only it's transparent where double 94 | underscore obscures. 95 | 96 | * Module names should be unique in the package. Subpackages shouldn't 97 | share module names with sibling or parent packages. Sadly this 98 | isn't possible for ``__init__.py``, but it's otherwise easy enough. 99 | 100 | * Module names should be all lower case, and probably have no 101 | underscores (smushedwords). 102 | 103 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/_static/paste.css: -------------------------------------------------------------------------------- 1 | a.invisible-link { 2 | color: #fff; 3 | text-decoration: none; 4 | } 5 | 6 | a.invisible-link:visited { 7 | color: #fff; 8 | text-decoration: none; 9 | } 10 | 11 | a.invisible:link { 12 | color: #fff; 13 | text-decoration: none; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/community/index.txt: -------------------------------------------------------------------------------- 1 | Community 2 | ========= 3 | 4 | **Much of the Paste community has moved on to other things. These 5 | links are left for reference, but do not expect to find much activity 6 | there.** 7 | 8 | Much of the communication goes on in the `mailing lists 9 | `_; see that page for information on the lists. 10 | 11 | For live IRC discussion, try the ``#pythonpaste`` channel on `Freenode 12 | `_. 13 | 14 | If you find bugs in the code or documentation, please `submit a ticket 15 | `_. You can also `view tickets 16 | `_. 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/community/mailing-list.txt: -------------------------------------------------------------------------------- 1 | Mailing Lists 2 | ============= 3 | 4 | **Much of the Paste community has moved on to other things. These 5 | links are left for reference, but do not expect to find much activity 6 | there.** 7 | 8 | General discussion and questions should go to: 9 | 10 | `paste-users@googlegroups.org `_: 11 | New posts are `on Google Groups `_ `old posts are in their own archive `_ 12 | 13 | More abstract discussion of Python web programming should go to: 14 | 15 | `web-sig@python.org `_: 16 | `Subscribe `__, 17 | `Archives `__ 18 | 19 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/community/repository.txt: -------------------------------------------------------------------------------- 1 | Repository 2 | ========== 3 | 4 | Paste is kept in a Git repository at 5 | http://github.com/cdent/paste 6 | 7 | Go there to make pull requests and report issues. 8 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/download/index.txt: -------------------------------------------------------------------------------- 1 | Downloads 2 | ========= 3 | 4 | Each of these packages is available in several formats. The source 5 | distribution is a complete set of documentation, tests, and the source 6 | files themselves. There are also two "Egg" files: these are files 7 | `easy_install `_ 8 | can install directly into your ``site-packages/`` directory, and are 9 | Python-version specific. The download files for the latest version 10 | are always located on the Cheese Shop pages (listed below). 11 | 12 | * `Paste `_ 13 | * `Paste Script `_ 14 | * `Paste Deploy `_ 15 | * `Paste WebKit `_ 16 | * `Wareweb `_ (deprecated, use `Pylons 17 | `_ instead) 18 | 19 | All the packages are available in some repositories, many rooted in 20 | http://bitbucket.org/ianb/ 21 | 22 | * https://github.com/cdent/paste 23 | * http://bitbucket.org/ianb/pastescript 24 | * http://bitbucket.org/ianb/pastedeploy 25 | * https://github.com/Pylons/webob 26 | * ... and others 27 | 28 | ..note:: Several of these repositories and projects are fairly stale and 29 | insufficiently maintained. Work is in progress to get them on 30 | life support, but it is unlikely they will ever be active projects 31 | again. WebOb is still actively maintained. 32 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/future.txt: -------------------------------------------------------------------------------- 1 | The Future Of Paste 2 | =================== 3 | 4 | Introduction 5 | ------------ 6 | 7 | Paste has been under development for a while, and has lots of code in it. Too much code! The code is largely decoupled except for some core functions shared by many parts of the code. Those core functions are largely replaced in `WebOb `_, and replaced with better implementations. 8 | 9 | The future of these pieces is to split them into independent packages, and refactor the internal Paste dependencies to rely instead on WebOb. 10 | 11 | Already Extracted 12 | ----------------- 13 | 14 | paste.fixture: 15 | WebTest 16 | ScriptTest 17 | 18 | paste.lint: 19 | wsgiref.validate 20 | 21 | paste.exceptions and paste.evalexception: 22 | WebError 23 | 24 | paste.util.template: 25 | Tempita 26 | 27 | 28 | To Be Separated 29 | --------------- 30 | 31 | paste.httpserver and paste.debug.watchthreads: 32 | Not sure what to call this. 33 | 34 | paste.cascade and paste.errordocuments: 35 | Not sure; Ben has an implementation of errordocuments in ``pylons.middleware.StatusCodeRedirect`` 36 | 37 | paste.urlmap, paste.deploy.config.PrefixMiddleware: 38 | In... some routing thing? Together with the previous package? 39 | 40 | paste.proxy: 41 | WSGIProxy (needs lots of cleanup though) 42 | 43 | paste.fileapp, paste.urlparser.StaticURLParser, paste.urlparser.PkgResourcesParser: 44 | In some new file-serving package. 45 | 46 | paste.cgiapp, wphp.fcgi_app: 47 | Some proxyish app... maybe WSGIProxy? 48 | 49 | paste.translogger, paste.debug.prints, paste.util.threadedprint, wsgifilter.proxyapp.DebugHeaders: 50 | Some... other place. Something loggy. 51 | 52 | paste.registry, paste.config: 53 | Not sure. Alberto Valverde expressed interest in splitting out paste.registry. 54 | 55 | paste.cgitb_catcher: 56 | Move to WebError? Not sure if it matters. For some reason people use this, though. 57 | 58 | 59 | To Deprecate 60 | ------------ 61 | 62 | (In that, I won't extract these anywhere; I'm not going to do any big deletes anytime soon, though) 63 | 64 | paste.recursive 65 | Better to do it manually (with webob.Request.get_response) 66 | 67 | paste.wsgiwrappers, paste.request, paste.response, paste.wsgilib, paste.httpheaders, paste.httpexceptions: 68 | All the functionality is already in WebOb. 69 | 70 | paste.urlparser.URLParser: 71 | Really this is tied to paste.webkit more than anything. 72 | 73 | paste.auth.*: 74 | Well, these all need to be refactored, and replacements exist in AuthKit and repoze.who. Some pieces might still have utility. 75 | 76 | paste.debug.profile: 77 | I think repoze.profile supersedes this. 78 | 79 | paste.debug.wdg_validator: 80 | It could get reimplemented with more options for validators, but I'm not really that interested at the moment. The code is nothing fancy. 81 | 82 | paste.transaction: 83 | More general in repoze.tm 84 | 85 | paste.url: 86 | No one uses this 87 | 88 | 89 | Undecided 90 | --------- 91 | 92 | paste.debug.fsdiff: 93 | Maybe ScriptTest? 94 | 95 | paste.session: 96 | It's an okay naive session system. But maybe Beaker makes it irrelevant (Beaker does seem slightly more complex to setup). But then, this can just live here indefinitely. 97 | 98 | paste.gzipper: 99 | I'm a little uncomfortable with this in concept. It's largely in WebOb right now, but not as middleware. 100 | 101 | paste.reloader: 102 | Maybe this should be moved to paste.script (i.e., paster serve) 103 | 104 | paste.debug.debugapp, paste.script.testapp: 105 | Alongside other debugging tools, I guess 106 | 107 | paste.progress: 108 | Not sure this works. 109 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/include/contact.txt: -------------------------------------------------------------------------------- 1 | If you have questions about this document, please contact the `paste 2 | mailing list `_ 3 | or try IRC (``#pythonpaste`` on freenode.net). If there's something that 4 | confused you and you want to give feedback, please `submit an issue 5 | `_. 6 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/include/reference_header.txt: -------------------------------------------------------------------------------- 1 | Paste Reference Document 2 | @@@@@@@@@@@@@@@@@@@@@@@@ 3 | 4 | .. contents:: 5 | 6 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/index.txt: -------------------------------------------------------------------------------- 1 | Python Paste 2 | ============ 3 | 4 | This is a new copy of the documentation for Paste. The project is now being 5 | maintained on limited life-support from https://github.com/cdent/paste 6 | **Please consider other options.** 7 | 8 | Many of the links you will find in these docs will be out of date. If you 9 | know of a better destination for a link please submit an issue or pull 10 | request at the GitHub repository above. 11 | 12 | Contents: 13 | 14 | .. toctree:: 15 | :maxdepth: 1 16 | 17 | news 18 | future 19 | testing-applications 20 | url-parsing-with-wsgi 21 | do-it-yourself-framework 22 | paste-httpserver-threadpool 23 | developer-features 24 | DeveloperGuidelines 25 | StyleGuide 26 | paste-httpserver-threadpool 27 | testing-applications 28 | url-parsing-with-wsgi 29 | community/index.txt 30 | community/mailing-list.txt 31 | community/repository.txt 32 | download/index.txt 33 | license 34 | 35 | Indices and tables 36 | ================== 37 | 38 | * :ref:`genindex` 39 | * :ref:`modindex` 40 | * :ref:`search` 41 | 42 | .. comment: 43 | 44 | I want to put these somewhere sometime, but no place for them now... 45 | Python Paste -- 50% tastier than Elmer's! 46 | Paste: making the web sticky. 47 | Fix broken websites by applying Paste liberally. 48 | Paste: paper over your inconsistencies. 49 | Paste: a soft mixture of malleable consistency. 50 | Paste: a tasty mixture to be spread on bread or crackers. 51 | Paste: glue that won't hurt you if you eat it. 52 | Python Paste: the web extruded into the form of a snake. 53 | Paste: the vinegar eel. 54 | Paste: you bring the cut. 55 | Paste: a doughy substance from which to make metaphorical web cupcakes. 56 | LAMP? LAMPP! 57 | Putting the P in Wep 2.0! 58 | Frankenweb crush tiny humans! 59 | DSL? DSF! 60 | Paste: Comfort for the framework-scarred 61 | 62 | Other Components 63 | ================ 64 | 65 | * `Paste Deploy <./deploy/>`_ 66 | 67 | * `Paste Script <./script/>`_ 68 | 69 | * `WebOb `_ 70 | 71 | * `WSGI specification (PEP 333) `_ 72 | 73 | License 74 | ======= 75 | 76 | Paste is distributed under the `MIT license 77 | `_. 78 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006-2007 Ian Bicking and Contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/auth.auth_tkt.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.auth.auth_tkt` -- auth_tkt cookie parsing 2 | ===================================================== 3 | 4 | .. automodule:: paste.auth.auth_tkt 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: AuthTKTMiddleware 10 | .. autofunction:: make_auth_tkt_middleware 11 | .. autoclass:: AuthTicket 12 | .. autoexception:: BadTicket 13 | 14 | 15 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/auth.basic.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.auth.basic` -- Basic HTTP authentication 2 | ==================================================== 3 | 4 | .. automodule:: paste.auth.basic 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: AuthBasicAuthenticator 10 | .. autoclass:: AuthBasicHandler 11 | .. autofunction:: make_basic 12 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/auth.cas.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.auth.cas` -- CAS authentication 2 | =========================================== 3 | 4 | .. automodule:: paste.auth.cas 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: AuthCASHandler 10 | 11 | 12 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/auth.cookie.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.auth.cookie` -- Cookie-based authentication 2 | ======================================================= 3 | 4 | .. automodule:: paste.auth.cookie 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: AuthCookieSigner 10 | .. autoclass:: AuthCookieHandler 11 | .. autoclass:: AuthCookieEnviron 12 | .. autofunction:: make_auth_cookie 13 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/auth.digest.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.auth.digest` -- HTTP Digest login 2 | ============================================= 3 | 4 | .. automodule:: paste.auth.digest 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: AuthDigestAuthenticator 10 | .. autoclass:: AuthDigestHandler 11 | .. autofunction:: digest_password 12 | .. autofunction:: make_digest 13 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/auth.form.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.auth.form` -- HTML form/cookie authentication 2 | ========================================================= 3 | 4 | .. automodule:: paste.auth.form 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: AuthFormHandler 10 | .. autofunction:: make_form 11 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/auth.grantip.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.auth.grantip` -- Set user and groups based on IP address 2 | ==================================================================== 3 | 4 | .. automodule:: paste.auth.grantip 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: GrantIPMiddleware 10 | .. autofunction:: make_grantip 11 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/auth.multi.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.auth.multi` -- Authentication via one of multiple methods 2 | ===================================================================== 3 | 4 | .. automodule:: paste.auth.multi 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: MultiHandler 10 | 11 | 12 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/cascade.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.cascade` -- send requests to multiple applications until success 2 | ============================================================================ 3 | 4 | .. automodule:: paste.cascade 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: Cascade 10 | .. autofunction:: make_cascade 11 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/cgiapp.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.cgiapp` -- run CGI scripts as WSGI applications 2 | =========================================================== 3 | 4 | .. automodule:: paste.cgiapp 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: CGIApplication 10 | .. autoexception:: CGIError 11 | .. autofunction:: make_cgi_application 12 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/cgitb_catcher.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.cgitb_catcher` -- catch exceptions using cgitb 2 | ========================================================== 3 | 4 | .. automodule:: paste.cgitb_catcher 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: CgitbMiddleware 10 | .. autofunction:: make_cgitb_middleware 11 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/debug.debugapp.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.debug.debugapp` -- debug app 2 | ======================================== 3 | 4 | .. automodule:: paste.debug.debugapp 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: SimpleApplication 10 | .. autoclass:: SlowConsumer 11 | .. autofunction:: make_test_app 12 | .. autofunction:: make_slow_app 13 | 14 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/debug.fsdiff.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.debug.fsdiff` -- Show differences between directories 2 | ================================================================= 3 | 4 | .. automodule:: paste.debug.fsdiff 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: Diff 10 | .. autoclass:: Snapshot 11 | .. autoclass:: File 12 | .. autoclass:: Dir 13 | .. autofunction:: report_expected_diffs 14 | .. autofunction:: show_diff 15 | 16 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/debug.prints.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.debug.prints` -- capture print output 2 | ================================================= 3 | 4 | .. automodule:: paste.debug.prints 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: PrintDebugMiddleware 10 | 11 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/debug.profile.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.debug.profile` -- profile applications and requests 2 | =============================================================== 3 | 4 | .. automodule:: paste.debug.profile 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: ProfileMiddleware 10 | .. autofunction:: make_profile_middleware 11 | .. autofunction:: profile_decorator 12 | 13 | 14 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/debug.watchthreads.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.debug.watchthreads` -- watch thread workers in paste.httpserver 2 | =========================================================================== 3 | 4 | .. automodule:: paste.debug.watchthreads 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: WatchThreads 10 | .. autofunction:: make_watch_threads 11 | .. autofunction:: make_bad_app 12 | 13 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/debug.wdg_validate.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.debug.debugapp` -- debug app 2 | ======================================== 3 | 4 | .. automodule:: paste.debug.wdg_validate 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: WDGValidateMiddleware 10 | .. autofunction:: make_wdg_validate_middleware 11 | 12 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/errordocument.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.errordocument` -- Do internal redirects for error responses 2 | ======================================================================= 3 | 4 | .. automodule:: paste.errordocument 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: StatusBasedForward 10 | .. autofunction:: make_errordocument 11 | 12 | 13 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/evalexception.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.evalexception` -- Interactive debugging for errors 2 | ============================================================== 3 | 4 | .. automodule:: paste.evalexception 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: EvalException 10 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/exceptions.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.exceptions` -- Catch, display, and notify for exceptions 2 | ==================================================================== 3 | 4 | .. automodule:: paste.exceptions.errormiddleware 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: ErrorMiddleware 10 | .. autofunction:: handle_exception 11 | .. autofunction:: make_error_middleware 12 | 13 | :mod:`paste.exceptions.collector` -- Collection information from exceptions 14 | =========================================================================== 15 | 16 | .. automodule:: paste.exceptions.collector 17 | 18 | Module Contents 19 | --------------- 20 | 21 | .. autoclass:: ExceptionCollector 22 | .. autofunction:: collect_exception 23 | 24 | :mod:`paste.exceptions.formatter` -- Format exception information 25 | ================================================================= 26 | 27 | .. automodule:: paste.exceptions.formatter 28 | 29 | Module Contents 30 | --------------- 31 | 32 | .. autoclass:: TextFormatter 33 | .. autoclass:: HTMLFormatter 34 | .. autofunction:: format_html 35 | .. autofunction:: format_text 36 | 37 | :mod:`paste.exceptions.reporter` -- Report exceptions 38 | ===================================================== 39 | 40 | .. automodule:: paste.exceptions.reporter 41 | 42 | Module Contents 43 | --------------- 44 | 45 | .. autoclass:: EmailReporter 46 | .. autoclass:: LogReporter 47 | .. autoclass:: FileReporter 48 | .. autoclass:: WSGIAppReporter 49 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/fileapp.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.fileapp` -- Serve files 2 | =================================== 3 | 4 | .. automodule:: paste.fileapp 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: FileApp 10 | .. autoclass:: DirectoryApp 11 | .. autofunction:: DataApp 12 | .. autofunction:: ArchiveStore 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/fixture.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.fixture` -- Test applications 2 | ========================================= 3 | 4 | .. contents:: 5 | 6 | .. automodule:: paste.fixture 7 | 8 | Module Contents 9 | --------------- 10 | 11 | .. autoclass:: TestApp 12 | :members: 13 | .. autoclass:: TestRequest 14 | 15 | Forms 16 | ----- 17 | 18 | .. autoclass:: Form 19 | :members: 20 | .. autoclass:: Field 21 | :members: 22 | .. autoclass:: Select 23 | .. autoclass:: Radio 24 | .. autoclass:: Checkbox 25 | .. autoclass:: Text 26 | .. autoclass:: Textarea 27 | .. autoclass:: Hidden 28 | .. autoclass:: Submit 29 | 30 | Script Testing 31 | -------------- 32 | 33 | .. autoclass:: TestFileEnvironment 34 | :members: 35 | .. autoclass:: ProcResult 36 | :members: 37 | .. autoclass:: FoundFile 38 | .. autoclass:: FoundDir 39 | 40 | 41 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/gzipper.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.gzipper` -- Gzip-compress responses 2 | =============================================== 3 | 4 | .. automodule:: paste.gzipper 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: middleware 10 | .. autofunction:: make_gzip_middleware 11 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/httpexceptions.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.httpexceptions` -- Easily product HTTP errors 2 | ========================================================= 3 | 4 | .. automodule:: paste.httpexceptions 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: HTTPExceptionHandler 10 | .. autofunction:: make_middleware 11 | 12 | Exceptions 13 | ---------- 14 | 15 | .. autoexception:: HTTPException 16 | .. autoexception:: HTTPError 17 | .. autoexception:: HTTPRedirection 18 | .. autoexception:: HTTPMultipleChoices 19 | .. autoexception:: HTTPMovedPermanently 20 | .. autoexception:: HTTPFound 21 | .. autoexception:: HTTPNotModified 22 | .. autoexception:: HTTPUseProxy 23 | .. autoexception:: HTTPTemporaryRedirect 24 | .. autoexception:: HTTPClientError 25 | .. autoexception:: HTTPBadRequest 26 | .. autoexception:: HTTPUnauthorized 27 | .. autoexception:: HTTPPaymentRequired 28 | .. autoexception:: HTTPForbidden 29 | .. autoexception:: HTTPNotFound 30 | .. autoexception:: HTTPMethodNotAllowed 31 | .. autoexception:: HTTPNotAcceptable 32 | .. autoexception:: HTTPProxyAuthenticationRequired 33 | .. autoexception:: HTTPRequestTimeout 34 | .. autoexception:: HTTPConflict 35 | .. autoexception:: HTTPGone 36 | .. autoexception:: HTTPLengthRequired 37 | .. autoexception:: HTTPPreconditionFailed 38 | .. autoexception:: HTTPRequestEntityTooLarge 39 | .. autoexception:: HTTPRequestURITooLong 40 | .. autoexception:: HTTPUnsupportedMediaType 41 | .. autoexception:: HTTPRequestRangeNotSatisfiable 42 | .. autoexception:: HTTPExpectationFailed 43 | .. autoexception:: HTTPServerError 44 | .. autoexception:: HTTPInternalServerError 45 | .. autoexception:: HTTPNotImplemented 46 | .. autoexception:: HTTPBadGateway 47 | .. autoexception:: HTTPServiceUnavailable 48 | .. autoexception:: HTTPGatewayTimeout 49 | .. autoexception:: HTTPVersionNotSupported 50 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/httpheaders.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.httpheaders` -- Manipulate HTTP Headers 2 | =================================================== 3 | 4 | .. comment: 5 | I just don't feel like documenting the items... 6 | 7 | .. automodule:: paste.httpheaders 8 | :members: 9 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/httpserver.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.httpserver` -- HTTP server 2 | ====================================== 3 | 4 | .. automodule:: paste.httpserver 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autofunction:: serve 10 | .. autofunction:: server_runner 11 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/lint.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.lint` -- Check for the validity of WSGI requests and responses 2 | ========================================================================== 3 | 4 | .. automodule:: paste.lint 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autofunction:: middleware 10 | .. autoexception:: WSGIWarning 11 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/pony.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.pony` -- Add pony power to your application 2 | ======================================================= 3 | 4 | .. automodule:: paste.pony 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: PonyMiddleware 10 | .. autofunction:: make_pony 11 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/progress.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.progress` -- Track progress of uploads 2 | ================================================== 3 | 4 | .. automodule:: paste.progress 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: UploadProgressMonitor 10 | .. autoclass:: UploadProgressReporter 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/proxy.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.proxy` -- Proxy WSGI requests to HTTP requests 2 | ========================================================== 3 | 4 | .. automodule:: paste.proxy 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: Proxy 10 | .. autofunction:: make_proxy 11 | .. autoclass:: TransparentProxy 12 | .. autofunction:: make_transparent_proxy 13 | 14 | 15 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/recursive.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.recursive` -- internal requests 2 | =========================================== 3 | 4 | .. automodule:: paste.recursive 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: RecursiveMiddleware 10 | .. autofunction:: ForwardRequestException 11 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/registry.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.registry` -- Manage thread-local request-specific objects 2 | ===================================================================== 3 | 4 | .. automodule:: paste.registry 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: StackedObjectProxy 10 | .. autoclass:: Registry 11 | .. autoclass:: RegistryManager 12 | .. autoclass:: StackedObjectRestorer 13 | .. autofunction:: make_registry_manager 14 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/reloader.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.reloader` -- Monitor for file changes to restart the process 2 | ======================================================================== 3 | 4 | .. automodule:: paste.reloader 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autofunction:: install 10 | .. autoclass:: Monitor 11 | .. autofunction:: watch_file 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/request.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.request` -- Utility functions for the WSGI environment 2 | ================================================================== 3 | 4 | .. automodule:: paste.request 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autofunction:: get_cookies 10 | .. autofunction:: get_cookie_dict 11 | .. autofunction:: parse_querystring 12 | .. autofunction:: parse_formvars 13 | .. autofunction:: construct_url 14 | .. autofunction:: path_info_split 15 | .. autofunction:: path_info_pop 16 | .. autofunction:: resolve_relative_url 17 | .. autoclass:: EnvironHeaders 18 | 19 | 20 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/response.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.response` -- Utility functions for producing responses 2 | ================================================================== 3 | 4 | .. automodule:: paste.response 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: HeaderDict 10 | .. autofunction:: has_header 11 | .. autofunction:: header_value 12 | .. autofunction:: remove_header 13 | .. autofunction:: replace_header 14 | 15 | 16 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/session.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.session` -- Simple file-based sessions 2 | ================================================== 3 | 4 | .. automodule:: paste.session 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: SessionMiddleware 10 | .. autofunction:: make_session_middleware 11 | 12 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/transaction.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.transaction` -- DB-API transactions 2 | =============================================== 3 | 4 | .. automodule:: paste.transaction 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: TransactionManagerMiddleware 10 | .. autoclass:: ConnectionFactory 11 | .. autofunction:: BasicTransactionHandler 12 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/translogger.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.translogger` -- Log requests 2 | ======================================== 3 | 4 | .. automodule:: paste.translogger 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: TransLogger 10 | .. autofunction:: make_filter 11 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/url.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.url` -- URL convenience class 2 | ========================================= 3 | 4 | .. automodule:: paste.url 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: URL 10 | .. autoclass:: Image 11 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/urlmap.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.urlmap` -- Map URL paths 2 | ==================================== 3 | 4 | .. automodule:: paste.urlmap 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: URLMap 10 | .. autofunction:: urlmap_factory 11 | .. autoclass:: PathProxyURLMap 12 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/urlparser.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.urlparser` -- Handle URL paths and server static files 2 | ================================================================== 3 | 4 | .. automodule:: paste.urlparser 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: StaticURLParser 10 | .. autofunction:: make_static 11 | .. autoclass:: PkgResourcesParser 12 | .. autofunction:: make_pkg_resources 13 | .. autoclass:: URLParser 14 | .. autofunction:: make_url_parser 15 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/util.import_string.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.util.import_string` -- Import objects from strings 2 | ============================================================== 3 | 4 | .. automodule:: paste.util.import_string 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autofunction:: eval_import 10 | .. autofunction:: simple_import 11 | .. autofunction:: import_module 12 | .. autofunction:: try_import_module 13 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/util.multidict.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.util.multidict` -- Dictionaries with multiple values 2 | ================================================================ 3 | 4 | .. automodule:: paste.util.multidict 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: MultiDict 10 | .. autoclass:: UnicodeMultiDict 11 | 12 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/wsgilib.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.wsgilib` -- Miscellaneous WSGI utility functions 2 | ============================================================ 3 | 4 | .. automodule:: paste.wsgilib 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autofunction:: add_close 10 | .. autofunction:: add_start_close 11 | .. autofunction:: chained_app_iters 12 | .. autoclass:: encode_unicode_app_iter 13 | .. autofunction:: catch_errors 14 | .. autofunction:: catch_errors_app 15 | .. autofunction:: raw_interactive 16 | .. autofunction:: interactive 17 | .. autofunction:: dump_environ 18 | .. autofunction:: intercept_output 19 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/modules/wsgiwrappers.txt: -------------------------------------------------------------------------------- 1 | :mod:`paste.wsgiwrappers` -- Wrapper functions for WSGI request and response 2 | ============================================================================ 3 | 4 | .. automodule:: paste.wsgiwrappers 5 | 6 | Module Contents 7 | --------------- 8 | 9 | .. autoclass:: WSGIRequest 10 | .. autoclass:: WSGIResponse 11 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/test_server.ini: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | error_email = ianb@colorstudy.com 3 | 4 | [app:main] 5 | use = egg:PasteScript#test 6 | 7 | [server:main] 8 | use = egg:Paste#http 9 | host = 127.0.0.1:8081 10 | # These options make it easier to trigger the thread pool catches 11 | # (i.e., threads are hung fast, killed fast, spawn fast, and the 12 | # whole process dies quickly due to zombies) 13 | threadpool_workers = 3 14 | threadpool_hung_thread_limit = 10 15 | threadpool_kill_thread_limit = 20 16 | threadpool_spawn_if_under = 2 17 | threadpool_max_zombie_threads_before_die = 2 18 | threadpool_hung_check_period = 1 19 | threadpool_dying_limit = 10 20 | 21 | [server:cherrypy] 22 | use = egg:PasteScript#cherrypy 23 | host = 127.0.0.1:8080 24 | 25 | [filter-app:watch_threads] 26 | use = egg:Paste#error_catcher 27 | debug = true 28 | next = watch_threads_inner 29 | 30 | [app:watch_threads_inner] 31 | use = egg:Paste#urlmap 32 | /bad = bad_app 33 | / = watch_app 34 | 35 | [app:watch_app] 36 | use = egg:Paste#watch_threads 37 | allow_kill = true 38 | 39 | [app:bad_app] 40 | paste.app_factory = paste.debug.watchthreads:make_bad_app 41 | 42 | 43 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/web/site.js: -------------------------------------------------------------------------------- 1 | function setup_dropdowns() { 2 | var els = document.getElementsByTagName('UL'); 3 | for (var i = 0; i < els.length; i++) { 4 | var el = els[i]; 5 | if (el.className.search(/\bcontents\b/) > -1) { 6 | enable_dropdown(el); 7 | } 8 | } 9 | } 10 | 11 | function enable_dropdown(el) { 12 | var title = el.getElementsByTagName('LI')[0]; 13 | var plus_minus = document.createTextNode(' [-]'); 14 | if (title.childNodes[0].tagName != 'A') { 15 | anchor = document.createElement('A'); 16 | while (title.childNodes.length) { 17 | anchor.appendChild(title.childNodes[0]); 18 | } 19 | anchor.setAttribute('href', '#'); 20 | anchor.style.padding = '1px'; 21 | title.appendChild(anchor); 22 | } else { 23 | anchor = title.childNodes[0]; 24 | } 25 | anchor.appendChild(plus_minus); 26 | function show_hide() { 27 | if (el.sub_hidden) { 28 | set_sub_li(el, ''); 29 | anchor.removeChild(plus_minus); 30 | plus_minus = document.createTextNode(' [-]'); 31 | anchor.appendChild(plus_minus); 32 | } else { 33 | set_sub_li(el, 'none'); 34 | anchor.removeChild(plus_minus); 35 | plus_minus = document.createTextNode(' [+]'); 36 | anchor.appendChild(plus_minus); 37 | } 38 | el.sub_hidden = ! el.sub_hidden; 39 | return false; 40 | } 41 | anchor.onclick = show_hide; 42 | show_hide(); 43 | } 44 | 45 | function set_sub_li(list, display) { 46 | var sub = list.getElementsByTagName('LI'); 47 | for (var i = 1; i < sub.length; i++) { 48 | sub[i].style.display = display; 49 | } 50 | } 51 | 52 | function add_onload(func) { 53 | if (window.onload) { 54 | var old_onload = window.onload; 55 | function new_onload() { 56 | old_onload(); 57 | func(); 58 | } 59 | window.onload = new_onload; 60 | } else { 61 | window.onload = func; 62 | } 63 | } 64 | 65 | add_onload(setup_dropdowns); 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/docs/web/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Helvetica,Arial,sans-serif; 3 | margin: 0; 4 | background-color: #fff; 5 | color: #000; 6 | } 7 | 8 | i, em { 9 | font-family: Times New Roman,Times,serif; 10 | } 11 | 12 | a:link { 13 | color: #730; 14 | } 15 | 16 | a:visited { 17 | color: #402; 18 | } 19 | 20 | a:hover { 21 | background-color: #fd8; 22 | } 23 | 24 | div#header { 25 | display: block; 26 | background-color: #930; 27 | color: #fd6; 28 | border-bottom: 3px solid #f70; 29 | padding: 3px; 30 | font-size: 30px; 31 | } 32 | 33 | div#header h1 { 34 | padding: 0; 35 | margin: 0; 36 | font-size: 1.5em; 37 | } 38 | 39 | div#nav { 40 | float: left; 41 | background-color: #fd9; 42 | border: 1px solid #f70; 43 | margin-right: 1em; 44 | border-bottom: 1px solid #f70; 45 | width: 200px; 46 | } 47 | 48 | div#nav ul { 49 | padding: 0; 50 | margin: 0; 51 | } 52 | 53 | div#nav li { 54 | list-style: none; 55 | margin: 0; 56 | } 57 | 58 | div#nav ul li ul li a { 59 | padding: 2px 2em 2px 2em; 60 | font-weight: normal; 61 | } 62 | 63 | div#nav a { 64 | display: block; 65 | padding: 2px 1em 2px 1em; 66 | text-decoration: none; 67 | color: #400; 68 | font-weight: bold; 69 | } 70 | 71 | div#nav a:hover { 72 | background-color: #f80; 73 | color: #fff; 74 | } 75 | 76 | /* If I ever do menus that show the "current" page, that would be 77 | by marking some "links" as selected */ 78 | div#nav span.selected { 79 | display: block; 80 | font-weight: bold; 81 | padding: 2px 1em 2px 1em; 82 | } 83 | 84 | div#body { 85 | padding: 1em; 86 | } 87 | 88 | h1.page-title { 89 | margin-top: 0; 90 | } -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/__init__$py.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/thirdpart/Paste-3.0.5/paste/__init__$py.class -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/__init__.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | try: 4 | import pkg_resources 5 | pkg_resources.declare_namespace(__name__) 6 | except ImportError: 7 | # don't prevent use of paste if pkg_resources isn't installed 8 | from pkgutil import extend_path 9 | __path__ = extend_path(__path__, __name__) 10 | 11 | try: 12 | import modulefinder 13 | except ImportError: 14 | pass 15 | else: 16 | for p in __path__: 17 | modulefinder.AddPackagePath(__name__, p) 18 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/auth/__init__.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | """ 4 | Package for authentication/identification of requests. 5 | 6 | The objective of this package is to provide single-focused middleware 7 | components that implement a particular specification. Integration of 8 | the components into a usable system is up to a higher-level framework. 9 | """ 10 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/auth/multi.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Clark C. Evans 2 | # This module is part of the Python Paste Project and is released under 3 | # the MIT License: http://www.opensource.org/licenses/mit-license.php 4 | # This code was written with funding by http://prometheusresearch.com 5 | """ 6 | Authentication via Multiple Methods 7 | 8 | In some environments, the choice of authentication method to be used 9 | depends upon the environment and is not "fixed". This middleware allows 10 | N authentication methods to be registered along with a goodness function 11 | which determines which method should be used. The following example 12 | demonstrates how to use both form and digest authentication in a server 13 | stack; by default it uses form-based authentication unless 14 | ``*authmeth=digest`` is specified as a query argument. 15 | 16 | >>> from paste.auth import form, cookie, digest, multi 17 | >>> from paste.wsgilib import dump_environ 18 | >>> from paste.httpserver import serve 19 | >>> 20 | >>> multi = multi.MultiHandler(dump_environ) 21 | >>> def authfunc(environ, realm, user): 22 | ... return digest.digest_password(realm, user, user) 23 | >>> multi.add_method('digest', digest.middleware, "Test Realm", authfunc) 24 | >>> multi.set_query_argument('digest') 25 | >>> 26 | >>> def authfunc(environ, username, password): 27 | ... return username == password 28 | >>> multi.add_method('form', form.middleware, authfunc) 29 | >>> multi.set_default('form') 30 | >>> serve(cookie.middleware(multi)) 31 | serving on... 32 | 33 | """ 34 | 35 | class MultiHandler(object): 36 | """ 37 | Multiple Authentication Handler 38 | 39 | This middleware provides two othogonal facilities: 40 | 41 | - a manner to register any number of authentication middlewares 42 | 43 | - a mechanism to register predicates which cause one of the 44 | registered middlewares to be used depending upon the request 45 | 46 | If none of the predicates returns True, then the application is 47 | invoked directly without middleware 48 | """ 49 | def __init__(self, application): 50 | self.application = application 51 | self.default = application 52 | self.binding = {} 53 | self.predicate = [] 54 | def add_method(self, name, factory, *args, **kwargs): 55 | self.binding[name] = factory(self.application, *args, **kwargs) 56 | def add_predicate(self, name, checker): 57 | self.predicate.append((checker, self.binding[name])) 58 | def set_default(self, name): 59 | """ set default authentication method """ 60 | self.default = self.binding[name] 61 | def set_query_argument(self, name, key = '*authmeth', value = None): 62 | """ choose authentication method based on a query argument """ 63 | lookfor = "%s=%s" % (key, value or name) 64 | self.add_predicate(name, 65 | lambda environ: lookfor in environ.get('QUERY_STRING','')) 66 | def __call__(self, environ, start_response): 67 | for (checker, binding) in self.predicate: 68 | if checker(environ): 69 | return binding(environ, start_response) 70 | return self.default(environ, start_response) 71 | 72 | middleware = MultiHandler 73 | 74 | __all__ = ['MultiHandler'] 75 | 76 | if "__main__" == __name__: 77 | import doctest 78 | doctest.testmod(optionflags=doctest.ELLIPSIS) 79 | 80 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/cowbell/bell-ascending.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/thirdpart/Paste-3.0.5/paste/cowbell/bell-ascending.png -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/cowbell/bell-descending.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/thirdpart/Paste-3.0.5/paste/cowbell/bell-descending.png -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/debug/__init__.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | """ 4 | Package for debugging and development tools 5 | """ 6 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/debug/debugapp.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | # (c) 2005 Clark C. Evans 4 | # This module is part of the Python Paste Project and is released under 5 | # the MIT License: http://www.opensource.org/licenses/mit-license.php 6 | # This code was written with funding by http://prometheusresearch.com 7 | """ 8 | Various Applications for Debugging/Testing Purposes 9 | """ 10 | 11 | import time 12 | __all__ = ['SimpleApplication', 'SlowConsumer'] 13 | 14 | 15 | class SimpleApplication(object): 16 | """ 17 | Produces a simple web page 18 | """ 19 | def __call__(self, environ, start_response): 20 | body = b"simple" 21 | start_response("200 OK", [('Content-Type', 'text/html'), 22 | ('Content-Length', str(len(body)))]) 23 | return [body] 24 | 25 | class SlowConsumer(object): 26 | """ 27 | Consumes an upload slowly... 28 | 29 | NOTE: This should use the iterator form of ``wsgi.input``, 30 | but it isn't implemented in paste.httpserver. 31 | """ 32 | def __init__(self, chunk_size = 4096, delay = 1, progress = True): 33 | self.chunk_size = chunk_size 34 | self.delay = delay 35 | self.progress = True 36 | 37 | def __call__(self, environ, start_response): 38 | size = 0 39 | total = environ.get('CONTENT_LENGTH') 40 | if total: 41 | remaining = int(total) 42 | while remaining > 0: 43 | if self.progress: 44 | print("%s of %s remaining" % (remaining, total)) 45 | if remaining > 4096: 46 | chunk = environ['wsgi.input'].read(4096) 47 | else: 48 | chunk = environ['wsgi.input'].read(remaining) 49 | if not chunk: 50 | break 51 | size += len(chunk) 52 | remaining -= len(chunk) 53 | if self.delay: 54 | time.sleep(self.delay) 55 | body = "%d bytes" % size 56 | else: 57 | body = (b'\n' 58 | b'
\n' 59 | b'\n' 60 | b'\n' 61 | b'
\n') 62 | print("bingles") 63 | start_response("200 OK", [('Content-Type', 'text/html'), 64 | ('Content-Length', str(len(body)))]) 65 | return [body] 66 | 67 | def make_test_app(global_conf): 68 | return SimpleApplication() 69 | 70 | make_test_app.__doc__ = SimpleApplication.__doc__ 71 | 72 | def make_slow_app(global_conf, chunk_size=4096, delay=1, progress=True): 73 | from paste.deploy.converters import asbool 74 | return SlowConsumer( 75 | chunk_size=int(chunk_size), 76 | delay=int(delay), 77 | progress=asbool(progress)) 78 | 79 | make_slow_app.__doc__ = SlowConsumer.__doc__ 80 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/debug/testserver.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Clark C. Evans 2 | # This module is part of the Python Paste Project and is released under 3 | # the MIT License: http://www.opensource.org/licenses/mit-license.php 4 | # This code was written with funding by http://prometheusresearch.com 5 | """ 6 | WSGI Test Server 7 | 8 | This builds upon paste.util.baseserver to customize it for regressions 9 | where using raw_interactive won't do. 10 | 11 | 12 | """ 13 | import time 14 | from paste.httpserver import * 15 | 16 | class WSGIRegressionServer(WSGIServer): 17 | """ 18 | A threaded WSGIServer for use in regression testing. To use this 19 | module, call serve(application, regression=True), and then call 20 | server.accept() to let it handle one request. When finished, use 21 | server.stop() to shutdown the server. Note that all pending requests 22 | are processed before the server shuts down. 23 | """ 24 | defaulttimeout = 10 25 | def __init__ (self, *args, **kwargs): 26 | WSGIServer.__init__(self, *args, **kwargs) 27 | self.stopping = [] 28 | self.pending = [] 29 | self.timeout = self.defaulttimeout 30 | # this is a local connection, be quick 31 | self.socket.settimeout(2) 32 | def serve_forever(self): 33 | from threading import Thread 34 | thread = Thread(target=self.serve_pending) 35 | thread.start() 36 | def reset_expires(self): 37 | if self.timeout: 38 | self.expires = time.time() + self.timeout 39 | def close_request(self, *args, **kwargs): 40 | WSGIServer.close_request(self, *args, **kwargs) 41 | self.pending.pop() 42 | self.reset_expires() 43 | def serve_pending(self): 44 | self.reset_expires() 45 | while not self.stopping or self.pending: 46 | now = time.time() 47 | if now > self.expires and self.timeout: 48 | # note regression test doesn't handle exceptions in 49 | # threads very well; so we just print and exit 50 | print("\nWARNING: WSGIRegressionServer timeout exceeded\n") 51 | break 52 | if self.pending: 53 | self.handle_request() 54 | time.sleep(.1) 55 | def stop(self): 56 | """ stop the server (called from tester's thread) """ 57 | self.stopping.append(True) 58 | def accept(self, count = 1): 59 | """ accept another request (called from tester's thread) """ 60 | assert not self.stopping 61 | [self.pending.append(True) for x in range(count)] 62 | 63 | def serve(application, host=None, port=None, handler=None): 64 | server = WSGIRegressionServer(application, host, port, handler) 65 | print("serving on %s:%s" % server.server_address) 66 | server.serve_forever() 67 | return server 68 | 69 | if __name__ == '__main__': 70 | from six.moves.urllib.request import urlopen 71 | from paste.wsgilib import dump_environ 72 | server = serve(dump_environ) 73 | baseuri = ("http://%s:%s" % server.server_address) 74 | 75 | def fetch(path): 76 | # tell the server to humor exactly one more request 77 | server.accept(1) 78 | # not needed; but this is what you do if the server 79 | # may not respond in a resonable time period 80 | import socket 81 | socket.setdefaulttimeout(5) 82 | # build a uri, fetch and return 83 | return urlopen(baseuri + path).read() 84 | 85 | assert "PATH_INFO: /foo" in fetch("/foo") 86 | assert "PATH_INFO: /womble" in fetch("/womble") 87 | 88 | # ok, let's make one more final request... 89 | server.accept(1) 90 | # and then schedule a stop() 91 | server.stop() 92 | # and then... fetch it... 93 | urlopen(baseuri) 94 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/evalexception/__init__.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | """ 4 | An exception handler for interactive debugging 5 | """ 6 | from paste.evalexception.middleware import EvalException 7 | 8 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/evalexception/evalcontext.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | from six.moves import cStringIO as StringIO 4 | import traceback 5 | import threading 6 | import pdb 7 | import six 8 | import sys 9 | 10 | exec_lock = threading.Lock() 11 | 12 | class EvalContext(object): 13 | 14 | """ 15 | Class that represents a interactive interface. It has its own 16 | namespace. Use eval_context.exec_expr(expr) to run commands; the 17 | output of those commands is returned, as are print statements. 18 | 19 | This is essentially what doctest does, and is taken directly from 20 | doctest. 21 | """ 22 | 23 | def __init__(self, namespace, globs): 24 | self.namespace = namespace 25 | self.globs = globs 26 | 27 | def exec_expr(self, s): 28 | out = StringIO() 29 | exec_lock.acquire() 30 | save_stdout = sys.stdout 31 | try: 32 | debugger = _OutputRedirectingPdb(save_stdout) 33 | debugger.reset() 34 | pdb.set_trace = debugger.set_trace 35 | sys.stdout = out 36 | try: 37 | code = compile(s, '', "single", 0, 1) 38 | six.exec_(code, self.globs, self.namespace) 39 | debugger.set_continue() 40 | except KeyboardInterrupt: 41 | raise 42 | except: 43 | traceback.print_exc(file=out) 44 | debugger.set_continue() 45 | finally: 46 | sys.stdout = save_stdout 47 | exec_lock.release() 48 | return out.getvalue() 49 | 50 | # From doctest 51 | class _OutputRedirectingPdb(pdb.Pdb): 52 | """ 53 | A specialized version of the python debugger that redirects stdout 54 | to a given stream when interacting with the user. Stdout is *not* 55 | redirected when traced code is executed. 56 | """ 57 | def __init__(self, out): 58 | self.__out = out 59 | pdb.Pdb.__init__(self) 60 | 61 | def trace_dispatch(self, *args): 62 | # Redirect stdout to the given stream. 63 | save_stdout = sys.stdout 64 | sys.stdout = self.__out 65 | # Call Pdb's trace dispatch method. 66 | try: 67 | return pdb.Pdb.trace_dispatch(self, *args) 68 | finally: 69 | sys.stdout = save_stdout 70 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/evalexception/media/minus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/thirdpart/Paste-3.0.5/paste/evalexception/media/minus.jpg -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/evalexception/media/plus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/thirdpart/Paste-3.0.5/paste/evalexception/media/plus.jpg -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/exceptions/__init__.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | """ 4 | Package for catching exceptions and displaying annotated exception 5 | reports 6 | """ 7 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/home/lj/.jython-cache/classes/__init__$py.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/thirdpart/Paste-3.0.5/paste/home/lj/.jython-cache/classes/__init__$py.class -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/httpserver$py.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/thirdpart/Paste-3.0.5/paste/httpserver$py.class -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/pony.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | """ 4 | We have a pony and/or a unicorn. 5 | """ 6 | from paste.request import construct_url 7 | 8 | PONY = """ 9 | eJyFkkFuxCAMRfdzCisbJxK2D5D2JpbMrlI3XXQZDt9PCG0ySgcWIMT79rcN0XClUJlZRB9jVmci 10 | FmV19khjgRFl0RzrKmqzvY8lRUWFlXvCrD7UbAQR/17NUvGhypAF9og16vWtkC8DzUayS6pN3/dR 11 | ki0OnpzKjUBFpmlC7zVFRNL1rwoq6PWXXQSnIm9WoTzlM2//ke21o5g/l1ckRhiPbkDZXsKIR7l1 12 | 36hF9uMhnRiVjI8UgYjlsIKCrXXpcA9iX5y7zMmtG0fUpW61Ssttipf6cp3WARfkMVoYFryi2a+w 13 | o/2dhW0OXfcMTnmh53oR9egzPs+qkpY9IKxdUVRP5wHO7UDAuI6moA2N+/z4vtc2k8B+AIBimVU= 14 | """ 15 | 16 | UNICORN = """ 17 | eJyVVD1vhDAM3e9XeAtIxB5P6qlDx0OMXVBzSpZOHdsxP762E0JAnMgZ8Zn37OePAPC60eV1Dl5b 18 | SS7fB6DmQNGhtegpNlPIQS8HmkYGdSqNqDF9wcMYus4TuBYGsZwIPqXfEoNir5K+R3mbzhlR4JMW 19 | eGpikPpn9wHl2sDgEH1270guZwzKDRf3nTztMvfI5r3fJqEmNxdCyISBcWjNgjPG8Egg2hgT3mJi 20 | KBwNvmPB1hbWJ3TwBfMlqdTzxNyDE2H8zOD5HA4KkqJGPVY/TwnxmPA82kdSJNj7zs+R0d1pB+JO 21 | xn2DKgsdxAfFS2pfTSD0Fb6Uzv7dCQSvE5JmZQEQ90vNjBU1GPuGQpCPS8cGo+dQgjIKqxnJTXbw 22 | ucFzPFVIJXtzk6BXKGPnYsKzvFmGx7A0j6Zqvlvk5rETXbMWTGWj0RFc8QNPYVfhJfMMniCPazWJ 23 | lGtPZecIGJWW6oL2hpbWRZEkChe8eg5Wb7xx/MBZBFjxeZPEss+mRQ3Uhc8WQv684seSRO7i3nb4 24 | 7HlKUg8sraz47LmXyh8S0somADvoUpoHjGWl+rUkF0H+EIf/gbyyMg58BBk6L634/fkHUCodMw== 25 | """ 26 | 27 | 28 | class PonyMiddleware(object): 29 | 30 | def __init__(self, application): 31 | self.application = application 32 | 33 | def __call__(self, environ, start_response): 34 | path_info = environ.get('PATH_INFO', '') 35 | if path_info == '/pony': 36 | url = construct_url(environ, with_query_string=False) 37 | if 'horn' in environ.get('QUERY_STRING', ''): 38 | data = UNICORN 39 | link = 'remove horn!' 40 | else: 41 | data = PONY 42 | url += '?horn' 43 | link = 'add horn!' 44 | msg = data.decode('base64').decode('zlib') 45 | msg = '
%s\n%s
' % ( 46 | msg, url, link) 47 | start_response('200 OK', [('content-type', 'text/html')]) 48 | return [msg] 49 | else: 50 | return self.application(environ, start_response) 51 | 52 | def make_pony(app, global_conf): 53 | """ 54 | Adds pony power to any application, at /pony 55 | """ 56 | return PonyMiddleware(app) 57 | 58 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/translogger$py.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/thirdpart/Paste-3.0.5/paste/translogger$py.class -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/PySourceColor.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/PySourceColor.py -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/__init__$py.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/__init__$py.class -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Package for miscellaneous routines that do not depend on other parts 3 | of Paste 4 | """ 5 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/classinit.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | 4 | class ClassInitMeta(type): 5 | 6 | def __new__(meta, class_name, bases, new_attrs): 7 | cls = type.__new__(meta, class_name, bases, new_attrs) 8 | if (new_attrs.has_key('__classinit__') 9 | and not isinstance(cls.__classinit__, staticmethod)): 10 | setattr(cls, '__classinit__', 11 | staticmethod(cls.__classinit__.im_func)) 12 | if hasattr(cls, '__classinit__'): 13 | cls.__classinit__(cls, new_attrs) 14 | return cls 15 | 16 | def build_properties(cls, new_attrs): 17 | """ 18 | Given a class and a new set of attributes (as passed in by 19 | __classinit__), create or modify properties based on functions 20 | with special names ending in __get, __set, and __del. 21 | """ 22 | for name, value in new_attrs.items(): 23 | if (name.endswith('__get') or name.endswith('__set') 24 | or name.endswith('__del')): 25 | base = name[:-5] 26 | if hasattr(cls, base): 27 | old_prop = getattr(cls, base) 28 | if not isinstance(old_prop, property): 29 | raise ValueError( 30 | "Attribute %s is a %s, not a property; function %s is named like a property" 31 | % (base, type(old_prop), name)) 32 | attrs = {'fget': old_prop.fget, 33 | 'fset': old_prop.fset, 34 | 'fdel': old_prop.fdel, 35 | 'doc': old_prop.__doc__} 36 | else: 37 | attrs = {} 38 | attrs['f' + name[-3:]] = value 39 | if name.endswith('__get') and value.__doc__: 40 | attrs['doc'] = value.__doc__ 41 | new_prop = property(**attrs) 42 | setattr(cls, base, new_prop) 43 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/classinstance.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | 4 | class classinstancemethod(object): 5 | """ 6 | Acts like a class method when called from a class, like an 7 | instance method when called by an instance. The method should 8 | take two arguments, 'self' and 'cls'; one of these will be None 9 | depending on how the method was called. 10 | """ 11 | 12 | def __init__(self, func): 13 | self.func = func 14 | self.__doc__ = func.__doc__ 15 | 16 | def __get__(self, obj, type=None): 17 | return _methodwrapper(self.func, obj=obj, type=type) 18 | 19 | class _methodwrapper(object): 20 | 21 | def __init__(self, func, obj, type): 22 | self.func = func 23 | self.obj = obj 24 | self.type = type 25 | 26 | def __call__(self, *args, **kw): 27 | assert 'self' not in kw and 'cls' not in kw, ( 28 | "You cannot use 'self' or 'cls' arguments to a " 29 | "classinstancemethod") 30 | return self.func(*((self.obj, self.type) + args), **kw) 31 | 32 | def __repr__(self): 33 | if self.obj is None: 34 | return ('' 35 | % (self.type.__name__, self.func.func_name)) 36 | else: 37 | return ('' 38 | % (self.type.__name__, self.func.func_name, self.obj)) 39 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/converters$py.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/converters$py.class -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/converters.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | 4 | import six 5 | 6 | 7 | def asbool(obj): 8 | if isinstance(obj, (six.binary_type, six.text_type)): 9 | obj = obj.strip().lower() 10 | if obj in ['true', 'yes', 'on', 'y', 't', '1']: 11 | return True 12 | elif obj in ['false', 'no', 'off', 'n', 'f', '0']: 13 | return False 14 | else: 15 | raise ValueError( 16 | "String is not true/false: %r" % obj) 17 | return bool(obj) 18 | 19 | def aslist(obj, sep=None, strip=True): 20 | if isinstance(obj, (six.binary_type, six.text_type)): 21 | lst = obj.split(sep) 22 | if strip: 23 | lst = [v.strip() for v in lst] 24 | return lst 25 | elif isinstance(obj, (list, tuple)): 26 | return obj 27 | elif obj is None: 28 | return [] 29 | else: 30 | return [obj] 31 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/dateinterval.py: -------------------------------------------------------------------------------- 1 | """ 2 | DateInterval.py 3 | 4 | Convert interval strings (in the form of 1w2d, etc) to 5 | seconds, and back again. Is not exactly about months or 6 | years (leap years in particular). 7 | 8 | Accepts (y)ear, (b)month, (w)eek, (d)ay, (h)our, (m)inute, (s)econd. 9 | 10 | Exports only timeEncode and timeDecode functions. 11 | """ 12 | 13 | import re 14 | 15 | __all__ = ['interval_decode', 'interval_encode'] 16 | 17 | second = 1 18 | minute = second*60 19 | hour = minute*60 20 | day = hour*24 21 | week = day*7 22 | month = day*30 23 | year = day*365 24 | timeValues = { 25 | 'y': year, 26 | 'b': month, 27 | 'w': week, 28 | 'd': day, 29 | 'h': hour, 30 | 'm': minute, 31 | 's': second, 32 | } 33 | timeOrdered = list(timeValues.items()) 34 | timeOrdered.sort(key=lambda x: x[1], reverse=True) 35 | 36 | 37 | def interval_encode(seconds, include_sign=False): 38 | """Encodes a number of seconds (representing a time interval) 39 | into a form like 1h2d3s. 40 | 41 | >>> interval_encode(10) 42 | '10s' 43 | >>> interval_encode(493939) 44 | '5d17h12m19s' 45 | """ 46 | s = '' 47 | orig = seconds 48 | seconds = abs(seconds) 49 | for char, amount in timeOrdered: 50 | if seconds >= amount: 51 | i, seconds = divmod(seconds, amount) 52 | s += '%i%s' % (i, char) 53 | if orig < 0: 54 | s = '-' + s 55 | elif not orig: 56 | return '0' 57 | elif include_sign: 58 | s = '+' + s 59 | return s 60 | 61 | _timeRE = re.compile(r'[0-9]+[a-zA-Z]') 62 | def interval_decode(s): 63 | """Decodes a number in the format 1h4d3m (1 hour, 3 days, 3 minutes) 64 | into a number of seconds 65 | 66 | >>> interval_decode('40s') 67 | 40 68 | >>> interval_decode('10000s') 69 | 10000 70 | >>> interval_decode('3d1w45s') 71 | 864045 72 | """ 73 | time = 0 74 | sign = 1 75 | s = s.strip() 76 | if s.startswith('-'): 77 | s = s[1:] 78 | sign = -1 79 | elif s.startswith('+'): 80 | s = s[1:] 81 | for match in allMatches(s, _timeRE): 82 | char = match.group(0)[-1].lower() 83 | if char not in timeValues: 84 | # @@: should signal error 85 | continue 86 | time += int(match.group(0)[:-1]) * timeValues[char] 87 | return time 88 | 89 | # @@-sgd 2002-12-23 - this function does not belong in this module, find a better place. 90 | def allMatches(source, regex): 91 | """Return a list of matches for regex in source 92 | """ 93 | pos = 0 94 | end = len(source) 95 | rv = [] 96 | match = regex.search(source, pos) 97 | while match: 98 | rv.append(match) 99 | match = regex.search(source, match.end() ) 100 | return rv 101 | 102 | if __name__ == '__main__': 103 | import doctest 104 | doctest.testmod() 105 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/filemixin.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | 4 | class FileMixin(object): 5 | 6 | """ 7 | Used to provide auxiliary methods to objects simulating files. 8 | Objects must implement write, and read if they are input files. 9 | Also they should implement close. 10 | 11 | Other methods you may wish to override: 12 | * flush() 13 | * seek(offset[, whence]) 14 | * tell() 15 | * truncate([size]) 16 | 17 | Attributes you may wish to provide: 18 | * closed 19 | * encoding (you should also respect that in write()) 20 | * mode 21 | * newlines (hard to support) 22 | * softspace 23 | """ 24 | 25 | def flush(self): 26 | pass 27 | 28 | def next(self): 29 | return self.readline() 30 | 31 | def readline(self, size=None): 32 | # @@: This is a lame implementation; but a buffer would probably 33 | # be necessary for a better implementation 34 | output = [] 35 | while 1: 36 | next = self.read(1) 37 | if not next: 38 | return ''.join(output) 39 | output.append(next) 40 | if size and size > 0 and len(output) >= size: 41 | return ''.join(output) 42 | if next == '\n': 43 | # @@: also \r? 44 | return ''.join(output) 45 | 46 | def xreadlines(self): 47 | return self 48 | 49 | def writelines(self, lines): 50 | for line in lines: 51 | self.write(line) 52 | 53 | 54 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/findpackage.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | 4 | import sys 5 | import os 6 | 7 | def find_package(dir): 8 | """ 9 | Given a directory, finds the equivalent package name. If it 10 | is directly in sys.path, returns ''. 11 | """ 12 | dir = os.path.abspath(dir) 13 | orig_dir = dir 14 | path = map(os.path.abspath, sys.path) 15 | packages = [] 16 | last_dir = None 17 | while 1: 18 | if dir in path: 19 | return '.'.join(packages) 20 | packages.insert(0, os.path.basename(dir)) 21 | dir = os.path.dirname(dir) 22 | if last_dir == dir: 23 | raise ValueError( 24 | "%s is not under any path found in sys.path" % orig_dir) 25 | last_dir = dir 26 | 27 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/html.py: -------------------------------------------------------------------------------- 1 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 2 | 3 | """Provide an html.escape method that is python method safe.""" 4 | 5 | import six 6 | 7 | if six.PY3: 8 | from html import escape 9 | else: 10 | # This is a copy from Python3. 11 | def escape(s, quote=True): 12 | """ 13 | Replace special characters "&", "<" and ">" to HTML-safe sequences. If 14 | the optional flag quote is true (the default), the quotation mark 15 | characters, both double quote (") and single quote (') characters are 16 | also translated. 17 | """ 18 | s = s.replace("&", "&") # Must be done first! 19 | s = s.replace("<", "<") 20 | s = s.replace(">", ">") 21 | if quote: 22 | s = s.replace('"', """) 23 | s = s.replace('\'', "'") 24 | return s 25 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/import_string.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | 4 | """ 5 | 'imports' a string -- converts a string to a Python object, importing 6 | any necessary modules and evaluating the expression. Everything 7 | before the : in an import expression is the module path; everything 8 | after is an expression to be evaluated in the namespace of that 9 | module. 10 | 11 | Alternately, if no : is present, then import the modules and get the 12 | attributes as necessary. Arbitrary expressions are not allowed in 13 | that case. 14 | """ 15 | 16 | def eval_import(s): 17 | """ 18 | Import a module, or import an object from a module. 19 | 20 | A module name like ``foo.bar:baz()`` can be used, where 21 | ``foo.bar`` is the module, and ``baz()`` is an expression 22 | evaluated in the context of that module. Note this is not safe on 23 | arbitrary strings because of the eval. 24 | """ 25 | if ':' not in s: 26 | return simple_import(s) 27 | module_name, expr = s.split(':', 1) 28 | module = import_module(module_name) 29 | obj = eval(expr, module.__dict__) 30 | return obj 31 | 32 | def simple_import(s): 33 | """ 34 | Import a module, or import an object from a module. 35 | 36 | A name like ``foo.bar.baz`` can be a module ``foo.bar.baz`` or a 37 | module ``foo.bar`` with an object ``baz`` in it, or a module 38 | ``foo`` with an object ``bar`` with an attribute ``baz``. 39 | """ 40 | parts = s.split('.') 41 | module = import_module(parts[0]) 42 | name = parts[0] 43 | parts = parts[1:] 44 | last_import_error = None 45 | while parts: 46 | name += '.' + parts[0] 47 | try: 48 | module = import_module(name) 49 | parts = parts[1:] 50 | except ImportError as e: 51 | last_import_error = e 52 | break 53 | obj = module 54 | while parts: 55 | try: 56 | obj = getattr(module, parts[0]) 57 | except AttributeError: 58 | raise ImportError( 59 | "Cannot find %s in module %r (stopped importing modules with error %s)" % (parts[0], module, last_import_error)) 60 | parts = parts[1:] 61 | return obj 62 | 63 | def import_module(s): 64 | """ 65 | Import a module. 66 | """ 67 | mod = __import__(s) 68 | parts = s.split('.') 69 | for part in parts[1:]: 70 | mod = getattr(mod, part) 71 | return mod 72 | 73 | def try_import_module(module_name): 74 | """ 75 | Imports a module, but catches import errors. Only catches errors 76 | when that module doesn't exist; if that module itself has an 77 | import error it will still get raised. Returns None if the module 78 | doesn't exist. 79 | """ 80 | try: 81 | return import_module(module_name) 82 | except ImportError as e: 83 | if not getattr(e, 'args', None): 84 | raise 85 | desc = e.args[0] 86 | if not desc.startswith('No module named '): 87 | raise 88 | desc = desc[len('No module named '):] 89 | # If you import foo.bar.baz, the bad import could be any 90 | # of foo.bar.baz, bar.baz, or baz; we'll test them all: 91 | parts = module_name.split('.') 92 | for i in range(len(parts)): 93 | if desc == '.'.join(parts[i:]): 94 | return None 95 | raise 96 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/killthread$py.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/killthread$py.class -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/killthread.py: -------------------------------------------------------------------------------- 1 | """ 2 | Kill a thread, from http://sebulba.wikispaces.com/recipe+thread2 3 | """ 4 | import six 5 | try: 6 | import ctypes 7 | except ImportError: 8 | raise ImportError( 9 | "You cannot use paste.util.killthread without ctypes installed") 10 | if not hasattr(ctypes, 'pythonapi'): 11 | raise ImportError( 12 | "You cannot use paste.util.killthread without ctypes.pythonapi") 13 | 14 | def async_raise(tid, exctype): 15 | """raises the exception, performs cleanup if needed. 16 | 17 | tid is the value given by thread.get_ident() (an integer). 18 | Raise SystemExit to kill a thread.""" 19 | if not isinstance(exctype, (six.class_types, type)): 20 | raise TypeError("Only types can be raised (not instances)") 21 | if not isinstance(tid, int): 22 | raise TypeError("tid must be an integer") 23 | res = ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(tid), ctypes.py_object(exctype)) 24 | if res == 0: 25 | raise ValueError("invalid thread id") 26 | elif res != 1: 27 | # """if it returns a number greater than one, you're in trouble, 28 | # and you should call it again with exc=NULL to revert the effect""" 29 | ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(tid), 0) 30 | raise SystemError("PyThreadState_SetAsyncExc failed") 31 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/quoting.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | 4 | import six 5 | import re 6 | from six.moves import html_entities 7 | from six.moves.urllib.parse import quote, unquote 8 | 9 | from paste.util import html 10 | 11 | 12 | __all__ = ['html_quote', 'html_unquote', 'url_quote', 'url_unquote', 13 | 'strip_html'] 14 | 15 | default_encoding = 'UTF-8' 16 | 17 | def html_quote(v, encoding=None): 18 | r""" 19 | Quote the value (turned to a string) as HTML. This quotes <, >, 20 | and quotes: 21 | """ 22 | encoding = encoding or default_encoding 23 | if v is None: 24 | return '' 25 | elif isinstance(v, six.binary_type): 26 | return html.escape(v, 1) 27 | elif isinstance(v, six.text_type): 28 | if six.PY3: 29 | return html.escape(v, 1) 30 | else: 31 | return html.escape(v.encode(encoding), 1) 32 | else: 33 | if six.PY3: 34 | return html.escape(six.text_type(v), 1) 35 | else: 36 | return html.escape(six.text_type(v).encode(encoding), 1) 37 | 38 | _unquote_re = re.compile(r'&([a-zA-Z]+);') 39 | def _entity_subber(match, name2c=html_entities.name2codepoint): 40 | code = name2c.get(match.group(1)) 41 | if code: 42 | return six.unichr(code) 43 | else: 44 | return match.group(0) 45 | 46 | def html_unquote(s, encoding=None): 47 | r""" 48 | Decode the value. 49 | 50 | """ 51 | if isinstance(s, six.binary_type): 52 | s = s.decode(encoding or default_encoding) 53 | return _unquote_re.sub(_entity_subber, s) 54 | 55 | def strip_html(s): 56 | # should this use html_unquote? 57 | s = re.sub('<.*?>', '', s) 58 | s = html_unquote(s) 59 | return s 60 | 61 | def no_quote(s): 62 | """ 63 | Quoting that doesn't do anything 64 | """ 65 | return s 66 | 67 | _comment_quote_re = re.compile(r'\-\s*\>') 68 | # Everything but \r, \n, \t: 69 | _bad_chars_re = re.compile('[\x00-\x08\x0b-\x0c\x0e-\x1f]') 70 | def comment_quote(s): 71 | """ 72 | Quote that makes sure text can't escape a comment 73 | """ 74 | comment = str(s) 75 | #comment = _bad_chars_re.sub('', comment) 76 | #print('in ', repr(str(s))) 77 | #print('out', repr(comment)) 78 | comment = _comment_quote_re.sub('->', comment) 79 | return comment 80 | 81 | url_quote = quote 82 | url_unquote = unquote 83 | 84 | if __name__ == '__main__': 85 | import doctest 86 | doctest.testmod() 87 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/paste/util/threadinglocal.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | """ 4 | Implementation of thread-local storage, for Python versions that don't 5 | have thread local storage natively. 6 | """ 7 | 8 | try: 9 | import threading 10 | except ImportError: 11 | # No threads, so "thread local" means process-global 12 | class local(object): 13 | pass 14 | else: 15 | try: 16 | local = threading.local 17 | except AttributeError: 18 | # Added in 2.4, but now we'll have to define it ourselves 19 | import thread 20 | class local(object): 21 | 22 | def __init__(self): 23 | self.__dict__['__objs'] = {} 24 | 25 | def __getattr__(self, attr, g=thread.get_ident): 26 | try: 27 | return self.__dict__['__objs'][g()][attr] 28 | except KeyError: 29 | raise AttributeError( 30 | "No variable %s defined for the thread %s" 31 | % (attr, g())) 32 | 33 | def __setattr__(self, attr, value, g=thread.get_ident): 34 | self.__dict__['__objs'].setdefault(g(), {})[attr] = value 35 | 36 | def __delattr__(self, attr, g=thread.get_ident): 37 | try: 38 | del self.__dict__['__objs'][g()][attr] 39 | except KeyError: 40 | raise AttributeError( 41 | "No variable %s defined for thread %s" 42 | % (attr, g())) 43 | 44 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/regen-docs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | mkdir -p docs/_static docs/_build 4 | sphinx-build -E -b html docs/ docs/_build || exit 1 5 | if [ "$1" = "publish" ] ; then 6 | cd docs/ 7 | echo "Uploading files..." 8 | scp -r _build/* ianb@webwareforpython.org:/home/paste/htdocs/ 9 | fi 10 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/setup.cfg: -------------------------------------------------------------------------------- 1 | [egg_info] 2 | tag_build = 3 | tag_date = 0 4 | tag_svn_revision = 0 5 | 6 | [aliases] 7 | distribute = register sdist bdist_egg upload pudge publish 8 | test = pytest 9 | 10 | [bdist_wheel] 11 | universal = 1 12 | 13 | [tool:pytest] 14 | testpaths = tests 15 | 16 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/__init__.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | 4 | sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) 5 | 6 | import pkg_resources 7 | pkg_resources.require('Paste') 8 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/cgiapp_data/error.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | print('hey you!') 4 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/cgiapp_data/form.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import print_function 4 | 5 | import cgi 6 | import six 7 | 8 | print('Content-type: text/plain') 9 | print('') 10 | 11 | if six.PY3: 12 | # Python 3: cgi.FieldStorage keeps some field names as unicode and some as 13 | # the repr() of byte strings, duh. 14 | 15 | class FieldStorage(cgi.FieldStorage): 16 | 17 | def _key_candidates(self, key): 18 | yield key 19 | 20 | try: 21 | # assume bytes, coerce to str 22 | try: 23 | yield key.decode(self.encoding) 24 | except UnicodeDecodeError: 25 | pass 26 | except AttributeError: 27 | # assume str, coerce to bytes 28 | try: 29 | yield key.encode(self.encoding) 30 | except UnicodeEncodeError: 31 | pass 32 | 33 | def __getitem__(self, key): 34 | 35 | superobj = super(FieldStorage, self) 36 | 37 | error = None 38 | 39 | for candidate in self._key_candidates(key): 40 | if isinstance(candidate, bytes): 41 | # ouch 42 | candidate = repr(candidate) 43 | try: 44 | return superobj.__getitem__(candidate) 45 | except KeyError as e: 46 | if error is None: 47 | error = e 48 | 49 | # fall through, re-raise the first KeyError 50 | raise error 51 | 52 | def __contains__(self, key): 53 | superobj = super(FieldStorage, self) 54 | 55 | for candidate in self._key_candidates(key): 56 | if superobj.__contains__(candidate): 57 | return True 58 | return False 59 | 60 | else: # PY2 61 | 62 | FieldStorage = cgi.FieldStorage 63 | 64 | 65 | form = FieldStorage() 66 | 67 | print('Filename: %s' % form['up'].filename) 68 | print('Name: %s' % form['name'].value) 69 | print('Content: %s' % form['up'].file.read()) 70 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/cgiapp_data/ok.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | print('Content-type: text/html; charset=UTF-8') 3 | print('Status: 200 Okay') 4 | print('') 5 | print('This is the body') 6 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/cgiapp_data/stderr.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from __future__ import print_function 3 | import sys 4 | print('Status: 500 Server Error') 5 | print('Content-type: text/html') 6 | print() 7 | print('There was an error') 8 | print('some data on the error', file=sys.stderr) 9 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_auth/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangsir404/pbscan/8c7f63bb6abe18b2964cac3e31fd36dd03163ca2/pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_auth/__init__.py -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_auth/test_auth_cookie.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Clark C. Evans 2 | # This module is part of the Python Paste Project and is released under 3 | # the MIT License: http://www.opensource.org/licenses/mit-license.php 4 | 5 | from six.moves import xrange 6 | import six 7 | 8 | from paste.auth import cookie 9 | from paste.wsgilib import raw_interactive, dump_environ 10 | from paste.response import header_value 11 | from paste.httpexceptions import * 12 | 13 | def build(application,setenv, *args, **kwargs): 14 | def setter(environ, start_response): 15 | save = environ['paste.auth.cookie'].append 16 | for (k,v) in setenv.items(): 17 | save(k) 18 | environ[k] = v 19 | return application(environ, start_response) 20 | return cookie.middleware(setter,*args,**kwargs) 21 | 22 | def test_noop(): 23 | app = build(dump_environ,{}) 24 | (status,headers,content,errors) = \ 25 | raw_interactive(app) 26 | assert not header_value(headers,'Set-Cookie') 27 | 28 | def test_basic(key='key', val='bingles'): 29 | app = build(dump_environ,{key:val}) 30 | (status,headers,content,errors) = \ 31 | raw_interactive(app) 32 | value = header_value(headers,'Set-Cookie') 33 | assert "Path=/;" in value 34 | assert "expires=" not in value 35 | cookie = value.split(";")[0] 36 | (status,headers,content,errors) = \ 37 | raw_interactive(app,{'HTTP_COOKIE': cookie}) 38 | expected = ("%s: %s" % (key,val.replace("\n","\n "))) 39 | if six.PY3: 40 | expected = expected.encode('utf8') 41 | assert expected in content 42 | 43 | def test_roundtrip(): 44 | roundtrip = str('').join(map(chr, xrange(256))) 45 | test_basic(roundtrip,roundtrip) 46 | 47 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_auth/test_auth_digest.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Clark C. Evans 2 | # This module is part of the Python Paste Project and is released under 3 | # the MIT License: http://www.opensource.org/licenses/mit-license.php 4 | 5 | from paste.auth.digest import * 6 | from paste.wsgilib import raw_interactive 7 | from paste.httpexceptions import * 8 | from paste.httpheaders import AUTHORIZATION, WWW_AUTHENTICATE, REMOTE_USER 9 | import os 10 | import six 11 | 12 | def application(environ, start_response): 13 | content = REMOTE_USER(environ) 14 | start_response("200 OK",(('Content-Type', 'text/plain'), 15 | ('Content-Length', len(content)))) 16 | 17 | if six.PY3: 18 | content = content.encode('utf8') 19 | return [content] 20 | 21 | realm = "tag:clarkevans.com,2005:testing" 22 | 23 | def backwords(environ, realm, username): 24 | """ dummy password hash, where user password is just reverse """ 25 | password = list(username) 26 | password.reverse() 27 | password = "".join(password) 28 | return digest_password(realm, username, password) 29 | 30 | application = AuthDigestHandler(application,realm,backwords) 31 | application = HTTPExceptionHandler(application) 32 | 33 | def check(username, password, path="/"): 34 | """ perform two-stage authentication to verify login """ 35 | (status,headers,content,errors) = \ 36 | raw_interactive(application,path, accept='text/html') 37 | assert status.startswith("401") 38 | challenge = WWW_AUTHENTICATE(headers) 39 | response = AUTHORIZATION(username=username, password=password, 40 | challenge=challenge, path=path) 41 | assert "Digest" in response and username in response 42 | (status,headers,content,errors) = \ 43 | raw_interactive(application,path, 44 | HTTP_AUTHORIZATION=response) 45 | if status.startswith("200"): 46 | return content 47 | if status.startswith("401"): 48 | return None 49 | assert False, "Unexpected Status: %s" % status 50 | 51 | def test_digest(): 52 | assert b'bing' == check("bing","gnib") 53 | assert check("bing","bad") is None 54 | 55 | # 56 | # The following code uses sockets to test the functionality, 57 | # to enable use: 58 | # 59 | # $ TEST_SOCKET=1 pytest 60 | 61 | 62 | if os.environ.get("TEST_SOCKET", ""): 63 | from six.moves.urllib.error import HTTPError 64 | from six.moves.urllib.request import build_opener, HTTPDigestAuthHandler 65 | from paste.debug.testserver import serve 66 | server = serve(application) 67 | 68 | def authfetch(username,password,path="/",realm=realm): 69 | server.accept(2) 70 | import socket 71 | socket.setdefaulttimeout(5) 72 | uri = ("http://%s:%s" % server.server_address) + path 73 | auth = HTTPDigestAuthHandler() 74 | auth.add_password(realm,uri,username,password) 75 | opener = build_opener(auth) 76 | result = opener.open(uri) 77 | return result.read() 78 | 79 | def test_success(): 80 | assert "bing" == authfetch('bing','gnib') 81 | 82 | def test_failure(): 83 | # urllib tries 5 more times before it gives up 84 | server.accept(5) 85 | try: 86 | authfetch('bing','wrong') 87 | assert False, "this should raise an exception" 88 | except HTTPError as e: 89 | assert e.code == 401 90 | 91 | def test_shutdown(): 92 | server.stop() 93 | 94 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_cgiapp.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | import pytest 5 | 6 | from paste.cgiapp import CGIApplication, CGIError 7 | from paste.fixture import * 8 | 9 | data_dir = os.path.join(os.path.dirname(__file__), 'cgiapp_data') 10 | 11 | # these CGI scripts can't work on Windows or Jython 12 | if sys.platform != 'win32' and not sys.platform.startswith('java'): 13 | 14 | # Ensure the CGI scripts are called with the same python interpreter. Put a 15 | # symlink to the interpreter executable into the path... 16 | def setup_module(): 17 | global oldpath, pyexelink 18 | oldpath = os.environ.get('PATH', None) 19 | os.environ['PATH'] = data_dir + os.path.pathsep + oldpath 20 | pyexelink = os.path.join(data_dir, "python") 21 | try: 22 | os.unlink(pyexelink) 23 | except OSError: 24 | pass 25 | os.symlink(sys.executable, pyexelink) 26 | 27 | # ... and clean up again. 28 | def teardown_module(): 29 | global oldpath, pyexelink 30 | os.unlink(pyexelink) 31 | if oldpath is not None: 32 | os.environ['PATH'] = oldpath 33 | else: 34 | del os.environ['PATH'] 35 | 36 | def test_ok(): 37 | app = TestApp(CGIApplication({}, script='ok.cgi', path=[data_dir])) 38 | res = app.get('') 39 | assert res.header('content-type') == 'text/html; charset=UTF-8' 40 | assert res.full_status == '200 Okay' 41 | assert 'This is the body' in res 42 | 43 | def test_form(): 44 | app = TestApp(CGIApplication({}, script='form.cgi', path=[data_dir])) 45 | res = app.post('', params={'name': b'joe'}, 46 | upload_files=[('up', 'file.txt', b'x'*10000)]) 47 | assert 'file.txt' in res 48 | assert 'joe' in res 49 | assert 'x'*10000 in res 50 | 51 | def test_error(): 52 | app = TestApp(CGIApplication({}, script='error.cgi', path=[data_dir])) 53 | pytest.raises(CGIError, app.get, '', status=500) 54 | 55 | def test_stderr(): 56 | app = TestApp(CGIApplication({}, script='stderr.cgi', path=[data_dir])) 57 | res = app.get('', expect_errors=True) 58 | assert res.status == 500 59 | assert 'error' in res 60 | assert b'some data' in res.errors 61 | 62 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_cgitb_catcher.py: -------------------------------------------------------------------------------- 1 | from paste.fixture import * 2 | from paste.cgitb_catcher import CgitbMiddleware 3 | from paste import lint 4 | from .test_exceptions.test_error_middleware import clear_middleware 5 | 6 | def do_request(app, expect_status=500): 7 | app = lint.middleware(app) 8 | app = CgitbMiddleware(app, {}, display=True) 9 | app = clear_middleware(app) 10 | testapp = TestApp(app) 11 | res = testapp.get('', status=expect_status, 12 | expect_errors=True) 13 | return res 14 | 15 | 16 | ############################################################ 17 | ## Applications that raise exceptions 18 | ############################################################ 19 | 20 | def bad_app(): 21 | "No argument list!" 22 | return None 23 | 24 | def start_response_app(environ, start_response): 25 | "raise error before start_response" 26 | raise ValueError("hi") 27 | 28 | def after_start_response_app(environ, start_response): 29 | start_response("200 OK", [('Content-type', 'text/plain')]) 30 | raise ValueError('error2') 31 | 32 | def iter_app(environ, start_response): 33 | start_response("200 OK", [('Content-type', 'text/plain')]) 34 | return yielder([b'this', b' is ', b' a', None]) 35 | 36 | def yielder(args): 37 | for arg in args: 38 | if arg is None: 39 | raise ValueError("None raises error") 40 | yield arg 41 | 42 | ############################################################ 43 | ## Tests 44 | ############################################################ 45 | 46 | def test_makes_exception(): 47 | res = do_request(bad_app) 48 | print(res) 49 | if six.PY3: 50 | assert 'bad_app() takes 0 positional arguments but 2 were given' in res 51 | else: 52 | assert 'bad_app() takes no arguments (2 given' in res 53 | assert 'iterator = application(environ, start_response_wrapper)' in res 54 | assert 'lint.py' in res 55 | assert 'cgitb_catcher.py' in res 56 | 57 | def test_start_res(): 58 | res = do_request(start_response_app) 59 | print(res) 60 | assert 'ValueError: hi' in res 61 | assert 'test_cgitb_catcher.py' in res 62 | assert 'line 26, in start_response_app' in res 63 | 64 | def test_after_start(): 65 | res = do_request(after_start_response_app, 200) 66 | print(res) 67 | assert 'ValueError: error2' in res 68 | assert 'line 30' in res 69 | 70 | def test_iter_app(): 71 | res = do_request(iter_app, 200) 72 | print(res) 73 | assert 'None raises error' in res 74 | assert 'yielder' in res 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_config.py: -------------------------------------------------------------------------------- 1 | # (c) 2007 Philip Jenvey; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | 4 | import pytest 5 | import six 6 | 7 | from paste.config import CONFIG, ConfigMiddleware 8 | from paste.fixture import TestApp 9 | 10 | test_key = 'test key' 11 | 12 | def reset_config(): 13 | while True: 14 | try: 15 | CONFIG._pop_object() 16 | except IndexError: 17 | break 18 | 19 | def app_with_config(environ, start_response): 20 | start_response('200 OK', [('Content-type','text/plain')]) 21 | lines = ['Variable is: %s\n' % CONFIG[test_key], 22 | 'Variable is (in environ): %s' % environ['paste.config'][test_key]] 23 | if six.PY3: 24 | lines = [line.encode('utf8') for line in lines] 25 | return lines 26 | 27 | class NestingAppWithConfig(object): 28 | def __init__(self, app): 29 | self.app = app 30 | 31 | def __call__(self, environ, start_response): 32 | response = self.app(environ, start_response) 33 | assert isinstance(response, list) 34 | supplement = ['Nesting variable is: %s' % CONFIG[test_key], 35 | 'Nesting variable is (in environ): %s' % \ 36 | environ['paste.config'][test_key]] 37 | if six.PY3: 38 | supplement = [line.encode('utf8') for line in supplement] 39 | response.extend(supplement) 40 | return response 41 | 42 | def test_request_config(): 43 | try: 44 | config = {test_key: 'test value'} 45 | app = ConfigMiddleware(app_with_config, config) 46 | res = TestApp(app).get('/') 47 | assert 'Variable is: test value' in res 48 | assert 'Variable is (in environ): test value' in res 49 | finally: 50 | reset_config() 51 | 52 | def test_request_config_multi(): 53 | try: 54 | config = {test_key: 'test value'} 55 | app = ConfigMiddleware(app_with_config, config) 56 | config = {test_key: 'nesting value'} 57 | app = ConfigMiddleware(NestingAppWithConfig(app), config) 58 | res = TestApp(app).get('/') 59 | assert 'Variable is: test value' in res 60 | assert 'Variable is (in environ): test value' in res 61 | assert 'Nesting variable is: nesting value' in res 62 | print(res) 63 | assert 'Nesting variable is (in environ): nesting value' in res 64 | finally: 65 | reset_config() 66 | 67 | def test_process_config(request_app=test_request_config): 68 | try: 69 | process_config = {test_key: 'bar', 'process_var': 'foo'} 70 | CONFIG.push_process_config(process_config) 71 | 72 | assert CONFIG[test_key] == 'bar' 73 | assert CONFIG['process_var'] == 'foo' 74 | 75 | request_app() 76 | 77 | assert CONFIG[test_key] == 'bar' 78 | assert CONFIG['process_var'] == 'foo' 79 | CONFIG.pop_process_config() 80 | 81 | pytest.raises(AttributeError, lambda: 'process_var' not in CONFIG) 82 | pytest.raises(IndexError, CONFIG.pop_process_config) 83 | finally: 84 | reset_config() 85 | 86 | def test_process_config_multi(): 87 | test_process_config(test_request_config_multi) 88 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_doctests.py: -------------------------------------------------------------------------------- 1 | import doctest 2 | import os 3 | 4 | import pytest 5 | import six 6 | 7 | from paste.util.import_string import simple_import 8 | 9 | filenames = [ 10 | 'tests/template.txt', 11 | ] 12 | 13 | modules = [ 14 | 'paste.util.template', 15 | 'paste.util.looper', 16 | # This one opens up httpserver, which is bad: 17 | #'paste.auth.cookie', 18 | #'paste.auth.multi', 19 | #'paste.auth.digest', 20 | #'paste.auth.basic', 21 | #'paste.auth.form', 22 | #'paste.progress', 23 | 'paste.exceptions.serial_number_generator', 24 | 'paste.evalexception.evalcontext', 25 | 'paste.util.dateinterval', 26 | 'paste.util.quoting', 27 | 'paste.wsgilib', 28 | 'paste.url', 29 | 'paste.request', 30 | ] 31 | 32 | options = doctest.ELLIPSIS | doctest.REPORT_ONLY_FIRST_FAILURE 33 | if six.PY3: 34 | options |= doctest.IGNORE_EXCEPTION_DETAIL 35 | 36 | 37 | @pytest.mark.parametrize('filename', filenames) 38 | def test_doctests(filename): 39 | filename = os.path.join( 40 | os.path.dirname(os.path.dirname(__file__)), 41 | filename) 42 | failure, total = doctest.testfile( 43 | filename, module_relative=False, 44 | optionflags=options) 45 | assert not failure, "Failure in %r" % filename 46 | 47 | 48 | @pytest.mark.parametrize('module', modules) 49 | def test_doctest_mods(module): 50 | module = simple_import(module) 51 | failure, total = doctest.testmod( 52 | module, optionflags=options) 53 | assert not failure, "Failure in %r" % module 54 | 55 | 56 | if __name__ == '__main__': 57 | import sys 58 | import doctest 59 | args = sys.argv[1:] 60 | if not args: 61 | args = filenames 62 | for filename in args: 63 | doctest.testfile(filename, module_relative=False) 64 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_errordocument.py: -------------------------------------------------------------------------------- 1 | from paste.errordocument import forward 2 | from paste.fixture import * 3 | from paste.recursive import RecursiveMiddleware 4 | 5 | def simple_app(environ, start_response): 6 | start_response("200 OK", [('Content-type', 'text/plain')]) 7 | return [b'requested page returned'] 8 | 9 | def not_found_app(environ, start_response): 10 | start_response("404 Not found", [('Content-type', 'text/plain')]) 11 | return [b'requested page returned'] 12 | 13 | def test_ok(): 14 | app = TestApp(simple_app) 15 | res = app.get('') 16 | assert res.header('content-type') == 'text/plain' 17 | assert res.full_status == '200 OK' 18 | assert 'requested page returned' in res 19 | 20 | def error_docs_app(environ, start_response): 21 | if environ['PATH_INFO'] == '/not_found': 22 | start_response("404 Not found", [('Content-type', 'text/plain')]) 23 | return [b'Not found'] 24 | elif environ['PATH_INFO'] == '/error': 25 | start_response("200 OK", [('Content-type', 'text/plain')]) 26 | return [b'Page not found'] 27 | else: 28 | return simple_app(environ, start_response) 29 | 30 | def test_error_docs_app(): 31 | app = TestApp(error_docs_app) 32 | res = app.get('') 33 | assert res.header('content-type') == 'text/plain' 34 | assert res.full_status == '200 OK' 35 | assert 'requested page returned' in res 36 | res = app.get('/error') 37 | assert res.header('content-type') == 'text/plain' 38 | assert res.full_status == '200 OK' 39 | assert 'Page not found' in res 40 | res = app.get('/not_found', status=404) 41 | assert res.header('content-type') == 'text/plain' 42 | assert res.full_status == '404 Not found' 43 | assert 'Not found' in res 44 | 45 | def test_forward(): 46 | app = forward(error_docs_app, codes={404:'/error'}) 47 | app = TestApp(RecursiveMiddleware(app)) 48 | res = app.get('') 49 | assert res.header('content-type') == 'text/plain' 50 | assert res.full_status == '200 OK' 51 | assert 'requested page returned' in res 52 | res = app.get('/error') 53 | assert res.header('content-type') == 'text/plain' 54 | assert res.full_status == '200 OK' 55 | assert 'Page not found' in res 56 | res = app.get('/not_found', status=404) 57 | assert res.header('content-type') == 'text/plain' 58 | assert res.full_status == '404 Not found' 59 | # Note changed response 60 | assert 'Page not found' in res 61 | 62 | def auth_required_app(environ, start_response): 63 | start_response('401 Unauthorized', [('content-type', 'text/plain'), ('www-authenticate', 'Basic realm="Foo"')]) 64 | return ['Sign in!'] 65 | 66 | def auth_docs_app(environ, start_response): 67 | if environ['PATH_INFO'] == '/auth': 68 | return auth_required_app(environ, start_response) 69 | elif environ['PATH_INFO'] == '/auth_doc': 70 | start_response("200 OK", [('Content-type', 'text/html')]) 71 | return [b'Login!'] 72 | else: 73 | return simple_app(environ, start_response) 74 | 75 | def test_auth_docs_app(): 76 | wsgi_app = forward(auth_docs_app, codes={401: '/auth_doc'}) 77 | app = TestApp(wsgi_app) 78 | res = app.get('/auth_doc') 79 | assert res.header('content-type') == 'text/html' 80 | res = app.get('/auth', status=401) 81 | assert res.header('content-type') == 'text/html' 82 | assert res.header('www-authenticate') == 'Basic realm="Foo"' 83 | assert res.body == b'Login!' 84 | 85 | def test_bad_error(): 86 | def app(environ, start_response): 87 | start_response('404 Not Found', [('content-type', 'text/plain')]) 88 | return ['not found'] 89 | app = forward(app, {404: '/404.html'}) 90 | app = TestApp(app) 91 | resp = app.get('/test', expect_errors=True) 92 | print(resp) 93 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_exceptions/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_exceptions/test_reporter.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | from paste.exceptions.reporter import * 4 | from paste.exceptions import collector 5 | 6 | def setup_file(fn, content=None): 7 | dir = os.path.join(os.path.dirname(__file__), 'reporter_output') 8 | fn = os.path.join(dir, fn) 9 | if os.path.exists(dir): 10 | if os.path.exists(fn): 11 | os.unlink(fn) 12 | else: 13 | os.mkdir(dir) 14 | if content is not None: 15 | f = open(fn, 'wb') 16 | f.write(content) 17 | f.close() 18 | return fn 19 | 20 | def test_logger(): 21 | fn = setup_file('test_logger.log') 22 | rep = LogReporter( 23 | filename=fn, 24 | show_hidden_frames=False) 25 | try: 26 | int('a') 27 | except: 28 | exc_data = collector.collect_exception(*sys.exc_info()) 29 | else: 30 | assert 0 31 | rep.report(exc_data) 32 | content = open(fn).read() 33 | assert len(content.splitlines()) == 4, len(content.splitlines()) 34 | assert 'ValueError' in content 35 | assert 'int' in content 36 | assert 'test_reporter.py' in content 37 | assert 'test_logger' in content 38 | 39 | try: 40 | 1 / 0 41 | except: 42 | exc_data = collector.collect_exception(*sys.exc_info()) 43 | else: 44 | assert 0 45 | rep.report(exc_data) 46 | content = open(fn).read() 47 | print(content) 48 | assert len(content.splitlines()) == 8 49 | assert 'ZeroDivisionError' in content 50 | 51 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_fixture.py: -------------------------------------------------------------------------------- 1 | from paste.debug.debugapp import SimpleApplication, SlowConsumer 2 | from paste.fixture import TestApp 3 | 4 | 5 | def test_fixture(): 6 | app = TestApp(SimpleApplication()) 7 | res = app.get('/', params={'a': ['1', '2']}) 8 | assert (res.request.environ['QUERY_STRING'] == 9 | 'a=1&a=2') 10 | res = app.put('/') 11 | assert (res.request.environ['REQUEST_METHOD'] == 12 | 'PUT') 13 | res = app.delete('/') 14 | assert (res.request.environ['REQUEST_METHOD'] == 15 | 'DELETE') 16 | class FakeDict(object): 17 | def items(self): 18 | return [('a', '10'), ('a', '20')] 19 | res = app.post('/params', params=FakeDict()) 20 | 21 | # test multiple cookies in one request 22 | app.cookies['one'] = 'first'; 23 | app.cookies['two'] = 'second'; 24 | app.cookies['three'] = ''; 25 | res = app.get('/') 26 | hc = res.request.environ['HTTP_COOKIE'].split('; '); 27 | assert ('one=first' in hc) 28 | assert ('two=second' in hc) 29 | assert ('three=' in hc) 30 | 31 | 32 | def test_fixture_form(): 33 | app = TestApp(SlowConsumer()) 34 | res = app.get('/') 35 | form = res.forms[0] 36 | assert 'file' in form.fields 37 | assert form.action == '' 38 | 39 | 40 | def test_fixture_form_end(): 41 | def response(environ, start_response): 42 | body = b"
sm\xc3\xb6rebr\xc3\xb6
" 43 | start_response("200 OK", [('Content-Type', 'text/html'), 44 | ('Content-Length', str(len(body)))]) 45 | return [body] 46 | TestApp(response).get('/') 47 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_grantip.py: -------------------------------------------------------------------------------- 1 | from paste.auth import grantip 2 | from paste.fixture import * 3 | 4 | def test_make_app(): 5 | def application(environ, start_response): 6 | start_response('200 OK', [('content-type', 'text/plain')]) 7 | lines = [ 8 | str(environ.get('REMOTE_USER')), 9 | ':', 10 | str(environ.get('REMOTE_USER_TOKENS')), 11 | ] 12 | if six.PY3: 13 | lines = [line.encode('utf8') for line in lines] 14 | return lines 15 | ip_map = { 16 | '127.0.0.1': (None, 'system'), 17 | '192.168.0.0/16': (None, 'worker'), 18 | '192.168.0.5<->192.168.0.8': ('bob', 'editor'), 19 | '192.168.0.8': ('__remove__', '-worker'), 20 | } 21 | app = grantip.GrantIPMiddleware(application, ip_map) 22 | app = TestApp(app) 23 | return app 24 | 25 | def test_req(): 26 | app = test_make_app() 27 | def doit(remote_addr): 28 | res = app.get('/', extra_environ={'REMOTE_ADDR': remote_addr}) 29 | return res.body 30 | assert doit('127.0.0.1') == b'None:system' 31 | assert doit('192.168.15.12') == b'None:worker' 32 | assert doit('192.168.0.4') == b'None:worker' 33 | result = doit('192.168.0.5') 34 | assert result.startswith(b'bob:') 35 | assert b'editor' in result and b'worker' in result 36 | assert result.count(b',') == 1 37 | assert doit('192.168.0.8') == b'None:editor' 38 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_gzipper.py: -------------------------------------------------------------------------------- 1 | from paste.fixture import TestApp 2 | from paste.gzipper import middleware 3 | import gzip 4 | import six 5 | 6 | def simple_app(environ, start_response): 7 | start_response('200 OK', [('content-type', 'text/plain')]) 8 | return [b'this is a test'] 9 | 10 | wsgi_app = middleware(simple_app) 11 | app = TestApp(wsgi_app) 12 | 13 | def test_gzip(): 14 | res = app.get( 15 | '/', extra_environ=dict(HTTP_ACCEPT_ENCODING='gzip')) 16 | assert int(res.header('content-length')) == len(res.body) 17 | assert res.body != b'this is a test' 18 | actual = gzip.GzipFile(fileobj=six.BytesIO(res.body)).read() 19 | assert actual == b'this is a test' 20 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_httpserver.py: -------------------------------------------------------------------------------- 1 | import email 2 | 3 | from paste.httpserver import WSGIHandler 4 | from six.moves import StringIO 5 | 6 | 7 | class MockServer(object): 8 | server_address = ('127.0.0.1', 80) 9 | 10 | 11 | class MockSocket(object): 12 | def makefile(self, mode, bufsize): 13 | return StringIO() 14 | 15 | 16 | def test_environ(): 17 | mock_socket = MockSocket() 18 | mock_client_address = '1.2.3.4' 19 | mock_server = MockServer() 20 | 21 | wsgi_handler = WSGIHandler(mock_socket, mock_client_address, mock_server) 22 | wsgi_handler.command = 'GET' 23 | wsgi_handler.path = '/path' 24 | wsgi_handler.request_version = 'HTTP/1.0' 25 | wsgi_handler.headers = email.message_from_string('Host: mywebsite') 26 | 27 | wsgi_handler.wsgi_setup() 28 | 29 | assert wsgi_handler.wsgi_environ['HTTP_HOST'] == 'mywebsite' 30 | 31 | 32 | def test_environ_with_multiple_values(): 33 | mock_socket = MockSocket() 34 | mock_client_address = '1.2.3.4' 35 | mock_server = MockServer() 36 | 37 | wsgi_handler = WSGIHandler(mock_socket, mock_client_address, mock_server) 38 | wsgi_handler.command = 'GET' 39 | wsgi_handler.path = '/path' 40 | wsgi_handler.request_version = 'HTTP/1.0' 41 | wsgi_handler.headers = email.message_from_string('Host: host1\nHost: host2') 42 | 43 | wsgi_handler.wsgi_setup() 44 | 45 | assert wsgi_handler.wsgi_environ['HTTP_HOST'] == 'host1,host2' 46 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_import_string.py: -------------------------------------------------------------------------------- 1 | from paste.util.import_string import * 2 | import sys 3 | import os 4 | 5 | def test_simple(): 6 | for func in eval_import, simple_import: 7 | assert func('sys') is sys 8 | assert func('sys.version') is sys.version 9 | assert func('os.path.join') is os.path.join 10 | 11 | def test_complex(): 12 | assert eval_import('sys:version') is sys.version 13 | assert eval_import('os:getcwd()') == os.getcwd() 14 | assert (eval_import('sys:version.split()[0]') == 15 | sys.version.split()[0]) 16 | 17 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_profilemiddleware.py: -------------------------------------------------------------------------------- 1 | from paste.fixture import * 2 | try: 3 | from paste.debug.profile import * 4 | disable = False 5 | except ImportError: 6 | disable = True 7 | 8 | if not disable: 9 | def simple_app(environ, start_response): 10 | start_response('200 OK', [('content-type', 'text/html')]) 11 | return ['all ok'] 12 | 13 | def long_func(): 14 | for i in range(1000): 15 | pass 16 | return 'test' 17 | 18 | def test_profile(): 19 | app = TestApp(ProfileMiddleware(simple_app, {})) 20 | res = app.get('/') 21 | # The original app: 22 | res.mustcontain('all ok') 23 | # The profile information: 24 | res.mustcontain('httpbin.org' in res 13 | -------------------------------------------------------------------------------- /pbscan-api/core/thirdpart/Paste-3.0.5/tests/test_request.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ben Bangert 2 | # This module is part of the Python Paste Project and is released under 3 | # the MIT License: http://www.opensource.org/licenses/mit-license.php 4 | from paste.fixture import * 5 | from paste.request import * 6 | from paste.wsgiwrappers import WSGIRequest 7 | import six 8 | 9 | def simpleapp(environ, start_response): 10 | status = '200 OK' 11 | response_headers = [('Content-type','text/plain')] 12 | start_response(status, response_headers) 13 | request = WSGIRequest(environ) 14 | body = [ 15 | 'Hello world!\n', 'The get is %s' % str(request.GET), 16 | ' and Val is %s\n' % request.GET.get('name'), 17 | 'The languages are: %s\n' % request.languages, 18 | 'The accepttypes is: %s\n' % request.match_accept(['text/html', 'application/xml'])] 19 | if six.PY3: 20 | body = [line.encode('utf8') for line in body] 21 | return body 22 | 23 | def test_gets(): 24 | app = TestApp(simpleapp) 25 | res = app.get('/') 26 | assert 'Hello' in res 27 | assert "get is MultiDict([])" in res 28 | 29 | res = app.get('/?name=george') 30 | res.mustcontain("get is MultiDict([('name', 'george')])") 31 | res.mustcontain("Val is george") 32 | 33 | def test_language_parsing(): 34 | app = TestApp(simpleapp) 35 | res = app.get('/') 36 | assert "The languages are: ['en-us']" in res 37 | 38 | res = app.get('/', headers={'Accept-Language':'da, en-gb;q=0.8, en;q=0.7'}) 39 | assert "languages are: ['da', 'en-gb', 'en', 'en-us']" in res 40 | 41 | res = app.get('/', headers={'Accept-Language':'en-gb;q=0.8, da, en;q=0.7'}) 42 | assert "languages are: ['da', 'en-gb', 'en', 'en-us']" in res 43 | 44 | def test_mime_parsing(): 45 | app = TestApp(simpleapp) 46 | res = app.get('/', headers={'Accept':'text/html'}) 47 | assert "accepttypes is: ['text/html']" in res 48 | 49 | res = app.get('/', headers={'Accept':'application/xml'}) 50 | assert "accepttypes is: ['application/xml']" in res 51 | 52 | res = app.get('/', headers={'Accept':'application/xml,*/*'}) 53 | assert "accepttypes is: ['text/html', 'application/xml']" in res 54 | 55 | def test_bad_cookie(): 56 | env = {} 57 | env['HTTP_COOKIE'] = '070-it-:>%0D", status=404) 51 | assert b'-->