Hello from Germany
So my problem is something very simple, i think. I need to Decode Base64 until there is no Base64, i check with an RegEx if there is some Base64 but i got no Idea how to decode until there is no Base64.
In this short Code i can Decode the Base64 until there is no Base64 because my Text is defined. (Until the Base64 Decode Stuff isn't "Hello World" decode)
# Import Libraries
from base64 import *
import re
# Text & Base64 String
strText = "Hello World"
strEncode = "VmxSQ2ExWXlUWGxUYTJoUVVqSlNXRlJYY0hOT1ZteHlXa1pLVVZWWE9EbERaejA5Q2c9PQo=".encode("utf-8")
# Decode
objRgx = re.search('^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$', strEncode.decode("utf-8"))
strDecode = b64decode(objRgx.group(0).encode("utf-8"))
print(strDecode.decode("utf-8"))
while strDecode != strText.encode("utf-8"):
strDecode = b64decode(strDecode)
print(strDecode.decode("utf-8"))
Does anyone have an Idea how i can decode the Base64 until there is the real text (no more base64)
P. S. sorry for my bad english.