def test_blackbox_header_fields_malconv(self): black_box_attack = CBlackBoxHeaderFieldsEvasionProblem( CEnd2EndWrapperPhi(self.end2end_classifier), iterations=2, population_size=2) engine = CGeneticAlgorithm(black_box_attack) y_pred, _, _, _ = engine.run(self.X, self.Y) self.assert_evasion_result(y_pred)
def test_blackbox_dos_header_malconv(self): black_box_attack = CBlackBoxHeaderEvasionProblem(CEnd2EndWrapperPhi( self.end2end_classifier), optimize_all_dos=True, iterations=5, population_size=10) engine = CGeneticAlgorithm(black_box_attack) y_pred, _, _, _ = engine.run(self.X, self.Y) self.assert_evasion_result(y_pred)
def test_blackbox_padding_malconv(self): black_box_attack = CBlackBoxPaddingEvasionProblem( CEnd2EndWrapperPhi(self.end2end_classifier), how_many_padding_bytes=1024, iterations=5, population_size=10) engine = CGeneticAlgorithm(black_box_attack) y_pred, _, _, _ = engine.run(self.X, self.Y) self.assert_evasion_result(y_pred)
def test_blackbox_format_exploit_malconv(self): black_box_attack = CBlackBoxFormatExploitEvasionProblem( CEnd2EndWrapperPhi(self.end2end_classifier), preferable_extension_amount=0x200, pe_header_extension=0, iterations=5, population_size=10) engine = CGeneticAlgorithm(black_box_attack) y_pred, _, _, _ = engine.run(self.X, self.Y) self.assert_evasion_result(y_pred)
def test_blackbox_gamma_ember(self): section_population, _ = CGammaEvasionProblem.create_section_population_from_folder( self.goodware_folder, 100) gamma = CGammaEvasionProblem(section_population, CEmberWrapperPhi(self.ember_classifier), population_size=10, penalty_regularizer=1e-6, iterations=5) engine = CGeneticAlgorithm(gamma) y_pred, _, _, _ = engine.run(self.X, self.Y) self.assert_evasion_result(y_pred)