Skip to content

Instantly share code, notes, and snippets.

View zv's full-sized avatar
💭
FOLLOWS YOU

zv zv

💭
FOLLOWS YOU
View GitHub Profile
@zv
zv / feistel.py
Last active February 18, 2022 17:09
Feistel on sequences
import hashlib
import math
import sys
def keyed_digest(salt):
byteorder = sys.byteorder
m = hashlib.sha256()
m.update(salt)
def digest(r, k):
@zv
zv / is_inside_triangle.py
Last active December 6, 2021 20:08
Check if point is inside triangle
from numpy.linalg import det
def solve(v, v0, v1, v2):
"See: https://mathworld.wolfram.com/TriangleInterior.html"
x = (det([v, v2]) - det([v0, v2])) / det([v1, v2])
y = -((det([v, v1]) - det([v0, v1])) / det([v1, v2]))
return x, y
for x, y in ([5, 2.5], [6, 2.5], [5, 12], [6, 12]):
a, b = solve(v=[x, y], v0 = [0, 0], v1 = [5, 10], v2 = [10, 0])
@zv
zv / output.term
Last active March 9, 2023 10:03
AV family name components (Polyunite)
Engine | H | OS | Macro | Language | Labels | Name | Malware Family
==================================================================================================================================================
Alibaba | | Android | | | trackware | Airpush | AdDisplay:Android/Airpush.52083512
Alibaba | H | Android | | | adware | Agent | AdWare:Android/Agent.fe8d701d
Alibaba | | Android | | | adware | Ewind | AdWare:Android/Ewind.5ee20870
Alibaba | | | | | adware | CrossRider | AdWare:NSIS/CrossRider.b36e5bcf
Alibaba | | Windows | | | adware | 1ClickDownload | AdWare:Win32/1ClickDownload.6c036a0d
Alibaba | | Windows | | | adware
@zv
zv / extract_family_feats.py
Last active March 9, 2023 10:03
extract_family_feats.py
# enum identifiers are sourced from https://maecproject.github.io/documentation/maec5-docs/#introduction
from typing import Optional
from enum import Enum
import re
seen = [
('Alibaba', "Trojan:MacOS/eicar.com"),
('Alibaba', "Virus:Win32/Zatoxp.71d40539"),
('Alibaba', "Test:Any/EICAR.51848e83"),
('Alibaba', "Virus:Any/EICAR_Test_File.a4cca4b9"),
@zv
zv / output.console
Last active November 4, 2019 01:22
toolbox clamav exploit
[zv@sigstkflt] ~ >> toolbox enter -c clamav
toolbox: container clamav not found
Creating toolbox container clamav instead.
Use the 'create' command to create a different toolbox.
Try 'toolbox --help' for more information.
⬢[zv@toolbox ~]$ sudo dnf -qy builddep clamav
⬢[zv@toolbox ~]$ wget https://www.clamav.net/downloads/production/clamav-0.102.0.tar.gz && tar -xvf clam* && cd clam*;
⬢[zv@toolbox clamav-0.102.0]$ ( CFLAGS='-Og -g -march=native' CXXFLAGS="$CFLAGS" ./configure && make -j4 ) > /dev/null
⬢[zv@toolbox clamav-0.102.0]$ wget http://pastebin.com/raw/cfP7X89m -O clam_shellcode.py
@zv
zv / wnhatev
Created May 4, 2019 02:24
asdf
0x85C4B61dDe8c2E0e164aEEfd5f319dA5Fd235d1A
@zv
zv / build_warnings.txt
Created February 13, 2019 22:21
pyethash 0.23 verbose build warnings
Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
Created temporary directory: C:\Users\POLYSW~1\AppData\Local\Temp\pip-ephem-wheel-cache-4780659q
Created temporary directory: C:\Users\POLYSW~1\AppData\Local\Temp\pip-req-tracker-flpl5slr
Created requirements tracker 'C:\\Users\\POLYSW~1\\AppData\\Local\\Temp\\pip-req-tracker-flpl5slr'
Created temporary directory: C:\Users\POLYSW~1\AppData\Local\Temp\pip-install-emn5o504
Collecting git+https://github.com/polyswarm/ethash.git@feature/distutils-test
Created temporary directory: C:\Users\POLYSW~1\AppData\Local\Temp\pip-req-build-o4mbkih2
Cloning https://github.com/polyswarm/ethash.git (to revision feature/distutils-test) to c:\users\polysw~1\appdata\local\temp\pip-req-build-o4mbkih2
Running command git clone -q https://github.com/polyswarm/ethash.git C:\Users\POLYSW~1\AppData\Local\Temp\pip-req-build-o4mbkih2
@zv
zv / test.s
Created June 26, 2018 08:00
optimize.asm
test:
.LFB0:
.cfi_startproc
push rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
mov rbp, rsp
.cfi_def_cfa_register 6
mov DWORD PTR [rbp-20], edi
mov DWORD PTR [rbp-4], 0
@zv
zv / all_128.smt
Last active October 6, 2017 23:26
Find MD4 fixed points with with less thab 2^(128/2)/16 decisions & conflicts!
(set-logic QF_BV) ; remove this line if you haven't patched z3 to incl. ext_rotate_left in QF_BV
(set-info :source |
NOiSE BRiDGE HASHSMASH KREW
solve md4(x) == x
author zv <zv@nxvr.org>
|)
(set-info :smt-lib-version 2.0)
(set-info :status unknown)
;; We are seeking a valid assignment of the 4 32-bit literals (named 'ch_$N')
@zv
zv / hanoi.bash
Last active April 11, 2017 19:51
indentation failure
#! /usr/bin/bash
function repeat { # $1=char $2=number of repetitions
local n # Repeat-print a character.
for (( n=0; n<$2; n++ )); do
echo -n "$1"
done
}