├── .gitignore ├── .python-version ├── .travis.yml ├── CNAME ├── HISTORY.md ├── LICENSE ├── README.md ├── _config.yml ├── build └── lib │ └── g3ar │ ├── __init__.py │ ├── decologger │ ├── __init__.py │ ├── decologger.py │ └── test.py │ ├── dict_parser │ ├── __init__.py │ ├── dict_parser.py │ └── test.py │ ├── taskbulter │ ├── __init__.py │ ├── exceptions.py │ ├── process_task.py │ ├── task_bulter.py │ └── utils_class.py │ ├── threadutils │ ├── README.md │ ├── __init__.py │ ├── contractor.py │ └── thread_pool.py │ └── utils │ ├── __init__.py │ ├── import_utils.py │ ├── inspect_utils.py │ ├── ip_calc_utils.py │ ├── ipwhois │ ├── __init__.py │ ├── exceptions.py │ ├── hr.py │ ├── ipwhois.py │ ├── net.py │ ├── nir.py │ ├── rdap.py │ ├── utils.py │ └── whois.py │ ├── print_utils.py │ ├── pyping │ ├── __init__.py │ ├── isalive.py │ └── ping.py │ ├── queue_utils.py │ └── tests.py ├── dist ├── g3ar-0.1.2-py2.7.egg ├── g3ar-0.1.2.tar.gz ├── g3ar-0.1.3-py2.7.egg ├── g3ar-0.1.3.tar.gz ├── g3ar-0.1.5.tar.gz ├── g3ar-0.1.6-py2.7.egg ├── g3ar-0.1.6.tar.gz ├── g3ar-0.1.7-py2.7.egg ├── g3ar-0.1.7.tar.gz ├── g3ar-0.1.8-py2.7.egg ├── g3ar-0.1.8.tar.gz ├── g3ar-0.1.9.tar.gz ├── g3ar-0.2.0b1.tar.gz ├── g3ar-0.2.0b2.tar.gz ├── g3ar-0.2.0b3.tar.gz ├── g3ar-0.2.0b4.tar.gz ├── g3ar-0.2.0b5.tar.gz ├── g3ar-0.2.0b6.tar.gz ├── g3ar-0.2.1-py2.7.egg ├── g3ar-0.2.1.macosx-10.6-intel.tar.gz ├── g3ar-0.2.1.tar.gz ├── g3ar-0.2.2-py2.7.egg ├── g3ar-0.2.2.tar.gz ├── g3ar-0.2.3-py3.5.egg ├── g3ar-0.2.3.tar.gz ├── g3ar-0.2.4.tar.gz ├── g3ar-0.2.5.tar.gz ├── g3ar-0.2.6.tar.gz ├── g3ar-0.2.7.tar.gz ├── g3ar-0.2.8.tar.gz ├── g3ar-0.2.9.tar.gz ├── g3ar-0.3.0.tar.gz ├── g3ar-0.3.1.tar.gz ├── g3ar-0.3.5.tar.gz ├── g3ar-0.3.6.tar.gz ├── g3ar-0.3.7.tar.gz ├── g3ar-0.3.8.tar.gz ├── g3ar-0.4.0a0.tar.gz ├── g3ar-0.4.3.tar.gz ├── g3ar-0.5.0.tar.gz ├── g3ar-0.5.1.tar.gz ├── g3ar-0.5.2.tar.gz ├── g3ar-0.5.3.tar.gz ├── g3ar-0.5.5.tar.gz ├── g3ar-0.5.6.tar.gz └── g3ar-0.5.7.tar.gz ├── docs ├── .DS_Store ├── Makefile ├── build │ ├── .DS_Store │ ├── doctrees │ │ ├── environment.pickle │ │ ├── func_quicklook.doctree │ │ ├── index.doctree │ │ ├── overview.doctree │ │ ├── step1.doctree │ │ └── step2.doctree │ └── html │ │ ├── .buildinfo │ │ ├── .nojekyll │ │ ├── _sources │ │ ├── func_quicklook.rst.txt │ │ ├── func_quicklook.txt │ │ ├── index.rst.txt │ │ ├── index.txt │ │ ├── overview.rst.txt │ │ ├── overview.txt │ │ ├── step1.txt │ │ └── step2.txt │ │ ├── _static │ │ ├── ajax-loader.gif │ │ ├── alabaster.css │ │ ├── basic.css │ │ ├── comment-bright.png │ │ ├── comment-close.png │ │ ├── comment.png │ │ ├── custom.css │ │ ├── doctools.js │ │ ├── down-pressed.png │ │ ├── down.png │ │ ├── file.png │ │ ├── jquery-1.11.1.js │ │ ├── jquery-3.1.0.js │ │ ├── jquery.js │ │ ├── minus.png │ │ ├── plus.png │ │ ├── pygments.css │ │ ├── searchtools.js │ │ ├── underscore-1.3.1.js │ │ ├── underscore.js │ │ ├── up-pressed.png │ │ ├── up.png │ │ └── websupport.js │ │ ├── func_quicklook.html │ │ ├── genindex.html │ │ ├── index.html │ │ ├── objects.inv │ │ ├── overview.html │ │ ├── search.html │ │ └── searchindex.js ├── make.bat └── source │ ├── conf.py │ ├── func_quicklook.rst │ ├── index.rst │ └── overview.rst ├── example ├── demodict ├── dictparser_e1.py ├── sessions_dat ├── taskbulter_e1.py └── threadpool_e1.py ├── g3ar.egg-info ├── PKG-INFO ├── SOURCES.txt ├── dependency_links.txt ├── not-zip-safe ├── requires.txt └── top_level.txt ├── g3ar ├── __init__.py ├── decologger │ ├── __init__.py │ ├── decologger.py │ └── test.py ├── dict_parser │ ├── .DS_Store │ ├── __init__.py │ ├── dict_parser.py │ ├── dict_parser_from_iter.py │ ├── dict_parser_mixer.py │ └── test.py ├── taskbulter │ ├── __init__.py │ ├── exceptions.py │ ├── process_task.py │ ├── task_bulter.py │ └── utils_class.py ├── threadutils │ ├── README.md │ ├── __init__.py │ ├── contractor.py │ ├── tests.py │ ├── thread_pool.py │ └── threadpoolex.py └── utils │ ├── .DS_Store │ ├── __init__.py │ ├── import_utils.py │ ├── inspect_utils.py │ ├── ip_calc_utils.py │ ├── ipwhois │ ├── __init__.py │ ├── data │ │ ├── iso_3166-1.csv │ │ └── iso_3166-1_list_en.xml │ ├── exceptions.py │ ├── hr.py │ ├── ipwhois.py │ ├── net.py │ ├── nir.py │ ├── rdap.py │ ├── scripts │ │ ├── ipwhois_cli.py │ │ └── ipwhois_utils_cli.py │ ├── utils.py │ └── whois.py │ ├── iter_utils.py │ ├── print_utils.py │ ├── pyping │ ├── __init__.py │ ├── isalive.py │ └── ping.py │ ├── queue_utils.py │ ├── thread_utils.py │ └── verify_utils.py ├── requirements.txt ├── sessions_dat ├── setup.py ├── test.py └── testdata ├── decolog └── testlogger │ ├── testlogger.critical.log │ ├── testlogger.critical.log.2017-01-09 │ ├── testlogger.critical.log.2017-02-09 │ ├── testlogger.critical.log.2017-02-24 │ ├── testlogger.critical.log.2017-02-26 │ ├── testlogger.critical.log.2017-03-09 │ ├── testlogger.critical.log.2017-05-10 │ ├── testlogger.crucial.log │ ├── testlogger.debug.log │ ├── testlogger.debug.log.2017-01-09 │ ├── testlogger.debug.log.2017-02-09 │ ├── testlogger.debug.log.2017-02-24 │ ├── testlogger.debug.log.2017-02-26 │ ├── testlogger.debug.log.2017-03-09 │ ├── testlogger.debug.log.2017-05-10 │ ├── testlogger.error.log │ ├── testlogger.info.log │ ├── testlogger.info.log.2017-01-09 │ ├── testlogger.info.log.2017-02-09 │ ├── testlogger.info.log.2017-02-24 │ ├── testlogger.info.log.2017-02-26 │ ├── testlogger.info.log.2017-03-09 │ ├── testlogger.info.log.2017-05-10 │ ├── testlogger.log │ ├── testlogger.log.2017-01-09 │ ├── testlogger.log.2017-02-09 │ ├── testlogger.log.2017-02-24 │ ├── testlogger.log.2017-02-26 │ ├── testlogger.log.2017-03-09 │ ├── testlogger.log.2017-05-10 │ └── testlogger.warning.log ├── dir.txt └── sessions.dat /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.log 3 | *.dat 4 | testdate/*py2env 5 | py2env/* 6 | py3env 7 | py3env/* 8 | -------------------------------------------------------------------------------- /.python-version: -------------------------------------------------------------------------------- 1 | 2.7.13 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | 3 | python: 4 | - "2.7.13" 5 | - "3.5" 6 | 7 | install: 8 | pip install -r requirements.txt 9 | 10 | script: python test.py 11 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | g3ar.villanch.top 2 | -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | ###Version: 0.5.7 2 | 修复线程池ex不能安全退出的小问题 3 | 4 | ###Version: 0.5.5 5 | 修复线程池 inuse 的小问题 6 | 7 | ###Version: 0.5.3 8 | 删除多余 DEBUG IO 9 | 10 | ###Version: 0.5.2 11 | 修复 bug 12 | 13 | ###Version: 0.5.0 14 | 增加 ThreadPoolX 一个以回调为基础的更加强大的线程池,修复一个 queue 的依赖问题 15 | 16 | ###Version: 0.5.0 17 | 增加 ThreadPoolX 一个以回调为基础的更加强大的线程池 18 | 19 | ###Version: 0.4.3 20 | 添加从 list set tuple 和 string 中建立 DictParser 的类 (DictParserFromIter) 21 | 22 | ###Version: 0.4.0a 23 | 当 TaskBulter 执行任务完毕的时候,关闭管道 24 | 25 | ###Version: 0.3.7 26 | 融合字典的进度总值错误 27 | 28 | ###Version: 0.3.6 29 | Fix bugs! 30 | 31 | ###Version: 0.3.1 32 | New feature! 融合字典! 33 | 34 | ###Version: 0.2.7 35 | ThreadPool 与 DictParser 的稳定性得到极大提升 36 | 37 | ###Version: 0.2.2 38 | Add get_result to TaskBulter 39 | 40 | ###Version: 0.2.1 41 | Add print_utils function! It 's great to print table easily! 42 | 43 | ###Version: 0.2.0bx 44 | Fix bugs and make g3ar stable 45 | 46 | ###Version: 0.1.9 47 | Fix A little bug in TaskBulter (result_pipe issue) 48 | 49 | ###Version: 0.1.8 50 | Add result_callback to TaskBulter 51 | 52 | ###Version: 0.1.7 53 | Add type filter to inspect_utils.get_fields(obj, [type, public]) 54 | 55 | ###Version: 0.1.6 56 | Add inspect_utils.get_classes() to gain classes from module instance 57 | 58 | ###Version: 0.1.5 59 | Support Py3 60 | 61 | ###Version: 0.0.7b1 62 | Add print_utils (print_bar) 63 | 64 | ###Version: 0.0.6b4 65 | Fix bugs 66 | 67 | ###Version: 0.0.6b1 68 | Add utils to support some useful module(ip calc, python-ping(root needed!)) 69 | 70 | ###Version: 0.0.6 71 | 4 Useful Class Added and completed 72 | 73 | ###Version: 0.0.5b1 74 | Add README.md & HISTORY.md in setup() 75 | 76 | ###Version: 0.0.5 77 | Fix Bugs and Add test.py to unittest 78 | 79 | ###Version: 0.0.1alpha3 80 | Add shortcut for every available and useful class. 81 | 82 | ###Version: 0.0.1alpha2 83 | Check import and fix little bugs XD. 84 | 85 | ###Version: 0.0.1alpha 86 | Changes: initial & test install. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2016, v1ll4n 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # g3ar 渗透编程工具包: 极速打造渗透测试工具 2 | 完美支持: Python2 3 | 单元测试通过: Python3 4 | 5 | [![Build Status](https://travis-ci.org/VillanCh/g3ar.svg?branch=master)](https://travis-ci.org/VillanCh/g3ar) 6 | 7 | ## 功能概述 8 | 9 | 1. 多线程与多进程管理: 10 | * 线程池与多线程调用极简化 11 | * 异步 12 | * Taskbulter 对进程内的线程监控与管理 13 | * 爆破用字典管理: 14 | * 支持任意大小的字典读取(大字典不再发愁) 15 | * 进度保存 16 | * 获取当前进行进度 17 | * 日志记录器: 18 | * 日志管理极简化 19 | * 装饰器接口 20 | * 自动追踪函数,日志记录函数的调用,Trace,和异常情况 21 | 22 | ## 安装 23 | 24 | ### By pip 25 | 26 | pip install g3ar 27 | 28 | ### By easy_install 29 | 30 | easy_install g3ar 31 | 32 | ### By Github: 33 | 34 | 35 | git clone https://github.com/VillanCh/g3ar.git 36 | cd g3ar 37 | pip install -r requirements.txt 38 | python setup.py install 39 | 40 | ## 帮助手册与 Quick Look 41 | 42 | 查看当前 repos 下 `docs/build/html/index.html` 获取更多帮助信息 43 | 44 | ### 功能简介 45 | 46 | Python 渗透工具,或者渗透测试工具框架可能需要用到的组件:带结果反馈的线程池,支持大字典流式读取 47 | 以及进度保存的字典解析模块,以进程方式启动并加以监视控制与结果反馈的任务管理器,带有装饰器接口的日志 48 | 记录工具,除此之外,utils 还包含了一些有用的小工具:打印带颜色的文字,指定路径的 import 工具, 49 | ip 计算工具,更加方便的 Python 自省工具。 50 | 51 | #### 线程池组件 52 | 53 | ##### 简介 54 | 55 | 线程池的出现极大的方便了密集型任务的编程,在线程池组件的帮助下,一个任务密集型的程序将会极大被简化, 56 | 只需要维护一个稳定的任务队列并且定时从线程池的结果队列中获取任务反馈。 57 | 58 | ##### Quick Look 59 | 60 | ``` 61 | import time 62 | from g3ar import ThreadPool 63 | 64 | def func(arg1): 65 | # 66 | # Do something intersting 67 | # 68 | time.sleep(5) 69 | return arg1 70 | 71 | pool = ThreadPool() 72 | pool.start() 73 | pool.feed(target_func=func, arg1=4) 74 | queue = pool.get_result_queue() 75 | result = queue.get() 76 | print(result) 77 | pool.stop() 78 | ``` 79 | 80 | 这个最简单的例子,就是我们使用 ThreadPool 做的一个最简单的事情,也就是执行一个函数,然后再异步 81 | 收集结果。 82 | 83 | 我们分别来讲解这一段小代码: 84 | 85 | ``` 86 | from g3ar import ThreadPool 87 | def func(arg1): 88 | # 89 | # Do something intersting 90 | # 91 | time.sleep(5) 92 | return arg1 93 | ``` 94 | 95 | 导入我们需要的 ThreadPool 然后并定义一个函数。 96 | 97 | ``` 98 | pool = ThreadPool() 99 | pool.start() 100 | ``` 101 | 新建一个 ThreadPool 对象,然后开启线程池(start)。启动线程池之后,线程池对象会在内部启动若干 102 | 个线程,然后这些线程就会进入等待状态。当任务队列中出现任务的时候,线程就会提取任务队列中的任务, 103 | 然后执行相应的任务,把任务的执行情况放在结果队列中 104 | 105 | 106 | ``` 107 | pool.feed(target_func=func, arg1=4) 108 | ``` 109 | 传入需要运行的函数,并且在 target_func 后输入其他的参数,例如在 func 中,arg1 是 func 的唯 110 | 一参数,因为后面必须要写出形参的名称和形参的值。 111 | 112 | 113 | ``` 114 | queue = pool.get_result_queue() 115 | result = queue.get() 116 | print(result) 117 | pool.stop() 118 | ``` 119 | 120 | 121 | 通过 pool.get_result_queue(), 获取一个 Queue.Queue 对象,这个对象是 Python 内置的对象, 122 | 所以不做过多的说明,通过 queue.get() 来获取函数执行的结果。 123 | 124 | 当获取到需要的结果之后,通过 pool.stop() 来关闭线程池。 125 | 126 | 你会发现,这个线程池使用起来非常的简单,事实上,简单已经是一切了对不对? 127 | 128 | #### 大字典读取 129 | 130 | 在进行 Python 渗透工具编写的过程中,我们经常需要用到各种各样的字典(当然不是用来查生词的字典), 131 | 比如你有一个 300MB 的字典,你想用它去跑密码,然后整个脚本都需要在短时间内完成,这个时候应该怎么办呢? 132 | 133 | 当然大家直到使用文件流去读取是最好不过的,但是实际上,可能你整天都在忙着渗透测试的业务并没有太多 134 | 去关注编程方面的东西,那么你难道真的就那样整个把字典加载进内存?而且还很麻烦做字典分片啊,进度 135 | 保存啊之类的基础性工作。实际上,这些工作,g3ar 都可以替你完成喔! 136 | 137 | ``` 138 | from g3ar import DictParser 139 | 140 | dparser = DictParser('bigdict.txt') 141 | for i in dparser: 142 | # 143 | # Do What you want! 144 | # 145 | pass 146 | ``` 147 | 148 | 看!实际的使用,就这么简单,但是然后呢?我们设想一些复杂的场景:我的字典大概跑了有 2000 条, 149 | 然后临时有事情,我需要暂停下来,然后等我忙完了事情接下来再跑这个字典,那么应该怎么做呢?当然是有 150 | 好办法啦!DictParser 提供了基于 session 控制的可选进度保存操作。 151 | 152 | 首先我们假定我们有一个叫 demodict 的字典文件:: 153 | 154 | ``` 155 | 6666123 156 | 12341 157 | 346 158 | 245!#$%@#$^# 159 | 325 160 | 12341adfas 161 | asd 162 | re 163 | yq 164 | dahy 165 | ar 166 | r 167 | 34 168 | awe 169 | g 170 | da 171 | haf 172 | dh 173 | ad 174 | s 175 | dasdtdassd 176 | ``` 177 | 178 | 针对这一个字典文件,我们需要读取这个字典文件中的内容,然后并且进行进度保存,那么我们应该怎么做呢? 179 | 180 | ##### TAKL IS CHEAP, LET ME SHOW YOU THE CODES! 181 | 182 | ``` 183 | from g3ar import DictParser 184 | from g3ar.utils.print_utils import print_bar 185 | 186 | # 187 | # 创建一个 DictParser, 把 demosession 作为 session_id 传入 DictParser 对象中 188 | # 189 | dparser = DictParser(filename='demodict', session_id='demosession') 190 | 191 | # 192 | # 读取前十行:因为 DictParser 本质上是一个迭代器,所以可以使用 foreach 的形式也可以直接调用 next 193 | # 去获取相应的值 194 | # 195 | print_bar('GET 10 LINES') 196 | for i in xrange(10): 197 | print(dparser.next()) 198 | print_bar('END') 199 | print() 200 | 201 | # 202 | # 强制保存当前字典读取的进度 203 | # 204 | dparser.force_save() 205 | 206 | # 207 | # 删除字典(自动关闭文件) 208 | # 209 | del dparser 210 | 211 | # 212 | # 重新创建一个 DictParser, 然后把之前使用的 session_id 传入,然后设置 do_continue 为 True 213 | # 这样得到的一个 DictParser 就是一个接着上一次读写字典进度的一个字典解析器 214 | # 215 | dparser_continue = DictParser(filename='demodict', session_id='demosession', do_continue=True) 216 | # 217 | # 那么我们现在来验证后面的字典剩下的内容是不是紧接着我们上一次保存的进度之后? 218 | # 219 | print_bar('GET NEXT ALL LINE') 220 | for i in dparser_continue: 221 | print(i) 222 | ``` 223 | 224 | 225 | 然后上面就是我们完成保存进度使用的接口,我们查看一下最终的结果来检查是不是按照我们的期望进行工作! 226 | 227 | ``` 228 | =============================GET 10 LINES============================= 229 | 6666123 230 | 12341 231 | 346 232 | 245!#$%@#$^# 233 | 325 234 | 12341adfas 235 | asd 236 | re 237 | yq 238 | dahy 239 | =================================END================================= 240 | () 241 | ==========================GET NEXT ALL LINE========================== 242 | ar 243 | r 244 | 34 245 | awe 246 | g 247 | da 248 | haf 249 | dh 250 | ad 251 | s 252 | dasdtdassd 253 | ``` 254 | 255 | 接下来我们对比一下之前我们创建的字典文件,发现确实实现字典的进度保存。那么现在,你可以使用它 256 | 去完成你想要的操作了!我觉得你现在可能已经想到它可以用在哪里了! 257 | 258 | #### 任务管理器 259 | 260 | 任务管理器其实不像是线程池那样适合高度密集任务的处理,因为进程开销显然要比线程开销大得多啊,那么 261 | 基于这些基础的问题,我们怎么样来认识我们 g3ar 给大家提供的任务管理器呢?其实也很好解释,就是假如说 262 | 我们需要启动两个爆破程序,每一个爆破程序会启动甚至几十个线程去进行密码爆破等操作,每一个爆破程序 263 | 都有高密度的任务,在这些任务中,我们为这些任务启动开销相对更低的线程。对于整个的爆破程序,我们 264 | 就以进程为单位去管理。这样做有什么好处呢? 265 | 266 | 1. 可以监控进程内部线程的运行状况:如果关键线程发生了异常,可以立即发现,采取相应措施。 267 | 2. 可以强行结束一个进程,然而并不能强行结束一个线程。 268 | 269 | 好的接下来,我们就来看一下,怎么样使用这些令人激动的功能吧? 270 | 271 | ``` 272 | # 273 | # example for taskbulter 274 | # 275 | import time 276 | from g3ar import TaskBulter 277 | from g3ar.utils.print_utils import print_bar 278 | 279 | # 280 | # 创建一个 TaskBulter 用以准备启动新的任务 281 | # 282 | tbr = TaskBulter() 283 | 284 | # 285 | # 自己定义一个 taskid 然后定一个任务函数 286 | # 287 | taskid = 'testtask-id' 288 | #---------------------------------------------------------------------- 289 | def func(arg1, arg2='1'): 290 | """""" 291 | time.sleep(2) 292 | return arg1, arg2 293 | 294 | # 295 | # 传入必须任务的 id, 传入目标函数,目标函数的参数 296 | # 297 | print_bar('start the task') 298 | print(tbr.start_task(id=taskid, target=func, args=('arg1var',))) 299 | 300 | # 301 | # 查看任务执行的状态 302 | # 303 | print_bar('watch the status') 304 | print(tbr.get_tasks_status()) 305 | 306 | time.sleep(3) 307 | 308 | # 309 | # 获取任务结果 310 | # 311 | print_bar('get result') 312 | print(tbr.get_result(taskid)) 313 | ``` 314 | 315 | 使用起来大概也不会有什么不适,非常的简单和理所当然的接口,我想关于结果大家肯定都已经猜到了 316 | 317 | ``` 318 | ============================start the task============================ 319 | None 320 | ===========================watch the status=========================== 321 | {'testtask-id': {'now': {}, 'last': {}}} 322 | ==============================get result============================== 323 | [{'state': True, 'exception': '', 'result': ('arg1var', '1')}] 324 | ``` 325 | 326 | 要说明的就是结果部分吧,可能大家会奇怪,为什么结果不是我的函数直接返回的结果,而且还被包装了一层 327 | 又一层? 328 | 329 | 这当然不是图麻烦,在后续的详细文档关于这个部分会详细解释,简单来想,原因就是:如果任务执行的过程 330 | 中,出现了问题,那么,如果按平时仅仅返回一个结果就会显得非常突兀,有时候我们又渴望知道到底出现了 331 | 什么异常信息,这样的话,一个格式化的输出就很有必要了。 332 | 333 | 在结果输出中,整个结果是存储在一个 list 里面的,list 内是一个又一个的 dict,state 代表的是运 334 | 行的结果是不是按照期望运行,如果出现了不期望的一场,state 则会为 335 | False,于此同时 exception 会记录出现的异常是什么;result 则表示函数返回的结果是什么,当然, 336 | 如果返回了多个结果,就会出现多个 dict,因为在我们的任务可能不是 return ,还有可能是 yield。 337 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-architect -------------------------------------------------------------------------------- /build/lib/g3ar/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: G3ar entry 6 | Created: 2016/12/20 7 | """ 8 | 9 | import unittest 10 | 11 | from .threadutils import thread_pool 12 | from .threadutils import contractor 13 | from .decologger import decologger 14 | from .dict_parser import dict_parser 15 | from .taskbulter import task_bulter 16 | #from .utils import ip_calc_utils 17 | from .utils.pyping import pyping 18 | 19 | ThreadPool = thread_pool.Pool 20 | Contractor = contractor.Contractor 21 | DictParser = dict_parser.DictParser 22 | DecoLogger = decologger.Decologger 23 | TaskBulter = task_bulter.TaskBulter 24 | #IPv4CalcUtils = ip_calc_utils 25 | 26 | 27 | #---------------------------------------------------------------------- 28 | def ping(host, timeout=2, count=4): 29 | """""" 30 | return pyping(host, timeout, count) 31 | -------------------------------------------------------------------------------- /build/lib/g3ar/decologger/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/build/lib/g3ar/decologger/__init__.py -------------------------------------------------------------------------------- /build/lib/g3ar/decologger/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Test for decologger 6 | Created: 2016/12/18 7 | """ 8 | 9 | import unittest 10 | import traceback 11 | from .decologger import Decologger 12 | 13 | 14 | 15 | 16 | if __name__ == '__main__': 17 | unittest.main() -------------------------------------------------------------------------------- /build/lib/g3ar/dict_parser/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Simple and Quick Parse your dictionary FOR TENTEST PROGRAMMER! 6 | Created: 2016/12/16 7 | """ 8 | 9 | from . import dict_parser 10 | from .dict_parser import * 11 | 12 | def get_dictparser(filename, 13 | session_id=DEFAULT_SESSION_ID, 14 | do_continue=False, 15 | session_data_file=SESSION_TABLE_FILE): 16 | return DictParser(filename, session_id, do_continue, session_data_file) 17 | 18 | 19 | -------------------------------------------------------------------------------- /build/lib/g3ar/dict_parser/dict_parser.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Parse dict 6 | Created: 2016/12/16 7 | """ 8 | 9 | import shelve 10 | import unittest 11 | import os 12 | from pprint import pprint 13 | from hashlib import md5 14 | 15 | SESSION_TABLE_FILE = 'sessions_dat' 16 | DEFAULT_SESSION_ID = 'default' 17 | 18 | #---------------------------------------------------------------------- 19 | def get_progress(shelvefile, key): 20 | """""" 21 | ret = shelve.open(shelvefile) 22 | temp = ret.get(key) 23 | ret.close() 24 | return temp 25 | 26 | #---------------------------------------------------------------------- 27 | def set_progress(shelvefile, key, value): 28 | """""" 29 | ret = shelve.open(shelvefile) 30 | ret[key] = value 31 | ret.close() 32 | 33 | 34 | 35 | 36 | 37 | ######################################################################## 38 | class DictParser(object): 39 | """""" 40 | 41 | #---------------------------------------------------------------------- 42 | def __init__(self, filename, 43 | session_id=SESSION_TABLE_FILE, 44 | do_continue=False, 45 | session_data_file=SESSION_TABLE_FILE): 46 | """Constructor 47 | 48 | Params: 49 | filename: :str: the target dict you want to use 50 | session_id: :str: the id you want to use to identify your session 51 | do_continue: :bool: continue or not 52 | session_data_file: :str: the file you want to save session info 53 | """ 54 | abspathfile = os.path.abspath(filename) 55 | if os.path.exists(abspathfile): 56 | self._filename = filename 57 | else: 58 | raise Exception('[!] No Such Dict File') 59 | 60 | self._session_data_file = session_data_file 61 | self._session_id = md5(str(session_id+filename).encode('utf-8')).hexdigest() 62 | 63 | self._dict_file_p = open(self._filename) 64 | try: 65 | self._session_progress_table = shelve.open(os.path.abspath(self._session_data_file)) 66 | except: 67 | os.remove(os.path.abspath(self._session_data_file)) 68 | self._session_progress_table = shelve.open(os.path.abspath(self._session_data_file)) 69 | finally: 70 | self._session_progress_table.close() 71 | # continue last task 72 | if do_continue: 73 | if self._session_id in self._session_progress_table: 74 | try: 75 | pos = get_progress(self._session_data_file, self._session_id) 76 | except ValueError: 77 | pos = 0 78 | self._dict_file_p.seek(pos) 79 | 80 | #---------------------------------------------------------------------- 81 | def __iter__(self): 82 | """""" 83 | return self 84 | 85 | 86 | #---------------------------------------------------------------------- 87 | def __next__(self): 88 | """""" 89 | return self._next() 90 | 91 | #---------------------------------------------------------------------- 92 | def next(self): 93 | """""" 94 | return self._next() 95 | 96 | 97 | #---------------------------------------------------------------------- 98 | def _next(self): 99 | """""" 100 | self._current_pos = 0 101 | self._current_pos = self._dict_file_p.tell() 102 | while True: 103 | ret = self._dict_file_p.readline() 104 | self.save() 105 | if ret.strip() == '': 106 | #_empty_lines_count = _empty_lines_count + 1 107 | if self._dict_file_p.tell() == self._current_pos: 108 | raise StopIteration() 109 | else: 110 | continue 111 | else: 112 | return ret.strip() 113 | 114 | #---------------------------------------------------------------------- 115 | def save(self): 116 | """""" 117 | if self._current_pos - self._dict_file_p.tell() >= 1024: 118 | self._save() 119 | #print self._session_progress_table 120 | 121 | 122 | #---------------------------------------------------------------------- 123 | def _save(self): 124 | """Save the progress""" 125 | #self._session_progress_table[self._session_id] = self._dict_file_p.tell() 126 | set_progress(self._session_data_file, self._session_id, self._dict_file_p.tell()) 127 | 128 | #---------------------------------------------------------------------- 129 | def force_save(self): 130 | """Force save""" 131 | self._save() 132 | 133 | 134 | #---------------------------------------------------------------------- 135 | def __del__(self): 136 | """Close the opened resource""" 137 | try: 138 | self.close() 139 | #self._session_progress_table.close() 140 | except AttributeError: 141 | pass 142 | 143 | #---------------------------------------------------------------------- 144 | def close(self): 145 | """""" 146 | self._dict_file_p.close() 147 | 148 | 149 | #---------------------------------------------------------------------- 150 | def get_next_collection(self, num=200): 151 | """Returns a tuple for the next [num] paylaod(lines)""" 152 | ret = [] 153 | for i in range(num): 154 | try: 155 | ret.append(self._next()) 156 | except StopIteration: 157 | pass 158 | self._save() 159 | 160 | return tuple(ret) 161 | 162 | #---------------------------------------------------------------------- 163 | def get_current_pos(self): 164 | """The current pos""" 165 | return self._dict_file_p.tell() 166 | 167 | #---------------------------------------------------------------------- 168 | def get_total_size(self): 169 | """total size(progress)""" 170 | return os.path.getsize(self._filename) 171 | 172 | #---------------------------------------------------------------------- 173 | def get_fp(self): 174 | """Get the fp(Dangerous)""" 175 | return self._dict_file_p 176 | 177 | #---------------------------------------------------------------------- 178 | def reset(self): 179 | """""" 180 | self._dict_file_p.seek(0) 181 | 182 | 183 | 184 | 185 | if __name__ == '__main__': 186 | unittest.main() -------------------------------------------------------------------------------- /build/lib/g3ar/dict_parser/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: TestForDictParser 6 | Created: 2016/12/16 7 | """ 8 | 9 | import unittest 10 | from .dict_parser import * 11 | 12 | 13 | 14 | 15 | if __name__ == '__main__': 16 | unittest.main() -------------------------------------------------------------------------------- /build/lib/g3ar/taskbulter/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/build/lib/g3ar/taskbulter/__init__.py -------------------------------------------------------------------------------- /build/lib/g3ar/taskbulter/exceptions.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Define Many Exceptions 6 | Created: 2016/12/12 7 | """ 8 | 9 | import unittest 10 | 11 | 12 | ######################################################################## 13 | class TaskRuntimeError(Exception): 14 | """""" 15 | pass 16 | 17 | 18 | 19 | ######################################################################## 20 | class TaskCannotBeCalled(Exception): 21 | """""" 22 | pass 23 | 24 | 25 | ######################################################################## 26 | class ExistedTaskId(Exception): 27 | """""" 28 | pass 29 | 30 | 31 | 32 | 33 | if __name__ == '__main__': 34 | unittest.main() -------------------------------------------------------------------------------- /build/lib/g3ar/taskbulter/utils_class.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Utils Classes 6 | Created: 2016/12/13 7 | """ 8 | 9 | import unittest 10 | 11 | 12 | ######################################################################## 13 | class Singleton(object): 14 | """""" 15 | #_instance = None 16 | 17 | #---------------------------------------------------------------------- 18 | def __new__(cls, *args, **kwargs): 19 | """singleton class wrapper""" 20 | if not hasattr(cls, '_instance'): 21 | origin = super(Singleton, cls) 22 | cls._instance = origin.__new__(cls, *args, **kwargs) 23 | return cls._instance 24 | 25 | 26 | 27 | if __name__ == '__main__': 28 | unittest.main() -------------------------------------------------------------------------------- /build/lib/g3ar/threadutils/README.md: -------------------------------------------------------------------------------- 1 | # vthu 2 | vthu 是一个非常轻型的 Python 的多任务并发框架 3 | -------------------------------------------------------------------------------- /build/lib/g3ar/threadutils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/build/lib/g3ar/threadutils/__init__.py -------------------------------------------------------------------------------- /build/lib/g3ar/threadutils/contractor.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Provide some useful thread utils 6 | Created: 2016/10/29 7 | """ 8 | import uuid 9 | import time 10 | import unittest 11 | try: 12 | from queue import Queue, Empty 13 | except: 14 | from Queue import Queue, Empty 15 | import threading 16 | from threading import Thread 17 | import inspect 18 | import traceback 19 | 20 | 21 | #---------------------------------------------------------------------- 22 | def start_thread(func, *args, **kwargs): 23 | """""" 24 | ret = Thread(target=func, args=args, kwargs=kwargs) 25 | ret.daemon = True 26 | ret.start() 27 | 28 | 29 | ######################################################################## 30 | class Contractor(object): 31 | """Create Multi-Thread to support the 32 | concurrence of many tasks""" 33 | 34 | #---------------------------------------------------------------------- 35 | def __init__(self, thread_max=50): 36 | """Constructor""" 37 | self.task_list = [] 38 | self.result_queue = Queue() 39 | 40 | self.lock = threading.Lock() 41 | 42 | self.thread_max = thread_max 43 | self._current_thread_count = 0 44 | 45 | self._executed_task_count = 0 46 | self._task_count = 0 47 | 48 | def _uuid1_str(self): 49 | '''Returns: random UUID tag ''' 50 | return str(uuid.uuid1()) 51 | 52 | #---------------------------------------------------------------------- 53 | def feed(self, target_func, *vargs, **kwargs): 54 | """""" 55 | self.add_task(target_func, *vargs, **kwargs) 56 | 57 | def add_task(self, target_func, *args, **argv): 58 | '''Add task to Pool and wait to exec 59 | 60 | Params: 61 | target_func : A callable obj, the entity of the current task 62 | args : the args of [target_func] 63 | argv : the argv of [target_func] 64 | ''' 65 | assert callable(target_func), '[!] Function can \'t be called' 66 | 67 | ret = {} 68 | ret['func'] = target_func 69 | ret['args'] = args 70 | ret['argv'] = argv 71 | #ret['uuid'] = self.signal_name 72 | self._task_count = self._task_count + 1 73 | self.task_list.append(ret) 74 | 75 | def start(self): 76 | """""" 77 | ret = Thread(target=self._run) 78 | ret.daemon = True 79 | ret.start() 80 | 81 | return self.result_queue 82 | 83 | #---------------------------------------------------------------------- 84 | def _run(self): 85 | """""" 86 | for i in self.task_list: 87 | #print self.current_thread_count 88 | while self.thread_max <= self._current_thread_count: 89 | time.sleep(0.3) 90 | self._start_task(i) 91 | 92 | def _start_task(self, task): 93 | """""" 94 | self._current_thread_count = self._current_thread_count + 1 95 | try: 96 | 97 | ret = Thread(target=self._worker, args=(task,)) 98 | ret.daemon = True 99 | ret.start() 100 | except TypeError: 101 | self._current_thread_count = self._current_thread_count - 1 102 | 103 | def _worker(self, dictobj): 104 | """""" 105 | func = dictobj['func'] 106 | args = dictobj['args'] 107 | argv = dictobj['argv'] 108 | 109 | try: 110 | result = func(*args, **argv) 111 | except Exception as e: 112 | #print 'ecp occured' 113 | result = tuple([e, traceback.extract_stack()]) 114 | 115 | self.lock.acquire() 116 | self._executed_task_count = self._executed_task_count + 1 117 | self._add_result_to_queue(result=result) 118 | self.lock.release() 119 | 120 | def _add_result_to_queue(self, **kw): 121 | """""" 122 | assert 'result' in kw, '[!] Result Error!' 123 | 124 | self.result_queue.put(kw['result']) 125 | self._current_thread_count = self._current_thread_count - 1 126 | 127 | #---------------------------------------------------------------------- 128 | def get_result_queue(self): 129 | """""" 130 | return self.result_queue 131 | 132 | #---------------------------------------------------------------------- 133 | def get_task_list(self): 134 | """""" 135 | self.task_list 136 | 137 | #---------------------------------------------------------------------- 138 | def get_result_generator(self): 139 | """""" 140 | while True: 141 | try: 142 | ret = self.result_queue.get(timeout=1) 143 | yield ret 144 | except Empty: 145 | if self._task_count == self._executed_task_count: 146 | break 147 | else: 148 | pass 149 | 150 | #---------------------------------------------------------------------- 151 | @property 152 | def task_count(self): 153 | """""" 154 | return self._task_count 155 | 156 | #---------------------------------------------------------------------- 157 | @property 158 | def executed_task_count(self): 159 | """""" 160 | return self._executed_task_count 161 | 162 | #---------------------------------------------------------------------- 163 | @property 164 | def percent(self): 165 | """""" 166 | return float(self._task_count)/float(self._executed_task_count) 167 | 168 | #---------------------------------------------------------------------- 169 | @property 170 | def current_thread_count(self): 171 | """""" 172 | return self._current_thread_count 173 | 174 | 175 | 176 | 177 | 178 | class UtilsTest(unittest.case.TestCase): 179 | def runTest(self): 180 | ms = inspect.getmembers(self) 181 | ms = [x[0] for x in ms] 182 | for i in ms: 183 | if callable(getattr(self,i)): 184 | if i.startswith('test_'): 185 | getattr(self, i)() 186 | 187 | def test_pool(self): 188 | def demo_task(*args): 189 | '''simulate the plugin.run''' 190 | print('[!] Computing!') 191 | time.sleep(args[0]) 192 | print('[!] Finished!') 193 | print() 194 | returns = 'Runtime Length : %s' % str(args) 195 | return returns 196 | pool = Contractor() 197 | pool.add_task(demo_task, 7) 198 | pool.add_task(demo_task, 3) 199 | q = pool.start() 200 | print(pool._current_thread_count) 201 | self.assertIsInstance(q, Queue) 202 | 203 | r = q.get() 204 | print(r) 205 | self.assertIsInstance(r, str) 206 | r = q.get() 207 | print(r) 208 | self.assertIsInstance(r, str) 209 | 210 | print(pool._current_thread_count) 211 | 212 | 213 | if __name__ == '__main__': 214 | unittest.main() -------------------------------------------------------------------------------- /build/lib/g3ar/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from . import import_utils 2 | from . import inspect_utils 3 | from . import ip_calc_utils 4 | from . import print_utils 5 | from . import queue_utils -------------------------------------------------------------------------------- /build/lib/g3ar/utils/import_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Import Utils 6 | Created: 2017/1/2 7 | """ 8 | 9 | import unittest 10 | import os 11 | import sys 12 | 13 | #---------------------------------------------------------------------- 14 | def import_by_path(path, module_name, basedir='.'): 15 | """""" 16 | dirname = os.path.dirname(basedir) 17 | absdir = os.path.abspath(dirname) 18 | absdir = os.path.join(absdir, path) 19 | sys.path.append(absdir) 20 | mod = __import__(module_name) 21 | sys.path.remove(absdir) 22 | 23 | return mod 24 | 25 | if __name__ == '__main__': 26 | unittest.main() -------------------------------------------------------------------------------- /build/lib/g3ar/utils/inspect_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Make inspect easier 6 | Created: 2017/1/2 7 | """ 8 | 9 | import unittest 10 | import inspect 11 | import types 12 | from types import FunctionType 13 | from types import MethodType 14 | from pprint import pprint 15 | #import ip_calc_utils 16 | 17 | #---------------------------------------------------------------------- 18 | def get_callables(module_or_instance): 19 | """Get all callable mamber from [module_or_instance] 20 | 21 | Params: 22 | module_or_instance: :str: the name of module or instance 23 | 24 | Returns: 25 | A list stored the callable objects""" 26 | result = [] 27 | 28 | for i in inspect.getmembers(module_or_instance): 29 | if callable(i[1]): 30 | result.append(i[1]) 31 | else: 32 | pass 33 | 34 | return result 35 | 36 | #---------------------------------------------------------------------- 37 | def get_fileds(module_or_instance, type=None, public=True): 38 | """Get all field member from [module_or_instance] 39 | 40 | Params: 41 | module_or_instance: :str: the name of module or instance 42 | type: :type: the type you want to filter or tuple([type1, type2]) 43 | pubic: :bool: do you want to inspect all field? 44 | 45 | Returns: 46 | A dict stored the keys and values.""" 47 | result = {} 48 | 49 | for i in inspect.getmembers(module_or_instance): 50 | if not callable(i[1]): 51 | if i[0].startswith('_') and public: 52 | pass 53 | else: 54 | if type != None: 55 | if isinstance(i[1], type): 56 | result[i[0]] = i[1] 57 | else: 58 | pass 59 | else: 60 | result[i[0]] = i[1] 61 | else: 62 | pass 63 | 64 | return result 65 | 66 | #---------------------------------------------------------------------- 67 | def get_functions(module_or_instance, public=True): 68 | """Get all function from [module_or_instance] 69 | 70 | Params: 71 | module_or_instance: :str: the name of module or instances 72 | public: :bool: get the public function? 73 | 'public' means that the [name].startswith('_') is true. 74 | 75 | Returns: 76 | A list stored the function from module/instance 77 | """ 78 | ret = [] 79 | 80 | for i in get_callables(module_or_instance): 81 | if isinstance(i, FunctionType): 82 | ret.append(i) 83 | 84 | if public: 85 | for i in range(len(ret)): 86 | if ret[i].__name__.startswith('_'): 87 | ret[i] = None 88 | while True: 89 | try: 90 | ret.remove(None) 91 | except ValueError: 92 | break 93 | else: 94 | pass 95 | 96 | while True: 97 | try: 98 | ret.remove(None) 99 | except ValueError: 100 | break 101 | 102 | return ret 103 | 104 | #---------------------------------------------------------------------- 105 | def get_methods(instance, public=True): 106 | """Get methods from instance""" 107 | 108 | ret = [] 109 | 110 | for i in get_callables(instance): 111 | if isinstance(i, MethodType): 112 | ret.append(i) 113 | 114 | if public: 115 | for i in range(len(ret)): 116 | if ret[i].__name__.startswith('_'): 117 | ret[i] = None 118 | while True: 119 | try: 120 | ret.remove(None) 121 | except ValueError: 122 | break 123 | else: 124 | pass 125 | 126 | while True: 127 | try: 128 | ret.remove(None) 129 | except ValueError: 130 | break 131 | 132 | return ret 133 | 134 | #---------------------------------------------------------------------- 135 | def get_args_dict(func): 136 | """""" 137 | assert callable(func), '[!] The [func] you input cannot be called!' 138 | 139 | result = {} 140 | 141 | try: 142 | func_name = getattr(func, '__name__') 143 | except: 144 | func_name = str(func) 145 | 146 | # 147 | # Process args 148 | # 149 | args = {} 150 | spec = inspect.getargspec(func) 151 | args['vargs'] = spec.varargs 152 | args['kwargs'] = spec.keywords 153 | args['defaults'] = spec.defaults if spec.defaults else [] 154 | args['args'] = spec.args 155 | args['args_table'] = {} 156 | 157 | for i in spec.args: 158 | args['args_table'][i] = None 159 | 160 | for i in range(len(args['defaults'])): 161 | index = -1 - i 162 | args['args_table'][spec.args[index]] = spec.defaults[index] 163 | 164 | result['func_name'] = func_name 165 | result['args'] = args 166 | 167 | return result 168 | 169 | #---------------------------------------------------------------------- 170 | def get_neccessary_params(func): 171 | """""" 172 | assert callable(func), '[!] The [func] you input cannot be called!' 173 | 174 | result = [] 175 | 176 | table = get_args_dict(func)['args']['args_table'] 177 | for i in list(table.items()): 178 | if i[1] != None: 179 | pass 180 | else: 181 | result.append(i[0]) 182 | 183 | return result 184 | 185 | 186 | 187 | 188 | #---------------------------------------------------------------------- 189 | def get_classes(mod, metaclass=None): 190 | """""" 191 | if metaclass == None: 192 | metaclass = tuple([types.TypeType, types.ClassType]) 193 | for i in get_callables(mod): 194 | if isinstance(i, metaclass): 195 | yield i 196 | 197 | if __name__ == '__main__': 198 | unittest.main() -------------------------------------------------------------------------------- /build/lib/g3ar/utils/ip_calc_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Caculate About IP using IPy 6 | Created: 2016/12/26 7 | """ 8 | 9 | import unittest 10 | 11 | from IPy import IP 12 | #from .ipwhois import IPWhois 13 | from random import randint, seed 14 | from time import time 15 | 16 | seed(time()) 17 | 18 | 19 | #---------------------------------------------------------------------- 20 | def is_ipv4(ip): 21 | """Check if the [ip] is a real ip addr. 22 | 23 | Params: 24 | ip: :str: General IP format. 25 | 26 | Returns: 27 | :type: bool 28 | :desc: if ip is a valid IP addr, return true 29 | else return False""" 30 | try: 31 | IP(ip) 32 | return True 33 | except ValueError: 34 | return False 35 | 36 | #---------------------------------------------------------------------- 37 | def get_all_c_class(ip): 38 | """Return the All C Class Addr (v4)""" 39 | for i in IP(ip).make_net('255.255.255.0'): 40 | yield i.strNormal() 41 | 42 | #---------------------------------------------------------------------- 43 | def ip2int(ip): 44 | """""" 45 | return IP(ip).int() 46 | 47 | #---------------------------------------------------------------------- 48 | def ipv4_range(start_ip, end_ip): 49 | """""" 50 | start = ip2int(start_ip) 51 | end = ip2int(end_ip) 52 | 53 | for i in range(start, end): 54 | yield IP(i).strNormal() 55 | 56 | #---------------------------------------------------------------------- 57 | def random_ip(start='0.0.0.0', end='224.0.0.0'): 58 | """""" 59 | return IP(randint(IP(start).int(), IP(end).int())).strNormal() 60 | 61 | 62 | if __name__ == '__main__': 63 | unittest.main() -------------------------------------------------------------------------------- /build/lib/g3ar/utils/ipwhois/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013, 2014, 2015, 2016 Philip Hane 2 | # All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright notice, 10 | # this list of conditions and the following disclaimer in the documentation 11 | # and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 17 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 23 | # POSSIBILITY OF SUCH DAMAGE. 24 | 25 | __version__ = '0.14.0' 26 | 27 | from .exceptions import * 28 | from .net import Net 29 | from .ipwhois import IPWhois 30 | -------------------------------------------------------------------------------- /build/lib/g3ar/utils/ipwhois/exceptions.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013, 2014, 2015, 2016 Philip Hane 2 | # All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright notice, 10 | # this list of conditions and the following disclaimer in the documentation 11 | # and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 17 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 23 | # POSSIBILITY OF SUCH DAMAGE. 24 | 25 | 26 | class NetError(Exception): 27 | """ 28 | An Exception for when a parameter provided is not an instance of 29 | ipwhois.net.Net. 30 | """ 31 | 32 | 33 | class IPDefinedError(Exception): 34 | """ 35 | An Exception for when the IP is defined (does not need to be resolved). 36 | """ 37 | 38 | 39 | class ASNLookupError(Exception): 40 | """ 41 | An Exception for when the ASN lookup failed. 42 | """ 43 | 44 | 45 | class ASNRegistryError(Exception): 46 | """ 47 | An Exception for when the ASN registry does not match one of the five 48 | expected values (arin, ripencc, apnic, lacnic, afrinic). 49 | """ 50 | 51 | 52 | class HostLookupError(Exception): 53 | """ 54 | An Exception for when the host lookup failed. 55 | """ 56 | 57 | 58 | class BlacklistError(Exception): 59 | """ 60 | An Exception for when the server is in a blacklist. 61 | """ 62 | 63 | 64 | class WhoisLookupError(Exception): 65 | """ 66 | An Exception for when the whois lookup failed. 67 | """ 68 | 69 | 70 | class HTTPLookupError(Exception): 71 | """ 72 | An Exception for when the RDAP lookup failed. 73 | """ 74 | 75 | 76 | class HTTPRateLimitError(Exception): 77 | """ 78 | An Exception for when HTTP queries exceed the NIC's request limit and have 79 | exhausted all retries. 80 | """ 81 | 82 | 83 | class InvalidEntityContactObject(Exception): 84 | """ 85 | An Exception for when JSON output is not an RDAP entity contact information 86 | object: 87 | https://tools.ietf.org/html/rfc7483#section-5.4 88 | """ 89 | 90 | 91 | class InvalidNetworkObject(Exception): 92 | """ 93 | An Exception for when JSON output is not an RDAP network object: 94 | https://tools.ietf.org/html/rfc7483#section-5.4 95 | """ 96 | 97 | 98 | class InvalidEntityObject(Exception): 99 | """ 100 | An Exception for when JSON output is not an RDAP entity object: 101 | https://tools.ietf.org/html/rfc7483#section-5.1 102 | """ 103 | -------------------------------------------------------------------------------- /build/lib/g3ar/utils/print_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Print Better Helper! 6 | Created: 2017/1/2 7 | """ 8 | 9 | import unittest 10 | from colorama import init, Fore 11 | from prettytable import PrettyTable 12 | 13 | #---------------------------------------------------------------------- 14 | def print_bar(text=None, basic_char='=', length=70, color=None): 15 | """""" 16 | if text: 17 | text = str(text) 18 | textlen = len(text) 19 | length_one_side = (length - textlen) / 2 20 | bar_side = basic_char * int(length_one_side) 21 | bar = bar_side + text + bar_side 22 | else: 23 | bar = basic_char * length 24 | 25 | if color and hasattr(Fore, color.upper()): 26 | bar = getattr(Fore, color.upper()) + bar 27 | else: 28 | bar = bar 29 | 30 | init(autoreset=True) 31 | print(bar) 32 | 33 | #---------------------------------------------------------------------- 34 | def print_red(*args): 35 | """""" 36 | raw = str(args) 37 | init(autoreset=True) 38 | print((Fore.RED + raw)) 39 | 40 | #---------------------------------------------------------------------- 41 | def print_green(*args): 42 | """""" 43 | raw = str(args) 44 | init(autoreset=True) 45 | print((Fore.GREEN + raw)) 46 | 47 | #---------------------------------------------------------------------- 48 | def print_blue(*args): 49 | """""" 50 | raw = str(args) 51 | init(autoreset=True) 52 | print((Fore.CYAN + raw)) 53 | 54 | #---------------------------------------------------------------------- 55 | def print_yellow(*args): 56 | """""" 57 | raw = str(args) 58 | init(autoreset=True) 59 | print((Fore.YELLOW + raw)) 60 | 61 | #---------------------------------------------------------------------- 62 | def print_cyan(*args): 63 | """""" 64 | raw = str(args) 65 | init(autoreset=True) 66 | print((Fore.CYAN + raw)) 67 | 68 | #---------------------------------------------------------------------- 69 | def print_purpul(*args): 70 | """""" 71 | raw = str(args) 72 | init(autoreset=True) 73 | print((Fore.MAGENTA + raw)) 74 | 75 | #---------------------------------------------------------------------- 76 | def print_gray(*args): 77 | """""" 78 | raw = str(args) 79 | init(autoreset=True) 80 | print((Fore.LIGHTBLACK_EX + raw)) 81 | 82 | 83 | #---------------------------------------------------------------------- 84 | def print_column(head, column, color=''): 85 | """Print Column With Color. 86 | 87 | Params: 88 | head: :: A head for the column data. 89 | column: :list tuple: the column data(list or tuple) 90 | coler: :str: 91 | lightblack_ex 92 | magenta 93 | cyan 94 | green 95 | blue 96 | yellow 97 | red 98 | 99 | Returns: 100 | return the strings of table 101 | """ 102 | assert isinstance(color, str) 103 | 104 | _prefix = '' 105 | if hasattr(Fore, color.upper()): 106 | _prefix = getattr(Fore, color.upper()) 107 | 108 | table = PrettyTable() 109 | table.add_column(head, column) 110 | 111 | raw = table.get_string() 112 | init(autoreset=True) 113 | print(_prefix + raw) 114 | return table 115 | 116 | #---------------------------------------------------------------------- 117 | def print_columns(heads, columns, color=''): 118 | """Print Column With Color. 119 | 120 | Params: 121 | head: :: A list of heads for the columns data. 122 | column: :list tuple: the column data(list or tuple) 123 | coler: :str: 124 | lightblack_ex 125 | magenta 126 | cyan 127 | green 128 | blue 129 | yellow 130 | red 131 | 132 | Returns: 133 | return the strings of table 134 | """ 135 | assert isinstance(color, str) 136 | assert len(heads) == len(columns) 137 | 138 | _prefix = '' 139 | if hasattr(Fore, color.upper()): 140 | _prefix = getattr(Fore, color.upper()) 141 | 142 | table = PrettyTable() 143 | for i in xrange(len(heads)): 144 | head = heads[i] 145 | column = columns[i] 146 | table.add_column(head, column) 147 | 148 | raw = table.get_string() 149 | init(autoreset=True) 150 | print(_prefix + raw) 151 | return table 152 | 153 | #---------------------------------------------------------------------- 154 | def print_rows(heads, rows, color=''): 155 | """Print Column With Color. 156 | 157 | Params: 158 | heads: :list: the row of heads 159 | rows: :list tuple: the rows data(list or tuple) 160 | coler: :str: 161 | lightblack_ex 162 | magenta 163 | cyan 164 | green 165 | blue 166 | yellow 167 | red 168 | 169 | Returns: 170 | return the strings of table 171 | """ 172 | assert len(heads) == len(rows[0]) 173 | assert isinstance(color, str) 174 | 175 | _prefix = '' 176 | if hasattr(Fore, color.upper()): 177 | _prefix = getattr(Fore, color.upper()) 178 | 179 | # 180 | # split rows 181 | # 182 | table = PrettyTable(heads) 183 | for row in rows: 184 | table.add_row(row) 185 | 186 | 187 | raw = table.get_string() 188 | init(autoreset=True) 189 | print(_prefix + raw) 190 | return table 191 | 192 | 193 | 194 | if __name__ == '__main__': 195 | unittest.main() -------------------------------------------------------------------------------- /build/lib/g3ar/utils/pyping/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Python Ping 6 | Created: 2016/12/26 7 | """ 8 | 9 | import unittest 10 | from .isalive import is_alive 11 | 12 | #---------------------------------------------------------------------- 13 | def pyping(target, timeout=2, count=4): 14 | """""" 15 | return is_alive(target) 16 | 17 | 18 | if __name__ == '__main__': 19 | unittest.main() -------------------------------------------------------------------------------- /build/lib/g3ar/utils/pyping/isalive.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Test the host is alive? 6 | Created: 2016/12/20 7 | """ 8 | 9 | import unittest 10 | from .ping import verbose_ping 11 | 12 | #---------------------------------------------------------------------- 13 | def is_alive(host, timeout=2, count=4): 14 | """""" 15 | result = {} 16 | 17 | ret = ping_host(host, timeout, count) 18 | result['ping'] = ret 19 | 20 | return result 21 | 22 | 23 | #---------------------------------------------------------------------- 24 | def ping_host(host, timeout=2, count=4): 25 | """""" 26 | result = {} 27 | result['alive'] = False 28 | result['delay'] = 0 29 | try: 30 | ping_delay = verbose_ping(host, timeout=timeout,count=count) 31 | if ping_delay != 0: 32 | result['alive'] = True 33 | result['delay'] = ping_delay 34 | return result 35 | else: 36 | raise ValueError() 37 | except: 38 | return result 39 | 40 | 41 | ######################################################################## 42 | class IsAliveTest(unittest.case.TestCase): 43 | """""" 44 | 45 | #---------------------------------------------------------------------- 46 | def test_pingtest(self): 47 | """Ping test""" 48 | 49 | print(ping_host('45.78.6.64')) 50 | 51 | 52 | 53 | 54 | 55 | if __name__ == '__main__': 56 | unittest.main() -------------------------------------------------------------------------------- /build/lib/g3ar/utils/queue_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Queue Utils 6 | Created: 2017/1/3 7 | """ 8 | 9 | import unittest 10 | import threading 11 | import time 12 | try: 13 | from queue import Empty 14 | except: 15 | from Queue import Empty 16 | 17 | #---------------------------------------------------------------------- 18 | def sync_dispatch(queue_instance, task_generator, 19 | buffer_size=100, interval=0.05): 20 | """To dispatch tasks from [task_generator] to [queue_instance] 21 | with the [buffer_size] buffer task. 22 | 23 | Params: 24 | queue_instance: :Queue: receive task. 25 | task_generator: :generator/list/tuple/set: Who have tasks 26 | waiting for being dispatched. 27 | buffer_size: :int: buffer_size. 28 | interval: :float/int: interval of checking the size of queue.""" 29 | 30 | assert isinstance(interval, (int, float)), \ 31 | '[!] [interval] should be a float/int! ' 32 | assert isinstance(buffer_size, int), \ 33 | '[!] [buffer_size] should be a int! ' 34 | 35 | for i in task_generator: 36 | while queue_instance.qsize() >= buffer_size: 37 | time.sleep(interval) 38 | queue_instance.put(i) 39 | 40 | #---------------------------------------------------------------------- 41 | def async_dispatch(queue_instance, task_generator, 42 | buffer_size=100, interval=0.05, 43 | thread_name='ASYNC_DISPATCHER', daemon=True): 44 | """To dispatch tasks from [task_generator] to [queue_instance] 45 | with the [buffer_size] buffer task. 46 | 47 | Params: 48 | queue_instance: :Queue: receive task. 49 | task_generator: :generator/list/tuple/set: Who have tasks 50 | waiting for being dispatched. 51 | buffer_size: :int: buffer_size 52 | interval: :float/int: interval of checking the size of queue. 53 | thread_name: :str: the name of thread. 54 | daemon: :bool: daemon thread?""" 55 | 56 | assert isinstance(interval, (int, float)), \ 57 | '[!] [interval] should be a float/int! ' 58 | assert isinstance(buffer_size, int), \ 59 | '[!] [buffer_size] should be a int! ' 60 | 61 | def _worker(): 62 | for i in task_generator: 63 | while queue_instance.qsize() >= buffer_size: 64 | time.sleep(interval) 65 | queue_instance.put(i) 66 | 67 | _threadi = threading.Thread(name=thread_name, target=_worker) 68 | _threadi.daemon = True 69 | _threadi.start() 70 | 71 | #---------------------------------------------------------------------- 72 | def queue_peek(queue_instance, timeout=60): 73 | """Convert Queue to A generator with a timeout 74 | 75 | Params: 76 | queue_instance: :Queue: the Queue you want to peek 77 | timeout: :int/float: from got a """ 78 | while True: 79 | try: 80 | yield queue_instance.get(timeout=timeout) 81 | except Empty: 82 | break 83 | 84 | 85 | if __name__ == '__main__': 86 | unittest.main() -------------------------------------------------------------------------------- /build/lib/g3ar/utils/tests.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Test for utils 6 | Created: 2017/1/2 7 | """ 8 | 9 | import unittest 10 | try: 11 | from queue import Queue 12 | except: 13 | from Queue import Queue 14 | from . import ip_calc_utils 15 | from .ip_calc_utils import * 16 | from .print_utils import print_bar 17 | from .inspect_utils import * 18 | from .import_utils import import_by_path 19 | from . import queue_utils 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | if __name__ == '__main__': 28 | unittest.main() -------------------------------------------------------------------------------- /dist/g3ar-0.1.2-py2.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.1.2-py2.7.egg -------------------------------------------------------------------------------- /dist/g3ar-0.1.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.1.2.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.1.3-py2.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.1.3-py2.7.egg -------------------------------------------------------------------------------- /dist/g3ar-0.1.3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.1.3.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.1.5.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.1.5.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.1.6-py2.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.1.6-py2.7.egg -------------------------------------------------------------------------------- /dist/g3ar-0.1.6.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.1.6.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.1.7-py2.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.1.7-py2.7.egg -------------------------------------------------------------------------------- /dist/g3ar-0.1.7.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.1.7.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.1.8-py2.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.1.8-py2.7.egg -------------------------------------------------------------------------------- /dist/g3ar-0.1.8.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.1.8.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.1.9.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.1.9.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.0b1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.0b1.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.0b2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.0b2.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.0b3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.0b3.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.0b4.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.0b4.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.0b5.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.0b5.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.0b6.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.0b6.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.1-py2.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.1-py2.7.egg -------------------------------------------------------------------------------- /dist/g3ar-0.2.1.macosx-10.6-intel.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.1.macosx-10.6-intel.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.1.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.2-py2.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.2-py2.7.egg -------------------------------------------------------------------------------- /dist/g3ar-0.2.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.2.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.3-py3.5.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.3-py3.5.egg -------------------------------------------------------------------------------- /dist/g3ar-0.2.3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.3.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.4.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.4.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.5.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.5.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.6.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.6.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.7.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.7.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.8.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.8.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.2.9.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.2.9.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.3.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.3.0.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.3.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.3.1.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.3.5.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.3.5.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.3.6.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.3.6.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.3.7.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.3.7.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.3.8.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.3.8.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.4.0a0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.4.0a0.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.4.3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.4.3.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.5.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.5.0.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.5.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.5.1.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.5.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.5.2.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.5.3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.5.3.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.5.5.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.5.5.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.5.6.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.5.6.tar.gz -------------------------------------------------------------------------------- /dist/g3ar-0.5.7.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/dist/g3ar-0.5.7.tar.gz -------------------------------------------------------------------------------- /docs/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/.DS_Store -------------------------------------------------------------------------------- /docs/build/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/.DS_Store -------------------------------------------------------------------------------- /docs/build/doctrees/environment.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/doctrees/environment.pickle -------------------------------------------------------------------------------- /docs/build/doctrees/func_quicklook.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/doctrees/func_quicklook.doctree -------------------------------------------------------------------------------- /docs/build/doctrees/index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/doctrees/index.doctree -------------------------------------------------------------------------------- /docs/build/doctrees/overview.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/doctrees/overview.doctree -------------------------------------------------------------------------------- /docs/build/doctrees/step1.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/doctrees/step1.doctree -------------------------------------------------------------------------------- /docs/build/doctrees/step2.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/doctrees/step2.doctree -------------------------------------------------------------------------------- /docs/build/html/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: 57d1154dd1466113b062d43b4f9a0213 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /docs/build/html/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/html/.nojekyll -------------------------------------------------------------------------------- /docs/build/html/_sources/func_quicklook.rst.txt: -------------------------------------------------------------------------------- 1 | 功能简介 2 | ============== 3 | Python 渗透工具,或者渗透测试工具框架可能需要用到的组件:带结果反馈的线程池,支持大字典流式读取 4 | 以及进度保存的字典解析模块,以进程方式启动并加以监视控制与结果反馈的任务管理器,带有装饰器接口的日志 5 | 记录工具,除此之外,utils 还包含了一些有用的小工具:打印带颜色的文字,指定路径的 import 工具, 6 | ip 计算工具,更加方便的 Python 自省工具。 7 | 8 | 线程池组件 9 | ----------------- 10 | 11 | 简介 12 | ^^^^^^^^ 13 | 线程池的出现极大的方便了密集型任务的编程,在线程池组件的帮助下,一个任务密集型的程序将会极大被简化, 14 | 只需要维护一个稳定的任务队列并且定时从线程池的结果队列中获取任务反馈。 15 | 16 | Quick Look 17 | ^^^^^^^^^^^^^^^^ 18 | 19 | .. code-block:: python 20 | 21 | import time 22 | from g3ar import ThreadPool 23 | 24 | def func(arg1): 25 | # 26 | # Do something intersting 27 | # 28 | time.sleep(5) 29 | return arg1 30 | 31 | pool = ThreadPool() 32 | pool.start() 33 | pool.feed(target_func=func, arg1=4) 34 | queue = pool.get_result_queue() 35 | result = queue.get() 36 | print(result) 37 | pool.stop() 38 | 39 | 40 | 这个最简单的例子,就是我们使用 ThreadPool 做的一个最简单的事情,也就是执行一个函数,然后再异步 41 | 收集结果。 42 | 43 | 我们分布来讲解这一段小代码: 44 | 45 | .. code-block:: python 46 | 47 | from g3ar import ThreadPool 48 | def func(arg1): 49 | # 50 | # Do something intersting 51 | # 52 | time.sleep(5) 53 | return arg1 54 | 55 | 56 | 导入我们需要的 ThreadPool 然后并定义一个函数。 57 | 58 | .. code-block:: python 59 | 60 | pool = ThreadPool() 61 | pool.start() 62 | 63 | 新建一个 ThreadPool 对象,然后开启线程池(start)。启动线程池之后,线程池对象会在内部启动若干 64 | 个线程,然后这些线程就会进入等待状态。当任务队列中出现任务的时候,线程就会提取任务队列中的任务, 65 | 然后执行相应的任务,把任务的执行情况放在结果队列中 66 | 67 | .. code-block:: python 68 | 69 | pool.feed(target_func=func, arg1=4) 70 | 71 | 传入需要运行的函数,并且在 target_func 后输入其他的参数,例如在 func 中,arg1 是 func 的唯 72 | 一参数,因为后面必须要写出形参的名称和形参的值。 73 | 74 | .. code-block:: python 75 | 76 | queue = pool.get_result_queue() 77 | result = queue.get() 78 | print(result) 79 | pool.stop() 80 | 81 | 82 | 通过 pool.get_result_queue(), 获取一个 Queue.Queue 对象,这个对象是 Python 内置的对象, 83 | 所以不做过多的说明,通过 queue.get() 来获取函数执行的结果。 84 | 85 | 当获取到需要的结果之后,通过 pool.stop() 来关闭线程池。 86 | 87 | 你会发现,这个线程池使用起来非常的简单,事实上,简单已经是一切了对不对? 88 | 89 | 大字典读取 90 | ----------------- 91 | 92 | 在进行 Python 渗透工具编写的过程中,我们经常需要用到各种各样的字典(当然不是用来查生词的字典), 93 | 比如你有一个 300MB 的字典,你想用它去跑密码,然后整个脚本都需要在短时间内完成,这个时候应该怎么办呢? 94 | 95 | 当然大家直到使用文件流去读取是最好不过的,但是实际上,可能你整天都在忙着渗透测试的业务并没有太多 96 | 去关注编程方面的东西,那么你难道真的就那样整个把字典加载进内存?而且还很麻烦做字典分片啊,进度 97 | 保存啊之类的基础性工作。实际上,这些工作,g3ar 都可以替你完成喔! 98 | 99 | .. code-block:: python 100 | 101 | from g3ar import DictParser 102 | 103 | dparser = DictParser('bigdict.txt') 104 | for i in dparser: 105 | # 106 | # Do What you want! 107 | # 108 | pass 109 | 110 | 看!实际的使用,就这么简单,但是然后呢?我们设想一些复杂的场景:我的字典大概跑了有 2000 条, 111 | 然后临时有事情,我需要暂停下来,然后等我忙完了事情接下来再跑这个字典,那么应该怎么做呢?当然是有 112 | 好办法啦!DictParser 提供了基于 session 控制的可选进度保存操作。 113 | 114 | 首先我们假定我们有一个叫 demodict 的字典文件:: 115 | 116 | 6666123 117 | 12341 118 | 346 119 | 245!#$%@#$^# 120 | 325 121 | 12341adfas 122 | asd 123 | re 124 | yq 125 | dahy 126 | ar 127 | r 128 | 34 129 | awe 130 | g 131 | da 132 | haf 133 | dh 134 | ad 135 | s 136 | dasdtdassd 137 | 138 | 针对这一个字典文件,我们需要读取这个字典文件中的内容,然后并且进行进度保存,那么我们应该怎么做呢? 139 | 140 | TAKL IS CHEAP, LET ME SHOW YOU THE CODES! 141 | 142 | .. code-block:: python 143 | 144 | from g3ar import DictParser 145 | from g3ar.utils.print_utils import print_bar 146 | 147 | # 148 | # 创建一个 DictParser, 把 demosession 作为 session_id 传入 DictParser 对象中 149 | # 150 | dparser = DictParser(filename='demodict', session_id='demosession') 151 | 152 | # 153 | # 读取前十行:因为 DictParser 本质上是一个迭代器,所以可以使用 foreach 的形式也可以直接调用 next 154 | # 去获取相应的值 155 | # 156 | print_bar('GET 10 LINES') 157 | for i in xrange(10): 158 | print(dparser.next()) 159 | print_bar('END') 160 | print() 161 | 162 | # 163 | # 强制保存当前字典读取的进度 164 | # 165 | dparser.force_save() 166 | 167 | # 168 | # 删除字典(自动关闭文件) 169 | # 170 | del dparser 171 | 172 | # 173 | # 重新创建一个 DictParser, 然后把之前使用的 session_id 传入,然后设置 do_continue 为 True 174 | # 这样得到的一个 DictParser 就是一个接着上一次读写字典进度的一个字典解析器 175 | # 176 | dparser_continue = DictParser(filename='demodict', session_id='demosession', do_continue=True) 177 | # 178 | # 那么我们现在来验证后面的字典剩下的内容是不是紧接着我们上一次保存的进度之后? 179 | # 180 | print_bar('GET NEXT ALL LINE') 181 | for i in dparser_continue: 182 | print(i) 183 | 184 | 然后上面就是我们完成保存进度使用的接口,我们查看一下最终的结果来检查是不是按照我们的期望进行工作!:: 185 | 186 | =============================GET 10 LINES============================= 187 | 6666123 188 | 12341 189 | 346 190 | 245!#$%@#$^# 191 | 325 192 | 12341adfas 193 | asd 194 | re 195 | yq 196 | dahy 197 | =================================END================================= 198 | () 199 | ==========================GET NEXT ALL LINE========================== 200 | ar 201 | r 202 | 34 203 | awe 204 | g 205 | da 206 | haf 207 | dh 208 | ad 209 | s 210 | dasdtdassd 211 | 212 | 接下来我们对比一下之前我们创建的字典文件,发现确实实现字典的进度保存。那么现在,你可以使用它 213 | 去完成你想要的操作了!我觉得你现在可能已经想到它可以用在哪里了! 214 | 215 | 任务管理器 216 | ---------------- 217 | 218 | 任务管理器其实不像是线程池那样适合高度密集任务的处理,因为进程开销显然要比线程开销大得多啊,那么 219 | 基于这些基础的问题,我们怎么样来认识我们 g3ar 给大家提供的任务管理器呢?其实也很好解释,就是假如说 220 | 我们需要启动两个爆破程序,每一个爆破程序会启动甚至几十个线程去进行密码爆破等操作,每一个爆破程序 221 | 都有高密度的任务,在这些任务中,我们为这些任务启动开销相对更低的线程。对于整个的爆破程序,我们 222 | 就以进程为单位去管理。这样做有什么好处呢? 223 | 224 | #. 可以监控进程内部线程的运行状况:如果关键线程发生了异常,可以立即发现,采取相应措施。 225 | #. 可以强行结束一个进程,然而并不能强行结束一个线程。 226 | 227 | 好的接下来,我们就来看一下,怎么样使用这些令人激动的功能吧? 228 | 229 | .. code-block:: python 230 | 231 | # 232 | # example for taskbulter 233 | # 234 | import time 235 | from g3ar import TaskBulter 236 | from g3ar.utils.print_utils import print_bar 237 | 238 | # 239 | # 创建一个 TaskBulter 用以准备启动新的任务 240 | # 241 | tbr = TaskBulter() 242 | 243 | # 244 | # 自己定义一个 taskid 然后定一个任务函数 245 | # 246 | taskid = 'testtask-id' 247 | #---------------------------------------------------------------------- 248 | def func(arg1, arg2='1'): 249 | """""" 250 | time.sleep(2) 251 | return arg1, arg2 252 | 253 | # 254 | # 传入必须任务的 id, 传入目标函数,目标函数的参数 255 | # 256 | print_bar('start the task') 257 | print(tbr.start_task(id=taskid, target=func, args=('arg1var',))) 258 | 259 | # 260 | # 查看任务执行的状态 261 | # 262 | print_bar('watch the status') 263 | print(tbr.get_tasks_status()) 264 | 265 | time.sleep(3) 266 | 267 | # 268 | # 获取任务结果 269 | # 270 | print_bar('get result') 271 | print(tbr.get_result(taskid)) 272 | 273 | 使用起来大概也不会有什么不适,非常的简单和理所当然的接口,我想关于结果大家肯定都已经猜到了:: 274 | 275 | ============================start the task============================ 276 | None 277 | ===========================watch the status=========================== 278 | {'testtask-id': {'now': {}, 'last': {}}} 279 | ==============================get result============================== 280 | [{'state': True, 'exception': '', 'result': ('arg1var', '1')}] 281 | 282 | 要说明的就是结果部分吧,可能大家会奇怪,为什么结果不是我的函数直接返回的结果,而且还被包装了一层 283 | 又一层? 284 | 285 | 这当然不是图麻烦,在后续的详细文档关于这个部分会详细解释,简单来想,原因就是:如果任务执行的过程 286 | 中,出现了问题,那么,如果按平时仅仅返回一个结果就会显得非常突兀,有时候我们又渴望知道到底出现了 287 | 什么异常信息,这样的话,一个格式化的输出就很有必要了。 288 | 289 | 在结果输出中,整个结果是存储在一个 list 里面的,list 内是一个又一个的 dict,state 代表的是运 290 | 行的结果是不是按照期望运行,如果出现了不期望的一场,state 则会为 291 | False,于此同时 exception 会记录出现的异常是什么;result 则表示函数返回的结果是什么,当然, 292 | 如果返回了多个结果,就会出现多个 dict,因为在我们的任务可能不是 return ,还有可能是 yield。 293 | 294 | 其他相关连接 295 | --------------------- 296 | 297 | * `首页 `_ 298 | * `总览 `_ 299 | * `功能简介 `_ 300 | -------------------------------------------------------------------------------- /docs/build/html/_sources/func_quicklook.txt: -------------------------------------------------------------------------------- 1 | 功能简介 2 | ============== 3 | 相信你看到这里应该是对这个东西有一些兴趣了对吧?那么我们接下来就来具体说明 g3ar 4 | 到底包含了怎么样的功能。 5 | 6 | 功能清单 7 | -------------- 8 | 当然你可以说是大杂烩,因为事实上,g3ar 确实是这样,提供了关于渗透测试遇到的 9 | 常见的编程问题的解决方案。比如之前提到的: 10 | 11 | #. 更方便高效可控的多线程处理(ThreadPool 与 Contractor)。 12 | #. 进程管理(TaskBulter)可以做到对某个进程内的线程进行监控。 13 | #. 大字典(百兆甚至上 G 级别)的解析与进度保存。 14 | #. 日志装饰器:使用日志装饰器来进行日志记录,追踪关键函数的运行状况,无需手动追踪。 15 | #. 小型工具库:比如快速自省工具(inspect_utils),关于 ip 的计算工具(ip_calc_utils) 16 | 17 | 这些功能(工具类)都已经在 g3ar 中得到了实现,并且有了非常良好的表现, 18 | 使用上面的几个小功能,作者很容易的构造出了一示例的密码爆破的框架,详见 19 | 20 | https://github.com/VillanCh/minihydra 21 | 22 | 一个 mini 版的 hydra 但是可以自己定制插件脚本。 23 | 24 | 其他相关连接 25 | --------------------- 26 | 27 | * `首页 `_ 28 | * `总览 `_ 29 | * `功能简介 `_ 30 | -------------------------------------------------------------------------------- /docs/build/html/_sources/index.rst.txt: -------------------------------------------------------------------------------- 1 | .. g3ar documentation master file, created by 2 | sphinx-quickstart on Mon Jan 09 23:11:23 2017. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | 欢迎来到 G3AR 7 | ================================ 8 | 9 | 10 | 11 | 内容: 12 | 13 | .. toctree:: 14 | :maxdepth: 2 15 | 16 | overview 17 | func_quicklook 18 | -------------------------------------------------------------------------------- /docs/build/html/_sources/index.txt: -------------------------------------------------------------------------------- 1 | .. g3ar documentation master file, created by 2 | sphinx-quickstart on Mon Jan 09 23:11:23 2017. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | 欢迎来到 G3AR 7 | ================================ 8 | 9 | 内容: 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | overview 15 | func_quicklook 16 | 17 | 18 | 快速开始 19 | ------- 20 | 21 | 22 | Indices and tables 23 | ================== 24 | 25 | * :ref:`genindex` 26 | * :ref:`modindex` 27 | * :ref:`search` 28 | -------------------------------------------------------------------------------- /docs/build/html/_sources/overview.rst.txt: -------------------------------------------------------------------------------- 1 | 什么是 g3ar?如何安装? 2 | ================================ 3 | 作为一个网络安全爱好者的你,喜欢搞一些奇怪的事情?但是苦于自己的 Python 编程实在是太糟糕了 4 | ,想要的东西都不会写。比如你早就想要个可以很快的调度多线程的东西了? 5 | 不用每次遍历 + 单线程去解决一些事情。或者说你很烦为你的工具去添加日志, 6 | 因为整个流程在关键地方打日志(处理异常)繁琐到爆炸会让人崩溃的。 7 | 或者说你很讨厌一些爆破工具只能加载小型的字典,但是面对上百兆的字典, 8 | 你无能为力…… 9 | 10 | g3ar 就是这样一个模块:专门为你解决你在进行奇奇怪怪编程中的“小麻烦”:例如, 11 | 你有更方便的可以收集结果的线程池,并且还能监视你的任务执行成功还是失败,而不必每次为 12 | 了多线程而烦恼;甚至说你还可以通过 g3ar 中的一个叫 TaskBulter 去启动真正的进程, 13 | 然后去监控进程中的线程存活性(比如关键线程的工作状况?当前进程有多少存活的线程?)…… 14 | 当然,强大的 g3ar 的功能远远不止如此。 15 | 16 | 作者 17 | ------- 18 | v1ll4n 19 | 20 | 作者是一个网络安全狂热爱好者。 21 | 22 | 特别鸣谢与赞助列表 23 | ------------------------- 24 | Fugitiv3 25 | 26 | Saferman 27 | 28 | Stardust 29 | 30 | TB 31 | 32 | HQ 33 | 34 | 依赖问题与环境说明 35 | ------------------------------------------------------ 36 | 推荐使用 Python2.7 +, 37 | 但是 Python3 也做了适配,但是可能会遇到一些不可预料的小问题。 38 | 39 | .. code-block:: bash 40 | 41 | colorama==0.3.7 42 | decorator==4.0.10 43 | IPy==0.83 44 | ipython==5.1.0 45 | ipython-genutils==0.1.0 46 | pexpect==4.2.1 47 | pickleshare==0.7.4 48 | prompt-toolkit==1.0.9 49 | ptyprocess==0.5.1 50 | Pygments==2.1.3 51 | simplegeneric==0.8.1 52 | six==1.10.0 53 | traitlets==4.3.1 54 | wcwidth==0.1.7 55 | 56 | 57 | 安装方法 58 | --------------------------------------------------------- 59 | 通过 pip 或者 easy_install 安装(以下命令任意选择一个都可以) 60 | 61 | .. code-block:: bash 62 | 63 | pip install g3ar 64 | easy_install g3ar 65 | 66 | 通过 github 安装: 67 | 68 | .. code-block:: bash 69 | 70 | git clone https://github.com/VillanCh/g3ar.git 71 | cd g3ar 72 | pip install -r requirements.txt 73 | python setup.py install 74 | 75 | 76 | 其他相关连接 77 | -------------------------------------------------- 78 | 79 | * `首页 `_ 80 | * `总览 `_ 81 | * `功能简介 `_ 82 | -------------------------------------------------------------------------------- /docs/build/html/_sources/overview.txt: -------------------------------------------------------------------------------- 1 | 什么是 g3ar?如何安装? 2 | ================================ 3 | 作为一个网络安全爱好者的你,喜欢搞一些奇怪的事情?但是苦于自己的 Python 编程实在是太糟糕了 4 | ,想要的东西都不会写。比如你早就想要个可以很快的调度多线程的东西了? 5 | 不用每次遍历 + 单线程去解决一些事情。或者说你很烦为你的工具去添加日志, 6 | 因为整个流程在关键地方打日志(处理异常)繁琐到爆炸会让人崩溃的。 7 | 或者说你很讨厌一些爆破工具只能加载小型的字典,但是面对上百兆的字典, 8 | 你无能为力…… 9 | 10 | g3ar 就是这样一个模块:专门为你解决你在进行奇奇怪怪编程中的“小麻烦”:例如, 11 | 你有更方便的可以收集结果的线程池,并且还能监视你的任务执行成功还是失败,而不必每次为 12 | 了多线程而烦恼;甚至说你还可以通过 g3ar 中的一个叫 TaskBulter 去启动真正的进程, 13 | 然后去监控进程中的线程存活性(比如关键线程的工作状况?当前进程有多少存活的线程?)…… 14 | 当然,强大的 g3ar 的功能远远不止如此。 15 | 16 | 作者 17 | ------- 18 | v1ll4n 19 | 20 | 作者是一个不折不扣的网络安全狂热爱好者。 21 | 22 | 特别鸣谢与赞助列表 23 | ------------------------- 24 | Fugitiv3 25 | 26 | Saferman 27 | 28 | Stardust 29 | 30 | TB 31 | 32 | HQ 33 | 34 | 依赖问题与环境说明 35 | ------------------------------------------------------ 36 | 推荐使用 Python2.7 +, 37 | 但是 Python3 也做了一定适配,基本可以正常运行。 38 | 39 | .. code-block:: bash 40 | 41 | colorama==0.3.7 42 | decorator==4.0.10 43 | IPy==0.83 44 | ipython==5.1.0 45 | ipython-genutils==0.1.0 46 | pexpect==4.2.1 47 | pickleshare==0.7.4 48 | prompt-toolkit==1.0.9 49 | ptyprocess==0.5.1 50 | Pygments==2.1.3 51 | simplegeneric==0.8.1 52 | six==1.10.0 53 | traitlets==4.3.1 54 | wcwidth==0.1.7 55 | 56 | 57 | 安装方法 58 | --------------------------------------------------------- 59 | 通过 pip 或者 easy_install 安装(以下命令任意选择一个都可以) 60 | 61 | .. code-block:: bash 62 | 63 | pip install g3ar 64 | easy_install g3ar 65 | 66 | 通过 github 安装: 67 | 68 | .. code-block:: bash 69 | 70 | git clone https://github.com/VillanCh/g3ar.git 71 | cd g3ar 72 | python setup.py install 73 | 74 | 75 | 其他相关连接 76 | -------------------------------------------------- 77 | 78 | * `首页 `_ 79 | * `总览 `_ 80 | * `功能简介 `_ 81 | -------------------------------------------------------------------------------- /docs/build/html/_sources/step1.txt: -------------------------------------------------------------------------------- 1 | Step1 :什么是 g3ar?如何安装? 2 | ============= 3 | 作为一个网络安全爱好者的你,喜欢搞一些奇怪的事情?但是苦于自己的 Python 编程实在是太糟糕了 4 | ,想要的东西都不会写。比如你早就想要个可以很快的调度多线程的东西了? 5 | 不用每次遍历 + 单线程去解决一些事情。或者说你很烦为你的工具去添加日志, 6 | 因为整个流程在关键地方打日志(处理异常)繁琐到爆炸会让人崩溃的。 7 | 或者说你很讨厌一些爆破工具只能加载小型的字典,但是面对上百兆的字典, 8 | 你无能为力…… 9 | 10 | g3ar 就是这样一个模块:专门为你解决你在进行奇奇怪怪编程中的“小麻烦”:例如, 11 | 你有更方便的可以收集结果的线程池,并且还能监视你的任务执行成功还是失败,而不必每次为 12 | 了多线程而烦恼;甚至说你还可以通过 g3ar 中的一个叫 TaskBulter 去启动真正的进程, 13 | 然后去监控进程中的线程存活性(比如关键线程的工作状况?当前进程有多少存活的线程?)…… 14 | 当然,强大的 g3ar 的功能远远不止如此。 15 | 16 | Why? 17 | ---- 18 | 19 | 作者 20 | ------- 21 | v1ll4n 22 | 23 | 作者是一个不折不扣的网络安全狂热爱好者。 24 | 25 | 特别鸣谢与赞助列表 26 | ----------------- 27 | 暂无 28 | 29 | 依赖问题与环境说明 30 | ---- 31 | 推荐使用 Python2.7 +, 32 | 但是 Python3 也做了一定适配,基本可以正常运行。 33 | 34 | .. code-block:: bash 35 | 36 | colorama==0.3.7 37 | decorator==4.0.10 38 | IPy==0.83 39 | ipython==5.1.0 40 | ipython-genutils==0.1.0 41 | pexpect==4.2.1 42 | pickleshare==0.7.4 43 | prompt-toolkit==1.0.9 44 | ptyprocess==0.5.1 45 | Pygments==2.1.3 46 | simplegeneric==0.8.1 47 | six==1.10.0 48 | traitlets==4.3.1 49 | wcwidth==0.1.7 50 | 51 | 52 | 安装方法 53 | ------- 54 | 通过 pip 或者 easy_install 安装(以下命令任意选择一个都可以) 55 | 56 | .. code-block:: bash 57 | 58 | pip install g3ar 59 | easy_install g3ar 60 | 61 | 通过 github 安装: 62 | 63 | .. code-block:: bash 64 | 65 | git clone https://github.com/VillanCh/g3ar.git 66 | cd g3ar 67 | python setup.py install 68 | -------------------------------------------------------------------------------- /docs/build/html/_sources/step2.txt: -------------------------------------------------------------------------------- 1 | Step2:功能简介 2 | ============== 3 | 相信你看到这里应该是对这个东西有一些兴趣了对吧?那么我们接下来就来具体说明 g3ar 4 | 到底包含了怎么样的功能。 5 | 6 | 大杂烩? 7 | ------- 8 | 当然你可以说是大杂烩,因为事实上,g3ar 确实是这样,提供了关于渗透测试 9 | -------------------------------------------------------------------------------- /docs/build/html/_static/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/html/_static/ajax-loader.gif -------------------------------------------------------------------------------- /docs/build/html/_static/comment-bright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/html/_static/comment-bright.png -------------------------------------------------------------------------------- /docs/build/html/_static/comment-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/html/_static/comment-close.png -------------------------------------------------------------------------------- /docs/build/html/_static/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/html/_static/comment.png -------------------------------------------------------------------------------- /docs/build/html/_static/custom.css: -------------------------------------------------------------------------------- 1 | /* This file intentionally left blank. */ 2 | -------------------------------------------------------------------------------- /docs/build/html/_static/down-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/html/_static/down-pressed.png -------------------------------------------------------------------------------- /docs/build/html/_static/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/html/_static/down.png -------------------------------------------------------------------------------- /docs/build/html/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/html/_static/file.png -------------------------------------------------------------------------------- /docs/build/html/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/html/_static/minus.png -------------------------------------------------------------------------------- /docs/build/html/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/html/_static/plus.png -------------------------------------------------------------------------------- /docs/build/html/_static/pygments.css: -------------------------------------------------------------------------------- 1 | .highlight .hll { background-color: #ffffcc } 2 | .highlight { background: #eeffcc; } 3 | .highlight .c { color: #408090; font-style: italic } /* Comment */ 4 | .highlight .err { border: 1px solid #FF0000 } /* Error */ 5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */ 6 | .highlight .o { color: #666666 } /* Operator */ 7 | .highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */ 8 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ 9 | .highlight .cp { color: #007020 } /* Comment.Preproc */ 10 | .highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */ 11 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ 12 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ 13 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ 14 | .highlight .ge { font-style: italic } /* Generic.Emph */ 15 | .highlight .gr { color: #FF0000 } /* Generic.Error */ 16 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 17 | .highlight .gi { color: #00A000 } /* Generic.Inserted */ 18 | .highlight .go { color: #333333 } /* Generic.Output */ 19 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ 20 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 21 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 22 | .highlight .gt { color: #0044DD } /* Generic.Traceback */ 23 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ 24 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ 25 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ 26 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */ 27 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ 28 | .highlight .kt { color: #902000 } /* Keyword.Type */ 29 | .highlight .m { color: #208050 } /* Literal.Number */ 30 | .highlight .s { color: #4070a0 } /* Literal.String */ 31 | .highlight .na { color: #4070a0 } /* Name.Attribute */ 32 | .highlight .nb { color: #007020 } /* Name.Builtin */ 33 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ 34 | .highlight .no { color: #60add5 } /* Name.Constant */ 35 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ 36 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ 37 | .highlight .ne { color: #007020 } /* Name.Exception */ 38 | .highlight .nf { color: #06287e } /* Name.Function */ 39 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ 40 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ 41 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ 42 | .highlight .nv { color: #bb60d5 } /* Name.Variable */ 43 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ 44 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 45 | .highlight .mb { color: #208050 } /* Literal.Number.Bin */ 46 | .highlight .mf { color: #208050 } /* Literal.Number.Float */ 47 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */ 48 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */ 49 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */ 50 | .highlight .sa { color: #4070a0 } /* Literal.String.Affix */ 51 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ 52 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */ 53 | .highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */ 54 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ 55 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ 56 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ 57 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ 58 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ 59 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */ 60 | .highlight .sr { color: #235388 } /* Literal.String.Regex */ 61 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ 62 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */ 63 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ 64 | .highlight .fm { color: #06287e } /* Name.Function.Magic */ 65 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ 66 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ 67 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ 68 | .highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */ 69 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ -------------------------------------------------------------------------------- /docs/build/html/_static/up-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/html/_static/up-pressed.png -------------------------------------------------------------------------------- /docs/build/html/_static/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/html/_static/up.png -------------------------------------------------------------------------------- /docs/build/html/genindex.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Index — g3ar 0.x documentation 11 | 12 | 13 | 14 | 15 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 |
42 |
43 |
44 | 45 | 46 |

Index

47 | 48 |
49 | 50 |
51 | 52 | 53 |
54 |
55 |
56 | 79 |
80 |
81 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /docs/build/html/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 欢迎来到 G3AR — g3ar 0.x documentation 10 | 11 | 12 | 13 | 14 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 |
42 |
43 |
44 | 45 |
46 |

欢迎来到 G3AR

47 |

内容:

48 | 67 |
68 | 69 | 70 |
71 |
72 |
73 | 101 |
102 |
103 | 114 | 115 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /docs/build/html/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/docs/build/html/objects.inv -------------------------------------------------------------------------------- /docs/build/html/overview.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 什么是 g3ar?如何安装? — g3ar 0.x documentation 10 | 11 | 12 | 13 | 14 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 |
42 |
43 |
44 |
45 | 46 |
47 |

什么是 g3ar?如何安装?

48 |

作为一个网络安全爱好者的你,喜欢搞一些奇怪的事情?但是苦于自己的 Python 编程实在是太糟糕了 49 | ,想要的东西都不会写。比如你早就想要个可以很快的调度多线程的东西了? 50 | 不用每次遍历 + 单线程去解决一些事情。或者说你很烦为你的工具去添加日志, 51 | 因为整个流程在关键地方打日志(处理异常)繁琐到爆炸会让人崩溃的。 52 | 或者说你很讨厌一些爆破工具只能加载小型的字典,但是面对上百兆的字典, 53 | 你无能为力……

54 |

g3ar 就是这样一个模块:专门为你解决你在进行奇奇怪怪编程中的“小麻烦”:例如, 55 | 你有更方便的可以收集结果的线程池,并且还能监视你的任务执行成功还是失败,而不必每次为 56 | 了多线程而烦恼;甚至说你还可以通过 g3ar 中的一个叫 TaskBulter 去启动真正的进程, 57 | 然后去监控进程中的线程存活性(比如关键线程的工作状况?当前进程有多少存活的线程?)…… 58 | 当然,强大的 g3ar 的功能远远不止如此。

59 |
60 |

作者

61 |

v1ll4n

62 |

作者是一个网络安全狂热爱好者。

63 |
64 |
65 |

特别鸣谢与赞助列表

66 |

Fugitiv3

67 |

Saferman

68 |

Stardust

69 |

TB

70 |

HQ

71 |
72 |
73 |

依赖问题与环境说明

74 |

推荐使用 Python2.7 +, 75 | 但是 Python3 也做了适配,但是可能会遇到一些不可预料的小问题。

76 |
colorama==0.3.7
 77 | decorator==4.0.10
 78 | IPy==0.83
 79 | ipython==5.1.0
 80 | ipython-genutils==0.1.0
 81 | pexpect==4.2.1
 82 | pickleshare==0.7.4
 83 | prompt-toolkit==1.0.9
 84 | ptyprocess==0.5.1
 85 | Pygments==2.1.3
 86 | simplegeneric==0.8.1
 87 | six==1.10.0
 88 | traitlets==4.3.1
 89 | wcwidth==0.1.7
 90 | 
91 |
92 |
93 |
94 |

安装方法

95 |

通过 pip 或者 easy_install 安装(以下命令任意选择一个都可以)

96 |
pip install g3ar
 97 | easy_install g3ar
 98 | 
99 |
100 |

通过 github 安装:

101 |
git clone https://github.com/VillanCh/g3ar.git
102 | cd g3ar
103 | pip install -r requirements.txt
104 | python setup.py install
105 | 
106 |
107 |
108 |
109 |

其他相关连接

110 | 115 |
116 |
117 | 118 | 119 |
120 |
121 |
122 | 163 |
164 |
165 | 176 | 177 | 178 | 179 | 180 | 181 | -------------------------------------------------------------------------------- /docs/build/html/search.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Search — g3ar 0.x documentation 10 | 11 | 12 | 13 | 14 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
48 |
49 |
50 |
51 | 52 |

Search

53 |
54 | 55 |

56 | Please activate JavaScript to enable the search 57 | functionality. 58 |

59 |
60 |

61 | From here you can search these documents. Enter your search 62 | words into the box below and click "search". Note that the search 63 | function will automatically search for all of the words. Pages 64 | containing fewer words won't appear in the result list. 65 |

66 |
67 | 68 | 69 | 70 |
71 | 72 |
73 | 74 |
75 | 76 |
77 |
78 |
79 | 89 |
90 |
91 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /docs/source/func_quicklook.rst: -------------------------------------------------------------------------------- 1 | 功能简介 2 | ============== 3 | Python 渗透工具,或者渗透测试工具框架可能需要用到的组件:带结果反馈的线程池,支持大字典流式读取 4 | 以及进度保存的字典解析模块,以进程方式启动并加以监视控制与结果反馈的任务管理器,带有装饰器接口的日志 5 | 记录工具,除此之外,utils 还包含了一些有用的小工具:打印带颜色的文字,指定路径的 import 工具, 6 | ip 计算工具,更加方便的 Python 自省工具。 7 | 8 | 线程池组件 9 | ----------------- 10 | 11 | 简介 12 | ^^^^^^^^ 13 | 线程池的出现极大的方便了密集型任务的编程,在线程池组件的帮助下,一个任务密集型的程序将会极大被简化, 14 | 只需要维护一个稳定的任务队列并且定时从线程池的结果队列中获取任务反馈。 15 | 16 | Quick Look 17 | ^^^^^^^^^^^^^^^^ 18 | 19 | .. code-block:: python 20 | 21 | import time 22 | from g3ar import ThreadPool 23 | 24 | def func(arg1): 25 | # 26 | # Do something intersting 27 | # 28 | time.sleep(5) 29 | return arg1 30 | 31 | pool = ThreadPool() 32 | pool.start() 33 | pool.feed(target_func=func, arg1=4) 34 | queue = pool.get_result_queue() 35 | result = queue.get() 36 | print(result) 37 | pool.stop() 38 | 39 | 40 | 这个最简单的例子,就是我们使用 ThreadPool 做的一个最简单的事情,也就是执行一个函数,然后再异步 41 | 收集结果。 42 | 43 | 我们分布来讲解这一段小代码: 44 | 45 | .. code-block:: python 46 | 47 | from g3ar import ThreadPool 48 | def func(arg1): 49 | # 50 | # Do something intersting 51 | # 52 | time.sleep(5) 53 | return arg1 54 | 55 | 56 | 导入我们需要的 ThreadPool 然后并定义一个函数。 57 | 58 | .. code-block:: python 59 | 60 | pool = ThreadPool() 61 | pool.start() 62 | 63 | 新建一个 ThreadPool 对象,然后开启线程池(start)。启动线程池之后,线程池对象会在内部启动若干 64 | 个线程,然后这些线程就会进入等待状态。当任务队列中出现任务的时候,线程就会提取任务队列中的任务, 65 | 然后执行相应的任务,把任务的执行情况放在结果队列中 66 | 67 | .. code-block:: python 68 | 69 | pool.feed(target_func=func, arg1=4) 70 | 71 | 传入需要运行的函数,并且在 target_func 后输入其他的参数,例如在 func 中,arg1 是 func 的唯 72 | 一参数,因为后面必须要写出形参的名称和形参的值。 73 | 74 | .. code-block:: python 75 | 76 | queue = pool.get_result_queue() 77 | result = queue.get() 78 | print(result) 79 | pool.stop() 80 | 81 | 82 | 通过 pool.get_result_queue(), 获取一个 Queue.Queue 对象,这个对象是 Python 内置的对象, 83 | 所以不做过多的说明,通过 queue.get() 来获取函数执行的结果。 84 | 85 | 当获取到需要的结果之后,通过 pool.stop() 来关闭线程池。 86 | 87 | 你会发现,这个线程池使用起来非常的简单,事实上,简单已经是一切了对不对? 88 | 89 | 大字典读取 90 | ----------------- 91 | 92 | 在进行 Python 渗透工具编写的过程中,我们经常需要用到各种各样的字典(当然不是用来查生词的字典), 93 | 比如你有一个 300MB 的字典,你想用它去跑密码,然后整个脚本都需要在短时间内完成,这个时候应该怎么办呢? 94 | 95 | 当然大家直到使用文件流去读取是最好不过的,但是实际上,可能你整天都在忙着渗透测试的业务并没有太多 96 | 去关注编程方面的东西,那么你难道真的就那样整个把字典加载进内存?而且还很麻烦做字典分片啊,进度 97 | 保存啊之类的基础性工作。实际上,这些工作,g3ar 都可以替你完成喔! 98 | 99 | .. code-block:: python 100 | 101 | from g3ar import DictParser 102 | 103 | dparser = DictParser('bigdict.txt') 104 | for i in dparser: 105 | # 106 | # Do What you want! 107 | # 108 | pass 109 | 110 | 看!实际的使用,就这么简单,但是然后呢?我们设想一些复杂的场景:我的字典大概跑了有 2000 条, 111 | 然后临时有事情,我需要暂停下来,然后等我忙完了事情接下来再跑这个字典,那么应该怎么做呢?当然是有 112 | 好办法啦!DictParser 提供了基于 session 控制的可选进度保存操作。 113 | 114 | 首先我们假定我们有一个叫 demodict 的字典文件:: 115 | 116 | 6666123 117 | 12341 118 | 346 119 | 245!#$%@#$^# 120 | 325 121 | 12341adfas 122 | asd 123 | re 124 | yq 125 | dahy 126 | ar 127 | r 128 | 34 129 | awe 130 | g 131 | da 132 | haf 133 | dh 134 | ad 135 | s 136 | dasdtdassd 137 | 138 | 针对这一个字典文件,我们需要读取这个字典文件中的内容,然后并且进行进度保存,那么我们应该怎么做呢? 139 | 140 | TAKL IS CHEAP, LET ME SHOW YOU THE CODES! 141 | 142 | .. code-block:: python 143 | 144 | from g3ar import DictParser 145 | from g3ar.utils.print_utils import print_bar 146 | 147 | # 148 | # 创建一个 DictParser, 把 demosession 作为 session_id 传入 DictParser 对象中 149 | # 150 | dparser = DictParser(filename='demodict', session_id='demosession') 151 | 152 | # 153 | # 读取前十行:因为 DictParser 本质上是一个迭代器,所以可以使用 foreach 的形式也可以直接调用 next 154 | # 去获取相应的值 155 | # 156 | print_bar('GET 10 LINES') 157 | for i in xrange(10): 158 | print(dparser.next()) 159 | print_bar('END') 160 | print() 161 | 162 | # 163 | # 强制保存当前字典读取的进度 164 | # 165 | dparser.force_save() 166 | 167 | # 168 | # 删除字典(自动关闭文件) 169 | # 170 | del dparser 171 | 172 | # 173 | # 重新创建一个 DictParser, 然后把之前使用的 session_id 传入,然后设置 do_continue 为 True 174 | # 这样得到的一个 DictParser 就是一个接着上一次读写字典进度的一个字典解析器 175 | # 176 | dparser_continue = DictParser(filename='demodict', session_id='demosession', do_continue=True) 177 | # 178 | # 那么我们现在来验证后面的字典剩下的内容是不是紧接着我们上一次保存的进度之后? 179 | # 180 | print_bar('GET NEXT ALL LINE') 181 | for i in dparser_continue: 182 | print(i) 183 | 184 | 然后上面就是我们完成保存进度使用的接口,我们查看一下最终的结果来检查是不是按照我们的期望进行工作!:: 185 | 186 | =============================GET 10 LINES============================= 187 | 6666123 188 | 12341 189 | 346 190 | 245!#$%@#$^# 191 | 325 192 | 12341adfas 193 | asd 194 | re 195 | yq 196 | dahy 197 | =================================END================================= 198 | () 199 | ==========================GET NEXT ALL LINE========================== 200 | ar 201 | r 202 | 34 203 | awe 204 | g 205 | da 206 | haf 207 | dh 208 | ad 209 | s 210 | dasdtdassd 211 | 212 | 接下来我们对比一下之前我们创建的字典文件,发现确实实现字典的进度保存。那么现在,你可以使用它 213 | 去完成你想要的操作了!我觉得你现在可能已经想到它可以用在哪里了! 214 | 215 | 任务管理器 216 | ---------------- 217 | 218 | 任务管理器其实不像是线程池那样适合高度密集任务的处理,因为进程开销显然要比线程开销大得多啊,那么 219 | 基于这些基础的问题,我们怎么样来认识我们 g3ar 给大家提供的任务管理器呢?其实也很好解释,就是假如说 220 | 我们需要启动两个爆破程序,每一个爆破程序会启动甚至几十个线程去进行密码爆破等操作,每一个爆破程序 221 | 都有高密度的任务,在这些任务中,我们为这些任务启动开销相对更低的线程。对于整个的爆破程序,我们 222 | 就以进程为单位去管理。这样做有什么好处呢? 223 | 224 | #. 可以监控进程内部线程的运行状况:如果关键线程发生了异常,可以立即发现,采取相应措施。 225 | #. 可以强行结束一个进程,然而并不能强行结束一个线程。 226 | 227 | 好的接下来,我们就来看一下,怎么样使用这些令人激动的功能吧? 228 | 229 | .. code-block:: python 230 | 231 | # 232 | # example for taskbulter 233 | # 234 | import time 235 | from g3ar import TaskBulter 236 | from g3ar.utils.print_utils import print_bar 237 | 238 | # 239 | # 创建一个 TaskBulter 用以准备启动新的任务 240 | # 241 | tbr = TaskBulter() 242 | 243 | # 244 | # 自己定义一个 taskid 然后定一个任务函数 245 | # 246 | taskid = 'testtask-id' 247 | #---------------------------------------------------------------------- 248 | def func(arg1, arg2='1'): 249 | """""" 250 | time.sleep(2) 251 | return arg1, arg2 252 | 253 | # 254 | # 传入必须任务的 id, 传入目标函数,目标函数的参数 255 | # 256 | print_bar('start the task') 257 | print(tbr.start_task(id=taskid, target=func, args=('arg1var',))) 258 | 259 | # 260 | # 查看任务执行的状态 261 | # 262 | print_bar('watch the status') 263 | print(tbr.get_tasks_status()) 264 | 265 | time.sleep(3) 266 | 267 | # 268 | # 获取任务结果 269 | # 270 | print_bar('get result') 271 | print(tbr.get_result(taskid)) 272 | 273 | 使用起来大概也不会有什么不适,非常的简单和理所当然的接口,我想关于结果大家肯定都已经猜到了:: 274 | 275 | ============================start the task============================ 276 | None 277 | ===========================watch the status=========================== 278 | {'testtask-id': {'now': {}, 'last': {}}} 279 | ==============================get result============================== 280 | [{'state': True, 'exception': '', 'result': ('arg1var', '1')}] 281 | 282 | 要说明的就是结果部分吧,可能大家会奇怪,为什么结果不是我的函数直接返回的结果,而且还被包装了一层 283 | 又一层? 284 | 285 | 这当然不是图麻烦,在后续的详细文档关于这个部分会详细解释,简单来想,原因就是:如果任务执行的过程 286 | 中,出现了问题,那么,如果按平时仅仅返回一个结果就会显得非常突兀,有时候我们又渴望知道到底出现了 287 | 什么异常信息,这样的话,一个格式化的输出就很有必要了。 288 | 289 | 在结果输出中,整个结果是存储在一个 list 里面的,list 内是一个又一个的 dict,state 代表的是运 290 | 行的结果是不是按照期望运行,如果出现了不期望的一场,state 则会为 291 | False,于此同时 exception 会记录出现的异常是什么;result 则表示函数返回的结果是什么,当然, 292 | 如果返回了多个结果,就会出现多个 dict,因为在我们的任务可能不是 return ,还有可能是 yield。 293 | 294 | 其他相关连接 295 | --------------------- 296 | 297 | * `首页 `_ 298 | * `总览 `_ 299 | * `功能简介 `_ 300 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. g3ar documentation master file, created by 2 | sphinx-quickstart on Mon Jan 09 23:11:23 2017. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | 欢迎来到 G3AR 7 | ================================ 8 | 9 | 10 | 11 | 内容: 12 | 13 | .. toctree:: 14 | :maxdepth: 2 15 | 16 | overview 17 | func_quicklook 18 | -------------------------------------------------------------------------------- /docs/source/overview.rst: -------------------------------------------------------------------------------- 1 | 什么是 g3ar?如何安装? 2 | ================================ 3 | 作为一个网络安全爱好者的你,喜欢搞一些奇怪的事情?但是苦于自己的 Python 编程实在是太糟糕了 4 | ,想要的东西都不会写。比如你早就想要个可以很快的调度多线程的东西了? 5 | 不用每次遍历 + 单线程去解决一些事情。或者说你很烦为你的工具去添加日志, 6 | 因为整个流程在关键地方打日志(处理异常)繁琐到爆炸会让人崩溃的。 7 | 或者说你很讨厌一些爆破工具只能加载小型的字典,但是面对上百兆的字典, 8 | 你无能为力…… 9 | 10 | g3ar 就是这样一个模块:专门为你解决你在进行奇奇怪怪编程中的“小麻烦”:例如, 11 | 你有更方便的可以收集结果的线程池,并且还能监视你的任务执行成功还是失败,而不必每次为 12 | 了多线程而烦恼;甚至说你还可以通过 g3ar 中的一个叫 TaskBulter 去启动真正的进程, 13 | 然后去监控进程中的线程存活性(比如关键线程的工作状况?当前进程有多少存活的线程?)…… 14 | 当然,强大的 g3ar 的功能远远不止如此。 15 | 16 | 作者 17 | ------- 18 | v1ll4n 19 | 20 | 作者是一个网络安全狂热爱好者。 21 | 22 | 特别鸣谢与赞助列表 23 | ------------------------- 24 | Fugitiv3 25 | 26 | Saferman 27 | 28 | Stardust 29 | 30 | TB 31 | 32 | HQ 33 | 34 | 依赖问题与环境说明 35 | ------------------------------------------------------ 36 | 推荐使用 Python2.7 +, 37 | 但是 Python3 也做了适配,但是可能会遇到一些不可预料的小问题。 38 | 39 | .. code-block:: bash 40 | 41 | colorama==0.3.7 42 | decorator==4.0.10 43 | IPy==0.83 44 | ipython==5.1.0 45 | ipython-genutils==0.1.0 46 | pexpect==4.2.1 47 | pickleshare==0.7.4 48 | prompt-toolkit==1.0.9 49 | ptyprocess==0.5.1 50 | Pygments==2.1.3 51 | simplegeneric==0.8.1 52 | six==1.10.0 53 | traitlets==4.3.1 54 | wcwidth==0.1.7 55 | 56 | 57 | 安装方法 58 | --------------------------------------------------------- 59 | 通过 pip 或者 easy_install 安装(以下命令任意选择一个都可以) 60 | 61 | .. code-block:: bash 62 | 63 | pip install g3ar 64 | easy_install g3ar 65 | 66 | 通过 github 安装: 67 | 68 | .. code-block:: bash 69 | 70 | git clone https://github.com/VillanCh/g3ar.git 71 | cd g3ar 72 | pip install -r requirements.txt 73 | python setup.py install 74 | 75 | 76 | 其他相关连接 77 | -------------------------------------------------- 78 | 79 | * `首页 `_ 80 | * `总览 `_ 81 | * `功能简介 `_ 82 | -------------------------------------------------------------------------------- /example/demodict: -------------------------------------------------------------------------------- 1 | 6666123 2 | 12341 3 | 346 4 | 245!#$%@#$^# 5 | 325 6 | 12341adfas 7 | asd 8 | re 9 | yq 10 | dahy 11 | ar 12 | r 13 | 34 14 | awe 15 | g 16 | da 17 | haf 18 | dh 19 | ad 20 | s 21 | dasdtdassd 22 | -------------------------------------------------------------------------------- /example/dictparser_e1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: 6 | Created: 02/24/17 7 | """ 8 | 9 | import unittest 10 | 11 | from g3ar import DictParser 12 | from g3ar.utils.print_utils import print_bar 13 | 14 | dparser = DictParser(filename='demodict', session_id='demosession') 15 | 16 | # 17 | # First 10 LINE 18 | # 19 | print_bar('GET 10 LINES') 20 | for i in xrange(10): 21 | print(dparser.next()) 22 | print_bar('END') 23 | print() 24 | 25 | dparser.force_save() 26 | 27 | del dparser 28 | 29 | dparser_continue = DictParser(filename='demodict', session_id='demosession', do_continue=True) 30 | # 31 | # Next Lines 32 | # 33 | print_bar('GET NEXT ALL LINE') 34 | for i in dparser_continue: 35 | print(i) 36 | 37 | if __name__ == '__main__': 38 | unittest.main() -------------------------------------------------------------------------------- /example/sessions_dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/example/sessions_dat -------------------------------------------------------------------------------- /example/taskbulter_e1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: example for taskbulter 6 | Created: 02/24/17 7 | """ 8 | 9 | import unittest 10 | 11 | # 12 | # example for taskbulter 13 | # 14 | import time 15 | from g3ar import TaskBulter 16 | from g3ar.utils.print_utils import print_bar 17 | 18 | tbr = TaskBulter() 19 | 20 | taskid = 'testtask-id' 21 | #---------------------------------------------------------------------- 22 | def func(arg1, arg2='1'): 23 | """""" 24 | time.sleep(2) 25 | return arg1, arg2 26 | 27 | 28 | print_bar('start the task') 29 | print(tbr.start_task(id=taskid, target=func, args=('arg1var',))) 30 | 31 | print_bar('watch the status') 32 | print(tbr.get_tasks_status()) 33 | 34 | time.sleep(3) 35 | 36 | print_bar('get result') 37 | print(tbr.get_result(taskid)) 38 | 39 | if __name__ == '__main__': 40 | unittest.main() -------------------------------------------------------------------------------- /example/threadpool_e1.py: -------------------------------------------------------------------------------- 1 | import time 2 | from g3ar import ThreadPool 3 | 4 | def func(arg1): 5 | # 6 | # Do something intersting 7 | # 8 | time.sleep(5) 9 | return arg1 10 | 11 | pool = ThreadPool() 12 | pool.start() 13 | pool.feed(target_func=func, arg1=4) 14 | queue = pool.get_result_queue() 15 | result = queue.get() 16 | print(result) 17 | pool.stop() 18 | -------------------------------------------------------------------------------- /g3ar.egg-info/SOURCES.txt: -------------------------------------------------------------------------------- 1 | setup.py 2 | g3ar/__init__.py 3 | g3ar.egg-info/PKG-INFO 4 | g3ar.egg-info/SOURCES.txt 5 | g3ar.egg-info/dependency_links.txt 6 | g3ar.egg-info/not-zip-safe 7 | g3ar.egg-info/requires.txt 8 | g3ar.egg-info/top_level.txt 9 | g3ar/decologger/__init__.py 10 | g3ar/decologger/decologger.py 11 | g3ar/decologger/test.py 12 | g3ar/dict_parser/__init__.py 13 | g3ar/dict_parser/dict_parser.py 14 | g3ar/dict_parser/dict_parser_from_iter.py 15 | g3ar/dict_parser/dict_parser_mixer.py 16 | g3ar/dict_parser/test.py 17 | g3ar/taskbulter/__init__.py 18 | g3ar/taskbulter/exceptions.py 19 | g3ar/taskbulter/process_task.py 20 | g3ar/taskbulter/task_bulter.py 21 | g3ar/taskbulter/utils_class.py 22 | g3ar/threadutils/__init__.py 23 | g3ar/threadutils/contractor.py 24 | g3ar/threadutils/tests.py 25 | g3ar/threadutils/thread_pool.py 26 | g3ar/threadutils/threadpoolex.py 27 | g3ar/utils/__init__.py 28 | g3ar/utils/import_utils.py 29 | g3ar/utils/inspect_utils.py 30 | g3ar/utils/ip_calc_utils.py 31 | g3ar/utils/iter_utils.py 32 | g3ar/utils/print_utils.py 33 | g3ar/utils/queue_utils.py 34 | g3ar/utils/thread_utils.py 35 | g3ar/utils/verify_utils.py 36 | g3ar/utils/ipwhois/__init__.py 37 | g3ar/utils/ipwhois/exceptions.py 38 | g3ar/utils/ipwhois/hr.py 39 | g3ar/utils/ipwhois/ipwhois.py 40 | g3ar/utils/ipwhois/net.py 41 | g3ar/utils/ipwhois/nir.py 42 | g3ar/utils/ipwhois/rdap.py 43 | g3ar/utils/ipwhois/utils.py 44 | g3ar/utils/ipwhois/whois.py 45 | g3ar/utils/pyping/__init__.py 46 | g3ar/utils/pyping/isalive.py 47 | g3ar/utils/pyping/ping.py -------------------------------------------------------------------------------- /g3ar.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /g3ar.egg-info/not-zip-safe: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /g3ar.egg-info/requires.txt: -------------------------------------------------------------------------------- 1 | IPy 2 | ipwhois 3 | colorama 4 | prettytable 5 | -------------------------------------------------------------------------------- /g3ar.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | g3ar 2 | -------------------------------------------------------------------------------- /g3ar/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: G3ar entry 6 | Created: 2016/12/20 7 | """ 8 | 9 | import unittest 10 | 11 | from .threadutils.thread_pool import Pool as ThreadPool 12 | from .threadutils.threadpoolex import ThreadPoolX 13 | from .threadutils.contractor import Contractor 14 | from .decologger.decologger import Decologger as DecoLogger 15 | from .dict_parser.dict_parser import DictParser 16 | from .dict_parser.dict_parser_from_iter import DictParserFromIter 17 | from .taskbulter.task_bulter import TaskBulter 18 | from .dict_parser.dict_parser_mixer import DictParserMixer 19 | #from .utils import ip_calc_utils 20 | from .utils.pyping import pyping 21 | from .utils.iter_utils import iter_mix 22 | 23 | #---------------------------------------------------------------------- 24 | def ping(host, timeout=2, count=4): 25 | """""" 26 | return pyping(host, timeout, count) 27 | 28 | #---------------------------------------------------------------------- 29 | def dict_parser_mixer_func(*args): 30 | """""" 31 | for i in args: 32 | assert isinstance(i, DictParser) 33 | 34 | return iter_mix(*args) 35 | -------------------------------------------------------------------------------- /g3ar/decologger/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/g3ar/decologger/__init__.py -------------------------------------------------------------------------------- /g3ar/decologger/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Test for decologger 6 | Created: 2016/12/18 7 | """ 8 | 9 | import unittest 10 | import traceback 11 | from .decologger import Decologger 12 | 13 | 14 | 15 | 16 | if __name__ == '__main__': 17 | unittest.main() -------------------------------------------------------------------------------- /g3ar/dict_parser/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/g3ar/dict_parser/.DS_Store -------------------------------------------------------------------------------- /g3ar/dict_parser/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Simple and Quick Parse your dictionary FOR TENTEST PROGRAMMER! 6 | Created: 2016/12/16 7 | """ 8 | 9 | from . import dict_parser 10 | from .dict_parser import * 11 | from .dict_parser_mixer import DictParser 12 | from .dict_parser_from_iter import DictParserFromIter 13 | 14 | def get_dictparser(filename, 15 | session_id=DEFAULT_SESSION_ID, 16 | do_continue=False, 17 | session_data_file=SESSION_TABLE_FILE): 18 | return DictParser(filename, session_id, do_continue, session_data_file) 19 | 20 | 21 | -------------------------------------------------------------------------------- /g3ar/dict_parser/dict_parser_mixer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Mixer for multiparser! 6 | Created: 03/09/17 7 | """ 8 | 9 | import unittest 10 | 11 | from .dict_parser import DictParser 12 | from ..utils.iter_utils import iter_mix 13 | 14 | 15 | #DictParser(filename) 16 | 17 | DEFAULT_SESSION_ID = 'default_session_id_{index}' 18 | DEFAULT_SESSION_FILENAME = 'session.dat' 19 | 20 | ######################################################################## 21 | class DictParserMixer(object): 22 | """""" 23 | 24 | #---------------------------------------------------------------------- 25 | def __init__(self, file_list, do_continue=True, session_id=DEFAULT_SESSION_ID, 26 | session_filename=DEFAULT_SESSION_FILENAME): 27 | """Constructor""" 28 | self._dict_parsers = [] 29 | for i in range(len(file_list)): 30 | self._dict_parsers.append(DictParser(file_list[i],session_id=DEFAULT_SESSION_ID.format(index=i), 31 | do_continue=do_continue, 32 | session_data_file=session_filename)) 33 | 34 | self._mixer = iter_mix(*tuple(self._dict_parsers)) 35 | 36 | #---------------------------------------------------------------------- 37 | def __iter__(self): 38 | """""" 39 | return self 40 | 41 | #---------------------------------------------------------------------- 42 | def __next__(self): 43 | """""" 44 | return self._next() 45 | 46 | #---------------------------------------------------------------------- 47 | def next(self): 48 | """""" 49 | return self._next() 50 | 51 | #---------------------------------------------------------------------- 52 | def _next(self): 53 | """""" 54 | for i in self._mixer: 55 | return i 56 | else: 57 | raise StopIteration() 58 | 59 | #---------------------------------------------------------------------- 60 | def save(self): 61 | """""" 62 | map(lambda x: x.force_save(), self._dict_parsers) 63 | 64 | #---------------------------------------------------------------------- 65 | def force_save(self): 66 | """""" 67 | self.save() 68 | 69 | #---------------------------------------------------------------------- 70 | def get_current_poses(self): 71 | """""" 72 | self._current_poses = map(lambda x: x.get_current_pos(), self._dict_parsers) 73 | return self._current_poses 74 | 75 | #---------------------------------------------------------------------- 76 | def get_current_pos(self): 77 | """""" 78 | return sum(self.get_current_poses()) 79 | 80 | #---------------------------------------------------------------------- 81 | def get_total_sizes(self): 82 | """""" 83 | self._total_sizes = map(lambda x: x.get_total_size(), self._dict_parsers) 84 | return self._total_sizes 85 | 86 | #---------------------------------------------------------------------- 87 | def get_total_size(self): 88 | """""" 89 | return reduce(lambda x,y: x * y, map(int, self.get_total_sizes())) 90 | 91 | #---------------------------------------------------------------------- 92 | def close(self): 93 | """""" 94 | map(lambda x: x.close(), self._dict_parsers) 95 | 96 | #---------------------------------------------------------------------- 97 | def reset(self): 98 | """""" 99 | map(lambda x: x.reset(), self._dict_parsers) 100 | 101 | 102 | 103 | 104 | 105 | if __name__ == '__main__': 106 | unittest.main() -------------------------------------------------------------------------------- /g3ar/dict_parser/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: TestForDictParser 6 | Created: 2016/12/16 7 | """ 8 | 9 | import unittest 10 | from .dict_parser import * 11 | 12 | 13 | 14 | 15 | if __name__ == '__main__': 16 | unittest.main() -------------------------------------------------------------------------------- /g3ar/taskbulter/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/g3ar/taskbulter/__init__.py -------------------------------------------------------------------------------- /g3ar/taskbulter/exceptions.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Define Many Exceptions 6 | Created: 2016/12/12 7 | """ 8 | 9 | import unittest 10 | 11 | 12 | ######################################################################## 13 | class TaskRuntimeError(Exception): 14 | """""" 15 | pass 16 | 17 | 18 | 19 | ######################################################################## 20 | class TaskCannotBeCalled(Exception): 21 | """""" 22 | pass 23 | 24 | 25 | ######################################################################## 26 | class ExistedTaskId(Exception): 27 | """""" 28 | pass 29 | 30 | 31 | 32 | 33 | if __name__ == '__main__': 34 | unittest.main() -------------------------------------------------------------------------------- /g3ar/taskbulter/utils_class.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Utils Classes 6 | Created: 2016/12/13 7 | """ 8 | 9 | import unittest 10 | 11 | 12 | ######################################################################## 13 | class Singleton(object): 14 | """""" 15 | #_instance = None 16 | 17 | #---------------------------------------------------------------------- 18 | def __new__(cls, *args, **kwargs): 19 | """singleton class wrapper""" 20 | if not hasattr(cls, '_instance'): 21 | origin = super(Singleton, cls) 22 | cls._instance = origin.__new__(cls, *args, **kwargs) 23 | return cls._instance 24 | 25 | 26 | 27 | if __name__ == '__main__': 28 | unittest.main() -------------------------------------------------------------------------------- /g3ar/threadutils/README.md: -------------------------------------------------------------------------------- 1 | # vthu 2 | vthu 是一个非常轻型的 Python 的多任务并发框架 3 | -------------------------------------------------------------------------------- /g3ar/threadutils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/g3ar/threadutils/__init__.py -------------------------------------------------------------------------------- /g3ar/threadutils/contractor.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Provide some useful thread utils 6 | Created: 2016/10/29 7 | """ 8 | import uuid 9 | import time 10 | import unittest 11 | try: 12 | from queue import Queue, Empty 13 | except: 14 | from Queue import Queue, Empty 15 | import threading 16 | from threading import Thread 17 | import inspect 18 | import traceback 19 | 20 | 21 | #---------------------------------------------------------------------- 22 | def start_thread(func, *args, **kwargs): 23 | """""" 24 | ret = Thread(target=func, args=args, kwargs=kwargs) 25 | ret.daemon = True 26 | ret.start() 27 | 28 | 29 | ######################################################################## 30 | class Contractor(object): 31 | """Create Multi-Thread to support the 32 | concurrence of many tasks""" 33 | 34 | #---------------------------------------------------------------------- 35 | def __init__(self, thread_max=50): 36 | """Constructor""" 37 | self.task_list = [] 38 | self.result_queue = Queue() 39 | 40 | self.lock = threading.Lock() 41 | 42 | self.thread_max = thread_max 43 | self._current_thread_count = 0 44 | 45 | self._executed_task_count = 0 46 | self._task_count = 0 47 | 48 | def _uuid1_str(self): 49 | '''Returns: random UUID tag ''' 50 | return str(uuid.uuid1()) 51 | 52 | #---------------------------------------------------------------------- 53 | def feed(self, target_func, *vargs, **kwargs): 54 | """""" 55 | self.add_task(target_func, *vargs, **kwargs) 56 | 57 | def add_task(self, target_func, *args, **argv): 58 | '''Add task to Pool and wait to exec 59 | 60 | Params: 61 | target_func : A callable obj, the entity of the current task 62 | args : the args of [target_func] 63 | argv : the argv of [target_func] 64 | ''' 65 | assert callable(target_func), '[!] Function can \'t be called' 66 | 67 | ret = {} 68 | ret['func'] = target_func 69 | ret['args'] = args 70 | ret['argv'] = argv 71 | #ret['uuid'] = self.signal_name 72 | self._task_count = self._task_count + 1 73 | self.task_list.append(ret) 74 | 75 | def start(self): 76 | """""" 77 | ret = Thread(target=self._run) 78 | ret.daemon = True 79 | ret.start() 80 | 81 | return self.result_queue 82 | 83 | #---------------------------------------------------------------------- 84 | def _run(self): 85 | """""" 86 | for i in self.task_list: 87 | #print self.current_thread_count 88 | while self.thread_max <= self._current_thread_count: 89 | time.sleep(0.3) 90 | self._start_task(i) 91 | 92 | def _start_task(self, task): 93 | """""" 94 | self._current_thread_count = self._current_thread_count + 1 95 | try: 96 | 97 | ret = Thread(target=self._worker, args=(task,)) 98 | ret.daemon = True 99 | ret.start() 100 | except TypeError: 101 | self._current_thread_count = self._current_thread_count - 1 102 | 103 | def _worker(self, dictobj): 104 | """""" 105 | func = dictobj['func'] 106 | args = dictobj['args'] 107 | argv = dictobj['argv'] 108 | 109 | try: 110 | result = func(*args, **argv) 111 | except Exception as e: 112 | #print 'ecp occured' 113 | result = tuple([e, traceback.extract_stack()]) 114 | 115 | self.lock.acquire() 116 | self._executed_task_count = self._executed_task_count + 1 117 | self._add_result_to_queue(result=result) 118 | self.lock.release() 119 | 120 | def _add_result_to_queue(self, **kw): 121 | """""" 122 | assert 'result' in kw, '[!] Result Error!' 123 | 124 | self.result_queue.put(kw['result']) 125 | self._current_thread_count = self._current_thread_count - 1 126 | 127 | #---------------------------------------------------------------------- 128 | def get_result_queue(self): 129 | """""" 130 | return self.result_queue 131 | 132 | #---------------------------------------------------------------------- 133 | def get_task_list(self): 134 | """""" 135 | self.task_list 136 | 137 | #---------------------------------------------------------------------- 138 | def get_result_generator(self): 139 | """""" 140 | while True: 141 | try: 142 | ret = self.result_queue.get(timeout=1) 143 | yield ret 144 | except Empty: 145 | if self._task_count == self._executed_task_count: 146 | break 147 | else: 148 | pass 149 | 150 | #---------------------------------------------------------------------- 151 | @property 152 | def task_count(self): 153 | """""" 154 | return self._task_count 155 | 156 | #---------------------------------------------------------------------- 157 | @property 158 | def executed_task_count(self): 159 | """""" 160 | return self._executed_task_count 161 | 162 | #---------------------------------------------------------------------- 163 | @property 164 | def percent(self): 165 | """""" 166 | return float(self._task_count)/float(self._executed_task_count) 167 | 168 | #---------------------------------------------------------------------- 169 | @property 170 | def current_thread_count(self): 171 | """""" 172 | return self._current_thread_count 173 | 174 | 175 | 176 | 177 | 178 | class UtilsTest(unittest.case.TestCase): 179 | def runTest(self): 180 | ms = inspect.getmembers(self) 181 | ms = [x[0] for x in ms] 182 | for i in ms: 183 | if callable(getattr(self,i)): 184 | if i.startswith('test_'): 185 | getattr(self, i)() 186 | 187 | def test_pool(self): 188 | def demo_task(*args): 189 | '''simulate the plugin.run''' 190 | print('[!] Computing!') 191 | time.sleep(args[0]) 192 | print('[!] Finished!') 193 | print() 194 | returns = 'Runtime Length : %s' % str(args) 195 | return returns 196 | pool = Contractor() 197 | pool.add_task(demo_task, 7) 198 | pool.add_task(demo_task, 3) 199 | q = pool.start() 200 | print(pool._current_thread_count) 201 | self.assertIsInstance(q, Queue) 202 | 203 | r = q.get() 204 | print(r) 205 | self.assertIsInstance(r, str) 206 | r = q.get() 207 | print(r) 208 | self.assertIsInstance(r, str) 209 | 210 | print(pool._current_thread_count) 211 | 212 | 213 | if __name__ == '__main__': 214 | unittest.main() -------------------------------------------------------------------------------- /g3ar/threadutils/tests.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Tester For Threadpoolex 6 | Created: 05/13/17 7 | """ 8 | 9 | import unittest 10 | import queue 11 | import time 12 | from threadpoolex import ThreadPoolXLabor, ThreadPoolX, _LaborFactory 13 | 14 | #---------------------------------------------------------------------- 15 | def test_task_error(arg1, arg2=4): 16 | """""" 17 | time.sleep(3) 18 | 1/0 19 | return arg1, arg2 20 | 21 | #---------------------------------------------------------------------- 22 | def test_task(arg1, arg2=4): 23 | """""" 24 | time.sleep(3) 25 | return arg1, arg2 26 | 27 | count = 0 28 | 29 | ######################################################################## 30 | class ThreadPoolExTester(unittest.TestCase): 31 | """""" 32 | 33 | #---------------------------------------------------------------------- 34 | def test_labor(self): 35 | """""" 36 | def _labor_callback(result): 37 | raise ValueError() 38 | #_retqueue.put(result) 39 | 40 | def _labor_callback_exc(result): 41 | _retqueue.put(result) 42 | 43 | def _task_exc_handle(e): 44 | _retqueue.put((1,4)) 45 | print e 46 | 47 | _retqueue = queue.Queue(1) 48 | s = ThreadPoolXLabor('test') 49 | s.add_task_exception_callback(_task_exc_handle) 50 | s.add_callback(_labor_callback, _labor_callback_exc) 51 | 52 | s.start() 53 | s.execute(test_task, var_args=(1,), keyword_args={}) 54 | 55 | _resultTuple = _retqueue.get() 56 | self.assertTrue(_resultTuple[0] == 1) 57 | self.assertEqual(_resultTuple[1], 4) 58 | 59 | s.quit() 60 | time.sleep(1) 61 | 62 | 63 | #---------------------------------------------------------------------- 64 | def test_pool(self): 65 | """""" 66 | quited = False 67 | def print_result(result): 68 | time.sleep(1) 69 | print result 70 | #_q.put(1) 71 | return result 72 | 73 | 74 | _q = queue.Queue() 75 | def _count(result): 76 | #_q.put(1) 77 | return result 78 | 79 | #---------------------------------------------------------------------- 80 | def test_task1(arg1, arg2=4): 81 | """""" 82 | time.sleep(3) 83 | _q.put(1) 84 | return arg1, arg2 85 | 86 | 87 | pool = ThreadPoolX() 88 | pool.add_callbacks(callback=print_result) 89 | pool.add_callbacks(callback=_count) 90 | 91 | for i in range(50): 92 | print(i) 93 | pool.feed(target=test_task1, vargs=(i,)) 94 | 95 | assert pool._task_queue.qsize() == 50 96 | pool.start() 97 | 98 | def target(): 99 | time.sleep(1) 100 | return 'h' 101 | 102 | def anothor_result(result): 103 | if result == 'h': 104 | print 'target with callback success!' 105 | 106 | pool.feed_with_callback(target, callback=anothor_result) 107 | time.sleep(6) 108 | time.sleep(6) 109 | #pool.quit() 110 | 111 | self.assertEqual(_q.qsize(),50) 112 | 113 | 114 | pool.quit() 115 | 116 | #---------------------------------------------------------------------- 117 | def test_laborfactory(self): 118 | """""" 119 | lf = _LaborFactory(debug=True, loop_interval=0.2) 120 | 121 | def _labor_callback(result): 122 | raise ValueError() 123 | #_retqueue.put(result) 124 | 125 | def _labor_callback_exc(result): 126 | _retqueue.put(result) 127 | 128 | def _task_exc_handle(e): 129 | _retqueue.put((1,4)) 130 | print e 131 | 132 | _retqueue = queue.Queue(1) 133 | lf.add_callbacks(_labor_callback, _labor_callback_exc) 134 | lf.add_exception_callback(_task_exc_handle) 135 | new_labor = lf.build_labor() 136 | 137 | self.assertIsInstance(new_labor, ThreadPoolXLabor) 138 | 139 | new_labor.start() 140 | new_labor.execute(test_task) 141 | new_labor.execute(test_task_error) 142 | new_labor.quit() 143 | 144 | 145 | if __name__ == '__main__': 146 | unittest.main() -------------------------------------------------------------------------------- /g3ar/utils/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/g3ar/utils/.DS_Store -------------------------------------------------------------------------------- /g3ar/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from . import import_utils 2 | from . import inspect_utils 3 | from . import ip_calc_utils 4 | from . import print_utils 5 | from . import queue_utils 6 | from . import iter_utils -------------------------------------------------------------------------------- /g3ar/utils/import_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Import Utils 6 | Created: 2017/1/2 7 | """ 8 | 9 | import unittest 10 | import os 11 | import sys 12 | 13 | #---------------------------------------------------------------------- 14 | def import_by_path(path, module_name, basedir='.'): 15 | """""" 16 | dirname = os.path.dirname(basedir) 17 | absdir = os.path.abspath(dirname) 18 | absdir = os.path.join(absdir, path) 19 | sys.path.append(absdir) 20 | mod = __import__(module_name) 21 | sys.path.remove(absdir) 22 | 23 | return mod 24 | 25 | if __name__ == '__main__': 26 | unittest.main() -------------------------------------------------------------------------------- /g3ar/utils/inspect_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Make inspect easier 6 | Created: 2017/1/2 7 | """ 8 | 9 | import unittest 10 | import inspect 11 | import types 12 | from types import FunctionType 13 | from types import MethodType 14 | from pprint import pprint 15 | #import ip_calc_utils 16 | 17 | #---------------------------------------------------------------------- 18 | def get_callables(module_or_instance): 19 | """Get all callable mamber from [module_or_instance] 20 | 21 | Params: 22 | module_or_instance: :str: the name of module or instance 23 | 24 | Returns: 25 | A list stored the callable objects""" 26 | result = [] 27 | 28 | for i in inspect.getmembers(module_or_instance): 29 | if callable(i[1]): 30 | result.append(i[1]) 31 | else: 32 | pass 33 | 34 | return result 35 | 36 | #---------------------------------------------------------------------- 37 | def get_fileds(module_or_instance, type=None, public=True): 38 | """Get all field member from [module_or_instance] 39 | 40 | Params: 41 | module_or_instance: :str: the name of module or instance 42 | type: :type: the type you want to filter or tuple([type1, type2]) 43 | pubic: :bool: do you want to inspect all field? 44 | 45 | Returns: 46 | A dict stored the keys and values.""" 47 | result = {} 48 | 49 | for i in inspect.getmembers(module_or_instance): 50 | if not callable(i[1]): 51 | if i[0].startswith('_') and public: 52 | pass 53 | else: 54 | if type != None: 55 | if isinstance(i[1], type): 56 | result[i[0]] = i[1] 57 | else: 58 | pass 59 | else: 60 | result[i[0]] = i[1] 61 | else: 62 | pass 63 | 64 | return result 65 | 66 | #---------------------------------------------------------------------- 67 | def get_functions(module_or_instance, public=True): 68 | """Get all function from [module_or_instance] 69 | 70 | Params: 71 | module_or_instance: :str: the name of module or instances 72 | public: :bool: get the public function? 73 | 'public' means that the [name].startswith('_') is true. 74 | 75 | Returns: 76 | A list stored the function from module/instance 77 | """ 78 | ret = [] 79 | 80 | for i in get_callables(module_or_instance): 81 | if isinstance(i, FunctionType): 82 | ret.append(i) 83 | 84 | if public: 85 | for i in range(len(ret)): 86 | if ret[i].__name__.startswith('_'): 87 | ret[i] = None 88 | while True: 89 | try: 90 | ret.remove(None) 91 | except ValueError: 92 | break 93 | else: 94 | pass 95 | 96 | while True: 97 | try: 98 | ret.remove(None) 99 | except ValueError: 100 | break 101 | 102 | return ret 103 | 104 | #---------------------------------------------------------------------- 105 | def get_methods(instance, public=True): 106 | """Get methods from instance""" 107 | 108 | ret = [] 109 | 110 | for i in get_callables(instance): 111 | if isinstance(i, MethodType): 112 | ret.append(i) 113 | 114 | if public: 115 | for i in range(len(ret)): 116 | if ret[i].__name__.startswith('_'): 117 | ret[i] = None 118 | while True: 119 | try: 120 | ret.remove(None) 121 | except ValueError: 122 | break 123 | else: 124 | pass 125 | 126 | while True: 127 | try: 128 | ret.remove(None) 129 | except ValueError: 130 | break 131 | 132 | return ret 133 | 134 | #---------------------------------------------------------------------- 135 | def get_args_dict(func): 136 | """""" 137 | assert callable(func), '[!] The [func] you input cannot be called!' 138 | 139 | result = {} 140 | 141 | try: 142 | func_name = getattr(func, '__name__') 143 | except: 144 | func_name = str(func) 145 | 146 | # 147 | # Process args 148 | # 149 | args = {} 150 | spec = inspect.getargspec(func) 151 | args['vargs'] = spec.varargs 152 | args['kwargs'] = spec.keywords 153 | args['defaults'] = spec.defaults if spec.defaults else [] 154 | args['args'] = spec.args 155 | args['args_table'] = {} 156 | 157 | for i in spec.args: 158 | args['args_table'][i] = None 159 | 160 | for i in range(len(args['defaults'])): 161 | index = -1 - i 162 | args['args_table'][spec.args[index]] = spec.defaults[index] 163 | 164 | result['func_name'] = func_name 165 | result['args'] = args 166 | 167 | return result 168 | 169 | #---------------------------------------------------------------------- 170 | def get_neccessary_params(func): 171 | """""" 172 | assert callable(func), '[!] The [func] you input cannot be called!' 173 | 174 | result = [] 175 | 176 | table = get_args_dict(func)['args']['args_table'] 177 | for i in list(table.items()): 178 | if i[1] != None: 179 | pass 180 | else: 181 | result.append(i[0]) 182 | 183 | return result 184 | 185 | 186 | 187 | 188 | #---------------------------------------------------------------------- 189 | def get_classes(mod, metaclass=None): 190 | """""" 191 | if metaclass == None: 192 | metaclass = tuple([types.TypeType, types.ClassType]) 193 | for i in get_callables(mod): 194 | if isinstance(i, metaclass): 195 | yield i 196 | 197 | if __name__ == '__main__': 198 | unittest.main() -------------------------------------------------------------------------------- /g3ar/utils/ip_calc_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Caculate About IP using IPy 6 | Created: 2016/12/26 7 | """ 8 | 9 | import unittest 10 | 11 | from IPy import IP 12 | #from .ipwhois import IPWhois 13 | from random import randint, seed 14 | from time import time 15 | 16 | seed(time()) 17 | 18 | 19 | #---------------------------------------------------------------------- 20 | def is_ipv4(ip): 21 | """Check if the [ip] is a real ip addr. 22 | 23 | Params: 24 | ip: :str: General IP format. 25 | 26 | Returns: 27 | :type: bool 28 | :desc: if ip is a valid IP addr, return true 29 | else return False""" 30 | try: 31 | IP(ip) 32 | return True 33 | except ValueError: 34 | return False 35 | 36 | #---------------------------------------------------------------------- 37 | def get_all_c_class(ip): 38 | """Return the All C Class Addr (v4)""" 39 | for i in IP(ip).make_net('255.255.255.0'): 40 | yield i.strNormal() 41 | 42 | #---------------------------------------------------------------------- 43 | def ip2int(ip): 44 | """""" 45 | return IP(ip).int() 46 | 47 | #---------------------------------------------------------------------- 48 | def ipv4_range(start_ip, end_ip): 49 | """""" 50 | start = ip2int(start_ip) 51 | end = ip2int(end_ip) 52 | 53 | for i in range(start, end): 54 | yield IP(i).strNormal() 55 | 56 | #---------------------------------------------------------------------- 57 | def random_ip(start='0.0.0.0', end='224.0.0.0'): 58 | """""" 59 | return IP(randint(IP(start).int(), IP(end).int())).strNormal() 60 | 61 | 62 | if __name__ == '__main__': 63 | unittest.main() -------------------------------------------------------------------------------- /g3ar/utils/ipwhois/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013, 2014, 2015, 2016 Philip Hane 2 | # All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright notice, 10 | # this list of conditions and the following disclaimer in the documentation 11 | # and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 17 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 23 | # POSSIBILITY OF SUCH DAMAGE. 24 | 25 | __version__ = '0.14.0' 26 | 27 | from .exceptions import * 28 | from .net import Net 29 | from .ipwhois import IPWhois 30 | -------------------------------------------------------------------------------- /g3ar/utils/ipwhois/data/iso_3166-1.csv: -------------------------------------------------------------------------------- 1 | AD,Andorra, 2 | AE,United Arab Emirates, 3 | AF,Afghanistan, 4 | AG,Antigua and Barbuda, 5 | AI,Anguilla, 6 | AL,Albania, 7 | AM,Armenia, 8 | AN,Netherlands Antilles, 9 | AO,Angola, 10 | AP,"Asia/Pacific Region", 11 | AQ,Antarctica, 12 | AR,Argentina, 13 | AS,American Samoa, 14 | AT,Austria, 15 | AU,Australia, 16 | AW,Aruba, 17 | AX,Aland Islands, 18 | AZ,Azerbaijan, 19 | BA,Bosnia and Herzegovina, 20 | BB,Barbados, 21 | BD,Bangladesh, 22 | BE,Belgium, 23 | BF,Burkina Faso, 24 | BG,Bulgaria, 25 | BH,Bahrain, 26 | BI,Burundi, 27 | BJ,Benin, 28 | BL,Saint Bartelemey, 29 | BM,Bermuda, 30 | BN,Brunei Darussalam, 31 | BO,Bolivia, 32 | BQ,"Bonaire, Saint Eustatius and Saba", 33 | BR,Brazil, 34 | BS,Bahamas, 35 | BT,Bhutan, 36 | BV,Bouvet Island, 37 | BW,Botswana, 38 | BY,Belarus, 39 | BZ,Belize, 40 | CA,Canada, 41 | CC,Cocos (Keeling) Islands, 42 | CD,"Congo, The Democratic Republic of the", 43 | CF,Central African Republic, 44 | CG,Congo, 45 | CH,Switzerland, 46 | CI,Cote d'Ivoire, 47 | CK,Cook Islands, 48 | CL,Chile, 49 | CM,Cameroon, 50 | CN,China, 51 | CO,Colombia, 52 | CR,Costa Rica, 53 | CU,Cuba, 54 | CV,Cape Verde, 55 | CW,Curacao, 56 | CX,Christmas Island, 57 | CY,Cyprus, 58 | CZ,Czech Republic, 59 | DE,Germany, 60 | DJ,Djibouti, 61 | DK,Denmark, 62 | DM,Dominica, 63 | DO,Dominican Republic, 64 | DZ,Algeria, 65 | EC,Ecuador, 66 | EE,Estonia, 67 | EG,Egypt, 68 | EH,Western Sahara, 69 | ER,Eritrea, 70 | ES,Spain, 71 | ET,Ethiopia, 72 | EU,Europe, 73 | FI,Finland, 74 | FJ,Fiji, 75 | FK,Falkland Islands (Malvinas), 76 | FM,"Micronesia, Federated States of", 77 | FO,Faroe Islands, 78 | FR,France, 79 | GA,Gabon, 80 | GB,United Kingdom, 81 | GD,Grenada, 82 | GE,Georgia, 83 | GF,French Guiana, 84 | GG,Guernsey, 85 | GH,Ghana, 86 | GI,Gibraltar, 87 | GL,Greenland, 88 | GM,Gambia, 89 | GN,Guinea, 90 | GP,Guadeloupe, 91 | GQ,Equatorial Guinea, 92 | GR,Greece, 93 | GS,South Georgia and the South Sandwich Islands, 94 | GT,Guatemala, 95 | GU,Guam, 96 | GW,Guinea-Bissau, 97 | GY,Guyana, 98 | HK,Hong Kong, 99 | HM,Heard Island and McDonald Islands, 100 | HN,Honduras, 101 | HR,Croatia, 102 | HT,Haiti, 103 | HU,Hungary, 104 | ID,Indonesia, 105 | IE,Ireland, 106 | IL,Israel, 107 | IM,Isle of Man, 108 | IN,India, 109 | IO,British Indian Ocean Territory, 110 | IQ,Iraq, 111 | IR,"Iran, Islamic Republic of", 112 | IS,Iceland, 113 | IT,Italy, 114 | JE,Jersey, 115 | JM,Jamaica, 116 | JO,Jordan, 117 | JP,Japan, 118 | KE,Kenya, 119 | KG,Kyrgyzstan, 120 | KH,Cambodia, 121 | KI,Kiribati, 122 | KM,Comoros, 123 | KN,Saint Kitts and Nevis, 124 | KP,"Korea, Democratic People's Republic of", 125 | KR,"Korea, Republic of", 126 | KW,Kuwait, 127 | KY,Cayman Islands, 128 | KZ,Kazakhstan, 129 | LA,Lao People's Democratic Republic, 130 | LB,Lebanon, 131 | LC,Saint Lucia, 132 | LI,Liechtenstein, 133 | LK,Sri Lanka, 134 | LR,Liberia, 135 | LS,Lesotho, 136 | LT,Lithuania, 137 | LU,Luxembourg, 138 | LV,Latvia, 139 | LY,Libyan Arab Jamahiriya, 140 | MA,Morocco, 141 | MC,Monaco, 142 | MD,"Moldova, Republic of", 143 | ME,Montenegro, 144 | MF,Saint Martin, 145 | MG,Madagascar, 146 | MH,Marshall Islands, 147 | MK,Macedonia, 148 | ML,Mali, 149 | MM,Myanmar, 150 | MN,Mongolia, 151 | MO,Macao, 152 | MP,Northern Mariana Islands, 153 | MQ,Martinique, 154 | MR,Mauritania, 155 | MS,Montserrat, 156 | MT,Malta, 157 | MU,Mauritius, 158 | MV,Maldives, 159 | MW,Malawi, 160 | MX,Mexico, 161 | MY,Malaysia, 162 | MZ,Mozambique, 163 | NA,Namibia, 164 | NC,New Caledonia, 165 | NE,Niger, 166 | NF,Norfolk Island, 167 | NG,Nigeria, 168 | NI,Nicaragua, 169 | NL,Netherlands, 170 | NO,Norway, 171 | NP,Nepal, 172 | NR,Nauru, 173 | NU,Niue, 174 | NZ,New Zealand, 175 | OM,Oman, 176 | PA,Panama, 177 | PE,Peru, 178 | PF,French Polynesia, 179 | PG,Papua New Guinea, 180 | PH,Philippines, 181 | PK,Pakistan, 182 | PL,Poland, 183 | PM,Saint Pierre and Miquelon, 184 | PN,Pitcairn, 185 | PR,Puerto Rico, 186 | PS,Palestinian Territory, 187 | PT,Portugal, 188 | PW,Palau, 189 | PY,Paraguay, 190 | QA,Qatar, 191 | RE,Reunion, 192 | RO,Romania, 193 | RS,Serbia, 194 | RU,Russian Federation, 195 | RW,Rwanda, 196 | SA,Saudi Arabia, 197 | SB,Solomon Islands, 198 | SC,Seychelles, 199 | SD,Sudan, 200 | SE,Sweden, 201 | SG,Singapore, 202 | SH,Saint Helena, 203 | SI,Slovenia, 204 | SJ,Svalbard and Jan Mayen, 205 | SK,Slovakia, 206 | SL,Sierra Leone, 207 | SM,San Marino, 208 | SN,Senegal, 209 | SO,Somalia, 210 | SR,Suriname, 211 | SS,South Sudan, 212 | ST,Sao Tome and Principe, 213 | SV,El Salvador, 214 | SX,Sint Maarten, 215 | SY,Syrian Arab Republic, 216 | SZ,Swaziland, 217 | TC,Turks and Caicos Islands, 218 | TD,Chad, 219 | TF,French Southern Territories, 220 | TG,Togo, 221 | TH,Thailand, 222 | TJ,Tajikistan, 223 | TK,Tokelau, 224 | TL,Timor-Leste, 225 | TM,Turkmenistan, 226 | TN,Tunisia, 227 | TO,Tonga, 228 | TR,Turkey, 229 | TT,Trinidad and Tobago, 230 | TV,Tuvalu, 231 | TW,Taiwan, 232 | TZ,"Tanzania, United Republic of", 233 | UA,Ukraine, 234 | UG,Uganda, 235 | UM,United States Minor Outlying Islands, 236 | US,United States, 237 | UY,Uruguay, 238 | UZ,Uzbekistan, 239 | VA,Holy See (Vatican City State), 240 | VC,Saint Vincent and the Grenadines, 241 | VE,Venezuela, 242 | VG,"Virgin Islands, British", 243 | VI,"Virgin Islands, U.S.", 244 | VN,Vietnam, 245 | VU,Vanuatu, 246 | WF,Wallis and Futuna, 247 | WS,Samoa, 248 | YE,Yemen, 249 | YT,Mayotte, 250 | ZA,South Africa, 251 | ZM,Zambia, 252 | ZW,Zimbabwe, -------------------------------------------------------------------------------- /g3ar/utils/ipwhois/exceptions.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013, 2014, 2015, 2016 Philip Hane 2 | # All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright notice, 10 | # this list of conditions and the following disclaimer in the documentation 11 | # and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 17 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 23 | # POSSIBILITY OF SUCH DAMAGE. 24 | 25 | 26 | class NetError(Exception): 27 | """ 28 | An Exception for when a parameter provided is not an instance of 29 | ipwhois.net.Net. 30 | """ 31 | 32 | 33 | class IPDefinedError(Exception): 34 | """ 35 | An Exception for when the IP is defined (does not need to be resolved). 36 | """ 37 | 38 | 39 | class ASNLookupError(Exception): 40 | """ 41 | An Exception for when the ASN lookup failed. 42 | """ 43 | 44 | 45 | class ASNRegistryError(Exception): 46 | """ 47 | An Exception for when the ASN registry does not match one of the five 48 | expected values (arin, ripencc, apnic, lacnic, afrinic). 49 | """ 50 | 51 | 52 | class HostLookupError(Exception): 53 | """ 54 | An Exception for when the host lookup failed. 55 | """ 56 | 57 | 58 | class BlacklistError(Exception): 59 | """ 60 | An Exception for when the server is in a blacklist. 61 | """ 62 | 63 | 64 | class WhoisLookupError(Exception): 65 | """ 66 | An Exception for when the whois lookup failed. 67 | """ 68 | 69 | 70 | class HTTPLookupError(Exception): 71 | """ 72 | An Exception for when the RDAP lookup failed. 73 | """ 74 | 75 | 76 | class HTTPRateLimitError(Exception): 77 | """ 78 | An Exception for when HTTP queries exceed the NIC's request limit and have 79 | exhausted all retries. 80 | """ 81 | 82 | 83 | class InvalidEntityContactObject(Exception): 84 | """ 85 | An Exception for when JSON output is not an RDAP entity contact information 86 | object: 87 | https://tools.ietf.org/html/rfc7483#section-5.4 88 | """ 89 | 90 | 91 | class InvalidNetworkObject(Exception): 92 | """ 93 | An Exception for when JSON output is not an RDAP network object: 94 | https://tools.ietf.org/html/rfc7483#section-5.4 95 | """ 96 | 97 | 98 | class InvalidEntityObject(Exception): 99 | """ 100 | An Exception for when JSON output is not an RDAP entity object: 101 | https://tools.ietf.org/html/rfc7483#section-5.1 102 | """ 103 | -------------------------------------------------------------------------------- /g3ar/utils/iter_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: iter mix 6 | Created: 03/09/17 7 | """ 8 | 9 | import unittest 10 | import ast 11 | 12 | forcode_tmp = """ 13 | for {valuebase}{index} in {iterbase}{index}: 14 | pass 15 | try: 16 | {iterbase}{index}.reset() # {last_index} 17 | except AttributeError: 18 | pass 19 | """ 20 | 21 | yieldcode_tmp = """ 22 | yield tuple([{content}]) 23 | """ 24 | 25 | define_tmp = """ 26 | {iterbase}{index} = args[{index}] 27 | """ 28 | 29 | func_tmp = """ 30 | def dynamic_func(*args): 31 | pass 32 | """ 33 | 34 | mod_tmp = """ 35 | """ 36 | 37 | mod = ast.parse(mod_tmp, '', 'exec') 38 | 39 | 40 | ITERBASE = 'arg_' 41 | VALUEBASE = 'i_' 42 | 43 | # 44 | # compact components to a function 45 | #---------------------------------------------------------------------- 46 | def _compact_dynamic_func(body): 47 | """""" 48 | mod = ast.parse(func_tmp, '') 49 | funcnode = mod.body[0] 50 | funcnode.body.pop() 51 | for i in body: 52 | funcnode.body.append(i) 53 | 54 | return funcnode 55 | 56 | # 57 | # render the for code 58 | #---------------------------------------------------------------------- 59 | def _render_for(iter_id_base, value_id_base, index, filled_expr=None): 60 | """""" 61 | iter_id_base = str(iter_id_base) 62 | value_id_base = str(value_id_base) 63 | index = int(index) 64 | lastindex = index if index - 1 < 0 else index - 1 65 | 66 | _tmp = forcode_tmp.format(valuebase=value_id_base, 67 | index=index, 68 | iterbase=iter_id_base, 69 | last_index=lastindex) 70 | 71 | _body = ast.parse(_tmp, '').body 72 | _for = _body[0] 73 | 74 | if filled_expr: 75 | _for.body.pop() 76 | if isinstance(filled_expr, (list, tuple)): 77 | for i in filled_expr: 78 | _for.body.append(i) 79 | else: 80 | _for.body.append(filled_expr) 81 | return _body 82 | 83 | 84 | #---------------------------------------------------------------------- 85 | def _render_yield(base, length): 86 | """""" 87 | base = str(base) 88 | length = int(length) 89 | ret = [] 90 | for i in range(length): 91 | ret.append((base + '{}').format(i)) 92 | yieldcode_new = yieldcode_tmp.format(content=','.join(ret)) 93 | #print yieldcode_new 94 | return ast.parse(yieldcode_new, '').body.pop() 95 | 96 | # 97 | # section2 yield 98 | #---------------------------------------------------------------------- 99 | def _render_core_block(iter_num, iter_namebase=ITERBASE, value_namebase=VALUEBASE): 100 | """""" 101 | last = None 102 | for i in range(iter_num): 103 | i = iter_num - i - 1 104 | if last == None: 105 | last = _render_for(iter_namebase, value_namebase, i, _render_yield(value_namebase, iter_num)) 106 | else: 107 | last = _render_for(iter_namebase, value_namebase, i, last) 108 | 109 | last = last[0] 110 | return last 111 | 112 | # 113 | # section1 define 114 | #---------------------------------------------------------------------- 115 | def _define_iter(iterbase, length): 116 | """""" 117 | defnieblock = [] 118 | for i in range(length): 119 | define_new = define_tmp.format(index=i, iterbase=iterbase) 120 | definebody = ast.parse(define_new, '').body.pop() 121 | defnieblock.append(definebody) 122 | 123 | return defnieblock 124 | 125 | 126 | #---------------------------------------------------------------------- 127 | def iter_mix(*args): 128 | """""" 129 | length = len(args) 130 | basebody = _define_iter(ITERBASE, length) 131 | basebody.append(_render_core_block(iter_num=length)) 132 | funcmod = _compact_dynamic_func(basebody) 133 | mod_tmp = """ 134 | """ 135 | 136 | mod = ast.parse(mod_tmp, '', 'exec') 137 | 138 | astt = funcmod 139 | if not isinstance(astt, (list, tuple)): 140 | mod.body.append(astt) 141 | else: 142 | for i in astt: 143 | mod.body.append(i) 144 | 145 | exec(compile(mod, '', 'exec')) 146 | return dynamic_func(*args) 147 | 148 | 149 | if __name__ == '__main__': 150 | unittest.main() -------------------------------------------------------------------------------- /g3ar/utils/print_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Print Better Helper! 6 | Created: 2017/1/2 7 | """ 8 | 9 | import unittest 10 | from colorama import init, Fore 11 | from prettytable import PrettyTable 12 | 13 | #---------------------------------------------------------------------- 14 | def print_bar(text=None, basic_char='=', length=70, color=None): 15 | """""" 16 | if text: 17 | text = str(text) 18 | textlen = len(text) 19 | length_one_side = (length - textlen) / 2 20 | bar_side = basic_char * int(length_one_side) 21 | bar = bar_side + text + bar_side 22 | else: 23 | bar = basic_char * length 24 | 25 | if color and hasattr(Fore, color.upper()): 26 | bar = getattr(Fore, color.upper()) + bar 27 | else: 28 | bar = bar 29 | 30 | init(autoreset=True) 31 | print(bar) 32 | 33 | #---------------------------------------------------------------------- 34 | def print_red(*args): 35 | """""" 36 | raw = str(args) 37 | init(autoreset=True) 38 | print((Fore.RED + raw)) 39 | 40 | #---------------------------------------------------------------------- 41 | def print_green(*args): 42 | """""" 43 | raw = str(args) 44 | init(autoreset=True) 45 | print((Fore.GREEN + raw)) 46 | 47 | #---------------------------------------------------------------------- 48 | def print_blue(*args): 49 | """""" 50 | raw = str(args) 51 | init(autoreset=True) 52 | print((Fore.CYAN + raw)) 53 | 54 | #---------------------------------------------------------------------- 55 | def print_yellow(*args): 56 | """""" 57 | raw = str(args) 58 | init(autoreset=True) 59 | print((Fore.YELLOW + raw)) 60 | 61 | #---------------------------------------------------------------------- 62 | def print_cyan(*args): 63 | """""" 64 | raw = str(args) 65 | init(autoreset=True) 66 | print((Fore.CYAN + raw)) 67 | 68 | #---------------------------------------------------------------------- 69 | def print_purpul(*args): 70 | """""" 71 | raw = str(args) 72 | init(autoreset=True) 73 | print((Fore.MAGENTA + raw)) 74 | 75 | #---------------------------------------------------------------------- 76 | def print_gray(*args): 77 | """""" 78 | raw = str(args) 79 | init(autoreset=True) 80 | print((Fore.LIGHTBLACK_EX + raw)) 81 | 82 | 83 | #---------------------------------------------------------------------- 84 | def print_column(head, column, color=''): 85 | """Print Column With Color. 86 | 87 | Params: 88 | head: :: A head for the column data. 89 | column: :list tuple: the column data(list or tuple) 90 | coler: :str: 91 | lightblack_ex 92 | magenta 93 | cyan 94 | green 95 | blue 96 | yellow 97 | red 98 | 99 | Returns: 100 | return the strings of table 101 | """ 102 | assert isinstance(color, str) 103 | 104 | _prefix = '' 105 | if hasattr(Fore, color.upper()): 106 | _prefix = getattr(Fore, color.upper()) 107 | 108 | table = PrettyTable() 109 | table.add_column(head, column) 110 | 111 | raw = table.get_string() 112 | init(autoreset=True) 113 | print(_prefix + raw) 114 | return table 115 | 116 | #---------------------------------------------------------------------- 117 | def print_columns(heads, columns, color=''): 118 | """Print Column With Color. 119 | 120 | Params: 121 | head: :: A list of heads for the columns data. 122 | column: :list tuple: the column data(list or tuple) 123 | coler: :str: 124 | lightblack_ex 125 | magenta 126 | cyan 127 | green 128 | blue 129 | yellow 130 | red 131 | 132 | Returns: 133 | return the strings of table 134 | """ 135 | assert isinstance(color, str) 136 | assert len(heads) == len(columns) 137 | 138 | _prefix = '' 139 | if hasattr(Fore, color.upper()): 140 | _prefix = getattr(Fore, color.upper()) 141 | 142 | table = PrettyTable() 143 | for i in xrange(len(heads)): 144 | head = heads[i] 145 | column = columns[i] 146 | table.add_column(head, column) 147 | 148 | raw = table.get_string() 149 | init(autoreset=True) 150 | print(_prefix + raw) 151 | return table 152 | 153 | #---------------------------------------------------------------------- 154 | def print_rows(heads, rows, color=''): 155 | """Print Column With Color. 156 | 157 | Params: 158 | heads: :list: the row of heads 159 | rows: :list tuple: the rows data(list or tuple) 160 | coler: :str: 161 | lightblack_ex 162 | magenta 163 | cyan 164 | green 165 | blue 166 | yellow 167 | red 168 | 169 | Returns: 170 | return the strings of table 171 | """ 172 | assert len(heads) == len(rows[0]) 173 | assert isinstance(color, str) 174 | 175 | _prefix = '' 176 | if hasattr(Fore, color.upper()): 177 | _prefix = getattr(Fore, color.upper()) 178 | 179 | # 180 | # split rows 181 | # 182 | table = PrettyTable(heads) 183 | for row in rows: 184 | table.add_row(row) 185 | 186 | 187 | raw = table.get_string() 188 | init(autoreset=True) 189 | print(_prefix + raw) 190 | return table 191 | 192 | 193 | 194 | if __name__ == '__main__': 195 | unittest.main() -------------------------------------------------------------------------------- /g3ar/utils/pyping/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Python Ping 6 | Created: 2016/12/26 7 | """ 8 | 9 | import unittest 10 | from .isalive import is_alive 11 | 12 | #---------------------------------------------------------------------- 13 | def pyping(target, timeout=2, count=4): 14 | """""" 15 | return is_alive(target) 16 | 17 | 18 | if __name__ == '__main__': 19 | unittest.main() -------------------------------------------------------------------------------- /g3ar/utils/pyping/isalive.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Test the host is alive? 6 | Created: 2016/12/20 7 | """ 8 | 9 | import unittest 10 | from .ping import verbose_ping 11 | 12 | #---------------------------------------------------------------------- 13 | def is_alive(host, timeout=2, count=4): 14 | """""" 15 | result = {} 16 | 17 | ret = ping_host(host, timeout, count) 18 | result['ping'] = ret 19 | 20 | return result 21 | 22 | 23 | #---------------------------------------------------------------------- 24 | def ping_host(host, timeout=2, count=4): 25 | """""" 26 | result = {} 27 | result['alive'] = False 28 | result['delay'] = 0 29 | try: 30 | ping_delay = verbose_ping(host, timeout=timeout,count=count) 31 | if ping_delay != 0: 32 | result['alive'] = True 33 | result['delay'] = ping_delay 34 | return result 35 | else: 36 | raise ValueError() 37 | except: 38 | return result 39 | 40 | 41 | ######################################################################## 42 | class IsAliveTest(unittest.case.TestCase): 43 | """""" 44 | 45 | #---------------------------------------------------------------------- 46 | def test_pingtest(self): 47 | """Ping test""" 48 | 49 | print(ping_host('45.78.6.64')) 50 | 51 | 52 | 53 | 54 | 55 | if __name__ == '__main__': 56 | unittest.main() -------------------------------------------------------------------------------- /g3ar/utils/queue_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: Queue Utils 6 | Created: 2017/1/3 7 | """ 8 | 9 | import unittest 10 | import threading 11 | import time 12 | try: 13 | from queue import Empty 14 | except: 15 | from Queue import Empty 16 | 17 | #---------------------------------------------------------------------- 18 | def sync_dispatch(queue_instance, task_generator, 19 | buffer_size=100, interval=0.05): 20 | """To dispatch tasks from [task_generator] to [queue_instance] 21 | with the [buffer_size] buffer task. 22 | 23 | Params: 24 | queue_instance: :Queue: receive task. 25 | task_generator: :generator/list/tuple/set: Who have tasks 26 | waiting for being dispatched. 27 | buffer_size: :int: buffer_size. 28 | interval: :float/int: interval of checking the size of queue.""" 29 | 30 | assert isinstance(interval, (int, float)), \ 31 | '[!] [interval] should be a float/int! ' 32 | assert isinstance(buffer_size, int), \ 33 | '[!] [buffer_size] should be a int! ' 34 | 35 | for i in task_generator: 36 | while queue_instance.qsize() >= buffer_size: 37 | time.sleep(interval) 38 | queue_instance.put(i) 39 | 40 | #---------------------------------------------------------------------- 41 | def async_dispatch(queue_instance, task_generator, 42 | buffer_size=100, interval=0.05, 43 | thread_name='ASYNC_DISPATCHER', daemon=True): 44 | """To dispatch tasks from [task_generator] to [queue_instance] 45 | with the [buffer_size] buffer task. 46 | 47 | Params: 48 | queue_instance: :Queue: receive task. 49 | task_generator: :generator/list/tuple/set: Who have tasks 50 | waiting for being dispatched. 51 | buffer_size: :int: buffer_size 52 | interval: :float/int: interval of checking the size of queue. 53 | thread_name: :str: the name of thread. 54 | daemon: :bool: daemon thread?""" 55 | 56 | assert isinstance(interval, (int, float)), \ 57 | '[!] [interval] should be a float/int! ' 58 | assert isinstance(buffer_size, int), \ 59 | '[!] [buffer_size] should be a int! ' 60 | 61 | def _worker(): 62 | for i in task_generator: 63 | while queue_instance.qsize() >= buffer_size: 64 | time.sleep(interval) 65 | queue_instance.put(i) 66 | 67 | _threadi = threading.Thread(name=thread_name, target=_worker) 68 | _threadi.daemon = True 69 | _threadi.start() 70 | 71 | #---------------------------------------------------------------------- 72 | def queue_peek(queue_instance, timeout=60): 73 | """Convert Queue to A generator with a timeout 74 | 75 | Params: 76 | queue_instance: :Queue: the Queue you want to peek 77 | timeout: :int/float: from got a """ 78 | while True: 79 | try: 80 | yield queue_instance.get(timeout=timeout) 81 | except Empty: 82 | break 83 | 84 | 85 | if __name__ == '__main__': 86 | unittest.main() -------------------------------------------------------------------------------- /g3ar/utils/thread_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: threads utils 6 | Created: 03/07/17 7 | """ 8 | 9 | import unittest 10 | import threading 11 | 12 | #---------------------------------------------------------------------- 13 | def start_new_thread(target, name=None, args=tuple(), 14 | kwargs={}, daemon=True): 15 | """""" 16 | ret = threading.Thread(target=target, args=args, 17 | kwargs=kwargs, name=name) 18 | ret.daemon = daemon 19 | ret.start() 20 | return ret 21 | 22 | 23 | 24 | if __name__ == '__main__': 25 | unittest.main() -------------------------------------------------------------------------------- /g3ar/utils/verify_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: --<> 5 | Purpose: 6 | Created: 03/02/17 7 | """ 8 | 9 | import unittest 10 | import re 11 | 12 | 13 | # 14 | # Domain reg pattern 15 | # 16 | DOMAIN_REG = '(?i)(([a-z0-9-]+)((\.[0-9a-z-]+)+))' 17 | 18 | # 19 | # URL reg pattern 20 | # 21 | URL_REG = '(^(([a-z]+)://)(' + DOMAIN_REG + ')((\/([a-zA-Z0-9-\.]+)?)+)?)' 22 | 23 | # 24 | # IP REG 25 | # 26 | IPv4_REG = "((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]))" 27 | IPv6_REG = "(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))" 28 | 29 | #---------------------------------------------------------------------- 30 | def is_url(target): 31 | """""" 32 | if len(re.findall(pattern=URL_REG, string=target)) > 0: 33 | return True 34 | else: 35 | return False 36 | 37 | #---------------------------------------------------------------------- 38 | def is_ipv4(target): 39 | """""" 40 | if len(re.findall(pattern=IPv4_REG, string=target)) > 0: 41 | return True 42 | else: 43 | return False 44 | 45 | #---------------------------------------------------------------------- 46 | def is_ipv6(target): 47 | """""" 48 | if len(re.findall(pattern=IPv6_REG, string=target)) > 0: 49 | return True 50 | else: 51 | return False 52 | 53 | 54 | #---------------------------------------------------------------------- 55 | def is_domain(target): 56 | """""" 57 | if len(re.findall(pattern=DOMAIN_REG, string=target)) > 0: 58 | return True 59 | else: 60 | return False 61 | 62 | 63 | ######################################################################## 64 | class ValidatorTester(unittest.case.TestCase): 65 | """""" 66 | 67 | #---------------------------------------------------------------------- 68 | def test_check_url(self): 69 | """""" 70 | url1 = 'ftp://blog.tbis.me/adfa/a/df/a' 71 | url2 = 'hTtP://bot-as.adf.ad.a/' 72 | 73 | self.assertTrue(is_url(url1)) 74 | self.assertTrue(is_url(url2)) 75 | 76 | #---------------------------------------------------------------------- 77 | def test_check_ip(self): 78 | """""" 79 | 80 | IPv4 = '12.3.2.3' 81 | IPv6 = '2001:0db8:85a3:08d3:1319:8a2e:0370:7344' 82 | 83 | self.assertTrue(is_ipv4(IPv4)) 84 | self.assertTrue(is_ipv6(IPv6)) 85 | 86 | #---------------------------------------------------------------------- 87 | def test_check_domain(self): 88 | """""" 89 | domain1 = 'demo.com' 90 | domain2 = 'vill1nch.top' 91 | 92 | 93 | self.assertTrue(is_domain(domain1)) 94 | self.assertTrue(is_domain(domain2)) 95 | 96 | 97 | 98 | if __name__ == '__main__': 99 | unittest.main() -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | IPy 2 | ipwhois 3 | colorama 4 | prettytable -------------------------------------------------------------------------------- /sessions_dat: -------------------------------------------------------------------------------- 1 | (dp0 2 | S'aa3e0ce6b145fd1d80d934dfcb07248e' 3 | p1 4 | I6 5 | sS'10e619bfadb73acbd6acc71497902fca' 6 | p2 7 | L96L 8 | s. -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | """ 4 | Author: -- 5 | Purpose: G3ar setup 6 | Created: 2016/12/20 7 | """ 8 | 9 | from codecs import open as copen 10 | from setuptools import setup, find_packages 11 | 12 | packages = find_packages() 13 | 14 | requires = ['IPy', 'ipwhois', 'colorama', 'prettytable'] 15 | 16 | version = '0.5.7' 17 | 18 | # 19 | # LOAD README.md 20 | # 21 | try: 22 | readme = None 23 | with copen('README.md', encoding='utf-8') as f: 24 | readme = f.read() 25 | 26 | history = None 27 | with copen('HISTORY.md', encoding='utf-8') as f: 28 | history = f.read() 29 | except: 30 | readme = 'Python Coding Toolkit for Pentester.' + \ 31 | '\nGithub: https://github.com/VillanCh/g3ar' + \ 32 | '\nREADME.md: https://github.com/VillanCh/g3ar/blob/master/README.md\n\n' 33 | history = 'https://github.com/VillanCh/g3ar/blob/master/HISTORY.md' 34 | 35 | 36 | setup( 37 | name='g3ar', 38 | version=version, 39 | description='Python Coding Toolkit for Pentester.', 40 | long_description=readme + '\n\n' + history, 41 | author='v1ll4n', 42 | author_email='v1ll4n@villanch.top', 43 | url='https://github.com/VillanCh/g3ar', 44 | packages=packages, 45 | package_data={"":["LICENSE", 'README.md', 'HISTORY.md']}, 46 | package_dir={'g3ar':'g3ar'}, 47 | include_package_data=True, 48 | install_requires=requires, 49 | license='BSD 2-Clause License', 50 | zip_safe=False, 51 | ) 52 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.critical.log: -------------------------------------------------------------------------------- 1 | 2017-05-14 13:40:36,978-testlogger.critical-CRITICAL: Hello Critical -- [process_id:9332][thread_name:MainThread-id:140735898657728] 2 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.critical.log.2017-01-09: -------------------------------------------------------------------------------- 1 | 2017-01-08 23:20:18,989-testlogger.critical-CRITICAL: Hello Critical -- [process_id:4292][thread_name:MainThread-id:1884] 2 | 2017-01-08 23:21:31,571-testlogger.critical-CRITICAL: Hello Critical -- [process_id:8372][thread_name:MainThread-id:4028] 3 | 2017-01-08 23:23:59,173-testlogger.critical-CRITICAL: Hello Critical -- [process_id:8580][thread_name:MainThread-id:11344] 4 | 2017-01-08 23:25:54,573-testlogger.critical-CRITICAL: Hello Critical -- [process_id:14996][thread_name:MainThread-id:9704] 5 | 2017-01-08 23:29:17,450-testlogger.critical-CRITICAL: Hello Critical -- [process_id:11916][thread_name:MainThread-id:12752] 6 | 2017-01-08 23:33:55,039-testlogger.critical-CRITICAL: Hello Critical -- [process_id:10840][thread_name:MainThread-id:8840] 7 | 2017-01-08 23:38:50,743-testlogger.critical-CRITICAL: Hello Critical -- [process_id:10480][thread_name:MainThread-id:8048] 8 | 2017-01-08 23:38:59,884-testlogger.critical-CRITICAL: Hello Critical -- [process_id:4068][thread_name:MainThread-id:4572] 9 | 2017-01-08 23:42:00,344-testlogger.critical-CRITICAL: Hello Critical -- [process_id:2504][thread_name:MainThread-id:7928] 10 | 2017-01-08 23:42:52,461-testlogger.critical-CRITICAL: Hello Critical -- [process_id:5004][thread_name:MainThread-id:13860] 11 | <<<<<<< HEAD 12 | 2017-01-08 11:22:29,172-testlogger.critical-CRITICAL: Hello Critical -- [process_id:5761][thread_name:MainThread-id:-1219395264] 13 | 2017-01-08 11:34:01,475-testlogger.critical-CRITICAL: Hello Critical -- [process_id:5961][thread_name:MainThread-id:-1219747520] 14 | 2017-01-08 11:37:37,656-testlogger.critical-CRITICAL: Hello Critical -- [process_id:6122][thread_name:MainThread-id:-1220271808] 15 | 2017-01-08 11:39:18,448-testlogger.critical-CRITICAL: Hello Critical -- [process_id:6329][thread_name:MainThread-id:-1219677888] 16 | ======= 17 | 2017-01-09 00:42:28,015-testlogger.critical-CRITICAL: Hello Critical -- [process_id:12820][thread_name:MainThread-id:5952] 18 | <<<<<<< HEAD 19 | >>>>>>> ea2bd6bf2c37960bc32bdb6e4ad6a5515bf07148 20 | 2017-01-08 11:53:23,435-testlogger.critical-CRITICAL: Hello Critical -- [process_id:6619][thread_name:MainThread-id:-1219612352] 21 | 2017-01-08 11:54:28,134-testlogger.critical-CRITICAL: Hello Critical -- [process_id:6772][thread_name:MainThread-id:-1219367936] 22 | ======= 23 | 2017-01-09 00:52:48,555-testlogger.critical-CRITICAL: Hello Critical -- [process_id:13496][thread_name:MainThread-id:12596] 24 | 2017-01-09 00:53:39,710-testlogger.critical-CRITICAL: Hello Critical -- [process_id:15084][thread_name:MainThread-id:12080] 25 | 2017-01-09 01:08:06,707-testlogger.critical-CRITICAL: Hello Critical -- [process_id:8072][thread_name:MainThread-id:11252] 26 | >>>>>>> 568555d59306b092fb39a05efae6b0174d25ab3e 27 | 2017-01-08 12:11:12,742-testlogger.critical-CRITICAL: Hello Critical -- [process_id:8588][thread_name:MainThread-id:-1219396608] 28 | 2017-01-08 12:11:28,996-testlogger.critical-CRITICAL: Hello Critical -- [process_id:8753][thread_name:MainThread-id:-1220054720] 29 | 2017-01-08 12:17:58,185-testlogger.critical-CRITICAL: Hello Critical -- [process_id:9034][thread_name:MainThread-id:-1220019200] 30 | 2017-01-08 12:18:44,438-testlogger.critical-CRITICAL: Hello Critical -- [process_id:9191][thread_name:MainThread-id:-1219321536] 31 | 2017-01-08 12:19:50,592-testlogger.critical-CRITICAL: Hello Critical -- [process_id:9345][thread_name:MainThread-id:-1219617792] 32 | 2017-01-09 22:46:37,796-testlogger.critical-CRITICAL: Hello Critical -- [process_id:6248][thread_name:MainThread-id:4052] 33 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.critical.log.2017-02-09: -------------------------------------------------------------------------------- 1 | 2017-01-22 11:51:58,901-testlogger.critical-CRITICAL: Hello Critical -- [process_id:12008][thread_name:MainThread-id:8576] 2 | 2017-02-09 20:32:53,017-testlogger.critical-CRITICAL: Hello Critical -- [process_id:9362][thread_name:MainThread-id:140736836027328] 3 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.critical.log.2017-02-24: -------------------------------------------------------------------------------- 1 | 2017-02-24 11:26:25,093-testlogger.critical-CRITICAL: Hello Critical -- [process_id:25243][thread_name:MainThread-id:140736836027328] 2 | 2017-02-24 11:40:45,758-testlogger.critical-CRITICAL: Hello Critical -- [process_id:26545][thread_name:MainThread-id:140736836027328] 3 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.critical.log.2017-02-26: -------------------------------------------------------------------------------- 1 | 2017-02-26 10:11:52,289-testlogger.critical-CRITICAL: Hello Critical -- [process_id:45708][thread_name:MainThread-id:140736836027328] 2 | 2017-02-26 10:54:21,333-testlogger.critical-CRITICAL: Hello Critical -- [process_id:61953][thread_name:MainThread-id:140736836027328] 3 | 2017-02-26 10:54:50,016-testlogger.critical-CRITICAL: Hello Critical -- [process_id:62060][thread_name:MainThread-id:140736836027328] 4 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.critical.log.2017-03-09: -------------------------------------------------------------------------------- 1 | 2017-03-09 20:46:28,915-testlogger.critical-CRITICAL: Hello Critical -- [process_id:46641][thread_name:MainThread-id:140735836132288] 2 | 2017-03-09 20:47:34,449-testlogger.critical-CRITICAL: Hello Critical -- [process_id:46749][thread_name:MainThread-id:140735836132288] 3 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.critical.log.2017-05-10: -------------------------------------------------------------------------------- 1 | 2017-05-10 14:58:51,832-testlogger.critical-CRITICAL: Hello Critical -- [process_id:46808][thread_name:MainThread-id:140736910648256] 2 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.crucial.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/testdata/decolog/testlogger/testlogger.crucial.log -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.debug.log: -------------------------------------------------------------------------------- 1 | 2017-05-14 13:40:36,979-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:9332][thread_name:MainThread-id:140735898657728] 2 | 2017-05-14 13:40:36,980-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:9332][thread_name:MainThread-id:140735898657728] 3 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.debug.log.2017-02-09: -------------------------------------------------------------------------------- 1 | 2017-01-22 11:51:58,905-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:12008][thread_name:MainThread-id:8576] 2 | 2017-01-22 11:51:58,908-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:12008][thread_name:MainThread-id:8576] 3 | 2017-02-09 20:32:53,017-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:9362][thread_name:MainThread-id:140736836027328] 4 | 2017-02-09 20:32:53,017-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:9362][thread_name:MainThread-id:140736836027328] 5 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.debug.log.2017-02-24: -------------------------------------------------------------------------------- 1 | 2017-02-24 11:26:25,094-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:25243][thread_name:MainThread-id:140736836027328] 2 | 2017-02-24 11:26:25,094-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:25243][thread_name:MainThread-id:140736836027328] 3 | 2017-02-24 11:40:45,758-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:26545][thread_name:MainThread-id:140736836027328] 4 | 2017-02-24 11:40:45,758-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:26545][thread_name:MainThread-id:140736836027328] 5 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.debug.log.2017-02-26: -------------------------------------------------------------------------------- 1 | 2017-02-26 10:11:52,290-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:45708][thread_name:MainThread-id:140736836027328] 2 | 2017-02-26 10:11:52,291-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:45708][thread_name:MainThread-id:140736836027328] 3 | 2017-02-26 10:54:21,333-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:61953][thread_name:MainThread-id:140736836027328] 4 | 2017-02-26 10:54:21,334-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:61953][thread_name:MainThread-id:140736836027328] 5 | 2017-02-26 10:54:50,016-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:62060][thread_name:MainThread-id:140736836027328] 6 | 2017-02-26 10:54:50,016-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:62060][thread_name:MainThread-id:140736836027328] 7 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.debug.log.2017-03-09: -------------------------------------------------------------------------------- 1 | 2017-03-09 20:46:28,916-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:46641][thread_name:MainThread-id:140735836132288] 2 | 2017-03-09 20:46:28,917-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:46641][thread_name:MainThread-id:140735836132288] 3 | 2017-03-09 20:47:34,449-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:46749][thread_name:MainThread-id:140735836132288] 4 | 2017-03-09 20:47:34,450-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:46749][thread_name:MainThread-id:140735836132288] 5 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.debug.log.2017-05-10: -------------------------------------------------------------------------------- 1 | 2017-05-10 14:58:51,834-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:46808][thread_name:MainThread-id:140736910648256] 2 | 2017-05-10 14:58:51,835-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:46808][thread_name:MainThread-id:140736910648256] 3 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.error.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/testdata/decolog/testlogger/testlogger.error.log -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.info.log: -------------------------------------------------------------------------------- 1 | 2017-05-14 13:40:36,979-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:9332][thread_name:MainThread-id:140735898657728] 2 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.info.log.2017-01-09: -------------------------------------------------------------------------------- 1 | 2017-01-08 23:20:18,990-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:4292][thread_name:MainThread-id:1884] 2 | 2017-01-08 23:21:31,586-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:8372][thread_name:MainThread-id:4028] 3 | 2017-01-08 23:23:59,173-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:8580][thread_name:MainThread-id:11344] 4 | 2017-01-08 23:25:54,575-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:14996][thread_name:MainThread-id:9704] 5 | 2017-01-08 23:29:17,450-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:11916][thread_name:MainThread-id:12752] 6 | 2017-01-08 23:33:55,039-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:10840][thread_name:MainThread-id:8840] 7 | 2017-01-08 23:38:50,743-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:10480][thread_name:MainThread-id:8048] 8 | 2017-01-08 23:38:59,887-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:4068][thread_name:MainThread-id:4572] 9 | 2017-01-08 23:42:00,344-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:2504][thread_name:MainThread-id:7928] 10 | 2017-01-08 23:42:52,461-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:5004][thread_name:MainThread-id:13860] 11 | <<<<<<< HEAD 12 | 2017-01-08 11:22:29,173-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:5761][thread_name:MainThread-id:-1219395264] 13 | 2017-01-08 11:34:01,476-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:5961][thread_name:MainThread-id:-1219747520] 14 | 2017-01-08 11:37:37,657-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:6122][thread_name:MainThread-id:-1220271808] 15 | 2017-01-08 11:39:18,449-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:6329][thread_name:MainThread-id:-1219677888] 16 | ======= 17 | 2017-01-09 00:42:28,017-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:12820][thread_name:MainThread-id:5952] 18 | <<<<<<< HEAD 19 | >>>>>>> ea2bd6bf2c37960bc32bdb6e4ad6a5515bf07148 20 | 2017-01-08 11:53:23,436-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:6619][thread_name:MainThread-id:-1219612352] 21 | 2017-01-08 11:54:28,134-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:6772][thread_name:MainThread-id:-1219367936] 22 | ======= 23 | 2017-01-09 00:52:48,558-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:13496][thread_name:MainThread-id:12596] 24 | 2017-01-09 00:53:39,713-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:15084][thread_name:MainThread-id:12080] 25 | 2017-01-09 01:08:06,710-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:8072][thread_name:MainThread-id:11252] 26 | >>>>>>> 568555d59306b092fb39a05efae6b0174d25ab3e 27 | 2017-01-08 12:11:12,742-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:8588][thread_name:MainThread-id:-1219396608] 28 | 2017-01-08 12:11:28,997-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:8753][thread_name:MainThread-id:-1220054720] 29 | 2017-01-08 12:17:58,186-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:9034][thread_name:MainThread-id:-1220019200] 30 | 2017-01-08 12:18:44,439-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:9191][thread_name:MainThread-id:-1219321536] 31 | 2017-01-08 12:19:50,593-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:9345][thread_name:MainThread-id:-1219617792] 32 | 2017-01-09 22:46:37,796-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:6248][thread_name:MainThread-id:4052] 33 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.info.log.2017-02-09: -------------------------------------------------------------------------------- 1 | 2017-01-22 11:51:58,907-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:12008][thread_name:MainThread-id:8576] 2 | 2017-02-09 20:32:53,017-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:9362][thread_name:MainThread-id:140736836027328] 3 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.info.log.2017-02-24: -------------------------------------------------------------------------------- 1 | 2017-02-24 11:26:25,094-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:25243][thread_name:MainThread-id:140736836027328] 2 | 2017-02-24 11:40:45,758-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:26545][thread_name:MainThread-id:140736836027328] 3 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.info.log.2017-02-26: -------------------------------------------------------------------------------- 1 | 2017-02-26 10:11:52,291-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:45708][thread_name:MainThread-id:140736836027328] 2 | 2017-02-26 10:54:21,333-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:61953][thread_name:MainThread-id:140736836027328] 3 | 2017-02-26 10:54:50,016-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:62060][thread_name:MainThread-id:140736836027328] 4 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.info.log.2017-03-09: -------------------------------------------------------------------------------- 1 | 2017-03-09 20:46:28,917-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:46641][thread_name:MainThread-id:140735836132288] 2 | 2017-03-09 20:47:34,450-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:46749][thread_name:MainThread-id:140735836132288] 3 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.info.log.2017-05-10: -------------------------------------------------------------------------------- 1 | 2017-05-10 14:58:51,834-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:46808][thread_name:MainThread-id:140736910648256] 2 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.log: -------------------------------------------------------------------------------- 1 | 2017-05-14 13:40:36,978-testlogger.critical-CRITICAL: Hello Critical -- [process_id:9332][thread_name:MainThread-id:140735898657728] 2 | 2017-05-14 13:40:36,979-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:9332][thread_name:MainThread-id:140735898657728] 3 | 2017-05-14 13:40:36,979-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:9332][thread_name:MainThread-id:140735898657728] 4 | 2017-05-14 13:40:36,980-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:9332][thread_name:MainThread-id:140735898657728] 5 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.log.2017-02-09: -------------------------------------------------------------------------------- 1 | 2017-01-22 11:51:58,901-testlogger.critical-CRITICAL: Hello Critical -- [process_id:12008][thread_name:MainThread-id:8576] 2 | 2017-01-22 11:51:58,905-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:12008][thread_name:MainThread-id:8576] 3 | 2017-01-22 11:51:58,907-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:12008][thread_name:MainThread-id:8576] 4 | 2017-01-22 11:51:58,908-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:12008][thread_name:MainThread-id:8576] 5 | 2017-02-09 20:32:53,017-testlogger.critical-CRITICAL: Hello Critical -- [process_id:9362][thread_name:MainThread-id:140736836027328] 6 | 2017-02-09 20:32:53,017-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:9362][thread_name:MainThread-id:140736836027328] 7 | 2017-02-09 20:32:53,017-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:9362][thread_name:MainThread-id:140736836027328] 8 | 2017-02-09 20:32:53,017-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:9362][thread_name:MainThread-id:140736836027328] 9 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.log.2017-02-24: -------------------------------------------------------------------------------- 1 | 2017-02-24 11:26:25,093-testlogger.critical-CRITICAL: Hello Critical -- [process_id:25243][thread_name:MainThread-id:140736836027328] 2 | 2017-02-24 11:26:25,094-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:25243][thread_name:MainThread-id:140736836027328] 3 | 2017-02-24 11:26:25,094-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:25243][thread_name:MainThread-id:140736836027328] 4 | 2017-02-24 11:26:25,094-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:25243][thread_name:MainThread-id:140736836027328] 5 | 2017-02-24 11:40:45,758-testlogger.critical-CRITICAL: Hello Critical -- [process_id:26545][thread_name:MainThread-id:140736836027328] 6 | 2017-02-24 11:40:45,758-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:26545][thread_name:MainThread-id:140736836027328] 7 | 2017-02-24 11:40:45,758-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:26545][thread_name:MainThread-id:140736836027328] 8 | 2017-02-24 11:40:45,758-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:26545][thread_name:MainThread-id:140736836027328] 9 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.log.2017-02-26: -------------------------------------------------------------------------------- 1 | 2017-02-26 10:11:52,289-testlogger.critical-CRITICAL: Hello Critical -- [process_id:45708][thread_name:MainThread-id:140736836027328] 2 | 2017-02-26 10:11:52,290-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:45708][thread_name:MainThread-id:140736836027328] 3 | 2017-02-26 10:11:52,291-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:45708][thread_name:MainThread-id:140736836027328] 4 | 2017-02-26 10:11:52,291-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:45708][thread_name:MainThread-id:140736836027328] 5 | 2017-02-26 10:54:21,333-testlogger.critical-CRITICAL: Hello Critical -- [process_id:61953][thread_name:MainThread-id:140736836027328] 6 | 2017-02-26 10:54:21,333-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:61953][thread_name:MainThread-id:140736836027328] 7 | 2017-02-26 10:54:21,333-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:61953][thread_name:MainThread-id:140736836027328] 8 | 2017-02-26 10:54:21,334-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:61953][thread_name:MainThread-id:140736836027328] 9 | 2017-02-26 10:54:50,016-testlogger.critical-CRITICAL: Hello Critical -- [process_id:62060][thread_name:MainThread-id:140736836027328] 10 | 2017-02-26 10:54:50,016-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:62060][thread_name:MainThread-id:140736836027328] 11 | 2017-02-26 10:54:50,016-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:62060][thread_name:MainThread-id:140736836027328] 12 | 2017-02-26 10:54:50,016-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:62060][thread_name:MainThread-id:140736836027328] 13 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.log.2017-03-09: -------------------------------------------------------------------------------- 1 | 2017-03-09 20:46:28,915-testlogger.critical-CRITICAL: Hello Critical -- [process_id:46641][thread_name:MainThread-id:140735836132288] 2 | 2017-03-09 20:46:28,916-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:46641][thread_name:MainThread-id:140735836132288] 3 | 2017-03-09 20:46:28,917-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:46641][thread_name:MainThread-id:140735836132288] 4 | 2017-03-09 20:46:28,917-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:46641][thread_name:MainThread-id:140735836132288] 5 | 2017-03-09 20:47:34,449-testlogger.critical-CRITICAL: Hello Critical -- [process_id:46749][thread_name:MainThread-id:140735836132288] 6 | 2017-03-09 20:47:34,449-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:46749][thread_name:MainThread-id:140735836132288] 7 | 2017-03-09 20:47:34,450-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:46749][thread_name:MainThread-id:140735836132288] 8 | 2017-03-09 20:47:34,450-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:46749][thread_name:MainThread-id:140735836132288] 9 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.log.2017-05-10: -------------------------------------------------------------------------------- 1 | 2017-05-10 14:58:51,832-testlogger.critical-CRITICAL: Hello Critical -- [process_id:46808][thread_name:MainThread-id:140736910648256] 2 | 2017-05-10 14:58:51,834-testlogger.debug-DEBUG: Into: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:46808][thread_name:MainThread-id:140736910648256] 3 | 2017-05-10 14:58:51,834-testlogger.info-INFO: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] Be Called -- [process_id:46808][thread_name:MainThread-id:140736910648256] 4 | 2017-05-10 14:58:51,835-testlogger.debug-DEBUG: Out of: [Module:g3ar.decologger.g3ar.decologger.decologger FunctionName:B] -- [process_id:46808][thread_name:MainThread-id:140736910648256] 5 | -------------------------------------------------------------------------------- /testdata/decolog/testlogger/testlogger.warning.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/testdata/decolog/testlogger/testlogger.warning.log -------------------------------------------------------------------------------- /testdata/dir.txt: -------------------------------------------------------------------------------- 1 | a 2 | s 3 | d 4 | as 5 | df 6 | asd 7 | fas 8 | df 9 | sad 10 | fsa 11 | df 12 | as 13 | df 14 | asd 15 | f 16 | asdf 17 | sa 18 | df 19 | asdf 20 | asd 21 | fa 22 | sdf 23 | sad 24 | fas 25 | df 26 | sad 27 | fsa 28 | df 29 | asdf 30 | as 31 | df 32 | sadf 33 | sa 34 | df 35 | asd 36 | fas 37 | df 38 | asdf 39 | as 40 | dfa 41 | sdf 42 | as 43 | df 44 | asdf 45 | qer 46 | t 47 | ert 48 | we 49 | rtw 50 | er 51 | twe 52 | rt 53 | eqwr 54 | tw 55 | ret 56 | wer 57 | tw 58 | ert 59 | we 60 | rtw 61 | ert 62 | wer 63 | tw 64 | ert 65 | wer 66 | tw 67 | ert 68 | wer 69 | twe 70 | rt 71 | we 72 | t 73 | wer 74 | twe 75 | rt 76 | wer 77 | tw 78 | ert 79 | -------------------------------------------------------------------------------- /testdata/sessions.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VillanCh/g3ar/99e01dacc130b02a3759ff04b1d36c6b9e0111ff/testdata/sessions.dat --------------------------------------------------------------------------------