$ PERLBREW_ROOT=/data/perlbrew perlbrew init
$ . /data/perlbrew/etc/bashrc
$ perlbrew self-install && perlbrew install-cpanm
$ perlbrew install-multiple -j 10 -n perl-5.40.0 perl-5.32.1 perl-5.26.3
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 |
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
| Capture state after a fresh install | |
| # rpm -qa --qf "%{name} == %{version}\n" > /root/1.rpm-qa.txt ; rpm -qal > /root/1.rpm-qal.txt ; find / \( -path /proc -prune -o -path /sys -o -path /dev -o -path /boot -o -path /run -o -path /tmp \) -prune -o ! -type d > /root/1.files.txt ; find / \( -path /proc -prune -o -path /sys -o -path /dev -o -path /boot -o -path /run -o -path /tmp \) -prune -o -type d > /root/1.dirs.txt | |
| # wc -l 1.* | |
| 5104 1.dirs.txt | |
| 30962 1.files.txt | |
| 52912 1.rpm-qal.txt | |
| 404 1.rpm-qa.txt | |
| Add rpms and unpack tarballs | |
| # yum update -q -y && yum upgrade -q -y ; yum install -q -y firefox postgresql grafana wget rpm-build rpmdevtools; wget -q https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.15.tar.xz -O /tmp/linux-6.15.tar.xz && tar xf /tmp/linux-6.15.tar.xz -C /opt |
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
| With the sample Open Metrics SLOC scrape, how to represent that in a Grafana table with these headers? | |
| Baseline, Release, Total Baseline SLOC Ada, Total Release SLOC C++, Added SLOC Ada, Added SLOC C++, Modified SLOC Ada, Modified SLOC C++, Deleted SLOC Ada, Deleted SLOC C++ | |
| ChatGPT said: | |
| To represent the OpenMetrics SLOC data in a Grafana table with your specified headers, follow this plan: | |
| 🪄 Grafana Table Setup Plan | |
| 📋 Desired Headers: | |
| | Baseline | Release | Total Baseline SLOC Ada | Total Baseline SLOC C++ | Added SLOC Ada | Added SLOC C++ | Modified SLOC Ada | Modified SLOC C++ | Deleted SLOC Ada | Deleted SLOC C++ | | |
| 🧮 Step 1: Use Prometheus as a Data Source |
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
| JFrog Artifactory doesn't have a Perl repository type, which would regenerate a new set of Perl modules index files on every artifact change in the repository. Create a Jfrog Artifactory plugin that will regenerate the Perl index files every type a file is added, removed or modified in order to allow Artifactory to become a "DarkPAN", or offline CPAN. | |
| ChatGPT said: | |
| To enable JFrog Artifactory to act as a DarkPAN (a private/offline CPAN mirror), you can write a user plugin that listens to events like artifact deployment, deletion, or modification, and then regenerates the required Perl index files (such as 02packages.details.txt.gz, etc.). | |
| 🛠 Plugin Strategy | |
| We'll create a User Plugin in Groovy that: | |
| Hooks into the afterCreate, afterDelete, and afterMove events. |
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 strict; | |
| use warnings; | |
| use File::Find; | |
| use File::Spec; | |
| use File::Basename; | |
| use File::Path qw(make_path); | |
| use MIME::Base64; | |
| my $srcdir = shift or die "Usage: $0 /path/to/dir\n"; |
NewerOlder