diff options
author | B. Watson <yalhcru@gmail.com> | 2016-09-21 02:38:57 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2016-09-21 02:38:57 -0400 |
commit | 4231e55a1bca84c55a53748944bcd7bada4689ec (patch) | |
tree | 17008b177d04545bc967b7b064e6cdc5c1ae8123 | |
parent | 9b629fdffebaf36d4ce6080a9390ec101ecdef5b (diff) | |
download | jumpmanjr-4231e55a1bca84c55a53748944bcd7bada4689ec.tar.gz |
add a couple more perl utils
-rw-r--r-- | dumpbytes.pl | 22 | ||||
-rw-r--r-- | grepbytes.pl | 9 |
2 files changed, 31 insertions, 0 deletions
diff --git a/dumpbytes.pl b/dumpbytes.pl new file mode 100644 index 0000000..baa3d20 --- /dev/null +++ b/dumpbytes.pl @@ -0,0 +1,22 @@ +#!/usr/bin/perl -w + +$count = 0; +while(<>) { + $_ = substr($_, 0, 79); + s/.*; \w\w\w\w // or next; + my @bytes = split " "; + push @got, eval "0x$_" for @bytes; +} + +for(@got) { + my $b = sprintf("%08b", $_); + $b =~ s/0/_/g; + $b =~ s/1/X/g; + printf "%02x ", $_; + print $b . "\n"; + $count++; + if($count == 10) { + print "\n"; + $count = 0; + } +} diff --git a/grepbytes.pl b/grepbytes.pl new file mode 100644 index 0000000..f356278 --- /dev/null +++ b/grepbytes.pl @@ -0,0 +1,9 @@ +#!/usr/bin/perl -w + +$regex = shift or die "no regex"; +undef $/; +$_ = <>; + +while($_ =~ /$regex/gc) { + printf "match at \$%04X\n", $-[0] + 0x8000; +} |