Code Sample |
#!/bin/bash # # hex2ascikey.sh # Takes hex wifi key as argument and prints asci # echo $1 | sed 's/[-:]//g' | while read -n 2 HEXCH; do printf "%s\x$HEXCH" 2>/dev/null; done | sed 's/\\\x$/\n/' |
Code Sample |
#!/usr/bin/perl # # hex2ascikey.pl # Takes hex wifi key as argument and prints asci # use strict; use warnings; my $hexkey = shift; chomp $hexkey; $hexkey =~ s/^[+]+//; # or can't cope with a leading + $hexkey =~ s/[:-]//g; # Insert space every 2 chars $hexkey =~ s/([^\s]{2})/$1 /gs; my @A = split (/ /, $hexkey); foreach my $c (@A){ my $dec = hex($c); print chr($dec); } print "\n"; |
Code Sample |
#!/bin/bash # # hex2ascikey.sh # Takes hex wifi key as argument and prints asci # echo -n $1 | sed 's/[0-9A-Fa-f]//g t message :message s/^.\+$/Ignoring non-hex chars &\n/' echo -n $1 | sed 's/[^0-9A-Fa-f]//g' | while read -n 2 HEXCH; do printf "%s\x$HEXCH" 2>/dev/null; done | sed 's/\\\x$//' echo |