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
8f50b7c4
Commit
8f50b7c4
authored
May 31, 2016
by
fwkz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validation of exploit creation
parent
39a69009
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
14 deletions
+28
-14
utils.py
routersploit/utils.py
+25
-0
rsf.py
rsf.py
+3
-14
No files found.
routersploit/utils.py
View file @
8f50b7c4
...
...
@@ -441,6 +441,31 @@ def boolify(value):
return
bool
(
value
)
def
create_exploit
(
path
):
from
.templates
import
exploit
try
:
module_type
,
vendor
,
name
=
path
.
split
(
os
.
sep
)
except
ValueError
:
print_error
(
"Invalid path. ;("
)
return
if
module_type
not
in
[
'creds'
,
'exploits'
,
'scanners'
]:
print_error
(
"Invalid module type. ;("
)
return
create_resource
(
name
=
os
.
path
.
join
(
module_type
,
vendor
),
content
=
(
Resource
(
name
=
"{}.py"
.
format
(
name
),
template_path
=
os
.
path
.
abspath
(
exploit
.
__file__
.
rstrip
(
"c"
)),
context
=
{}),
),
python_package
=
True
)
def
create_resource
(
name
,
content
=
(),
python_package
=
False
):
""" Creates resource directory in current working directory. """
root_path
=
os
.
path
.
join
(
MODULES_DIR
,
name
)
...
...
rsf.py
View file @
8f50b7c4
#!/usr/bin/env python2
from
__future__
import
print_function
import
os
import
argparse
from
routersploit.interpreter
import
RoutersploitInterpreter
from
routersploit.utils
import
create_resource
,
Resource
from
routersploit.templates
import
exploit
from
routersploit.utils
import
create_exploit
parser
=
argparse
.
ArgumentParser
(
description
=
'RouterSploit - Router Exploitation Framework'
)
...
...
@@ -23,16 +22,6 @@ if __name__ == "__main__":
args
=
parser
.
parse_args
()
if
args
.
add_exploit
:
base
,
_
,
name
=
args
.
add_exploit
.
rpartition
(
os
.
sep
)
create_resource
(
name
=
base
,
content
=
(
Resource
(
name
=
"{}.py"
.
format
(
name
),
template_path
=
os
.
path
.
abspath
(
exploit
.
__file__
.
rstrip
(
"c"
)),
context
=
{}),
),
python_package
=
True
)
create_exploit
(
args
.
add_exploit
)
else
:
routersploit
()
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