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
| # $ MOJO_LOG_LEVEL=info perl -Ilib -Mojo -MUtil=sq -E 'BEGIN { $Util::log = app->log; } a("/:n" => sub { $_->render(text => sq) })->start' get /5 | |
| # 36 | |
| # $ MOJO_LOG_LEVEL=trace perl -Ilib -Mojo -MUtil=sq -E 'BEGIN { $Util::log = app->log; } a("/:n" => sub { $_->render(text => sq) })->start' get /5 | |
| # [2026-06-08 17:10:33.96373] [87592] [trace] 6^2 = 36 | |
| # 36 | |
| package Util; | |
| use Mojo::Base -strict, -signatures; | |
| use Exporter qw(import); |
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 v5.40; | |
| use strict; | |
| use warnings; | |
| use Fcntl qw(SEEK_CUR); | |
| use IO::Uncompress::Gunzip qw(gunzip $GunzipError); | |
| use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error); | |
| use IO::Uncompress::UnXz qw(unxz $UnXzError); | |
| use Time::Piece qw(localtime); |
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 | |
| } |
NewerOlder