Files
XSStrike/core/encoders.py

10 lines
276 B
Python
Raw Normal View History

import base64 as b64
import re
2018-11-16 21:13:45 +05:30
def base64(string):
2018-11-16 21:13:45 +05:30
if re.match(r'^[A-Za-z0-9+\/=]+$', string) and (len(string) % 4) == 0:
return b64.b64decode(string.encode('utf-8')).decode('utf-8')
else:
return b64.b64encode(string.encode('utf-8')).decode('utf-8')