C
C#11mo ago
pjd

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
pjd
pjdOP11mo ago
heres the code tho
Buddy
Buddy11mo ago
Doing a CTF?
pjd
pjdOP11mo ago
yessir but its impossible for me since i dont know how to work with c#
Angius
Angius11mo ago
Just FYI, ValueTuple<T1, T2> can be just (T1, T2) and new ValueTuple<T1, T2>(a, b) can just be (a, b)
Buddy
Buddy11mo ago
Are you allowed to use a decompiler? Sure feels like cheating lol
pjd
pjdOP11mo ago
yep its fake game in unity and i need to find flag in code i have full access to code by dnspy
Buddy
Buddy11mo ago
So are you allowed to execute said function? Just cloning the code and running it
pjd
pjdOP11mo ago
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
Buddy
Buddy11mo ago
You can remove base..ctor();
pjd
pjdOP11mo ago
what it means? 😄 like i said i have no knowledge about C# sorry
Buddy
Buddy11mo ago
The rest should be fine. Just .NET CLR doing its thing, calling the base constructor
pjd
pjdOP11mo ago
i mean still dont know how i should do that if i run the code its only errors like this
Buddy
Buddy11mo ago
You might need to fix some errors but it is doable
pjd
pjdOP11mo ago
It should work normally cause the game works but the code with flag idk tbh
Buddy
Buddy11mo ago
Is GetFlag ever called?
pjd
pjdOP11mo ago
not really
Buddy
Buddy11mo ago
Mind showing us how the code looks? $paste
MODiX
MODiX11mo ago
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!
Buddy
Buddy11mo ago
The one you've copied over
pjd
pjdOP11mo ago
yep
pjd
pjdOP11mo ago
BlazeBin - iegnzwvagcah
A tool for sharing your source code with the world!
pjd
pjdOP11mo ago
can u see it? i got to this now
Buddy
Buddy11mo ago
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
pjd
pjdOP11mo ago
yep i can edit it but im totally clueless about the code right now i cant debug it says there is no runable file
Buddy
Buddy11mo ago
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.
pjd
pjdOP11mo ago
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
Buddy
Buddy11mo ago
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
pjd
pjdOP11mo ago
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?
MODiX
MODiX11mo ago
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.
Angius
Angius11mo ago
All I meant is that
private readonly ValueTuple<int, int>[] numbers0 = new ValueTuple<int, int>[]
{
new ValueTuple<int, int>(241, 162),
new ValueTuple<int, int>(97, 21),
new ValueTuple<int, int>(219, 239),
new ValueTuple<int, int>(89, 58),
new ValueTuple<int, int>(37, 20),
new ValueTuple<int, int>(135, 216),
new ValueTuple<int, int>(245, 175),
new ValueTuple<int, int>(210, 230)
};
private readonly ValueTuple<int, int>[] numbers0 = new ValueTuple<int, int>[]
{
new ValueTuple<int, int>(241, 162),
new ValueTuple<int, int>(97, 21),
new ValueTuple<int, int>(219, 239),
new ValueTuple<int, int>(89, 58),
new ValueTuple<int, int>(37, 20),
new ValueTuple<int, int>(135, 216),
new ValueTuple<int, int>(245, 175),
new ValueTuple<int, int>(210, 230)
};
can just be
private readonly (int A, int B)[] numbers0 = new[]
{
(241, 162),
(97, 21),
(219, 239),
(89, 58),
(37, 20),
(135, 216),
(245, 175),
(210, 230)
};
private readonly (int A, int B)[] numbers0 = new[]
{
(241, 162),
(97, 21),
(219, 239),
(89, 58),
(37, 20),
(135, 216),
(245, 175),
(210, 230)
};
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
pjd
pjdOP11mo ago
thanks i get the point little bit but im still completely lost how to find the steps to get my answer of the flag
Angius
Angius11mo ago
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
pjd
pjdOP11mo ago
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?
Buddy
Buddy11mo ago
Destroy(yourGameObject);
pjd
pjdOP11mo ago
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
Want results from more Discord servers?
Add your server