This file contains 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
#include <stddef.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
const size_t BUFFERGROWTH = 128; | |
size_t getline_(char **lineptr, size_t *linesize, FILE *stream) | |
{ | |
if (*lineptr == NULL) { | |
*lineptr = malloc(BUFFERGROWTH); |
This file contains 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
#define _GNU_SOURCE | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <assert.h> | |
const char* const ANSI_COLOR_RED = "\x1b[31m"; | |
const char* const ANSI_COLOR_RESET = "\x1b[0m"; |
This file contains 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
#include <sys/socket.h> | |
#include <netinet/ip.h> | |
#include <sys/time.h> | |
#include <assert.h> | |
#include <stdio.h> | |
#include <string.h> | |
int main(void) | |
{ | |
struct sockaddr_in addr = {AF_INET}; |
This file contains 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
#define _GNU_SOURCE 1 | |
#include <ucontext.h> | |
#include <signal.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
void action_handler(int sig, siginfo_t* info, void* context_p) | |
{ | |
ucontext_t* ucontext = (ucontext_t*)context_p; | |
ucontext->uc_mcontext.gregs[REG_RIP] += 6; |
This file contains 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
#include <stdlib.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <math.h> | |
#include <assert.h> | |
#include <time.h> | |
// Heuristically compare memory | |
int memcmp_heur(const void* lhs, const void* rhs, size_t length, float confidence) | |
{ |
This file contains 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
# Script for emulating the Canon BJNP discover request | |
# License: CC0 | |
import socket | |
import time | |
import itertools | |
import time | |
import select | |
from datetime import datetime |
This file contains 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
#include <fstream> | |
#include <string> | |
#include <limits.h> | |
class CharStream | |
{ | |
public: | |
CharStream(char* str, int size_) : |
This file contains 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
#include <stdio.h> | |
// Drawing the numbers left from the center | |
#define FLAG_LEFT (1 << 30) | |
// Drawing right from the center | |
#define FLAG_RIGHT (1 << 29) | |
// Used to remove flags from a number | |
#define NOFLAG_MASK ((1 << 29) - 1) | |
void draw_flags(int num) |
This file contains 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
#include <fstream> | |
#include <cassert> | |
#include <regex> | |
#include <string> | |
#include <vector> | |
#include <stddef.h> | |
#include <algorithm> | |
This file contains 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
#include <fstream> | |
#include <cassert> | |
#include <string> | |
#include <iostream> | |
#include <vector> | |
#include <array> | |
constexpr int LABEL_LEN = 26; | |
int main() |