Reverse an address

July 11, 2020 // echel0n

This script will reverse your address and gives back  in \xbla\xbla format.

Credits goes to selftaught!


  1. #!/usr/bin/env perl
  2. use 5.010;
  3. use strict;
  4. use warnings;
  5. use Getopt::Long;
  6. my $address;
  7. GetOptions('a|address=s' => \$address);
  8. if ($address) {
  9. my $len;
  10. my @bytes = split('', $address);
  11. if (($len = length $address) == 10 &&
  12. $bytes[0] eq '0' && lc $bytes[1] eq 'x') {
  13. $address = substr $address, 2, $len;
  14. }
  15. say '\x' . join ('\x', reverse ($address =~ m/../g));
  16. }