Skip to content

Instantly share code, notes, and snippets.

View mpfund's full-sized avatar

Marinus Pfund mpfund

  • ifempty
  • Munich
View GitHub Profile
@mpfund
mpfund / main.go
Last active December 7, 2023 12:34
package main
import (
"fmt"
"github.com/miekg/dns"
)
func main() {
// Create a DNS server instance
server := &dns.Server{Addr: ":53", Net: "udp"}
@mpfund
mpfund / secrets_crawler.exs
Last active April 3, 2023 08:57
crawler in elixir. finding secret files in alexa top 1m csv
Mix.install([
:req,
:csv,
:parallel_stream
])
Logger.configure(level: :info)
# Desktop.ini, /.git/config, /.DS_Store, /.subversion/config,
# Dockerfile, package.json, .env, appsettings.json, secrets.json
@mpfund
mpfund / exploit.c
Created July 9, 2022 19:38
Linux Kernel 2.6.19 < 5.9 - 'Netfilter Local Privilege Escalation
/*
* CVE-2021-22555: Turning \x00\x00 into 10000$
* by Andy Nguyen (theflow@)
*
* theflow@theflow:~$ gcc -m32 -static -o exploit exploit.c
* theflow@theflow:~$ ./exploit
* [+] Linux Privilege Escalation by theflow@ - 2021
*
* [+] STAGE 0: Initialization
* [*] Setting up namespace sandbox...
@mpfund
mpfund / Main.js
Created April 21, 2022 21:45
Azure function with http call
#source https://dzhavat.github.io/2019/07/09/making-http-requests-inside-azure-functions.html
const fetch = require("node-fetch"); // 1
module.exports = async function (context, req) { // 2
const accessToken = '...';
const url = 'https://api.github.com/user';
const headers = {
'Authorization': `token ${accessToken}`
};
@mpfund
mpfund / HomeController.cs
Created February 17, 2021 09:31
RegexRewriteWithCapture: a Microsoft.AspNetCore.Rewrite rule with regular expression and variable capture.
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult Index()
@mpfund
mpfund / find_projectfiles_without_appendtargetframework.ps1
Created February 8, 2021 18:35
find VisualStudio projectfile not containing AppendTargetFramworkToOutputPath
# New vs project cspoj file format appends .net framework version to output folder
# https://stackoverflow.com/questions/43602782/how-do-i-set-outputpath-in-a-visual-studio-2017-project-new-csproj-file-form
# Search for all projectfiles containing net472 and not AppendTargetFrameworkToOuputPath
Get-ChildItem -Recurse *.csproj | where { ($_ | Select-String net472) -and -not ($_ | Select-String AppendTargetFrameworkToOutputPath) }
# source https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-debian-9
sudo apt update
# let apt use package over https
sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
# add docker gpg key
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
# add docker repository to apt
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
sudo apt update
@mpfund
mpfund / excel_interop_character.cs
Created November 29, 2019 10:56
format character in excel cell and preserve old formatting
using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
using System.Drawing;
namespace excelinterop
{
class Program
{
@mpfund
mpfund / main.go
Created May 24, 2017 09:47
read raw bytes from disk
package main
import (
"syscall"
"fmt"
)
func main() {
disk := "\\\\.\\C:"
@mpfund
mpfund / main.go
Created May 24, 2017 09:46
encode/decode file base64
package main
import( b64 "encoding/base64"
"fmt"
"log"
"flag"
"io/ioutil"
)
func main() {