From 280e9d8af8b075b1fadd47ab1eee9cc6e61bbd6e Mon Sep 17 00:00:00 2001 From: Terrtia Date: Wed, 18 Jul 2018 13:47:06 +0200 Subject: [PATCH] fix: Binary decoder base2 string to bytes --- bin/Binary.py | 10 +++++++--- bin/LAUNCH.sh | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/Binary.py b/bin/Binary.py index 00c422f6..29d6f2c5 100755 --- a/bin/Binary.py +++ b/bin/Binary.py @@ -30,9 +30,13 @@ def timeout_handler(signum, frame): 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)) +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): find = False binary_list = re.findall(regex_binary, content) @@ -40,11 +44,11 @@ def search_binary(content, message, date): for binary in binary_list: if len(binary) >= 40 : - decode = decode_binary_string(binary).encode() - print(decode) + decode = decode_binary(binary) print(message) type = magic.from_buffer(decode, mime=True) + print(type) find = True hash = sha1(decode).hexdigest() diff --git a/bin/LAUNCH.sh b/bin/LAUNCH.sh index 1f987479..d393d621 100755 --- a/bin/LAUNCH.sh +++ b/bin/LAUNCH.sh @@ -144,6 +144,8 @@ function launching_scripts { sleep 0.1 screen -S "Script_AIL" -X screen -t "Base64" bash -c './Base64.py; read x' 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' sleep 0.1 screen -S "Script_AIL" -X screen -t "Phone" bash -c './Phone.py; read x'