Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to convert .so file into .c file?

Tags:

c

.so

I am writing a C program and I have converted it from .c to .so file using GCC. I was little curious to know if is there any way to convert back the .so file to .c file.

Assume I am shipping my code to someone and it contains all the .so files. Is there a chance that someone can get access to my source code using any tool, editor, technique etc?

like image 910
user3457384 Avatar asked Apr 10 '19 09:04

user3457384


People also ask

What is .so file in C?

An SO file is a shared library used by programs installed on the Linux and Android operating systems. It contains common program functions and logic that multiple programs require access to.

How do I open a .so file?

so file is a binary file used as a native library on Android. Normally it's a part of an Android application. If you want to see its content, you need to open it as a binary file in a binary (hex) viewer. In any case you won't see much there, but hex code.

Are .so files binary?

so are dynamic libraries. If you use code stored inside them, it's not taken and embedded into your own binary. Instead it's just referenced, so the binary will depend on them and the code from the so file is added/loaded at runtime. In Visual Studio/Windows these would be .

What is a so file in C++?

A *.so file is a compiled shared object (roughly equivalent to a dll in windows). It contains all the information for a function in a language the machine understands. This is not necessarily the same language as the one it is written in - If the original was not pure assembly, it almost certainly isn't the same language.

How do I convert a folder to an ISO file?

Next, click on Browse for Folder and select the folder you want to convert to an ISO image. Next, click on Choose ISO and select the save location for the ISO file. You can change the volume label name or leave it as default. Click on Options to customize the File System and ISO Settings .

Can I convert so files to DLL files?

We're not aware of any programs that can convert SO to DLL for use on Windows and considering what these files are and what they do, it's not likely there's one out there. It's also not a straightforward task to convert SO to other file formats like JAR or A (a Stat Library file).

How to convert a so file to a JAR file?

It's also not a straightforward task to convert SO to other file formats like JAR or A (a Stat Library file). You might be able to "convert" SO files to JAR files by just zipping them into an archive file format like . ZIP and then renaming it to .JAR. The name of a Shared Library file is called a soname.


1 Answers

You can’t get the original C source file back, because that contains information that are simply not represented in the machine code inside a shared object (.so) file.

However, object code can be disassembled into readable machine code, which an expert can understand. So the logic in your C code shouldn’t be considered “secret”.

There are methods of obfuscating code to make it harder to understand disassembled code but these methods have varying degree of effectiveness, and the more effective they are the more side-effects they carry (predominantly by making code execution a lot slower).

like image 58
Konrad Rudolph Avatar answered Oct 19 '22 15:10

Konrad Rudolph