I don't speak english very well, but i'll try to explain my situation.
I'm trying to convert source code assembler to other source code, or build a data flow diagram that represent the code. I need some guide or maybe some code to do that.
Maybe a guide to recognize or to interpret assembler in relation with other language

Thanks!!!
Posted on 2004-03-18 13:01:18 by jeremy_k311
You might try to google for decompilers, a quick look yeilded this : http://www.autistici.org/uncc/

But you have to realize that they will be a hack at best and will only ever be useful for decompiling things that were originally made in that language. For code that was written in assembler you will for the most part be out of luck as by definition assembler does not follow the standard rules of any compiler.

Also this comes very close to the subject of RE which is forbidden here and you may find that the moderators will delete this thread
Posted on 2004-03-18 13:17:12 by donkey

For code that was written in assembler you will for the most part be out of luck

Not with the kind of code that's most often pasted here ^_^. But sure, some of the more "interesting" assembly code will be hard to convert to 'good' code in another language - will probably end up looking pretty crappy.
Posted on 2004-03-18 13:25:35 by f0dder
OK! I'll try to explain this, first in spanish (more easy for me):
Mi intencion no es realizar ninguna accion de tipo Cracking, es solo un Proyecto Universitario de Ingenier?a de Software, aclaro esto para que no piensen mal.

Now, i'll try to translate it:

My intention with this is just a Universitary Project about Software Enginnering, just that, no exists intentions of any cracking action.

Gracias por la ayuda y por la atenci?n!!! :)
Thanks for your help !!! :)
Posted on 2004-03-19 08:49:47 by jeremy_k311
Hi there, I understand that. Also I not think that your translation is not good at all. ;), but no problem.


I supose that if is an university project then is not much complex.

My sugestions:

? Know in what sintaxis is the example, source or prog.
? Separe the codes that are made for a specific porpuose (functions or procedures). If there are this they will have a name. With this names (that are normally descriptive), and if the teacher give to you the porpuose of the source code, then you can draft a little the flow of the program.
? Search for the difurcations of the programm:
a) for conditional jumps.
b) for unconditional jumps.
c) for branch that are generated for a call to a function, this can be a function in the source code, or a external function, like when you call for a function on a static library, or a dll.
Know this branch will help more, also see that a) and b) are used in the structured programming like the names for:
+if/else/else if.
+ for, while and other relatives.
? Now that you know where the branch are, and you construct a draft in your mind, analyse the specific parts. The porpuose.




With the anterior, at less you can draw secuences and the branch, also like I say in the past, if the code is separed in funct/procs, and they have descriptive name, then you have a good way to start, because you know the porpuose of the programm and you can start first, in "lugar(place)" of analyse the code, draw a flow diagram how you will do some, with the functions provided.

For more you need know asm.


* I think That is all.


Also see that I think that a flow diagram is diferent from a data flow diagram. :D


Question: Is the same a flow diagram that a data flow diagram?

I cosider that a flow diagram is that (extrange not?)... analyse the secuence, branch and suchs things, but a data flow diagram.. for me at less will require analyse too the data structures, operations and suchs things... or I am wrong?



Have a nice day or night.
Posted on 2004-03-19 09:49:16 by rea

Mi intencion no es realizar ninguna accion de tipo Cracking, es solo un Proyecto Universitario de Ingenier?a de Software, aclaro esto para que no piensen mal.

Bueno, para entender mejor:
1. Tienes c?digo fuente en ensamblador.?es c?digo libre??es el resultado de una decompilaci?n?
2. Necesitas traducirlo. ?a que tipo de lenguaje??para que?
3. El resultado final debe ser presentado como proyecto universitario.

Si aclaras ?stas dudas, podre darte un consejo acerca del m?todo a seguir.

Suerte,
Posted on 2004-03-19 23:38:43 by pelaillo

Question: Is the same a flow diagram that a data flow diagram?
There is a difference between a control flow diagram (it documents sequencing of instructions) and a data flow diagram (it documents source and destination of data).
Posted on 2004-03-20 02:00:23 by tenkey
Thx. I think both are important. Only a little thing, how will be called a analysis where you only whant extract the (a)DT's and the operations involved with them (I think this should be diferent than a control flow diagram?)?




Es importante que contestes lo que pide pelaillo, porque yo creo que el programa es solo un ejemplo y no un proyecto.
Posted on 2004-03-20 07:29:41 by rea
OK! Acerca de las cuestiones:
1- Tengo c?digo en ensamblador, el cual consigo a partir de c?digo libre que me enviaron.
2-No es necesario traducirlo a un lenguaje necesariamente, le idea es que a partir del c?digo assembler consiga dar una utilidad como crear un diagrama de flujos b?sico, o como dije pasarlo a otro lenguaje en forma basica
3-El resultado es para presentarlo en un proyecto que he estado investigando.

Exactly, if i can't obtain a translation, i just need a flow diagram.
Build a basic representation of the program.
This project is a investigation that i choose. I don't have a teacher or a guide to help me.

Thanks a lot for all help you bring to me!!! :D

Gracias por la ayuda y la atenci?n prestada!!!
Posted on 2004-03-22 13:35:54 by jeremy_k311

le idea es que a partir del c?digo assembler consiga dar una utilidad como crear un diagrama de flujos b?sico, o como dije pasarlo a otro lenguaje en forma basica


Lo mejor es que primero encuentres las articulaciones
del c?digo, es decir, que lo dividas en partes. Para eso debes
dividirlo primero en procedimientos.

Luego debes entender qu? ocurre en cada procedimiento y
darle a cada uno un nombre que lo describa. Qu? hace un
procedimiento lo descubres determinando qu? tipo de
decisiones se toman y bajo qu? criterios se hace.

