Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
routersploit
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
czos-dpend
routersploit
Commits
c9836b5e
Commit
c9836b5e
authored
Apr 12, 2016
by
fwkz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changing API for utils.pprint_dict_in_order() + fixing bug
parent
664bf247
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
interpreter.py
routersploit/interpreter.py
+1
-1
utils.py
routersploit/utils.py
+4
-2
No files found.
routersploit/interpreter.py
View file @
c9836b5e
...
@@ -330,8 +330,8 @@ class RoutersploitInterpreter(BaseInterpreter):
...
@@ -330,8 +330,8 @@ class RoutersploitInterpreter(BaseInterpreter):
sub_command
=
args
[
0
]
sub_command
=
args
[
0
]
if
sub_command
==
info
:
if
sub_command
==
info
:
utils
.
pprint_dict_in_order
(
utils
.
pprint_dict_in_order
(
(
"name"
,
"description"
,
"targets"
,
"authors"
,
"references"
),
self
.
module_metadata
,
self
.
module_metadata
,
(
"name"
,
"description"
,
"targets"
,
"authors"
,
"references"
),
)
)
utils
.
print_info
()
utils
.
print_info
()
elif
sub_command
==
options
:
elif
sub_command
==
options
:
...
...
routersploit/utils.py
View file @
c9836b5e
...
@@ -201,13 +201,13 @@ def sanitize_url(address):
...
@@ -201,13 +201,13 @@ def sanitize_url(address):
return
url
return
url
def
pprint_dict_in_order
(
order
,
dictionary
):
def
pprint_dict_in_order
(
dictionary
,
order
=
None
):
""" Pretty dict print.
""" Pretty dict print.
Pretty printing dictionary in specific order. (as in 'show info' command)
Pretty printing dictionary in specific order. (as in 'show info' command)
Keys not mentioned in *order* parameter will be printed in random order.
Keys not mentioned in *order* parameter will be printed in random order.
ex. pprint_dict_in_order(
('sex', 'name'), {'name': John, 'sex': 'male', "hobby": ["rugby", "golf"]}
)
ex. pprint_dict_in_order(
{'name': John, 'sex': 'male', "hobby": ["rugby", "golf"]}, ('sex', 'name')
)
Sex:
Sex:
male
male
...
@@ -220,6 +220,8 @@ def pprint_dict_in_order(order, dictionary):
...
@@ -220,6 +220,8 @@ def pprint_dict_in_order(order, dictionary):
- golf
- golf
"""
"""
order
=
order
or
()
def
prettyprint
(
title
,
body
):
def
prettyprint
(
title
,
body
):
print_info
(
"
\n
{}:"
.
format
(
title
.
capitalize
()))
print_info
(
"
\n
{}:"
.
format
(
title
.
capitalize
()))
if
not
isinstance
(
body
,
str
):
if
not
isinstance
(
body
,
str
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment