Exemplo n.º 1
0
 def test_split_into_statements(self):
     code = "sText1 = 'abcdefgh';\r\n" \
            " nElem = 2;\r\n" \
            " # dasjd; dasjdas '' qdawdas\r\n" \
            "# daskldlaskjdla aksdlas;das \r\n" \
            "    # dasdwad\r\n" \
            "sText2 = 'dasjnd;jkas''dasdas'';dasdas';\r\n" \
            "SaveDataAll;"
     code = TIObfuscator.remove_comment_lines(code)
     statements = TIObfuscator.split_into_statements(code)
     self.assertEqual(len(statements), 4)
Exemplo n.º 2
0
 def test_expand(self):
     if self.tm1.processes.exists(self.expand_process_name_obf):
         self.tm1.processes.delete(self.expand_process_name_obf)
     process = self.tm1.processes.get(self.expand_process_name)
     process_obf = TIObfuscator.obfuscate_process(process, self.expand_process_name_obf)
     self.tm1.processes.create(process_obf)
     self.tm1.processes.execute(process_obf.name, {})
Exemplo n.º 3
0
    def test_bedrock_clone_cube(self):
        if self.tm1.processes.exists("Bedrock.Cube.Clone.Obf"):
            self.tm1.processes.delete("Bedrock.Cube.Clone.Obf")

        p = self.tm1.processes.get("Bedrock.Cube.Clone")
        p_obf = TIObfuscator.obfuscate_process(
            process=p, new_name='Bedrock.Cube.Clone.Obf')
        self.tm1.processes.create(p_obf)
        # call obfuscated process
        parameters = {
            "Parameters": [{
                "Name": "pSourceCube",
                "Value": self.cube_name
            }, {
                "Name": "pTargetCube",
                "Value": self.cube_name_cloned
            }, {
                "Name": "pIncludeRules",
                "Value": "1"
            }, {
                "Name": "pIncludeData",
                "Value": "1"
            }, {
                "Name": "pDebug",
                "Value": "1"
            }]
        }
        self.tm1.processes.execute("Bedrock.Cube.Clone.Obf", parameters)
Exemplo n.º 4
0
    def test_bedrock_clone_dim(self):
        if self.tm1.processes.exists("Bedrock.Dim.Clone.Obf"):
            self.tm1.processes.delete("Bedrock.Dim.Clone.Obf")

        p = self.tm1.processes.get("Bedrock.Dim.Clone")
        p_obf = TIObfuscator.obfuscate_process(
            process=p, new_name="Bedrock.Dim.Clone.Obf")
        self.tm1.processes.create(p_obf)
        # call obfuscated process
        parameters = {
            "Parameters": [
                {
                    "Name": "pSourceDim",
                    "Value": self.dimension_name
                },
                {
                    "Name": "pTargetDim",
                    "Value": self.dimension_name_cloned
                },
                {
                    "Name": "pAttr",
                    "Value": "1"
                },
            ]
        }
        self.tm1.processes.execute("Bedrock.Dim.Clone.Obf", parameters)
Exemplo n.º 5
0
    def test_remove_generated_code(self):
        code = "#****Begin: Generated Statements***\r\n"\
               "DIMENSIONELEMENTINSERT('Employee','',V1,'s');\r\n"\
               "DIMENSIONELEMENTINSERT('Employee','',V2,'s');\r\n"\
               "DIMENSIONELEMENTINSERT('Employee','',V3,'s');\r\n"\
               "DIMENSIONELEMENTINSERT('Employee','',V4,'s');\r\n"\
               "#****End: Generated Statements****\r\n"\
               "\r\n"\
               "sText = 'test';"

        code = TIObfuscator.remove_generated_code(code)
        self.assertNotIn("#****Begin", code)
        self.assertNotIn("DIMENSIONELEMENTINSERT", code)
        self.assertNotIn("#****End", code)
Exemplo n.º 6
0
 def test_obfuscate_code(self):
     if self.tm1.processes.exists(self.process_name_obf):
         self.tm1.processes.delete(self.process_name_obf)
     process_obf = TIObfuscator.obfuscate_process(self.process, self.process_name_obf)
     self.tm1.processes.create(process_obf)