Por ?ltimo, debes determinar c?mo se relacionan los
procedimientos para formar una secuencia coherente.



i just need a flow diagram.
Build a basic representation of the program.


You need find the articulations of the program, you must
divide it in procedures or modules.

Then, you must understand what is the function of each
procedure and give them descriptive names. This you can
find it if you see what kind of decisions are taken and
what is the criterion.

Last, you must determine what is the relation between
the procedures to make a coherent sequence.
Posted on 2004-03-23 04:07:20 by n u M I T_o r
hgb write:
I supose that if is an university project then is not much complex.


Sorry, the phrase is: If is not a university project, then should not be much complex.

Now you say that is a university project.

3-El resultado es para presentarlo en un proyecto que he estado investigando.


No entiendo, ?tienes que hacer una aplicaci?n que analice c?digos fuente en asm ? solo tienes que presentar el diagrama de este espec?fico c?digo?.


a partir del c?digo assembler

Bueno, como lo veo, si no es un 'desensamblado' de un programa y lo que tienes es el codigo, talvez, entonces sea un poco m?s sencillo (solo un poco), ya que como dice n u M I T_o r
dividirlo primero en procedimientos
Ya que tienes el codigo, supongo que entonces tienes los nombres descriptivos, si es asi, entonces lo siguiente, ser?a ver como son llamadas las partes del codigo.

Por ejemplo puedes analizar desde lo m?s general, que ser?a analizar cada fragmento de c?digo o procedimiento, que procedimientos llama y hacer una lista con los procedimientos que llama (desde adentro de el procedimiento), con esto podr?s empezar a trazar diagram?s. (No se si me explique bien).



Analizando las llamadas.
Una de las cosas que debes tener en cuenta es que normalmente se llama (call) a las rutinas, pero siempre despues de la ejecuci?n se regresa al punto de llamada(la siguiente instrucci?n))*, tienes que tener en cuenta casos especiales, como es la recursividad que puede ser directa o indirecta, creo que puedes reconocer la directa, cuando en tu lista tengas el nombre (o la direcci?n) de un mismo procedimiento llamandose a si mismo, la indirecta, cuando siguiendo una secuencia de llamadas, llegues de nuevo a un procedimiento por el cual ya pasaste.

Otro caso que debes tener en cuenta, es cuando el programa tenga m?s de un hilo.



Bueno, ahora que tenemos un breve esbozo de ?por qui?n son llamados? los procedimientos, creo que ser?a momento de analizar bajo que circunstancias, esto es analizar la estructura interna de cada procedimiento, los datos que se le pasan, y como se ven afectados para mandar a llamar a X ? Y rutina.

Estar?n de acuerdo que determinadas entradas, dar?n determinada s?lida, por eso es importante ver de que manera son afectados los datos y analizar bajo que circunstancias se llamar? a el otro procedimiento.



Bueno, creo que ya escrib? mucho ;)


* La unica manera que no suceda esto, es si el programa modifica internamente la direcci?n de retorno.


-------------------------------------------------------------------------------------------

3-El resultado es para presentarlo en un proyecto que he estado investigando.


I not understand, ?You have to make an applications that analize sources of asm or only show the diagram of this specific code?.


a partir del c?digo assembler

OK, like I see, if is not a 'disasembly' of a programm and you have the code, maybe, become a little less hard (a little), because like sayn u M I T_o r
dividirlo primero en procedimientos
Ya que you have the code, I supose then that you have the descriptive names, if is like that, then the next will be see how the parts of the code are called.

For example you can analize from the general, that will be analize each part of the code or procedure, wich others call 'he' and make a list with the procedures that are called (from inside of this procedure), With this you can start drawing diagrams. (I dont know if I explain well).



Analising the calls.
One of the things that you need take care is that normally the procedures are called (call) the rutines, but after the execution is a return to the call point(the next instruction)*, you have to take a count of special cases, like is the recursivity that can be direct and indirect, I think that you can recognogize the direct, when you have the name in the list (or the direction) of a equal procedure calling itself, the indirect, when you follow a secuence of calls, and enter to a procedure that you have visited before.

Another case that you need take at count, is when the programm have more than one thread.



OK, Now that we have a draft of ?for who are called? the procedures, I feel that is moment to analiseunder what circunstances, this is analize the internal structureof each procedure, the data that is passed, and how is affected to choice call X or Y routin.

You will be 'acord' in that determinate entries, give determinate outputs, for that is important see in what way the data is affected and analise under what 'circunstances' will be called a procedure.



OK, I think I write to much ;)


* The only whay that not happend this, is if the programm modificates internally the return address.

Have a nice day or night.
Posted on 2004-03-23 07:54:48 by rea
Gracias a todos por las ideas, estoy trabajando para ver si puedo obtener un resultado.
Solo queria aclarar que el c?digo en assembler lo obtengo con un programa desensamblador, por lo cual no tengo los nombres de las procedimientos o funciones.

Tambien aclarar que tengo que hacer un programa que analice el assembler y produzca un resultado como el diagrama.

Con la ayuda que me brindaron buscar? la forma de encontrar un esquema basico de funcionamiento :)

------

Thanks for all ideas! I'm working to obtain a good result.
I just want to clarify that assembler code i obtain is result of disassembler program, then, i don't have the names of procedures or functions.

Also, i must explain that i have to make a program that analize the assembler code and then generate a result like a diagram.

With your help i'll try to find a way to doing it.
Thanks for your patience! :D
Posted on 2004-03-23 10:11:23 by jeremy_k311