Skip to content

Instantly share code, notes, and snippets.

@ebubekirtrkr
Created February 14, 2022 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebubekirtrkr/352947254eea58e093c7a29211652444 to your computer and use it in GitHub Desktop.
Save ebubekirtrkr/352947254eea58e093c7a29211652444 to your computer and use it in GitHub Desktop.
patch strings in binary
f = open("alice.elf","rb").read()
strs={
"У тебя все получится!":\
"You will succeed!",
"Скоро все наладится!":\
"Everything will be fine soon!",
"Держи флажок flag{ne_ssi_bro}":\
"Hold the flag flag{ne_ssi_bro}",
"Может надо порешать стегу?":\
"Maybe you need to solve the stegu?",
"Ладно тебе, ты не виноват!":\
"Okay, you're not to blame!",
"Алиса любит тебя":\
"Alice loves you",
"Не сегодня, так завтра!":\
"If not today, then tomorrow!",
"Может пора уже на работу?":\
"Maybe it's time to go to work?",
"====== Алиса - виртуальный помощник v0.001 ======":\
"====== Alice - virtual assistant v0.001 ======",
"[*] Активирую семантический движок...":\
"[*] Activating the semantic engine...",
"Алиса > Привет! Я высокоинтеллектуальная система по противодейсию депрессии \"АЛИСА\"":\
"Alice > Hello! I am a highly intelligent countermeasure system",
"ию депрессии \"АЛИСА\"":\
"Yu depression \"ALICE\"",
"Алиса > Озвучь мне свою проблему и введи число [1-8]":\
"Alice > Tell me your problem and enter a number [1-8]",
"Алиса > Я же попросила, от ОДНОГО до ВОСЬМИ!":\
"Alice > I asked, from ONE to EIGHT!",
"Алиса > Прости, как-то грубовато прозвучало, давай по новой.":\
"Alice > I'm sorry, somehow it sounded rude, let's do it again.",
"Алиса > Не помогло?.. Ну ты уж прости, это бета версия.":\
"Alice > Didn't help?.. Well, forgive me, this is a beta version.",
"Алиса > Могу записать тебя к психологу. Напиши свое имя:":\
"Alice > I can sign you up for a psychologist. Write your name:",
"Алиса > Записала на 12.02 в 13:37. Пока!":\
"Alice > Recorded on 12.02 at 13:37. Till!",
"Алиса > ":\
"Alice >"
}
for st,r_st in strs.items():
st=st.encode()
r_st=r_st.encode()+b"\x00"
if len(r_st)>len(st)+1:
print("Lenght exceed",st,r_st)
continue
r_st= r_st.ljust(len(st),b"\x00")
f=f.replace(st,r_st)
print("success",r_st)
open("alice_patched.elf","wb").write(f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment