❔ How to reverse engineer your simple console app code?
Just curious. Is this possible with programs like x64dbg or... ?
T
Thinker•509d ago
You can use ILSpy or similar to open your DLL or EXE and view the IL code
C# is ridiculously easy to reverse-engineer
O
ogie1985•509d ago
Maybe some background info from me: I see people doing stuff with x64dbg but this is not intented to reverse-engineer c# stuff?
T
Thinker•509d ago
I have no idea what x64dbg is
O
ogie1985•509d ago
T
Thinker•509d ago
ah, so an ASM viewer
O
ogie1985•509d ago
Didn't know there was a word for that
T
Thinker•509d ago
Well, C# compiles to IL, which looks kind of like ASM but more high-level. IL is a binary format which is emitted directly into DLL or EXE files by the C# compiler, which means that you can use a program like ILSpy which allows you to view the IL binary in an ASM-like format, and even as C# code.
You can also go to Sharplab.io if you want to see the IL generated by some simple code
M
MODiX•509d ago
O
ogie1985•509d ago
Ohh I see. So IL is also called managed code right?
T
Thinker•509d ago
Afaik "managed code" refers to something else unrelated to IL
O
ogie1985•509d ago
Hmm reading this book C# in a nutshell and this sentence over here says:
"C# is called a managed language because it compiles source code into managed code, which is represented in Intermediate Language (IL)"
X
x0rld•509d ago
for me it's managed because there is a garbage collector 🤔
T
Thinker•509d ago
I think "managed" might just refer to the fact that there is an runtime
Although you're better off asking about that in #allow-unsafe-blocks
You can write unmanaged code if you just don't use managed types (everything that isn't a reference type or contains reference types as fields)
O
ogie1985•509d ago
I need to get a better understanding of this JIT thing. Because that "ASM Viewer" looks alot like that jit in sharplab.io
T
Thinker•509d ago
JIT is the ASM code that the Just In Time compiler generates at runtime
O
ogie1985•509d ago
T
Thinker•509d ago
You write C#, the C# gets compiled into IL by the compiler, the runtime runs the IL by running it through the JIT which turns the IL into machine code at runtime.
O
ogie1985•509d ago
ohhhh
T
Thinker•509d ago
Although there is also native Ahead Of Time (AOT) which compiles C# directly to architecture-specific machine code
O
ogie1985•509d ago
Ok, ok. That's a bit to deep :D. But I had a feeling that I had to understand this first to start reverse engineer stuff
X
x0rld•509d ago
just use ILSpy for classic program
T
Thinker•509d ago
Although be aware that depending on what you reverse engineer, it may or may not be against the terms of service of that thing. Although who tf cares about tos anyway.
O
ogie1985•509d ago
haha, yeah true. But btw it's just my own console app which i'm trying to run trough that
I'll give a little sneakpeak of what i'm trying to accomplish
O
ogie1985•509d ago
O
ogie1985•509d ago
Trying to run this trough that program and I want to change the program via that tool to hit the first if statement
But all I see is machine code with zero string references of what I'm showing lmao
A
ACiDCA7•509d ago
or from ilspy
A
ACiDCA7•509d ago
O
ogie1985•509d ago
I'll download ilspy realquick but I assume you cant change the behaviour of ur .exe
A
ACiDCA7•509d ago
you could use dnspy
its ilspy but can debug runnign process
meaning change variables on runtime
theoretically you could also change the code, but it never worked for me^^
while i am at it.. i guess you are using visual studio to develop.. it can decompile aswell
O
ogie1985•509d ago
hmmm
X
x0rld•509d ago
there is a plugin to install ILSpy as a plugin in VS
O
ogie1985•509d ago
itneresting
O
ogie1985•509d ago
I also found this: https://www.youtube.com/watch?v=ZDXTdgfG5HE&ab_channel=howCode
howCode
YouTube
Simple Reverse Engineering on Windows
In this video we'll be learning how to use simple reverse engineering techniques to see inside a Windows EXE and manipulate it.
The program we'll be looking at asks for a secret code, we'll be manipulating the program to make it accept any code we give it.
Go to https://howcode.org for more!
Link to the program we'll be manipulating: http://h...
O
ogie1985•509d ago
if u skip to 6:32 that's exactly what im trying to do
well sort of
so u can basically open the .exe in vs studio and change code ?
X
x0rld•509d ago
you cannot change it with ilspy
O
ogie1985•509d ago
for my examply
with IL spy you can change make it so it runs the first if statement?
M
MODiX•509d ago
Ogie#1985
Quoted by
<@!971836278058405898> from #How to reverse engineer your simple console app code? (click here)
React with ❌ to remove this embed.
X
x0rld•509d ago
well looks like you can change things with ilspy with the video you linked
🤔
never tried
¯\_(ツ)_/¯
looks like ILSpy can edit the ILCode and you can export it after with save as
A
ACiDCA7•509d ago
if you look more closely in the vid he is using reflexil to change the il
X
x0rld•509d ago
oh yeah
it's a plugin ? 🤔
A
ACiDCA7•509d ago
seems like it
https://github.com/sailro/Reflexil
GitHub
GitHub - sailro/Reflexil: The .NET Assembly Editor
The .NET Assembly Editor. Contribute to sailro/Reflexil development by creating an account on GitHub.
X
x0rld•509d ago
so just use that ogie
O
ogie1985•509d ago
Ilspy with reflexil okay
Many people use x64dbg for some reason but hmm
A
ACiDCA7•509d ago
x64dbg is for native apps
O
ogie1985•509d ago
What do you mean with native apps?
X
x0rld•509d ago
C or C++ or anything compiled to native
O
ogie1985•509d ago
ohh nvm
T
Thinker•509d ago
apps containing native machine code
O
ogie1985•509d ago
isn't the console app converted to machine code after publishing ?
X
x0rld•509d ago
nop it's ILCode
T
Thinker•509d ago
C# is compiled to IL
O
ogie1985•509d ago
i see so the clr covnerts il to native code of the machine
X
x0rld•509d ago
O
ogie1985•509d ago
yeah ok
X
x0rld•509d ago
yeah
O
ogie1985•509d ago
hmmmmm
Ok my theory was if it could get converted to machine code somehow you were able to do stuff with x64dbg on that simple console app
T
Thinker•509d ago
just use ILSpy
O
ogie1985•509d ago
I give up on x64dbg going to try ilspy now
X
x0rld•509d ago
at the runtime there is at some point machine code but it's clearly easier to manipulate ILCode
T
Thinker•509d ago
If you try to use x64dbg on IL then you'll just end up with garbage
O
ogie1985•509d ago
Reflexil doesn't work with latest version of ilspy or a tleast preview version
I guess I'll just wait. Cba uninstalling and downgrading versions
Thanks man dnspy did the job
well I thought that editing the file/ change code would work but nvm
MW
Monsieur Wholesome•509d ago
dnspy for the win
dips
O
ogie1985•508d ago
naa dnspy had the option te modify code but it doesn't compile 😒
only solution is left to downgrade il spy and get reflixit for it but i guess ill open an issue on dn spy repo
O
ogie1985•508d ago
tldr; dnspy is waiting for release version 8 of ilspy. After that dnspy will be upodated to edit code. Huge
source: https://github.com/dnSpyEx/dnSpy/discussions/149
GitHub
What language version does this version of DnSpy support? · Discuss...
As the title asks, thanks in advance.
O
ogie1985•508d ago
Also for context: dnspy publicly archived but dnSpyEx is an (fork) continuation of the dnSpy repo
No one knows why the heck main repo closed but assumptions are buyouts and to remain silent
A
Accord•507d ago
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
51KMembers
View on DiscordWant results from more Discord servers?
More Posts❔ Ef Core Constructor problemHello its my first big project with ef. I have an class with 3 attributes and one constructor that i❔ many to many database cant update the 3rd tablecant update the 3rd table who had the cust id and drink id✅ rest requests helphello i am trying to send to os command injections with RestSharp to dvwa for pentestering can someo❔ Source generator, generating type script definitions at compile timeI would like to make a automatic type script definition from code, i consider to use source generato❔ Making an async method without anything to async insidelet's say i have following scenario:
```csharp
void Foo()
{
for(int i = 0 ; i < 10000000 ;i++){} /❔ Reading file from the folder where .csproj isHow can i read files from folder where .csproj is? just like webapps allow to do, they do not copy f✅ Interoperability between incompatible typesHi!
I'm trying to pass a class back-and-forth from C# to CPP.
This class contains some members that ❔ Set item to null inside a listHey! I am trying to remove some items from a JSON object (created like `var model = new ObjectModel{Refactoring long if statement that checks for user rolesHi, I'm trying to find a cleaner way of refactoring this if code block that checks for each user rol❔ IEnumerable and dependency injectionif i want to loop enumerable from DI multiple times
```
var foos = services.GetRequiredService<IEnum❔ How did you learn . NET ?Books /youtube/udemy /other courses, what resources made you learn .NET to use as your job as web de✅ Is it possible to disable these properties on EF6? Web API 2 project, multi-layered, NF472SCENARIO
- Solution type is NET Framework 4.7.2 (it is, what it is).
- I have this project, I'm cons✅ This EntityFramework query can not be translated for SQLiteThe issue lies within `Intersect`. The point of the query is to fetch the current user, and to popul✅ Detect Network RequestI want make service that detect all connection to specific domain or ip?
And if this request contain❔ CORS errorHello, I have Cors error on my project. I add Addpolicy in my configureServices and also add app.Us❔ Ambiguities? How?Idk how i can resolve this i don't see the problem✅ How can I get rid of this annoying pointer thing in the first row, datagridview winforms^✅ How can I use a row header of a datagridview to display the row number instead of being empty?^✅ How can i properly display this datagridviewHow can i get rid of the row select thing on the left (just white space)✅ I am trying to output a 2D array to a datagridview, but it is not outputting correctlyIt is saying System.Int32[]