#!/usr/bin/env python

import sys
import re


for line in sys.stdin:
  if ':' in line:
    passw = line.split(':')[1].rstrip()
    if passw.startswith('$HEX['):
      hexpassw = re.search('\$HEX\[([a-zA-Z0-9]+)\]', passw).group(1)
      passw = bytearray.fromhex(hexpassw).decode('latin-1')
    print(repr(passw)[1:][:-1])

@@ -288,16 +288,82 @@
 1')%0A    
+if rep.startswith('u'):%0A      print(rep%5B2:%5D%5B:-1%5D)%0A    else:%0A      
 print(re
@@ -367,16 +367,8 @@
 (rep
-r(passw)
 %5B1:%5D
@@ -366,16 +366,17 @@
 t(rep%5B1:%5D%5B:-1%5D)%0A
+%0A

deal with python2/3 incompatibilities