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

Erlang Bytecode String Converter

Erlang Bytecode String Converter
Posted Dec 21, 2020
Authored by Jeremy Brown

estr2bc is a python script to convert arbitrary string input to Erlang bytecode.

tags | tool, arbitrary, python
systems | unix
SHA-256 | ea4aff1b7084945953980fb63882fb41c9d14b2cd6acf58e45a9f68cf0428975

Erlang Bytecode String Converter

Change Mirror Download
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#
# estr2bc.py
#
# Convert arbitrary string input to Erlang bytecode
#
# Jeremy Brown [jbrown3264/gmail]
# Dec 2020
#
# Example
# > estr2bc.py "ps -aux"
# [112,115,32,45,97,117,120]
#
# > rpc:call('node', file, write_file, ["test", [112,115,32,45,97,117,120]]).
#
# There's probably a native way to do this within Erlang, but this script is
# useful in the exploit chain eg. for generating Riak file:write_file payloads
#

import os
import sys
import argparse
import string

#
# enough for most things
#
string_special_1 = ' !"#$%&\'()*+,-./'
string_special_2 = ':;<=>?@'
string_special_3 = '[\\]^_`'

class Estr2bc(object):
def __init__(self, args):
self.input = args.input

def run(self):
special_1 = dict()
for i, c in enumerate(string_special_1):
special_1[c] = i + 32

numbers = dict()
for i, c in enumerate(string.digits):
numbers[c] = i + 48

special_2 = dict()
for i, c in enumerate(string_special_2):
special_2[c] = i + 58

alpha_upper = dict()
for i, c in enumerate(string.ascii_uppercase):
alpha_upper[c] = i + 65

special_3 = dict()
for i, c in enumerate(string_special_3):
special_3[c] = i + 91

alpha_lower = dict()
for i, c in enumerate(string.ascii_lowercase):
alpha_lower[c] = i + 97

bytecode = ""

for c in self.input:
if(c in string_special_1):
bc = str(special_1[c])
elif(c in string.digits):
bc = str(numbers[c])
elif(c in string_special_2):
bc = str(special_2[c])
elif(c in string.ascii_uppercase):
bc = str(alpha_upper[c])
elif(c in string_special_3):
bc = str(special_3[c])
elif(c in string.ascii_lowercase):
bc = str(alpha_lower[c])
else:
print("error: can't map character '%s'" % (c))
return -1

bytecode += bc + ','

bytecode = bytecode[:-1]

print("[%s]" % bytecode)

return 0

def arg_parse():
parser = argparse.ArgumentParser()

parser.add_argument("input",
type=str,
help="String you wish to convert to bytecode")

args = parser.parse_args()

return args

def main():
args = arg_parse()

esb = Estr2bc(args)
result = esb.run()

if(result != 0):
sys.exit(-1)

if(__name__ == '__main__'):
main()
Login or Register to add favorites

File Archive:

July 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jul 1st
    27 Files
  • 2
    Jul 2nd
    10 Files
  • 3
    Jul 3rd
    35 Files
  • 4
    Jul 4th
    27 Files
  • 5
    Jul 5th
    18 Files
  • 6
    Jul 6th
    0 Files
  • 7
    Jul 7th
    0 Files
  • 8
    Jul 8th
    28 Files
  • 9
    Jul 9th
    44 Files
  • 10
    Jul 10th
    24 Files
  • 11
    Jul 11th
    25 Files
  • 12
    Jul 12th
    11 Files
  • 13
    Jul 13th
    0 Files
  • 14
    Jul 14th
    0 Files
  • 15
    Jul 15th
    28 Files
  • 16
    Jul 16th
    6 Files
  • 17
    Jul 17th
    34 Files
  • 18
    Jul 18th
    6 Files
  • 19
    Jul 19th
    34 Files
  • 20
    Jul 20th
    0 Files
  • 21
    Jul 21st
    0 Files
  • 22
    Jul 22nd
    19 Files
  • 23
    Jul 23rd
    17 Files
  • 24
    Jul 24th
    47 Files
  • 25
    Jul 25th
    31 Files
  • 26
    Jul 26th
    13 Files
  • 27
    Jul 27th
    0 Files
  • 28
    Jul 28th
    0 Files
  • 29
    Jul 29th
    27 Files
  • 30
    Jul 30th
    49 Files
  • 31
    Jul 31st
    29 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