I've been trying to edit the lua files for the game victor vran (made by developers of the tropico series) but when i tried to decompile the files i'd get back errors. So i opened up some of the files in both notepad++ and luaedit, and noticed the first string of every file was lz4 which I automatically associated with compression. After a quick google I found the lua rocks lz4 module. With that i tried to decompress some files but couldn't really wrap my head arround it.
If anybody could give me some tips to point me in the right direction/tell me where i'm going wrong, or even take a quick look at the files i'll link to below, to give me advice on the matter I'd be greatly appreciatave. I will include 2 types of lua files from the game, ones with the lz4 string and ones without. thank you so much in advance, ifanybody needs more information on the files or the steps i took ask away
.lua files with "LZ4" as first string https://drive.google.com/open?id=0B042ggDJxSmJaTJ2Z1l4RTkzUHc
.lua files without lz4 as first string https://drive.google.com/open?id=0B042ggDJxSmJa2VNcjQxVC1TZ1k
Related
How can I change a file type?
A year ago I wrote a few articles that should be viewed in any text type of program. however, I recently opened them and they are viewed in symbols and alphanumeric characters. In linux os, the 'file' is now in an archived folder type that contains .xml files. in windows os it is 'file' as type of file. it has no extension.
Is there any way to recover the original readable alpha-numeric information in these files?
My preference would be to salvage the original information than redo.
First off the extension doesn't actually mean anything for the information of the file, it's only purpose is as a hint to the OS for deciding which application should be used in opening the file. You can prove this by renaming something like an exe to have a txt extension which will then open in notepad as a lot of seemingly random characters; renaming it back to exe will allow it to run again.
Based on your description the files you mention are some form of binary file, the bad news with that is you need to know either what application was used to create the file in order to be able to open it or what the original file extension was (which would be a hint to the former).
If you don't know either of those pieces of information you can of course use trial and error by guessing what extension it might be, renaming it, then opening it with the associated application and seeing if it worked.
I'm trying to see how does certain ios apps executable files look like, what i do is export the app files to my computer using iexplorer, i then took a look at the info.plist to see the executable files, after that i opened them with my notepad to use the UTF - 8 Encoding, but here how does things look like in both files-in the opening of both of the files i see english words that are expressing directories:
sample of file 1:
‹"Ò.(?!ÑNÓU£C°îXjøe”Ú5O•½°{^ÿÝŒEÌrôðæ$#[3,ÔÜ£æ»8I˜hGw!*aHÒQ•tœl²þ„™AÍçßÍ憴³)è:cÌ7H5æß-eFç¯î&Ø\n,$Ë$y»¥ÁB^6ÙP; i(q,AÅ
âðð·'©=Ÿa"v!PBÛÚ"¤¬‹Wj·;ËsÌŽÚâZüŠ–ÇüÉ;ÜA´sI«¸Üæ¿÷ ›‚‰.êøLž
sample of file 2:
ßꪧgö«húDªÝn¡±CÅÁ¹ â=؉ˆ4|®b¡ JeW-ɯðó¦xgýgeéÀXœH7ßJÉ" 3‡rÜ6ÒI_ ƒr cdÅá¸|íð¼l;Töl±”›MÛ˜±o/ôÇô#¬RS;Y¥!ÜzGò“vî©6ØR¡‚>Ì0m5
ŸzrPÐiDMÊ|Þ·9âëYß,p؃‹£x—.àN5îüÝrjœG]Æ·
ironically in the second file i can see a huge block of english words absolutely fine, but i dont get it why i don't see the whole file very good? i have also tried to open the files in an objective-c compiler after i have made them .m but that again was useless???
The executable files contain machine langage (binary) and cannot easily be read or understand by human. The word you still see in english are probably comments left by compiler that are not executed.
Trying to open those files in a compiler won't work because if the compiler role is to convert objective-c in machine langage, he's not able to convert the other way. For a same set of machine instructions, there are many ways to code it in objective-c.
The only way to get a source-code from a binary executable is to do some retro-engineering. It is done by converting the binary executable in assembly langage (it's a very low level langage but with understandable syntax) and then trying to reproduce the instructions with a higher-level langage such as objective-C.
I've been trying to load a library into lua file. Sparing the details, as they are not really important, I have tried this many ways.
The final way, and the one I believe to be correct although I still can't get it to work, is to use "package.loadlib". See code:
ed = package.loadlib("Encode_Decode.lua", "luaopen_ed")
print(ed)
But when I run the program I get this error:
Encode_Decode.lua is either not designed to run on Windows or it
contains an error. Try installing the program again using the original
installation media or contact your system administrator or the
software vendor for support.
I know the program runs because I used it internally to test it's encoding and decoding abilities and it worked fine. I'd really prefer not moving the contents of the library over as my main lua file is crowded as it is. I will if I have to though.
Yes it is in the main folder. I've also tried changing the extension of the library file into a .dll, with the same error.
What am I doing wrong?
I apologize in advance if this is a duplicate, I did my best to research this problem as thoroughly as I could. But to be honest it's almost 3 AM and I've been searching for almost an hour.
Stupid beginner mistake, used the wrong syntax.
require("Encode_Decode")
print(dec("bnVs")) --returns "nul"
package.loadlib is used for loading shared libraries; i.e. .dll or .so files. You're passing a .lua file to it, so Windows attempts to load it as a .dll and fails when it can't.
To load Lua source code, you can use dofile. Alternatively, you can use require, which is a bit more complex, but handles loading modules only once and works with both Lua and C modules.
I have a path library which has a zip function in it, and while writing the unit test, I tried to find the best way to verify that the zip function works correctly.
Can someone please show me the best way to verify that the zip function works correctly ?
The few ways I can think of are:
Comparing the md5 of the resultant zip file against a sample zip file
Listing out the contents of the zip file and ensuring the content are correct
However, both ways seems a little long winded and I am guessing not exactly idiomatic Elixir. Can someone please show me a better way ?
I would create a directory of test files to zip up in your unit test, zip it up using a trusted utility and get the resulting md5. Then for your unit test, perform the zip function, take the md5, and compare with your verified md5.
If I am correct, there are some parameters that can affect the result of zip processing (like block size). So, unless your purpose is to check exhaustively that your zip process reproduces all or a subset of the zip features, I find more interesting to validate that various files from your system (or/and some random files) can be compresses with your function, and uncompressed outside using different unzip tools, and finally compare that the files are identical to the original. (of course it takes more time, but it can be easily automated).
Concerning the usage of MD5 rather than file comparison, I think that on one hand file comparison is easy to write and in the other hand you need to read the whole file to calculate the MD5, so I don't think it is worth to use this trick to accelerate the comparison - (especially if files are different :o).
I'm developing a BlackBerry application in which I need to unpack a zip file compressed with PKZIP. The package could have one file in it, or it could have 10; it will vary in each case. I know that the BlackBerry API has native support for GZip and Zlib, although I'm pretty sure that these methods aren't going to be helpful in my case. It doesn't look as if I can extract the individual files using these calls.
I've tried JZlib (http://www.jcraft.com/jzlib/), which compiled fine, but again it doesn't look as if the methods contained therein are going to allow me to pull the individual files.
It appears as if this is possible, as there's an application called Ziplorer (http://www.s4bb.com/software/ziplorer/) that claims to do perform this exact procedure. How they're doing it, however, escapes me.
So here I am after hours of Googling. I'm welcoming any insight into my problem with open arms.
"zip" algorithms are typically offshoots of the Lempel-Ziv-Welch algorithm. They are a fairly efficient stream compression algorithms, but because of how they function, you can't start to decompress at random points in the file, you have to start from the start.
Any product that claims to be able to decompress one file from a zip still has to decompress everything before it in the zip file in order to know how to decrypt the given file, or even, for that matter, where the file is in the archive.
If you can tolerate GPL code in your application, then this library http://jazzme.sourceforge.net/ that might work. However the project (and its parent project http://sourceforge.net/projects/jazzlib/) don't look like they're being developed.