Recover BGP password (Juniper JUNOS)
# Get a root shell:
jahil@junos> start shell
% su - root
Password:
jahil@jahil%
# View the contents of /var/etc/keyadmin.conf
jahil@jahil% less /var/etc/keyadmin.conf
tcp 179 0.0.0.0 10.0.0.1 md5 instance default 0x6162636431323334
tcp 179 :: 2001:DB8:1::1 md5 instance default 0x313233717765727479
# Run the following command on a system with Perl :
jahil@jahil:~>perl -e 'print "Hex: ";$_=<>;print "MD5: ";s/(\w\w)/\1:/g;for (split(/:/)) {printf "%s", chr(hex($_))};print "\n"'
Hex: 0x6162636431323334
MD5: abcd1234
jahil@jahil:~>perl -e 'print "Hex: ";$_=<>;print "MD5: ";s/(\w\w)/\1:/g;for (split(/:/)) {printf "%s", chr(hex($_))};print "\n"'
Hex: 0x313233717765727479
MD5: 123qwerty
That's it! Many thanks for the person who provided me this code and to the person who developed it :)