This file contains hidden or 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
| // bytecut.c | |
| // cc -O2 -Wall -Wextra -o bytecut bytecut.c | |
| // $ head -c1024 /dev/urandom | bytecut -b 1-4,9- | wc -c | |
| // 1020 | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <errno.h> |
This file contains hidden or 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
| Perl’s pack and unpack templates define how binary data is converted to and from Perl scalars. Below are practical examples for the most commonly used templates. | |
| Basic Integer Templates | |
| Signed / Unsigned 8-bit | |
| c — signed char | |
| my $bin = pack('c', -5); | |
| my $num = unpack('c', $bin); | |
| print "$num\n"; # -5 |
This file contains hidden or 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
| #!/usr/bin/env perl | |
| # chmod +x bindiff.pl | |
| # ./bindiff.pl old.bin new.bin | |
| # Difference range: 0x00000010 - 0x0000001f | |
| # old.bin: | |
| # 00000010 41 42 43 00 ff 10 20 7e |ABC... ~| | |
| # new.bin: | |
| # 00000010 41 42 44 00 fe 10 21 7e |ABD...!~| |
This file contains hidden or 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
| package OFP::Asset; | |
| use Mojo::Base -strict, -signatures; | |
| use Mojo::Collection qw(c); | |
| use Mojo::File; | |
| has [qw(fat oat)]; | |
| has [qw(core sup partner sil1 sil2 sil3)]; | |
| has warnings => sub { Mojo::Collection->new }; |
This file contains hidden or 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
| CC ?= cc | |
| CFLAGS ?= -O2 -Wall -Wextra | |
| # Change if you want a stricter install path | |
| LICENSE_PATH ?= /tmp/demo_license.txt | |
| CFLAGS += -DLICENSE_PATH=\"$(LICENSE_PATH)\" | |
| SECRET ?= DEMO-ONLY-SECRET-CHANGE-ME-KEEP-PRIVATE | |
| EXPIRES ?= 2030-12-31 | |
| BIND_TYPE ?= hostname | |
| BIND_VALUE ?= $$(hostname) |
This file contains hidden or 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
| #!/usr/bin/env perl | |
| use Mojo::Base -strict, -signatures; | |
| use Mojo::File qw(path); | |
| use Mojo::Collection qw(c); | |
| use Mojo::ByteStream qw(b); | |
| use Mojo::Util qw(getopt trim decamelize); | |
| use constant DEFAULT_THRESHOLD => 0.60; | |
| # ---- CLI ------------------------------------------------------------- |
This file contains hidden or 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
| <# | |
| .SYNOPSIS | |
| Collect extensive Windows host inventory & security-relevant configuration. | |
| .DESCRIPTION | |
| Produces JSON + HTML report containing: | |
| - system / OS info | |
| - installed apps (registry, winget/choco/Get-Package) | |
| - installed updates/hotfixes | |
| - services, processes, listening ports | |
| - firewall rules |
This file contains hidden or 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
| # Source - https://stackoverflow.com/questions/1194882/how-to-generate-random-number-in-bash | |
| # Posted by s1037989 | |
| # Retrieved 2025-11-05, License - CC BY-SA 4.0 | |
| rand() { | |
| perl -E '$ARGV[0]||=""; $ARGV[0]=int($ARGV[0])||length($ARGV[0]); say join "", int(rand(9)+1)*($ARGV[0]?1:0), map { int(rand(10)) } (0..($ARGV[0]||0)-2)' $1 | |
| } |
This file contains hidden or 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
| # save.py | |
| # mitmdump -s save.py | |
| """ | |
| mitmproxy addon: save each response body to a separate file and print only | |
| metadata + response headers (no bodies). | |
| Filename format: | |
| <ct_main_sanitized>__<url_escaped>__<timestamp>.response | |
| Example printed output block: |
This file contains hidden or 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
| // tc - traffic control | |
| // netem - network emulator | |
| // Start a web server that takes time to do something and respond with the Server-Timing HTTP header | |
| $ perl -Mojo -E 'a("/" => sub ($c) { $c->timing->begin("routed"); $c->render_later; Mojo::IOLoop->timer(2 => sub { $c->timing->server_timing("routed", "Routed", $c->timing->elapsed("routed")); $c->render(text => "", status => 204); }) })->start' daemon | |
| Web application available at http://127.0.0.1:3000 | |
| // Delete artificial 50ms roundtrip delay | |
| $ sudo tc qdisc delete dev lo root netem delay 25ms |
NewerOlder