diff options
-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; +} |