exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Shellcode Helper

Shellcode Helper
Posted Aug 4, 2015
Authored by B3mB4m

Shellcode Helper is a python script designed to act as an x86 little endian stack converter.

tags | tool, x86, shellcode, python
SHA-256 | 2169ef9e90390289a012969247ecff8e6fb7a30ae571da774b8a381696435b8c

Shellcode Helper

Change Mirror Download
import sys
import re
from optparse import OptionParser
#Deprecated since version 2.6
#The commands module has been removed in Python 3. Use the subprocess module instead.
#I'm still using 2.x, so fuck it lol.
try:
from colorama import init,Fore
init()
except:
print "Please, install colorama module!"
print "pip install colorama"

#Author : B3mB4m
#Title : Shellcode Helper(x86 Litle Endian Stack Converter)
#Concat : b3mb4m@gmail.com
#Version : v2 Final(I hope)
#Supported AT&T - Intel Syntaxs
#Most boring part shellcoding turning strings to stack but from now on its not !
#https://github.com/b3mb4m/Shellcode/tree/master/Auxiliary/ConverStack

def helper():
print r"""
___ _ ___
| _ ) ___ _ __ | |__ ___ _ _ _ __ __ _ _ _ / __|
| _ \/ _ \ ' \| '_ \/ -_) '_| ' \/ _` | ' \\__ \
|___/\___/_|_|_|_.__/\___|_| |_|_|_\__,_|_||_|___/
Bomberman & B3mB4m & T-Rex
root~/Desktop$ python stack.py --type "AT&T" --target "MyString" or "PATH"
root~/Desktop$ python stack.py --type "Intel" --target "MyString" or "PATH"
""";
sys.exit()


class B3mB4mPusheR(object):
def __init__(self, syntaxtype, target):
self.generate = target
self.syntaxtype = syntaxtype
self.cout = 0
self.fill = "/"
self.newlist = [x for x in range(len(str(self.generate)))]
for i in xrange(0, len(self.generate)):
self.newlist[i] = self.generate[i]
self.cout += 1;

if "/" in self.generate:
self.calculatorifpath( self.generate)
else:
self.calculatorifstring( self.generate)


def calculatorifstring(self, string):
if len(string) == 4:
if self.syntaxtype == "Intel":
stack = "push 0x%s" % (string[::-1].encode('hex'))
elif self.syntaxtype == "AT&T":
stack = "push $0x%s" % (string[::-1].encode('hex'))
print(Fore.GREEN + stack)
sys.exit()
elif len(string) % 4 == 0:
self.splitter( string)
else:
dwordpart = string[0:(len(string)-len(string)%4)]
wordpart = string[(len(string)-len(string)%4):len(string)]
self.splitter( dwordpart)
self.splitter( wordpart, "WordTime")


def calculatorifpath(self, hexme):
#In linux doesnt matter how many / in path.
#So we can use that our purpose.
#Therefore,we dont need convert to words too.
if len(hexme) % 4 == 0:
self.fill = self.fill
if len(hexme) % 4 == 1:
self.fill = self.fill * 4
elif len(hexme) % 4 == 2:
self.fill = self.fill * 3
elif len(hexme) % 4 == 3:
self.fill = self.fill * 2

if self.cout == 4:
if self.syntaxtype == "Intel":
stack = "push 0x%s" % (hexme[::-1].encode('hex'))
elif self.syntaxtype == "AT&T":
stack = "push $0x%s" % (hexme[::-1].encode('hex'))
print(Fore.GREEN + stack)
sys.exit()

elif self.cout > 4:
if len(hexme) % 4 == 0:
self.hextime(self.fill, hexme)
elif len(hexme) % 4 == 1:
self.hextime(self.fill, hexme)
sys.exit()
elif len(hexme) % 4 == 2:
self.hextime(self.fill, hexme)
sys.exit()
elif len(hexme) % 4 == 3:
self.hextime(self.fill, hexme)
sys.exit()


def hextime(self, putmein, hexme):
for i in xrange(0, len(hexme)):
if hexme[i] == "/":
self.newlist[i] = putmein
fixstring = self.complie( self.newlist)
self.splitter(fixstring)
break;


def complie(self, givemethatstring):
compliestring = ""
for i in givemethatstring:
compliestring += i
return compliestring


def splitter(self, hexdump, pushword="None"):
self.mylist = []
if pushword == "None":
fixmesempai = re.findall('....?', hexdump)
for x in fixmesempai[::-1]:
self.syntaxtyper( str(x[::-1].encode("hex")), "dword")
else:
fixmesempai = re.findall('..?', hexdump)
for x in fixmesempai[::-1]:
self.syntaxtyper( str(x[::-1].encode("hex")), "word")

for x in self.mylist:
print (Fore.GREEN + x)


def syntaxtyper(self, getstring, dwordORword):
if self.syntaxtype == "Intel":
if dwordORword == "dword":
getstring = "push 0x%s" % getstring
self.mylist.append(getstring)
elif dwordORword == "word":
getstring = "push word 0x%s" % getstring
self.mylist.append(getstring)
elif self.syntaxtype == "AT&T":
if dwordORword == "dword":
getstring = "push $0x%s" % getstring
self.mylist.append(getstring)
elif dwordORword == "word":
getstring = "pushw 0x%s" % getstring
self.mylist.append(getstring)


if __name__ == '__main__':
parser = OptionParser()
parser.add_option('--type', action="store")
parser.add_option('--target', action="store")
options, args = parser.parse_args()

if options.type:
B3mB4mPusheR( options.type, options.target)
else:
helper()
Login or Register to add favorites

File Archive:

April 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close