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
9974c895
Commit
9974c895
authored
Apr 29, 2016
by
Marcin Bury
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #62 from kamyarrasta/fix/openfile
Open file using with block
parents
5e1b7853
90691cb5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
utils.py
routersploit/utils.py
+16
-16
No files found.
routersploit/utils.py
View file @
9974c895
...
@@ -126,26 +126,26 @@ def multi(fn):
...
@@ -126,26 +126,26 @@ def multi(fn):
_
,
_
,
feed_path
=
self
.
target
.
partition
(
"file://"
)
_
,
_
,
feed_path
=
self
.
target
.
partition
(
"file://"
)
try
:
try
:
file_handler
=
open
(
feed_path
,
'r'
)
with
open
(
feed_path
)
as
file_handler
:
for
target
in
file_handler
:
target
=
target
.
strip
()
if
not
target
:
continue
self
.
target
,
_
,
port
=
target
.
partition
(
':'
)
if
port
:
self
.
port
=
port
else
:
self
.
port
=
original_port
print_status
(
"Attack against: {}:{}"
.
format
(
self
.
target
,
self
.
port
))
fn
(
self
,
*
args
,
**
kwargs
)
self
.
target
=
original_target
self
.
port
=
original_port
return
# Nothing to return, ran multiple times.
except
IOError
:
except
IOError
:
print_error
(
"Could not read file: {}"
.
format
(
self
.
target
))
print_error
(
"Could not read file: {}"
.
format
(
self
.
target
))
return
return
for
target
in
file_handler
:
target
=
target
.
strip
()
if
not
target
:
continue
self
.
target
,
_
,
port
=
target
.
partition
(
':'
)
if
port
:
self
.
port
=
port
else
:
self
.
port
=
original_port
print_status
(
"Attack against: {}:{}"
.
format
(
self
.
target
,
self
.
port
))
fn
(
self
,
*
args
,
**
kwargs
)
self
.
target
=
original_target
self
.
port
=
original_port
file_handler
.
close
()
return
# Nothing to return, ran multiple times.
else
:
else
:
return
fn
(
self
,
*
args
,
**
kwargs
)
return
fn
(
self
,
*
args
,
**
kwargs
)
return
wrapper
return
wrapper
...
...
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