...sh script...
something.tar.gzNULNULNUL...bunch tarball here....7z¼¯' ...bunch of 7z compressed material here...NULNULBS=MIME-Version: 1.0 ... base64 encoded material here...
####
script_len=3265
/bin/dd if="${0}" bs=$script_len skip=1 | /bin/tar -xO | /bin/tar -xzv -C $_EXTRACT_DIR || exit 1
offset=$(/usr/bin/expr $script_len + 20480)
/bin/dd if="${0}" bs=$offset skip=1 | /bin/cat | /bin/dd bs=1024 count=26 of=$_EXTRACT_DIR/data.tar.7z || exit 1
[ -f /usr/local/bin/python ] && /usr/local/bin/python -c "with open('$_EXTRACT_DIR/data.tar.7z', 'rw+') as f: f.seek(26585); f.truncate()"
offset=$(/usr/bin/expr $offset + 26585)
####
#!/usr/bin/perl
use strict ;
use warnings ;
use File::Basename ;
# binmode(STDOUT, ":utf8");
my $fn = $ARGV[0] ;
( my $fns, my $fp, my $fs ) = fileparse( $fn, qr/\.[^.]*/ ) ;
# print "fns = $fns, fp = $fp, fs = $fs\n" ;
my $fc ;
{
local $/ ; # slurp
# ? '<:encoding(utf8)'
# open (my $fh, '<:encoding(utf8)', $fn ) or die "Failed to open file $fn with error: $!\n" ;
open (my $fh, '<', $fn ) or die "Failed to open file $fn with error: $!\n" ;
binmode $fh ; # Edit suggestion Anonymous Monk on Feb 14, 2021 at 21:31 UTC
$fc = <$fh> ;
close $fh ;
}
my $number = 'x' ;
my @numbers ;
while ( $number ne '' ) {
print "Type number where to split: " ;
$number = ;
chomp $number ;
push( @numbers, $number ) unless $number eq '' ;
}
my $start = 0 ;
for my $i (0 .. $#numbers) {
print "$i: $numbers[$i]\n" ;
my $fn2 = $fp . $fns . "." . ($i+1) ;
open (my $fh, ">", $fn2 ) or die "Failed to open file $fn2\n" ;
binmode $fh ; # Edit suggestion Anonymous Monk on Feb 14, 2021 at 21:31 UTC
print $fh substr($fc, $start, $numbers[$i]) ;
$start = $numbers[$i] ;
close $fh ;
}