MCPcopy Create free account
hub / github.com/Bashfuscator/Bashfuscator / test_mutators

Function test_mutators

test/test_mutators.py:26–43  ·  view source on GitHub ↗
(mutatorName, stubName)

Source from the content-addressed store, hash-verified

24@pytest.mark.parametrize("mutatorName,stubName", mutators)
25
26def test_mutators(mutatorName, stubName):
27 try:
28 for i in range(100):
29 payload = obHandler.genObfuscationLayer(inputCommand, userMutator=mutatorName, userStub=stubName)
30
31 proc = Popen(payload, executable="bash", stdout=PIPE, stderr=STDOUT, shell=True, universal_newlines=True)
32 payloadOutput, __ = proc.communicate()
33
34 assert(expectedOutput == payloadOutput)
35 except AssertionError:
36 if not os.path.exists("failing"):
37 os.mkdir("failing")
38
39 date = datetime.now()
40 timestamp = str(date.month) + "." + str(date.day) + "." + str(date.year) + "-" + str(date.hour) + "." + str(date.minute) + "." + str(date.second)
41 with open("failing/" + mutatorName.replace("/", ".") + "-" + timestamp + ".sh", "w") as errorFile:
42 errorFile.write(payload)
43 raise

Callers

nothing calls this directly

Calls 1

genObfuscationLayerMethod · 0.80

Tested by

no test coverage detected