Skip to content

Commit

Permalink
Merge pull request #204 from 13ph03nix/master
Browse files Browse the repository at this point in the history
feat(): add show definition options for poc
  • Loading branch information
13ph03nix authored Aug 13, 2021
2 parents c2e2d4f + 4759cc6 commit 1686ece
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
3 changes: 3 additions & 0 deletions manpages/pocsuite.1
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ Specify the name of the export rule file
.SS "Poc options:"
.IP
definition options for PoC
.TP
\fB\-\-options\fR
Show all definition options
.SH EXAMPLES
.PP
.br
Expand Down
23 changes: 23 additions & 0 deletions pocsuite3/lib/core/option.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import socket
import socks
import importlib
import prettytable
from termcolor import colored
from queue import Queue
from urllib.parse import urlsplit

Expand Down Expand Up @@ -557,6 +559,7 @@ def _set_conf_attributes():
conf.rule = False
conf.rule_req = False
conf.rule_filename = None
conf.show_options = False


def _set_kb_attributes(flush_all=True):
Expand Down Expand Up @@ -696,6 +699,25 @@ def _init_target_from_poc_dork():
plugin.init()


def _show_pocs_modules_options():
if not conf.show_options:
return
for module_name, poc_class in kb.registered_pocs.items():
module_options = poc_class.options
tb = prettytable.PrettyTable(
['Name', 'Current settings', 'Type', 'Description'])
# add target option
for name, opt in module_options.items():
value = opt.value
if opt.require and value == '':
value = colored('*require*', 'red')
tb.add_row([name, value, opt.type, opt.description])
data_to_stdout(f'\nModule ({module_name}) options:\n')
data_to_stdout(tb.get_string())
data_to_stdout('\n')
exit()


def init():
"""
Set attributes into both configuration and knowledge base singletons
Expand All @@ -715,6 +737,7 @@ def init():
_set_plugins()
_init_targets_plugins()
_init_pocs_plugins()
_show_pocs_modules_options()
_init_target_from_poc_dork()
_set_task_queue()
_init_results_plugins()
Expand Down
5 changes: 5 additions & 0 deletions pocsuite3/lib/core/poc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import re
import traceback
import inspect
from collections import OrderedDict
from urllib.parse import urlparse

Expand Down Expand Up @@ -277,6 +278,10 @@ def __init__(self, poc=None):
self.app_name = poc.appName
self.app_version = poc.appVersion
self.error_msg = poc.expt
self.poc_attrs = {}
for i in inspect.getmembers(poc):
if not i[0].startswith('_') and type(i[1]) in [str, list, dict]:
self.poc_attrs[i[0]] = i[1]

def is_success(self):
return bool(True and self.status)
Expand Down
2 changes: 1 addition & 1 deletion pocsuite3/lib/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@
'max-page', 'search-type', 'shodan-token', 'fofa-user', 'fofa-token', 'quake-token','vul-keyword', 'ssv-id',
'lhost', 'lport', 'plugins', 'pocs-path', 'threads', 'batch', 'requires', 'quiet', 'poc',
'verbose', 'mode', 'api', 'connect_back_host', 'connect_back_port', 'ppt', 'help', 'pcap',
'rule','rule-req','rule-filename','dork-b64']
'rule','rule-req','rule-filename','dork-b64', 'options']
2 changes: 2 additions & 0 deletions pocsuite3/lib/parse/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ def cmd_line_parser(argv=None):
help="Specify the name of the export rule file")
# Diy options
diy = parser.add_argument_group("Poc options", "definition options for PoC")
diy.add_argument("--options", dest="show_options", action="store_true", default=False,
help="Show all definition options")

for line in argv:
if line.startswith("--"):
Expand Down

0 comments on commit 1686ece

Please sign in to comment.