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
f57c9494
Commit
f57c9494
authored
Jul 29, 2016
by
fwkz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding string representation of Exploit()
parent
ae5d4eaa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
exploits.py
routersploit/exploits.py
+5
-0
test_exploits.py
routersploit/test/test_exploits.py
+11
-0
No files found.
routersploit/exploits.py
View file @
f57c9494
...
...
@@ -2,6 +2,7 @@ from weakref import WeakKeyDictionary
from
itertools
import
chain
import
threading
import
time
import
os
from
routersploit.utils
import
print_status
,
NonStringIterable
...
...
@@ -117,3 +118,7 @@ class Exploit(object):
for
worker
in
workers
:
worker
.
join
()
print_status
(
'Elapsed time: '
,
time
.
time
()
-
start
,
'seconds'
)
def
__str__
(
self
):
return
self
.
__module__
.
split
(
'.'
,
2
)
.
pop
()
.
replace
(
'.'
,
os
.
sep
)
routersploit/test/test_exploits.py
View file @
f57c9494
import
unittest
import
os
try
:
import
unittest.mock
as
mock
except
ImportError
:
import
mock
from
routersploit.test
import
RoutersploitTestCase
from
routersploit.exploits
import
Exploit
,
Option
,
GLOBAL_OPTS
...
...
@@ -78,6 +84,11 @@ class OptionTest(RoutersploitTestCase):
GLOBAL_OPTS
[
'doo'
]
=
'global_doo'
self
.
assertEqual
(
self
.
exploit_with_validators
.
doo
,
'global_doo_suffix'
)
def
test_str_representation
(
self
):
with
mock
.
patch
.
object
(
TestExploitFoo
,
"__module__"
,
new_callable
=
mock
.
PropertyMock
)
as
mock_module
:
mock_module
.
return_value
=
"routersploit.modules.exploits.foo.bar"
self
.
assertEqual
(
str
(
TestExploitFoo
()),
os
.
path
.
join
(
'exploits'
,
'foo'
,
'bar'
))
if
__name__
==
'__main__'
:
unittest
.
main
()
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