Skip to content

Instantly share code, notes, and snippets.

View unfo's full-sized avatar

Jan Wikholm unfo

View GitHub Profile
import csv
import sys
from itertools import product
from cvss import CVSS3
# Check if a CVSS score was provided as a command-line argument
if len(sys.argv) != 2:
print(f'Usage: {sys.argv[0]} <cvss_score>')
sys.exit(1)
#%%
"""
Converts https://disobey.fi/2024/program html into .ics feed
only fix i needed to do was change the duplicate
<div id='timetable-day-1'> to <div id='timetable-day-2'>
"""
from bs4 import BeautifulSoup, NavigableString
import lxml
[package]
name = "minimum_sample_size"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = { version = "4.4.14", features = ["derive"] }
num-integer = "0.1.45"
@unfo
unfo / analyze.py
Last active August 3, 2023 12:35
Analyzing entropy visually in jupyter notebook
# ChatGPT: i have a binary file called "output.bin".
# i want to read it with python as a stream of integers triplets
# that map as coordinates in a 3d space and then plot those data points with mathplotlib.
# all of this is happening in jupyter notebook.
# + some additional small tweaking
# Output:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# ChatGPT prompt:
# i would like to create a code that would generate all possible combinations of CVSS scores and
# output the configuration + calculated score in CVS format to STDOUT.
# could you help me generate that code in python?
# Output:
import csv
import sys
from itertools import product
from cvss import CVSS3
@unfo
unfo / gamma-encoder.rs
Created January 20, 2023 15:36
Elias Gamma Encoding in Rust
// Wikipedia: https://en.wikipedia.org/wiki/Elias_gamma_coding
use std::vec;
use std::env;
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() < 2 {
panic!("Please provide gamma-encoded binary string as input");
}
@unfo
unfo / brute-force-counter-main.rs
Created January 9, 2023 12:54
brute-force-counter
use counter::Counter;
use itertools::Itertools;
fn main() {
let pw = String::from("lW2jYRI02ZKDBb9VtQBU1f6eDRo6WEj9");
let lower = (b'a' ..= b'z').map(char::from).collect::<Vec<_>>();
let upper = (b'A' ..= b'Z').map(char::from).collect::<Vec<_>>();
let num = (b'0' ..= b'9').map(char::from).collect::<Vec<_>>();
let mut pw_space = lower.clone();
pw_space.extend(upper);
@unfo
unfo / multiple-sieves.rs
Last active March 1, 2021 19:47
Some pretty naive Erastothenes' Sieve implementations in Rust
use bitvec::prelude::*;
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}

Getting vol.py to run on python3

After fixing all of the core vol.py py2 -> py3 syntax and import errors, I get a bunch of SyntaxError failures for plugins.

tl;dr effectively all plugins are broken.

Most common syntax problems:

print "[x86] Gathering all referenced SSDTs from KTHREADs..."
@unfo
unfo / oscp-tips.md
Last active December 13, 2018 17:14

A few tips for OSCP

  1. Doing all of the exercises is important since you will discover low-hanging fruit from the labs based on the recon you do with the different tools in the exercises.
  2. Be wary of doing full /24 range port scans, especially for anything more than a few TCP ports. The machines might be in all sorts of broken states left by students etc.
  3. When starting to recon a specific machine:
  • Revert
  • Port scan
  • Try to identify services

Those steps in that order are important. You want a fresh state for the machine and you want to do just simple port scanning first because doing nmap's service scanning or nse scripts might send payloads that actually crash services. So be careful.