Skip to content

Instantly share code, notes, and snippets.

@zhsh9
zhsh9 / configure_krb5.py
Created February 22, 2024 22:22 — forked from opabravo/configure_krb5.py
This script can easily configure /etc/krb5.conf for evil-winrm, by providing a domain fqdn and domain controller name
"""
This script can easily configure /etc/krb5.conf for evil-winrm, by providing a domain fqdn and domain controller name
So that evil-winrm can be used with kerberos authentication
Evil-winrm Example:
```bash
export KRB5CCNAME=Administrator.ccache
evil-winrm -i forest.htb.local -r htb.local
```
@drygdryg
drygdryg / wps_checksum.py
Created July 1, 2020 06:59
Validating and calculating WPS PIN checksum
# -*- coding: utf-8 -*-
def checksum(pin):
'''
Standard WPS checksum algorithm.
@pin — A 7 digit pin to calculate the checksum for.
Returns the checksum value.
'''
accum = 0
while pin:
accum += (3 * (pin % 10))
@Techbrunch
Techbrunch / favicon-shodan.rb
Created December 2, 2019 15:22
Calculate Murmur3 hash of a favicon to be used in Shodan
# Initial code by Matt Harzewski
# https://gist.github.com/mattvh/6692349
# Read more: http://www.webmaster-source.com/2013/09/25/finding-a-websites-favicon-with-ruby/
# https://github.com/hajimes/mmh3
require "httparty"
require "nokogiri"
require "base64"
require "murmurhash3"
// start with:
// frida -U -l pinning.js -f [APP_ID] --no-pause
Java.perform(function () {
console.log('')
console.log('===')
console.log('* Injecting hooks into common certificate pinning methods *')
console.log('===')
var X509TrustManager = Java.use('javax.net.ssl.X509TrustManager');
@ondrasek
ondrasek / spawn-interactive-process.c
Last active September 23, 2022 07:23
spawn-interactive-process: How to launch a process from a Windows Service running in interactive user session(s)
// spawn-interactive-process.cpp : Defines the entry point for the console application.
// Do not forget to link against wtsapi32.lib
// How to test this: use psexec from SysInternals, such as ```psexec -s c:\windows\system32\cmd.exe```
// to run CMD under NT AUTHORITY\SYSTEM account (you can confirm this by running whoami) and then
// run spawn-interactive-process (feel free to disable waiting for debugger). The result is a notepad process
// running under interactive user credentials and on the interactive desktop launched from a service running under
// system account.
#include <stdio.h>
#include <tchar.h>
@yi
yi / gist:01e3ab762838d567e65d
Created July 24, 2014 18:52
lua hex <= => string
function string.fromhex(str)
return (str:gsub('..', function (cc)
return string.char(tonumber(cc, 16))
end))
end
function string.tohex(str)
return (str:gsub('.', function (c)
return string.format('%02X', string.byte(c))
end))
@RobinDavid
RobinDavid / code_injector.py
Created February 25, 2014 17:45
sample of shellcode injection into a process (Gray Hat Python)
'''
Example taken from Gray Hat Python
The script inject a shellcode which tasks is to kill the given process, so that the process will not be killed by our process directly.
'''
import sys
from ctypes import *
# We set the EXECUTE access mask so that our shellcode will execute in the memory block we have allocated
PAGE_EXECUTE_READWRITE = 0x00000040
@amoilanen
amoilanen / webcrawler.js
Last active March 24, 2022 03:14
Simple PhantomJS-based web crawler library
//PhantomJS http://phantomjs.org/ based web crawler Anton Ivanov [email protected] 2012
//UPDATE: This gist has been made into a Node.js module and now can be installed with "npm install js-crawler"
//the Node.js version does not use Phantom.JS, but the API available to the client is similar to the present gist
(function(host) {
function Crawler() {
this.visitedURLs = {};
};