-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add hash algorithm for unknown Mythic agent
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python | ||
|
||
DESCRIPTION = "API hash find in an unknown Mythic agent, need a XOR key" | ||
# Type can be either 'unsigned_int' (32bit) or 'unsigned_long' (64bit) | ||
TYPE = "unsigned_int" | ||
# Test must match the exact has of the string 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' | ||
TEST_1 = 3762100525 | ||
|
||
|
||
def hash(data): | ||
crc = 0xffffffff | ||
for val in data: | ||
for _ in range(8): | ||
tmp = crc | ||
crc = crc >> 1 & 0xffffffff | ||
if (val ^ tmp) & 1 != 0: | ||
crc ^= 0xedb88320 | ||
val = val >> 1 & 0xffffffff | ||
return crc |