Skip to content

Instantly share code, notes, and snippets.

View syzdek's full-sized avatar

David M. Syzdek syzdek

  • Anchorage, Alaska
View GitHub Profile
// Program to strip comments and strings from a C file
//
// Answer to StackOverflow question:
// http://stackoverflow.com/questions/16086617/c-removing-comments-with-a-sliding-window-without-nested-while-loops
//
// Build:
// gcc -o strip-comments strip-comments.c
//
// Test:
// ./strip-comments strip-comments.c
@syzdek
syzdek / locky-dga.c
Last active February 25, 2016 07:24
Locky Ransomware Domain Generation Algorithm
/*
* Locky Ransomware Domain Generation Algorithm
*
* Original code from Forcepoint Security Labs:
* https://blogs.forcepoint.com/security-labs/locky-ransomware-encrypts-documents-databases-code-bitcoin-wallets-and-more
*
* Code updated by David M. Syzdek <ten . kedzys @ divad> on 2016/02/24
*
* Compile with:
* gcc -W -Wall -Werror -o locky-dga locky-dga.c
#include <inttypes.h>
const char * qr-code-ver1[] =
"+----------------------------------------------------------+",
"| |",
"| |",
"| |",
"| |",
"| ▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓ |",
Converting base 10 frame diagram to base 8 with byte offsets:
Original (https://tools.ietf.org/html/rfc6455#section-5.2):
This wire format for the data transfer part is described by the ABNF
[RFC5234] given in detail in this section. (Note that, unlike in
other sections of this document, the ABNF in this section is
operating on groups of bits. The length of each group of bits is
indicated in a comment. When encoded on the wire, the most
significant bit is the leftmost in the ABNF). A high-level overview
@syzdek
syzdek / mmap-build-TomSellers.sh
Created August 21, 2017 19:58
Simple build script to build TomSellers' nmap repository
#!/bin/bash
echo "building TomSellers's nmap..."
set -x -e
pwd
git clone https://github.com/TomSellers/nmap.git
( cd nmap && git branch build 7c833b933e771923e660 && checkout build )
( cd nmap && ./configure --prefix=/opt/nmap )
( cd nmap/libdnet-stripped && make )
( cd nmap/liblinear && make )

Keybase proof

I hereby claim:

  • I am syzdek on github.
  • I am syzdek (https://keybase.io/syzdek) on keybase.
  • I have a public key whose fingerprint is 000C CBFA BA86 33B7 9FB3 E532 6C69 94B2 91A8 B42D

To claim this, I am signing this object:

This following can used to distribute common files amoung hosts. For example, to distribute a shared hosts file.

Initial Setup:

  mkdir /etc/gitfiles
  cd /etc/gitfiles
  git init
  git remote add origin https://1.2.3.4/path/to/shared/repo.git

git fetch origin

#!/bin/bash
FILE="${1}"
PROG_NAME="$(basename "${0}")"
if test -z "${FILE}";then
echo "Usage: ${PROG_NAME} <file>"
exit 1
fi
@syzdek
syzdek / example-oidspec.c
Last active November 27, 2019 04:46
Example output of example.oidspec from ldap-utils
//
// Generated on: 2019-11-26 19:42:02
// Generated with: ./src/oidspectool
// --source
// ../src/utils/oidspectool/example.oidspec
//
#define _LDAPSCHEMA_OIDSPECS 1
#include <stdio.h>
@syzdek
syzdek / encrypt-sshpass.sh
Created July 9, 2012 20:25
Script to encrypt a string using an SSH user's public RSA ssh key.
#!/bin/sh
#
# Convience script for encrypting a SSH user's password
# using the user's public SSH RSA key.
#
# encrypt-sshpass.sh
#
PROGRAM_NAME=`basename ${0}`