Okay i know python was not designed with obfuscation in mind but it doesn't hurt to try.
i found really neat obfuscated python codes online like this two below:
[#[#[#[#[#[#[#[#[# By TaroOgawa #]#]#]#]#]#]#]#]#]
                      globals()
                .update({   "______":
             lambda x:         globals()
             .update((         dict([[x]
                *2])))}),   ______(((
                      "Just")))
                ,______((   "another"
             )),______         ("Python"
          ),______(               "Hacker")
          ];print (               " ".join(
             [(Just),(         (another)
                ),(Python   ),Hacker]
                      ));______
                      
print ''.join('%(pre)s%(num)s %(bot)s on the wall, %(nul)s %(bot)s,\n%(tak)s\n' % (lambda c,b:
  {'pre':['','%s %s on the wall.\n\n' % (c,b)][abs(cmp(c,'Ninety-nine'))],
 'num':c, 'nul':c.lower(), 'bot':b,
 'tak':['Go to the store and buy some more... Ninety-nine %s.' % b,'Take one down, pass it around,'][abs(cmp(x,0))]
  })((lambda x,o: [(['Twenty','Thirty','Forty','Fifty',
  'Sixty','Seventy','Eighty','Ninety'][x/10-2]+'-'+o.lower()).replace('-no more',''), o][int(x<20)])(x, ['No more','One','Two',
  'Three','Four','Five','Six','Seven','Eight',
  'Nine','Ten','Eleven','Twelve','Thirteen','Fourteen',
  'Fifteen','Sixteen','Seventeen','Eighteen','Nineteen'][[x,x%10][int(x>=20)]]),'bottle%s of beer' % ['','s'][abs(cmp(x,1))])
  for x in xrange(99,-1,-1))
So i thought of try to get a reverse shell using python eval() function and base64 module for encrypting and decrypting.....so first test,print directory contents:
#test script to print current directory contents
[code=Python]
eval('''cmd="ls -l"; p=__import__("subprocess",globals(),locals(),['*'],-1);proc = p.Popen(cmd, shell=True, tdout=p.PIPE,stderr=p.PIPE, stdin=p.PIPE);out,err=proc.communicate(); out+err'''
);
using base64
eval("__import__('base64').b64decode("Y21kPSJscyAtbCI7cD1fX2ltcG9ydF9fKCJzdWJwcm9jZXNzIixnbG9iYWxzKCksbG9jYWxzKCksWycqJ10sLTEpO3Byb2MgPSBwLlBvcGVuKGNtZCwgc2hlbGw9VHJ1ZSwgc3Rkb3V0PXAuUElQRSxzdGRlcnI9cC5QSVBFLCBzdGRpbj1wLlBJUEUpO291dCxlcnI9cHJvYy5jb21tdW5pY2F0ZSgpO291dCtlcnI=\")")
i only get the output as the base64 decoded string nothing is executed by eval.
So my question is how can i get to execute python code using eval while its still encoded say base64 encoded.....an example is how php shells are encoded.
with os .system this worked well
shell
#python shell with system() call function
eval("__import__('os').system('/bin/sh -i')")
#also
eval("__import__('subprocess').call('/bin/sh -i')")
#python reverse shell
eval("p=__import__('subprocess',globals(),locals(),['*']),-1);p.call('/bin/sh -i');")
This is where things don't work out,once i have included the base64 eval just prints the decoded string.
base64 encoded to get shell running
#encode python code
eval("__import__('base64').b64decode('cD1fX2ltcG9ydF9fKCdzdWJwcm9jZXNzJyxnbG9iYWxzKCksbG9jYWxzKCksWycqJ10pLC0xKTtwLmN
hbGwoJy9iaW4vc2ggLWknKTs=')")
 basically the code is not giving me results i wanted.....a shell with obfuscated code .help if you can......