Skip to content

Instantly share code, notes, and snippets.

View albertzaharovits's full-sized avatar

Albert Zaharovits albertzaharovits

View GitHub Profile
### Keybase proof
I hereby claim:
* I am albertzaharovits on github.
* I am albertzaharovits (https://keybase.io/albertzaharovits) on keybase.
* I have a public key ASB1G2TuWDfj_Sk3Gyx3iXIFpEdsw1QTqW_AOxfAKfuGVQo
To claim this, I am signing this object:
@albertzaharovits
albertzaharovits / smtp-data.bro
Created September 29, 2015 11:21
Bro extract SMTP data (eml), cache in Redis
@load base/protocols/conn
@load base/protocols/smtp
event mime_all_data(c: connection, length: count, data: string)
{
local conn_key: string;
local cmd: string;
if ( ! c?$smtp )
return;
def get_hash(file_path, hash_name="sha256", block_size=4096):
# hash_name = md5 / sha256 / sha512
hash = hashlib.new(hash_name)
with open(file_path, "rb") as f:
for block in iter(lambda: f.read(block_size), ""):
hash.update(block)
return hash.hexdigest()