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
03a99eac
Commit
03a99eac
authored
Jul 10, 2016
by
Marcin Bury
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Windows support for ssh_interactive
parent
5d5d5c3d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
5 deletions
+36
-5
utils.py
routersploit/utils.py
+36
-5
No files found.
routersploit/utils.py
View file @
03a99eac
...
...
@@ -8,8 +8,6 @@ import random
import
string
import
socket
import
importlib
import
termios
import
tty
import
select
import
socket
from
functools
import
wraps
...
...
@@ -443,6 +441,16 @@ def boolify(value):
def
ssh_interactive
(
ssh
):
chan
=
ssh
.
invoke_shell
()
try
:
import
termios
import
tty
posix_shell
(
chan
)
except
:
windows_shell
(
chan
)
def
posix_shell
(
chan
):
oldtty
=
termios
.
tcgetattr
(
sys
.
stdin
)
try
:
tty
.
setraw
(
sys
.
stdin
.
fileno
())
...
...
@@ -456,12 +464,11 @@ def ssh_interactive(ssh):
x
=
unicode
(
chan
.
recv
(
1024
))
if
(
len
(
x
)
==
0
):
sys
.
stdout
.
write
(
'
\r\n
Exiting...
\r\n
'
)
break
sys
.
stdout
.
write
(
x
)
sys
.
stdout
.
flush
()
except
socket
.
timeout
:
pass
...
...
@@ -472,7 +479,31 @@ def ssh_interactive(ssh):
break
chan
.
send
(
x
)
finally
:
termios
.
tcsetattr
(
sys
.
stdin
,
termios
.
TCSADRAIN
,
oldtty
)
return
def
windows_shell
(
chan
):
def
writeall
(
sock
):
while
True
:
data
=
sock
.
recv
(
256
)
if
not
data
:
sys
.
stdout
.
flush
()
return
sys
.
stdout
.
write
(
data
)
sys
.
stdout
.
flush
()
writer
=
threading
.
Thread
(
target
=
writeall
,
args
=
(
chan
,))
writer
.
start
()
try
:
while
True
:
d
=
sys
.
stdin
.
read
(
1
)
if
not
d
:
break
chan
.
send
(
d
)
except
:
pass
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