This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* TOTP: Time-Based One-Time Password Algorithm | |
* Copyright (c) 2015, David M. Syzdek <david@syzdek.net> | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are | |
* met: | |
* | |
* 1. Redistributions of source code must retain the above copyright |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# set parameters | |
TOTP_UID=${1:-$UID} | |
TOTP_CODE=${2:-123456} | |
# encode numeric UID into three port numbers | |
TOTP_PORT1=$(( $(( ${TOTP_UID} / 4194304)) + 4096 )) | |
TOTP_PORT2=$(( $(( $(( ${TOTP_UID} % 4194304)) / 16384 )) + 4096 )) | |
TOTP_PORT3=$(( $(( $(( ${TOTP_UID} % 4194304)) % 16384 )) + 4096 )) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Use posixregex CLI tool from: https://github.com/syzdek/dmstools/blob/master/src/posixregex.c | |
RE_IPV4="((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])" | |
posixregex -r "^(${RE_IPV4})$" \ | |
127.0.0.1 \ | |
10.0.0.1 \ | |
192.168.1.1 \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* simple Iv4/IPv6 TCP server which echos any data sent to the open port | |
*/ | |
#include <stdio.h> | |
#include <poll.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
#include <sys/uio.h> | |
#include <unistd.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage *) tileImageFromImage:(UIImage *)image | |
{ | |
CGImageRef imageRef; | |
CGContextRef context; | |
CGColorSpaceRef color; | |
CGFloat w; | |
CGFloat h; | |
CGFloat r; | |
CGFloat m; | |
NSInteger pos; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
intmax_t sqroot_imax(intmax_t n, int round) | |
{ | |
intmax_t op = n; | |
intmax_t res = 0; | |
intmax_t one = 1uL << ((sizeof(intmax_t)*8)-2); | |
// "one" starts at the highest power of four <= than the argument. | |
while (one > op) | |
one >>= 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dictionary Stats: | |
Words Dropped: 23* | |
Words Duplicated: 0 | |
Words Indexed: 117946 | |
---------------------------- | |
Total Words Parsed: 117969** | |
* Words with a 'q' not immediately followed by a 'u' (e.g "qiviut"). | |
** The 'u' following a 'q' have been striped from the word (e.g. "quilting" | |
becomes "qilting"). The 'u' is implied by a 'q' in some word tile/dice |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
int main(int argc, const char * argv[]) | |
{ | |
NSRunLoop * runLoop; | |
CLIMain * main; // replace with desired class | |
@autoreleasepool | |
{ | |
// create run loop |