fix: Binary decoder base2 string to bytes

This commit is contained in:
Terrtia 2018-07-18 13:47:06 +02:00
parent e25dd52d64
commit 280e9d8af8
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
2 changed files with 9 additions and 3 deletions

View file

@ -30,9 +30,13 @@ def timeout_handler(signum, frame):
signal.signal(signal.SIGALRM, timeout_handler) signal.signal(signal.SIGALRM, timeout_handler)
def decode_binary_string(s): def decode_binary_string(binary_string):
return ''.join(chr(int(s[i*8:i*8+8],2)) for i in range(len(s)//8)) return ''.join(chr(int(s[i*8:i*8+8],2)) for i in range(len(s)//8))
def decode_binary(binary_string):
return bytes(bytearray([int(binary_string[i:i+8], 2) for i in range(0, len(binary_string), 8)]))
def search_binary(content, message, date): def search_binary(content, message, date):
find = False find = False
binary_list = re.findall(regex_binary, content) binary_list = re.findall(regex_binary, content)
@ -40,11 +44,11 @@ def search_binary(content, message, date):
for binary in binary_list: for binary in binary_list:
if len(binary) >= 40 : if len(binary) >= 40 :
decode = decode_binary_string(binary).encode() decode = decode_binary(binary)
print(decode)
print(message) print(message)
type = magic.from_buffer(decode, mime=True) type = magic.from_buffer(decode, mime=True)
print(type)
find = True find = True
hash = sha1(decode).hexdigest() hash = sha1(decode).hexdigest()

View file

@ -144,6 +144,8 @@ function launching_scripts {
sleep 0.1 sleep 0.1
screen -S "Script_AIL" -X screen -t "Base64" bash -c './Base64.py; read x' screen -S "Script_AIL" -X screen -t "Base64" bash -c './Base64.py; read x'
sleep 0.1 sleep 0.1
screen -S "Script_AIL" -X screen -t "Binary" bash -c './Binary.py; read x'
sleep 0.1
screen -S "Script_AIL" -X screen -t "Bitcoin" bash -c './Bitcoin.py; read x' screen -S "Script_AIL" -X screen -t "Bitcoin" bash -c './Bitcoin.py; read x'
sleep 0.1 sleep 0.1
screen -S "Script_AIL" -X screen -t "Phone" bash -c './Phone.py; read x' screen -S "Script_AIL" -X screen -t "Phone" bash -c './Phone.py; read x'