Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial mako support #38

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Add initial mako support #38

wants to merge 5 commits into from

Conversation

msm-cert
Copy link
Member

No description provided.

@msm-cert
Copy link
Member Author

from mwdb_iocextract import parse


x = parse("netwire", {"c2": "https://nazywam.pl"}).to_maco()
print(x)

src/model.py Outdated
for key in self.rsa_keys:
obj = model.ExtractorModel.Encryption(
algorithm="rsa",
public_key=str((key.n, key.e)),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the recommended way to serialize a RSA public key? As far as I can see, I can only pass str

src/model.py Outdated
public_key=str((key.n, key.e)),
)
if key.d:
obj.key = str((key.n, key.d))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question goes here

output.encryption.append(
model.ExtractorModel.Encryption(
algorithm=curve.t, # for example, "ecdsa_pub_p384"
public_key=str((curve.x, curve.y)),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

for curve in self.ecdsa_curves:
output.encryption.append(
model.ExtractorModel.Encryption(
algorithm=curve.t, # for example, "ecdsa_pub_p384"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a convention for naming this types (we don't have an enum ourselves, though we map ecdsa_pub_p384 to something that MISP wants)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far I don't believe we have a naming convention for the algorithm field

output.encryption.append(
model.ExtractorModel.Encryption(
algorithm=key[0],
key=key[1],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hexencoded

return "c2"
elif location_type == LocationType.DOWNLOAD_URL:
return "download"
elif location_type in [LocationType.OTHER, LocationType.PEER]:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No way to add a peer I think (it's not useful nowadays anyway)

)
)
else:
output.tcp.append(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't keep track of connection type for non-http connections, sadly. But I can't think of a situation where this was not TCP

output.paths.append(filename)

# Not supported by Maco
# for email in self.emails_to + self.emails_from:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, for credentials stealing

# output.emails.append(email)

# Not supported by Maco
# for message in self.ransom_messages:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used by ransomware

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this could be something added to decoded_strings field or perhaps we should introduce a body field to the SMTP model to maintain the context of the string as being a ransomware-related to an email?

output.mutex.append(mutex)

for filename in self.dropped_filenames:
output.paths.append(filename)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think i'm not adhering to the spirit of this field - we only store filenames, not complete paths.

mwdblib>=3.3.0
maco
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
maco
maco-model

Might be better to use the maco-model package since it only contains the Pydantic models which is the only part in use in this feature.

Module structure is the same as the full package so you won't have to update the imports 😁

Comment on lines +403 to +405
# Not supported by Maco
# for email in self.emails_to + self.emails_from:
# output.emails.append(email)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants