G-Code - Decrypting Z-Code to G-code - file-format

I have a Zortrax m200 3d printer which you may/ may not be familiar with. It is closed source, and uses its own proprietary software to produce Z-code files which should in principal be almost identical to G-code.
My curiosity has kicked in and I'm wondering whether there is a way to decrypt a Z-code file or convert a g-code file to z-code. How would one go about investigating this?
Here is a z-code file:
[https://drive.google.com/file/d/0ByYqoSxe29qtS05UZlpDclBZNWs/view?usp=sharing][1]

Yes, possible to do it. You can find a good tool (with source code) here: https://github.com/bonafid3/zcode2gcode
to convert ZCode to GCode.

Related

How can I get a `Makeheaders` binary for Windows?

I'm tired of seperately having to generate a declaration in the header file for most of the functions I'm defining in my C file. Hence, I would like to automatize this.
I've found an ideal application for this: Makeheaders
Unfortunately only the sources seem to be available, no readymade binary.
Documentation: https://www.fossil-scm.org/xfer/doc/trunk/src/makeheaders.html
Code: https://code.launchpad.net/~lockal/makeheaders/head
Does someone know where to get a binary? Would it be hard to somehow build it myself?
You can download the source code from here. It is a single makeheaders.c file.
then you just need to call cl.exe makeheaders.c it will generate a makeheaders.exe that you can use.

How to decode the c source code which is gcc compiled [duplicate]

This question already has answers here:
How can I view the C code after compilation in binary code?
(5 answers)
Closed 7 years ago.
I accidentally deleted my source program, now i only have the gcc compiled code.Is there any way to get back my source code.
Recovering C source from a binary has been described as "turning hamburger back into cows". You will not be able to recover your original source code. At best, you will get back some code that's functionally equivalent to your original source, but it won't contain any of your original variable names, comments, macros, etc., it may not be structured the same (depending on how aggressively it was optimized), and it may not be very understandable (again, depending on how it was optimized).
Hopefully the original is still recoverable somehow.
You can use a disassembler, but you'll never be able to fully restore the program's source code.
To prevent this in the future, I recommend either using source control, like Git or Subversion. Using these tools, you will always have backups of your code in case a big mistake like this were to happen.
If you are using an Eclipse-based IDE, it might have a saved version of your source in its history. If so, right-click on the project and select "Restore from Local History...".
EDIT
Otherwise try grep -a -C 200 -F 'Unique string in text file' /dev/sda1 > OutputFile; replace 200 with the number of lines you think are in the file and /dev/sda1 with the partition.
See the Text file recovery section at https://wiki.archlinux.org/index.php/File_recovery for more info.
Good luck!

Detecting UPX programmatically

I'm trying to figure out how to detect whether a binary has been compressed with UPX. I am using a simple CRC to detect whether my app was in any way changed and if the CRC failed on the size due to a packer I would like to detect that as OK.
Right now I am starting with UPX.
So, is there any marker on the binary? are there any specific JMP or other instructions that I should search?
This will mainly be tested in Windows, but in the future I might add it to Linux as well.
Any help (and code) is appreciated.
ADDED:
I found that in the 10 binaries I checked the
AddressOfEntryPoint
Import Directory RVA
Resouce Directory RVA
either point to UPX or have an offset that is set by UPX. Any information on this?
Thanks
Download upx source code from UPX Homepage and open src/p_w32pe.cpp file; the function you are looking for is;
int PackW32Pe::canUnpack()
This function checks if the file is compressed with win32 upx.
You might try checking the section names of the executable. UPX changes them to UPX0, UPX1, UPX2, I believe.

make file running on Linux - how to ignore case sensitive?

I have a huge project, whole written in C language and I have a single make file that is used to compile it. The project C files contains lots of capitalize problems in it's header files, meaning there are tones of header files that were miss-spelled in lots of C files.
The problem is I need to migrate this project to compile on Linux machine and since Linux is case sensitive I got tones of errors.
Is there an elegant way which I can run make file in Linux and tell him to ignore case sensitive?
Any other solution will be welcome as well.
Thanks a lot.
Motti.
You'll have to fix everything by hand and rename every file or fix every place with #include. Even if you have a huge project (comparable with linux kernel), it should be possible to do this during a hour or two. Automation may be possible, but manual way should be better - because script won't be able to guess which name is right - filename, or the name used in #include.
Besides, this situation is a fault of original project developer. If he/she wasn't sloppy and named every header in every #include correctly, this wouldn't happen. Technically, this is a code problem similar to syntax error. The only right way to deal with it is to fix it.
I think it takes not too long to write a small script, which goes thru the directories first, then replaces C headers. Explained:
Scan the headers' folder and collect filenames.
Make a lowercase list of them. You have now original and locased pairs.
Scan the C source files and find each line contains "#include"
Lowercase it.
Find the lowercase filename in the list collected and lowercased from headers.
Replace the source line with the one collected from headers.
You should put the modified files into a separate folder structure, avoid overwriting the whole source with some buggy stuff. Don't forget to create target folders during the source tree scan.
I recommend a script language for that task, I prefer PHP, but just it's the only server-side script language which I know. Yep, it will run for a while, but only once.
(I bet that you will have other difficulties with that project, this problem is not a typical indicator of high quality work.)
Well I can only tell you that you need to change the case of those header files. I don't know that there is any way you can make it automatic but still you can use cscope to do it in a easier way.
http://www.linux-tutorial.info/modules.php?name=ManPage&sec=1&manpage=cscope
You can mount the files on a case-insensitive file system. FAT comes to mind. ntfs-3g does not appear to support this.
I use the find all and replace all functionality of Source Insight when i have to do complete replacement. But your problem seems quite big, but you can try the option to replace every header file name in all occurences of source files using the
"Find All" + "Replace" functionality. You can use notepad++ too for doing the same.
A long time ago there was a great tool under MPW (Macintosh Programmer's Workshop) called Canon. It was used to canonize text files, i.e. make all symbols found in a given refernce list have have the same usage of upper/lower case. This tool would be ideal for a task like this - I wonder if anything similar exists under Linux ?

.obj to .cpp converter?

Is there any .obj to .cpp converter?
Is it possible to do it?
MICROSOFT VISUAL STUDIO auto-magically deleted my code files when pressed the F5 key.
Please help me.
I have the .obj files (VS forgot to delete them.ha ha ha).
Unfortunately it is impossible to decompile an .obj file back to source. More info here.
shut down your computer, boot from removable media, some sort of the UNIX, and run strings utility on your hard drive. It may be able to recover text off your source code.
As everyone has pointed out, this is impossible.
I would suggest that before you rebuild all those files, you take the time to look into SVN or another version control system.
Version Control allows you to save copies of your files to a safe place. If the compiler eats your homework, you can update with the last copy you saved to the repository.
You should try Recuva
You are out of luck. There is no safe way to reverse an obj file back to its cpp source.
I do not think that is actually possible. You'd be reversing the compilation process, which from my knowledge is not possible.
NO, it's not possible. obj files contain object code, not source code. The compilation process is typically not reversible.
PS: Visual Studio did surely not delete your code files when you pressed F5. They are somewhere, or you've deleted them accidentially.
It is impossible to do that...as all the code's comments and variables are translated into a machine code, you cannot deterministically reproduce a variable name by gleaning in on assembler byte code, Consider this as an example of a mock dump of a binary image:
0x55 0x90 0x33 0xf0 ....
Now, how can you tell that's variable foobar that is of type int....
Hope this helps,
Best regards,
Tom.
As said earlier, it is impossible to get the C source code from on obj. As an alternative, you can try a file recovery utility and scan your disk for lost files. I have previously used testdisk with partial success.
Also, you really need to use some form of SCM!
.obj files are text files for a 3d model I was actually looking for something to bring them into C++ to display using OpenGL. there are programs out there to load them into C++ I was looking for one to download when I came across this.
en.wikipedia.org/wiki/Obj

Resources