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
f2a9d518
Commit
f2a9d518
authored
Jun 15, 2016
by
Marcin Bury
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding ssh_interactive functionality.
parent
a6b62284
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
__init__.py
routersploit/__init__.py
+1
-0
utils.py
routersploit/utils.py
+41
-0
No files found.
routersploit/__init__.py
View file @
f2a9d518
...
@@ -12,6 +12,7 @@ from routersploit.utils import (
...
@@ -12,6 +12,7 @@ from routersploit.utils import (
mute
,
mute
,
multi
,
multi
,
index_modules
,
index_modules
,
ssh_interactive
,
)
)
from
routersploit
import
exploits
from
routersploit
import
exploits
...
...
routersploit/utils.py
View file @
f2a9d518
...
@@ -8,6 +8,10 @@ import random
...
@@ -8,6 +8,10 @@ import random
import
string
import
string
import
socket
import
socket
import
importlib
import
importlib
import
termios
import
tty
import
select
import
socket
from
functools
import
wraps
from
functools
import
wraps
from
distutils.util
import
strtobool
from
distutils.util
import
strtobool
from
abc
import
ABCMeta
,
abstractmethod
from
abc
import
ABCMeta
,
abstractmethod
...
@@ -435,3 +439,40 @@ def boolify(value):
...
@@ -435,3 +439,40 @@ def boolify(value):
return
False
return
False
else
:
else
:
return
bool
(
value
)
return
bool
(
value
)
def
ssh_interactive
(
ssh
):
chan
=
ssh
.
invoke_shell
()
oldtty
=
termios
.
tcgetattr
(
sys
.
stdin
)
try
:
tty
.
setraw
(
sys
.
stdin
.
fileno
())
tty
.
setcbreak
(
sys
.
stdin
.
fileno
())
chan
.
settimeout
(
0.0
)
while
(
True
):
r
,
w
,
e
=
select
.
select
([
chan
,
sys
.
stdin
],
[],
[])
if
(
chan
in
r
):
try
:
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
if
(
sys
.
stdin
in
r
):
x
=
sys
.
stdin
.
read
(
1
)
if
(
len
(
x
)
==
0
):
break
chan
.
send
(
x
)
finally
:
termios
.
tcsetattr
(
sys
.
stdin
,
termios
.
TCSADRAIN
,
oldtty
)
return
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