Finding flag in code..
Hello I want to ask you for help. I need to find the flag in this code.
The flag should be looking like this: HCKR{flag}
I only found out how the string works since Im not C# skilled guy I need some help please.
35 Replies
heres the code tho
Doing a CTF?
yessir
but its impossible for me since i dont know how to work with c#
Just FYI,
ValueTuple<T1, T2>
can be just (T1, T2)
and new ValueTuple<T1, T2>(a, b)
can just be (a, b)
Are you allowed to use a decompiler? Sure feels like cheating lol
yep
its fake game in unity and i need to find flag in code
i have full access to code by dnspy
So are you allowed to execute said function?
Just cloning the code and running it
Im allowed to do anything to get the flag there are no rules at all
if it will work yes I can do that I tried that already somehow but it didnt work at all
You can remove base..ctor();
what it means? 😄
like i said i have no knowledge about C# sorry
The rest should be fine.
Just .NET CLR doing its thing, calling the base constructor
i mean still dont know how i should do that if i run the code its only errors like this
You might need to fix some errors but it is doable
It should work normally cause the game works
but the code with flag idk tbh
Is GetFlag ever called?
not really
Mind showing us how the code looks?
$paste
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
The one you've copied over
yep
BlazeBin - iegnzwvagcah
A tool for sharing your source code with the world!
can u see it?
i got to this now
I'm fairly sure dnspy allows you to debug the executable, can't you do that and then call said function?
So you should be able to forget about copying over code
Hell, Dnspy allows you to edit the code
yep i can edit it
but im totally clueless about the code right now
i cant debug it says there is no runable file
Is the job to reverse engineer the code or to just retrieve the text?
If there are no rules and you want to cheese it, you can just call
string myflag = Flag.getFlag();
and then do like a log call or something.i would like to try what are u saying but i dont know where..
reverse engineering is done cause i already opened the unitygame in dnspy i just need to read the flag from this code
Usually CTFs are a lot more complex, like using tools such as x64dbg, patching usually disallowed, etc.
Usually you'd extract them from RAM.
Editing code with dnspy counts as patching
I mean this is really just this I need to get the number combination between those 2 strings
HCKR{ and }
but im not that good to read the code
and see the answer
@ZZZZZZZZZZZZZZZZZZZZZZZZZ can i ask u if you know please how to work with it?
Angius
Just FYI,
ValueTuple<T1, T2>
can be just (T1, T2)
and new ValueTuple<T1, T2>(a, b)
can just be (a, b)
Quoted by
<@203166497198047232> from #Finding flag in code.. (click here)
React with ❌ to remove this embed.
All I meant is that
can just be
You also get the benefit of being able to name the tuple items
So instead of
.Item1
, in this example, it would be .A
numbers0[0].A
instead of numbers0[0].Item1
thanks i get the point little bit but im still completely lost how to find the steps to get my answer of the flag
Oh my message had nothing to do with your actual issue, I have no idea
I just subscribe to the belief that the easier the code is to parse, the easier it is to understand and find issues with it
okay i will try and maybe i will comeback later lets see
but @Net🅱orking is🎄save me pls
can i have question
i can see you are game dev
dont u know how to remove some object in unity code?
Destroy(yourGameObject);
thats me standing on checkpooint
and i need to get rid of it
because the blue barrier keeps me away from checkpoint
looking like that from distance