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
f217cb1e
Unverified
Commit
f217cb1e
authored
Jun 27, 2018
by
Marcin Bury
Committed by
GitHub
Jun 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve TCP communication (#478)
* Fixing TCP communication
parent
9f859190
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
tcp_client.py
routersploit/core/tcp/tcp_client.py
+12
-0
heartbleed.py
routersploit/modules/exploits/generic/heartbleed.py
+4
-4
No files found.
routersploit/core/tcp/tcp_client.py
View file @
f217cb1e
...
...
@@ -57,6 +57,18 @@ class TCPClient(Exploit):
def
tcp_recv
(
self
,
tcp_client
,
num
):
if
tcp_client
:
try
:
response
=
tcp_client
.
recv
(
num
)
return
response
except
socket
.
timeout
:
print_error
(
"Socket did timeout"
,
verbose
=
self
.
verbosity
)
except
socket
.
error
:
print_error
(
"Socket error"
,
verbose
=
self
.
verbosity
)
return
None
def
tcp_recv_all
(
self
,
tcp_client
,
num
):
if
tcp_client
:
try
:
response
=
b
""
received
=
0
while
received
<
num
:
...
...
routersploit/modules/exploits/generic/heartbleed.py
View file @
f217cb1e
...
...
@@ -173,7 +173,7 @@ class Exploit(TCPClient):
print_status
(
"Sending Heartbeat..."
)
heartbeat_req
=
self
.
heartbeat_request
(
self
.
heartbeat_length
)
self
.
tcp_send
(
self
.
tcp_client
,
heartbeat_req
)
hdr
=
self
.
tcp_recv
(
self
.
tcp_client
,
self
.
SSL_RECORD_HEADER_SIZE
)
hdr
=
self
.
tcp_recv
_all
(
self
.
tcp_client
,
self
.
SSL_RECORD_HEADER_SIZE
)
if
not
hdr
:
print_error
(
"No Heartbeat response..."
)
return
False
...
...
@@ -184,7 +184,7 @@ class Exploit(TCPClient):
print_error
(
"Unexpected Hearbeat response header"
)
self
.
tcp_close
(
self
.
tcp_client
)
heartbeat_data
=
self
.
tcp_recv
(
self
.
tcp_client
,
self
.
heartbeat_length
)
heartbeat_data
=
self
.
tcp_recv
_all
(
self
.
tcp_client
,
self
.
heartbeat_length
)
if
heartbeat_data
:
print_success
(
"Heartbeat response, {} bytes"
.
format
(
len
(
heartbeat_data
)))
else
:
...
...
@@ -303,11 +303,11 @@ class Exploit(TCPClient):
already_read
=
already_read
+
single_cert_len
+
3
def
get_ssl_record
(
self
):
hdr
=
self
.
tcp_recv
(
self
.
tcp_client
,
self
.
SSL_RECORD_HEADER_SIZE
)
hdr
=
self
.
tcp_recv
_all
(
self
.
tcp_client
,
self
.
SSL_RECORD_HEADER_SIZE
)
if
hdr
:
length
=
unpack
(
">BHH"
,
hdr
)[
2
]
data
=
self
.
tcp_recv
(
self
.
tcp_client
,
length
)
data
=
self
.
tcp_recv
_all
(
self
.
tcp_client
,
length
)
hdr
+=
data
return
hdr
...
...
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