磐石行动-今天天气怎么样?
打开程序分析32位无壳,打开程序开始分析
前面的str做了一个校验,长度得是30,还进过了crazy和ohh函数的加密,后面看的出来,my_function是一个函数,不过被smc加密了,后续直接动调看是什么函数就行,先把这个开头的str给解除啦。
这是crazy的代码,判断奇偶数
ohh,做一个比较
把值提取出来做个逆运算,还原str
enc=[0x00000066, 0x0000006B, 0x00000063, 0x00000064, 0x0000007F, 0x00000063, 0x00000069, 0x00000070, 0x00000057, 0x00000060, 0x00000079, 0x00000054, 0x00000078, 0x0000005B, 0x0000006B, 0x00000050, 0x00000067, 0x00000054, 0x00000073, 0x00000061, 0x0000007C, 0x00000050, 0x00000064, 0x00000048, 0x0000006C, 0x00000056, 0x0000007E, 0x00000046, 0x00000065, 0x00000060]
str=''
for i in range(len(enc)):
if (i & 1) != 0:
str+=chr(enc[i] + i)
else: # 如果i是偶数
str+= chr(enc[i] ^ i)
print(str)
#flag{how_is_the_weather_today}
虽然得到一个flag,但是不对,后面解密smc看到函数
可以从他的特征明显看出来是rc4,那么详细分析一下
原来我们刚才得到了的是rc4的密钥,直接动调获得flag就好了。
rc4,流密码直接动调,脚本都没写
flag{This_is_a_beautiful_day!}
磐石行动-ezlogin
是一个安卓逆向用jadx打开分析一下关键函数都要哪些
通过wrong找到关键函数,des解密,还有base64的加密。
key在native层,条件都拿到了,直接gpt写代码
from base64 import b64decode
from Crypto.Cipher import DES
from Crypto.Util.Padding import unpad
def des_decrypt(encrypted_text, key):
try:
# Decode the base64 encoded encrypted text
encrypted_bytes = b64decode(encrypted_text)
# Ensure the key is 8 bytes long for DES
key = key.ljust(8)[:8]
# Initialize DES cipher in ECB mode
cipher = DES.new(key.encode('utf-8'), DES.MODE_ECB)
# Decrypt and unpad the data
decrypted_bytes = unpad(cipher.decrypt(encrypted_bytes), DES.block_size)
# Convert bytes to string
decrypted_string = decrypted_bytes.decode('utf-8')
return decrypted_string
except Exception as e:
print(f"An error occurred: {e}")
return None
# Example usage
encrypted_string = "yU4Ad3tEpSgTdmBJ5wDbUhZAeY+Lm3VobQEQLyck1lfhEJ+OKcyU10PMij+RGqus" # Ensure this is actually DES encrypted data
key = "key_here"
decrypted_string = des_decrypt(encrypted_string, key)
print("Decrypted string:", decrypted_string)
#flag{f3c826ec-8453-4b80-8f52-468e0f9e05bf}