Conflict Crusher

by sealldev
🚩 CTFs HackTheBox University CTF 2024 coding
Conflict Crusher / HackTheBox University CTF 2024
Conflict Crusher

Description

Awakened by Lena Starling, you, the legendary Space Cowboy, must assist the Minutemen in their fight against the Frontier Board. Their intercepted data streams hold vital intelligence but are riddled with conflicting keys. Use your skills to resolve these conflicts and unify the data to aid the resistance!

Original Writeup on seall.dev

We need to combine two dict’s, when conflicting keys occur overwrite the value in the first dict with the one from the second. We are given them in strings.

String Dict input: {β€˜a’: 1, β€˜b’: 2, β€˜c’: 3}, {β€˜b’: 4, β€˜d’: 5}

Merged Output: {β€˜a’: 1, β€˜b’: 4, β€˜c’: 3, β€˜d’: 5}

# Input two dictionaries as strings
dict1_str = input()
dict2_str = input()

# Write your solution below and make sure to print the dictionary
from json import loads
d1 = loads(dict1_str.replace("'", "\""))
d2 = loads(dict2_str.replace("'", "\""))
dout = d1

for k in d2.keys():
    dout[k] = d2[k]

print(dout)

Flag: HTB{n0w_1m_0ff1c4lly_4_c0nfl1ct_crunch3r_y4y!_4050aff36d539d4441180a9616746b56}

Share this writeup

Contribute

Found an issue or want to improve this writeup?

Edit on GitHub