Skip to content

Commit

Permalink
add -hc/--helpCN,fix single_target mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Xyntax committed May 22, 2016
1 parent 8c10a3f commit a68158f
Show file tree
Hide file tree
Showing 10 changed files with 208 additions and 179 deletions.
78 changes: 39 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,45 +51,45 @@

### 参数中文说明
```
usage:
python POC-T.py [-T|-C] [-m NAME] [-f|-i|-n VALUE] [options]
python POC-T.py [-T|-C] [-m NAME] [TARGET] [options]
python POC-T.py [-h|-v|--show|--update]
example:
python POC-T.py -m jboss-poc http://www.cdxy.me
python POC-T.py -T -m test -f ./dic/1-100.txt
python POC-T.py -C -m test -i 1-100
python POC-T.py -C -m spider -n 10.0.0.0/24
powered by cdxy <mail:[email protected]>
engine:
-T 多线程模式
-C 协程(单线程异步)模式
-t NUM 设置并发数量(线程数量),默认为10
module:
-m NAME 指定加载的PoC或模块名称
target mode:
TARGET 加载单个目标
-f FILE 从文件加载目标列表(常用于扫描或批量漏洞验证)
-i START-END 给定起始数字和结束数字,自动生成payload(常用于有数字规则的遍历,爬虫等)
-n IP/MASK 从IP和子网掩码加载目标,如:10.0.0.0/28 (用于扫描网段)
optimization:
-o FILE 输出文件路径,默认保存在./output/目录下
--single 当验证到一个结果时退出(常用于密码爆破)
--nF 取消文件输出
--nS 取消屏幕输出
--show 显示./module/文件夹下所有可用的模块名称
--browser 程序结束后,将运行结果在浏览器/记事本中打开
--debug 开启debug模式,输出一些细节
--update 自动从github更新程序
-h, --help 打印此页帮助
-v, --version 打印版本号
本文档为程序中文使用说明,您也可以使用 -h 查看英文版使用说明
powered by cdxy <mail:[email protected]>
使用方法:
python POC-T.py [-T|-C] [-m NAME] [-s|-f|-i|-n VALUE] [options]
python POC-T.py [-h|-v|--show|--update]
示例:
python POC-T.py -T -m jboss-poc -s http://www.cdxy.me
python POC-T.py -T -m test -f ./dic/1-100.txt
python POC-T.py -C -m test -i 1-100
python POC-T.py -C -m spider -n 10.0.0.0/24
引擎(必需项):
-T 多线程模式
-C 协程(单线程异步)模式
-t NUM 设置并发数量(线程数量),默认为10
模块(必需项):
-m NAME 指定加载的POC或模块名称(结尾不需加.py)
目标(必需项):
-s TARGET 验证单个目标 (e.g. www.wooyun.org)
-f FILE 从文件加载目标列表(常用于扫描或批量漏洞验证) (e.g. ./data/wooyun_domain)
-i START-END 给定起始数字和结束数字,自动生成payload(常用于有数字规则的遍历,爬虫等) (e.g. 1-100)
-n IP/MASK 从IP和子网掩码加载目标(用于扫描网段) (e.g. 127.0.0.0/24)
可选项:
-o FILE 输出文件路径,默认保存在./output/目录下
--single 当验证到一个结果时退出(常用于密码爆破)
--nF 取消文件输出
--nS 取消屏幕输出
--show 显示所有可用的模块名称(./module/文件夹下)
--browser 程序结束后,将运行结果在浏览器/记事本中打开
--debug 开启debug模式,运行时将输出一些参数细节
--update 自动从github更新程序
-v, --version 版本号
-h, --help 英文帮助
-hc, --helpCN 中文帮助
```


Expand Down
2 changes: 1 addition & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
* 2016.05.16 - 增加`--browser`功能,优化运行时屏幕输出
* 2016.05.17 - 修改`parser.py`标准化help格式
* 2016.05.20 - 增加`lib.core.exception`,优化数据结构
* 2016.05.22 - 增加`TARGET`参数,支持单个目标验证
* 2016.05.22 - 增加`TARGET`参数,支持单个目标验证;增加`--helpCN`支持中文帮助
39 changes: 0 additions & 39 deletions docs/USAGE.md

This file was deleted.

8 changes: 5 additions & 3 deletions lib/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
__author__ = 'xy'

import os.path
from lib.parse.parser import parseArgs
from lib.parse.cmdline import cmdLineParser
from lib.parse.handler import initOptions
from lib.controller.loader import loadModule, loadPayloads
from lib.core.common import setPaths, showDebugData, banner, systemQuit, openBrowser
from lib.core.data import paths, conf, logger
from lib.core.data import paths, conf, logger,cmdLineOptions
from lib.core.enums import EXIT_STATUS
from lib.core.settings import IS_WIN
from lib.core.exception import ToolkitUserQuitException
Expand All @@ -30,7 +31,8 @@ def main():
raise SystemExit
setPaths()

parseArgs()
cmdLineOptions.update(cmdLineParser().__dict__)
initOptions(cmdLineOptions)

if IS_WIN:
winowsColorInit()
Expand Down
27 changes: 24 additions & 3 deletions lib/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ def debugPause():


def showDebugData():
logger.log(CUSTOM_LOGGING.SYSINFO, '----conf---=\n%s' % conf)
logger.log(CUSTOM_LOGGING.SYSINFO, '----paths---=\n%s' % paths)
logger.log(CUSTOM_LOGGING.SYSINFO, '----th---=\n%s' % th)
logger.log(CUSTOM_LOGGING.SYSINFO, '----conf----\n%s' % conf)
logger.log(CUSTOM_LOGGING.SYSINFO, '----paths----\n%s' % paths)
logger.log(CUSTOM_LOGGING.SYSINFO, '----th----\n%s' % th)
debugPause()


Expand Down Expand Up @@ -285,3 +285,24 @@ def openBrowser():
except Exception, e:
errMsg = '\n[ERROR] Fail to open file with web browser: %s' % path
raise ToolkitSystemException(errMsg)

def checkSystemEncoding():
"""
Checks for problematic encodings
"""

if sys.getdefaultencoding() == "cp720":
try:
codecs.lookup("cp720")
except LookupError:
errMsg = "there is a known Python issue (#1616979) related "
errMsg += "to support for charset 'cp720'. Please visit "
errMsg += "'http://blog.oneortheother.info/tip/python-fix-cp720-encoding/index.html' "
errMsg += "and follow the instructions to be able to fix it"
logger.critical(errMsg)

warnMsg = "temporary switching to charset 'cp1256'"
logger.warn(warnMsg)

reload(sys)
sys.setdefaultencoding("cp1256")
6 changes: 4 additions & 2 deletions lib/core/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@

logger = LOGGER

conf = AttribDict()

paths = AttribDict()

cmdLineOptions = AttribDict()

conf = AttribDict()

th = AttribDict()
26 changes: 11 additions & 15 deletions lib/parse/parser.py → lib/parse/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,15 @@

import argparse
import sys

from lib.parse.handler import checkArgs, setArgs
from lib.core.settings import VERSION


def parseArgs():
parser = argparse.ArgumentParser(prog='POC-T',
formatter_class=argparse.RawTextHelpFormatter,
description='powered by cdxy <mail:[email protected]> ',
usage='\n python POC-T.py [-T|-C] [-m NAME] [-f|-i|-n VALUE] [options]'
'\n python POC-T.py [-T|-C] [-m NAME] [TARGET] [options]'
def cmdLineParser():
parser = argparse.ArgumentParser(description='powered by cdxy <mail:[email protected]> ',
usage='\n python POC-T.py [-T|-C] [-m NAME] [-s|-f|-i|-n VALUE] [options]'
'\n python POC-T.py [-h|-v|--show|--update]'
'\n\nexample:\n'
' python POC-T.py -m jboss-poc http://www.cdxy.me\n'
' python POC-T.py -T -m jboss-poc -s http://www.cdxy.me\n'
' python POC-T.py -T -m test -f ./dic/1-100.txt\n'
' python POC-T.py -C -m test -i 1-100\n'
' python POC-T.py -C -m spider -n 10.0.0.0/24',
Expand All @@ -40,7 +35,7 @@ def parseArgs():

target = parser.add_argument_group('target mode')

target.add_argument('TARGET', type=str, default='',
target.add_argument('-s', metavar='TARGET', type=str, default='',
help="scan a single target (e.g. www.wooyun.org)")
target.add_argument('-f', metavar='FILE', type=str, default='',
help='load targets from TargetFile (e.g. ./data/wooyun_domain)')
Expand All @@ -62,18 +57,19 @@ def parseArgs():
optimization.add_argument('--show', default=False, action='store_true',
help='show available module/POC names and exit')
optimization.add_argument('--browser', default=False, action='store_true',
help='Open notepad or web browser to view report after task was finished.')
help='Open notepad or web browser to view report after task finished.')
optimization.add_argument('--debug', default=False, action='store_true',
help='show more details while running')
optimization.add_argument('--update', default=False, action='store_true',
help='update POC-T from github')
optimization.add_argument('-h', '--help', action='help',
help='show this help message and exit')
optimization.add_argument('-v', '--version', action='version', version=VERSION,
help="show program's version number and exit")
optimization.add_argument('-h', '--help', action='help',
help='show this help message and exit')
optimization.add_argument('-hc', '--helpCN', default=False, action='store_true',
help='打印中文帮助(show help message in Chinese)')

if len(sys.argv) == 1:
sys.argv.append('-h')
args = parser.parse_args()
checkArgs(args)
setArgs(args)
return args
Loading

0 comments on commit a68158f

Please sign in to comment.