nopernik / sshpry2.0 Goto Github PK
View Code? Open in Web Editor NEWSSHPry v2 - Spy & Control os SSH Connected client's TTY
License: Other
SSHPry v2 - Spy & Control os SSH Connected client's TTY
License: Other
OS: debian 11
kernel: Linux debian 5.10.0-19-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64 GNU/Linux
python -V: 3.9.2
root@debian:~/Desktop/SSHPry2.0# python sshpry2.py --auto
SSHPry2 SSH-TTY control by @nopernik 2017
[+] Getting available ssh connections...
[+] Found active SSH connections:
PID: 1511 | TTY: /dev/pts/1 (root)
[+] -- Lazy mode activated -- :-)
[+] Target TTY keystrokes file: 'keys-2022-11-05-1232.sshpry.log'
[+] Target TTY session file: 'sess-2022-11-05-1232.sshpry.log'
[+] Attaching to 1511 at /dev/pts/1...
(<class 'TypeError'>, TypeError("a bytes-like object is required, not 'str'"), <traceback object at 0x7f8dd83da900>)
root@kali:~/Desktop/SSHPry2.0# ./sshpry2.py --tty /dev/pts/2
SSHPry2 SSH-TTY control by @nopernik 2017
[+] Getting available ssh connections...
[+] Target TTY keystrokes file: 'keys-2020-03-28-0834.sshpry.log'
[+] Target TTY session file: 'sess-2020-03-28-0834.sshpry.log'
[+] Attaching to 18809 at /dev/pts/2...
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "./sshpry2.py", line 105, in PryonTTY
sshpipe = Popen(['strace', '-s', '16384', '-p', z.pid, '-e', 'read,write'], shell=False, stdout=PIPE, stderr=PIPE)
File "/usr/lib/python2.7/subprocess.py", line 394, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Hello,
If I'll use the --auto parameter, the programm crash with the following Error-Code:
user@test:~/test/SSHPry2.0$ sudo python sshpry2.py
SSHPry2 SSH-TTY control by @nopernik 2017
Usage: sshpry2.py [OPTIONS]
Args: --auto # Lazy mode, auto-attach to first found session
--list # List available SSH Sessions
--tty /dev/pts/XX # Point SSHPry to specific TTY
--raw # Record and Play raw term output, no timing.
--replay <file> # Replace previously recorded session.
--speed 4 # Replay speed multiplier (Default: 4).
----- root privileges required! -----
user@test:~/test/SSHPry2.0$ sudo python sshpry2.py --list
SSHPry2 SSH-TTY control by @nopernik 2017
[+] Getting available ssh connections...
[+] Found active SSH connections:
PID: 21508 | TTY: /dev/pts/1 (user)
[!] Choose yours with "--tty TTY" switch
user@test:~/test/SSHPry2.0$ sudo python sshpry2.py --auto
SSHPry2 SSH-TTY control by @nopernik 2017
[+] Getting available ssh connections...
[+] Found active SSH connections:
PID: 21508 | TTY: /dev/pts/1 (user)
[+] -- Lazy mode activated -- :-)
[+] Target TTY keystrokes file: 'keys-2020-03-24-1931.sshpry.log'
[+] Target TTY session file: 'sess-2020-03-24-1931.sshpry.log'
[+] Attaching to 21508 at /dev/pts/1...
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "sshpry2.py", line 105, in PryonTTY
sshpipe = Popen(['strace', '-s', '16384', '-p', z.pid, '-e', 'read,write'], shell=False, stdout=PIPE, stderr=PIPE)
File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Can anybody help me?
Hi!
SSHPry is not working for me, when I'm tying to attach to a TTY, it crashes.
I'm using Python 3.5.2 on Ubuntu 16.04.4 x64.
I thought maybe I should use pyton2, but the code looks pretty much like its written in python3.
Crash log:
[+] Attaching to 1668 at /dev/pts/1...
(<class 'TypeError'>, TypeError("a bytes-like object is required, not 'str'",), <traceback object at 0x7fad8a9ae848>)
root@ubnt:~/SSHPry2.0#
Thank you for your help.
A apt install strace
for apt based systems and other package managers in the readme would be nice. And maybe fail with a nicer message than this:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "sshpry2.py", line 105, in PryonTTY
sshpipe = Popen(['strace', '-s', '16384', '-p', z.pid, '-e', 'read,write'], shell=False, stdout=PIPE, stderr=PIPE)
File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'strace': 'strace'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.