How to visualize this binary file better? - unix

I look at the source code of file and see
I run file script and see
ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV),
for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped
I recall that I have been able to read this binary as plain text sometimes and saw that it is filesystem dependent script.
However, I forgot how I did it.
The script is just splitting a file and just interested in what is the split pattern what it is using.
However, with those ^# signs it is difficult to make sense of it.
However, there are rather much text which you can read.
How can you visualize such a binary file better?

I would suggest to use the strings command:
strings script | less
Note that despite its name, script is not a script but a binary executable, as file shows.

Related

How to make R executable file

Is it possible to create an executable file where I can just upload the excels and an output is generated based on the coding and without sharing it as well.
On Linux or OSX you can make an R script double clickable with the shebang trick:
Add #!/usr/bin/Rscript as the first line
Make the script executable with chmod +x
On OSX, there is also the option to convert an R script into an application bundle with Platypus. On Windows, I do not know whether this is easily achievable at all, especially as executables usually are not placed in the search path on Windows.
is using R-Shiny apps can cover that? Its an R based program and you can customize the output / logic there.

In GHC, is there a way I can check compilation without actually producing output?

Sometimes, I write code to a file solely for the purpose of checking whether it compiles -- with no interest in the generated binaries.
For example, if I am doing a learning exercise and want to produce some error or see if certain code compiles without error, I'd like to see the ordinary compile output printed to the terminal but without generating the *.hi or *.o files that occur by running ghc <myprogram>.hs.
I sometimes effectively do this using runhaskell, but that is not ideal -- it requires a main function, and actually runs the program whereas I am just looking for a compilation check.
Is there some way to suppress generation when running GHC, only displaying the ordinary compilation errors and warnings?
One of the answers to this question suggested the answer that I'm looking for: ghc option -fno-code.
I.e., compile but don't generate binaries with:
$ ghc -fno-code <myprogram>.hs
In the same spirit to the purpose of the question and in addition to the working answer by #mherzl, my answer below:
while true;do
inotifywait -e modify myprogram.hs
ghc -fno-code myprogram.hs
done
This only works on Linux systems having the inotifywait tool. It blocks an detects if the file is modified.

Can I get source code from PyInstaller generated package?

Seems the PyInstaller put all the python script into the executable file, and when run this file, it start PyInstaller bootloader first, then prepare a temp python environment add run the scripts.
So I wonder whether my source code are safe. Can I get the source code from the package when running the executable file?
PyInstaller includes the byte compiled (.pyc) files of your program but not the original source (.py) files. You don't even need to run the executable to get the .pyc files. There are more or less working Python decompilers that turn compiled byte code (.pyc) into equivalent source code (.py).
You need to assess whether this protection is good enough for your purposes. However as a friendly suggestion, I recommend first inventing/writing something that people will want to copy before worrying about how to protect it.

Executing a python script

I am a biologist trying to run a particular script (http://www.ricediversity.org/tools/code/Plumage%20Script%202%20F2%20Populations.zip) on my data-set. I have installed python 3.4, panda 0.14.0 and numpy dependecies on my windows 7 laptop as the instructions demand. My data set is in excel file. How do I go forth applying this script to my data? I have no experience with python scripts/ program.
Thank you for your time.
python Plumage2_for_F2.py -h
should give you the usage information. (Being on Windows, simply invoking as Plumage2_for_F2.py does not work as it would on a Unixoid system, so be sure to preface all your commands with python, as above.) The file (as supplied by the -i option) will have to be a CSV (comma-separated values), which you can export from Excel (I do not know the current version of Excel, but it should be something like Save As, or Export).

Decipher a unix executable file

There is a unix executable file and I want to read the contents of that file. It is in an unreadable format and needs to be deciphered. It does not have any extension, when I do a cat of it on the terminal its in an unreadable format.
Is there any command that I can use to decipher it or any tool that can help. Please help.
You don't need to decipher it (unless it has some binary-level obfuscation because it's an IOCCC entry). You can disassemble it using otool -tv or objdump and read what the program inside does.)
If it's unreadable with cat then it's probably an executable format such as a.out or, more likely, ELF (though it could be a different format).
If your executable is xyzzy, you should be able to find out what type it is by using file xyzzy on it, such as with:
pax> file /bin/ls
/bin/ls: ELF 32-bit LSB executable, Intel 80386,
version 1 (SYSV), dynamically linked
(uses shared libs), for GNU/Linux 2.6.18,
stripped
That file format is well documented (such as starting from here) if you search the web, and there are tools like gcb, nm, readelf and objdump which can look inside it to varying degrees, but all it's likely to deliver to you is the raw assembly language. Getting back to easily-understandable source code will be very hard.

Resources