Skip to content

Instantly share code, notes, and snippets.

View zeddee's full-sized avatar

Zed zeddee

View GitHub Profile
data.x_nvd.cpeMatches.vendor: "canonical" AND
(
data.x_nvd.cpeMatches.version_criteria_match: /20\.[0-9]{2}/ OR (
(data.x_nvd.cpeMatches.version_start_including: /20\.[0-9]{2}/ OR data.x_nvd.cpeMatches.version_start_excluding: /20\.[0-9]{2}/) AND
(data.x_nvd.cpeMatches.version_end_including: /20\.[0-9]{2}/ OR data.x_nvd.cpeMatches.version_end_excluding: /20\.[0-9]{2}/)
)
)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""Run with pytest
"""
import csv
from typing import List, Iterable
from io import StringIO
from copy import copy
TEST_DATA_WITH_SPACES = StringIO("""# "first_seen_utc","sha256_hash","md5_hash","sha1_hash","reporter","file_name","file_type_guess","mime_type","signature","clamav","vtpercent","imphash","ssdeep","tlsh"
"2023-08-21 22:53:38", "fd834695fc878b5ed5178dad8,6cf30130adf4a7ac88d5997f8eb7814ca41f211", "db896ff1c3a206de4da48748f0a4731d", "28e85fe7ff3e99fd2c629db98690ecf72194ba7c", "SquiblydooBlog", "installer-package.exe.zip", "zip", "application/zip", "n/a", "n/a", "n/a", "n/a", "24576:2KyTK3lpgjVaC5CAfmXAYpDRvGGOtL0DBlkyYXPGEIwP:WCPeVa4/fkAqD9U8BKJ+EI8", "T139F5EEE784C42CC293FF041525A3EF6032BE2584A138D24F7C591CDB688DD95AA5FBB9"
@zeddee
zeddee / rust-bitwise-example.rs
Last active August 12, 2023 14:28
Rust bitwise operations example
// Following: https://dev.to/somedood/bitmasks-a-very-esoteric-and-impractical-way-of-managing-booleans-1hlf
fn repr(label: &str, num: i8) {
/* Convenience function that prints `num`, which must be an i8,
as its 8-bit representation, and as an integer.
We use `{:#010b}` because when printing with `{:#}`, the number
of padded values on the left includes the initial `0b`.
E.g. `repr("Anything", 1)` prints this output:
use rand::Rng;
use std::collections::HashMap;
use std::ops::Range;
use std::sync::mpsc;
use std::thread;
use std::time::Duration;
fn sleep(range: Range<usize>) {
thread::sleep(Duration::from_millis(
rand::thread_rng().gen_range(range) as u64
"""Copyright 2023 zed@shootbird.work
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
from networkchuck
```
# Show macOS download history
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'
```
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMWvdSlFXXWyvEdYpAzz6yTCAjFmi17bytwy0O4YPkKk zeddee@irisiert.home
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDYXG7ZZ/Jx5N4YmsHOTH0KcT0q0ppxpbsEY/vd+o6KY zeddee@OESTERA.local

Typescript notes

a as b is not type casting

The a as b operation may look like a type casting or type conversion operation, but it is not.

a as b actually performs a type assertion. No type conversion or "casting" happens.