Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a793d60
feat(insn): emit number(0) on xor of same registers
v1bh475u Mar 18, 2025
828509c
add test case for emit number(0) for insn like " xor eax, eax"
v1bh475u Mar 21, 2025
d940b7b
format conditional check for xor insn
v1bh475u Mar 21, 2025
d753fdd
udpate CHANGELOG
v1bh475u Mar 21, 2025
221e885
Merge branch 'master' into emit-number-0
v1bh475u Mar 21, 2025
172b365
feat(insn): emit number(0) on xor of same registers
v1bh475u Mar 21, 2025
b3b51a3
ghidra: emit number(0) on xor of same registers
v1bh475u Mar 21, 2025
7c20e31
Merge branch 'master' into emit-number-0
v1bh475u Mar 21, 2025
ce727a0
Merge branch 'master' into emit-number-0
v1bh475u Mar 21, 2025
998e850
binexport2: emit number(0) on xor of same registers
v1bh475u Mar 21, 2025
976a1ec
add fixture for mimikatz with number(0)
v1bh475u Mar 21, 2025
f278a35
refactor: rename instruction variable
v1bh475u Mar 21, 2025
a0053c9
Merge branch 'master' into emit-number-0
v1bh475u Mar 24, 2025
310eb0c
add helper functions to identify XOR insns & zeored XORs
v1bh475u Mar 25, 2025
469d76c
Merge branch 'master' into emit-number-0
v1bh475u Mar 26, 2025
e239784
fix is_zxor & add is_operands_equal helper function
v1bh475u Mar 27, 2025
f27c9ba
inline is_operand_equal logic into is_zxor and insn extraction
v1bh475u Mar 28, 2025
cf0831d
add is_xor and is_zxor helper functions
v1bh475u Mar 31, 2025
237c9ef
refactor extract_insn_number_feature to use is_zxor helper
v1bh475u Mar 31, 2025
fa55058
add is_operands_equal helper function for instruction operand comparison
v1bh475u Mar 31, 2025
51c16ab
simplify is_zxor logic
v1bh475u Apr 1, 2025
e91ba10
fix is_zxor to compare both operands directly
v1bh475u Apr 1, 2025
46b3d4e
viv-backend: refactor is_zxor
v1bh475u Apr 1, 2025
6e3944c
rename is_operands_equal to are_operands_equal for consistency
v1bh475u Apr 2, 2025
88f15bd
Merge branch 'master' into emit-number-0
v1bh475u Jun 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
## master (unreleased)

### New Features

- emit number(0) for instructions like "xor eax,eax" #2622 @v1bh475u
-
### Breaking Changes

### New Rules (4)

- communication/socket/connect-socket [email protected] [email protected] [email protected]
- communication/socket/udp/connect-udp-socket [email protected]
- nursery/enter-debug-mode-in-dotnet @v1bh475u
-

### Bug Fixes
- cape: make some fields optional @williballenthin #2631 #2632
Expand Down
12 changes: 12 additions & 0 deletions capa/features/extractors/viv/insn.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,18 @@ def extract_op_number_features(
insn: envi.Opcode = ih.inner
f: viv_utils.Function = fh.inner

if (
insn.mnem == "xor"
and insn.opers[0].isReg()
and insn.opers[1].isReg()
and insn.opers[0].reg == insn.opers[1].reg
):
# for pattern like:
#
# xor eax, eax
#
yield Number(0), ih.address

# this is for both x32 and x64
if not isinstance(oper, (envi.archs.i386.disasm.i386ImmOper, envi.archs.i386.disasm.i386ImmMemOper)):
return
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,7 @@ def parametrize(params, values, **kwargs):
("7351f.elf", "function=0x408753,bb=0x408781", capa.features.insn.API("open"), True),
("79abd...", "function=0x10002385,bb=0x10002385", capa.features.common.Characteristic("call $+5"), True),
("946a9...", "function=0x10001510,bb=0x100015c0", capa.features.common.Characteristic("call $+5"), True),
("9324d...", "function=0x40806C,bb=0x40806C,insn=0x40806C", capa.features.insn.Number(0), True),
],
# order tests by (file, item)
# so that our LRU cache is most effective.
Expand Down