Ejemplo n.º 1
0
def hide_code_with_string(obj):
    code = Utils.get_string_from_obj(obj)
    code = Utils.standar_quotes(code)
    obj = Utils.get_obj_from_code(code)
    s_var = g.variable()
    res = "Local " + s_var + ' = "' + obj[0] + '" & _ \n'
    for i in xrange(1, len(obj) - 1):
        res += '"' + obj[i] + '" & _ \n'
    res += '"' + obj[len(obj) - 1] + '"\n'
    res += "Local " + g.variable() + " = Execute(" + s_var + ")\n"
    return res
Ejemplo n.º 2
0
def add_hardcoded_funcs(obj,add_calls=False,functions=Globals.defined_new_functions,arity=Globals.arity_new_functions,n_funcs_min=3,n_funcs_max=5):
    n_funcs = randint(min(n_funcs_min,n_funcs_max),max(n_funcs_min,n_funcs_max))
    shuffle(hp.HARDCODED_PROGRAMS)
    funcs   = hp.HARDCODED_PROGRAMS[:n_funcs]
    for i in xrange(n_funcs):
	function_code   = funcs[i]()
	obj.insert(0,function_code+"\n\n")
	if add_calls:
	    arity           = Globals.arity_new_functions[-1]
	    identifier      = Globals.defined_new_functions[-1]
	    params          = ",".join([g.value() for i in xrange(arity)])
	    obj.insert(0,Utils.low_up_string(Utils.generate_random_declarator()) + \
		       g.variable() + " = " + identifier + "("+params+")\n\n")
    return obj