Run an executable without showing in "top" - matlab

I need to run an executable in background on a server, however, it takes some parameter that I do not want to expose to others. I wonder if there is any way that I can wrap this executable in another app, or preferably just by using MATLAB, that the actual executable will not be shown in top command?
I need to hide three things, 1) the parameter of, 2) the path to, 3) the CPU usage of the executable. For the CPU usage, I do not intend to trick the system to show a constant 0% percent, but I want to let the usage been shown in the wrapper app.
For example, I have an executable in /secret_path/A, which takes parameter -password 123, and consumes a constant 10% CPU usage, all these information will be very easy to be spotted if I type top in another terminal window. I want to create another executable, for example in ~/B, which hard code path and parameters of A, so I can just run B with no parameter to execute A, and instead showing a A record in top, it would be no trace of A and B will show 10% CPU usage in top.
Please suggest any way of doing that, without requiring root privilege, or why it is not possible.

You can run it in a virtual machine. That way not only the path can be hidden but the executable itself won't have to exist on the file system. If you run top you will see the VM using the CPU, which shouldn't be a problem for you since apparently you only want to hide the path of the program.

Related

How to add parameters to a running process or exe by default?

Objective:
I'm trying to use a program called Texmod.exe to start another program (exe) with certain parameters.
Background:
Texmod is program that opens up another exe and extracts/replaces textures that are pulled up in the second program while it is running. I'm trying to start the second exe with the parameters: -AlwaysFocus -ControllerOffset=1 -SaveDataId=2. Starting the second exe with shortcuts/.bat that have these parameters in a command line DOES work. However, I would like to do this in conjunction with Texmod.
Complications:
I'm using Texmod v0.9 b which doesn't support starting an exe with command line parameters. Newer versions, such as the open source reboot known as uMod, does support but it doesn't replace textures as well and crashes often compared to the original version.
Texmod.exe must start the second exe directly. Texmod can't select a shortcut to start the exe. I've tried making Texmod start another exe/.bat that then starts the second desired exe with parameters but this causes Texmod not to function.
Methods I have thought about but not sure if they work or even possible:
Somehow forcing all processes started by Texmod.exe to start with certain parameters
Somehow force the desired exe to always start with certain parameters regardless of start method (via Texmod, shortcuts, .bat, etc)
Add parameters to the process started by the desired exe after it is already running
Obviously I'm open to any ideas. Is what I'm asking even possible? Sorry if it seems unclear or I sound irrational; my knowledge on this is limited.
Edit: #Toby Speight I'm not sure what you mean by an example of the code I'm having trouble with as I'm just wondering if it's possible to perform the scenario I described. This is where I got the Texmod program from (it's the oldest release texmod.zip - Original TexMod 0.9 beta). I've searched the internet for possible solutions but I've found very few so some of the methods I've tried are:
Used Texmod.exe to start a desktop shortcut with target: "directory to exe" -AlwaysFocus -ControllerOffset=1 -SaveDataId=2. The result was Texmod couldn't use the shortcut and just opened the exe without the parameters.
Used Texmod to start an exe named caller.exe which started the exe I desired using the method described here. In command.txt, described by the instructions, I put ""name of exe.exe" -AlwaysFocus -ControllerOffset=1 -SaveDataId=2." The result was the exe started with the parameters but Texmod failed to modify the textures because it was modifying textures pulled up by caller.exe instead.
Used Texmod to open a .bat file with the lines: ""name of exe.exe" -AlwaysFocus -ControllerOffset=1 -SaveDataId=2." The result was the same as attempt described in #2.
Edit2: I also stumbled on this page where someone else claims they managed to achieve what sounds like the objective I desire. However, I do not know enough about code to understand it. If someone could look over this to see if it would work or see if they can modify it to fit the arguments that I desire.
You can use windows registry to force Windows run another app when specific .exe is called. Let me show an example: i'm trying to use TexMod with Remember Me.
Required setup:
Create a copy of game .exe, place it near original with different name, eg RememberMe_copy.exe
Go to windows registry location HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
create new key named as original .exe, in my case it's RememberMe.exe. Registry key looks like a folder.
In this key, create new string value named Debugger with full path to copy of .exe with required commandline args. For example: "C:\Program Files (x86)\Steam\steamapps\common\Remember Me\Binaries\Win32\RememberMe_copy.exe" -ReadPoolSizeFromIni. Note the path to .exe is quoted, commandline arguments are not. String value has type REG_SZ.
Now when you try to run anything called RememberMe.exe, Windows will instead run the RememberMe_copy.exe with specified parameters (and something else but we don't care). This feature is left in Windows for debugging purposes.
Finally, open TexMod, select RememberMe.exe. It will think it's running original file, but instead Windows will silently run another file with another parameters. As there is nothing else in between, TexMod is happy.
Why can't we use single file? Well, Windows will run original .exe instead of original .exe, then instead of it will run original .exe... causing infinite loop.

Generate executable larger than 4GB with TurboStudio

Thinapp has no problem generating virtual applications above 4GB.
Whenever I try something similar with TurboStudio it fails. Is there a way around it?
Okay, after several experiments I think I found an answer.
Spoon Studio (or Turbo Studio as it is now called) cannot create executables larger than 4GB. Checking the "Compress Payload" option reduces output size, but these captures perform usually a bit slower (due to the decompression required at runtime) and of course, there are always apps that will exceed the 4GB limit even with this option checked.
A workaround, however, is to divide the installation process in multiple captures (when possible) and use svm files.
For example, assume you are capturing a large application (Myapp) and some addons or plugins to it which together generate a capture larger than 4GB in size.
The solution would then be to first capture the application without any addons. Then install the plugins/addons and capture them separately. When you capture the plugins choose as Project Type "Component". At the end of this process you will have a captured application in executable "myapp.exe" and the plugins captured separately in "plugins.svm". It is possible to repeat this process several times, thus ending with "myapp.exe" and multiple SVMs, such as "plugins.svm", "plugins02.svm" etc.
In order to load the "plugins.svm" in "myapp.exe" without importing it as a component (which would defeat the purpose as it would still blow up the size beyond 4GB), go to Settings-->Process Configuration-->SVMs.
In the SVM search pattern you enter a text string to specify the SVMs to be loaded during startup of the application.
You can specify a single SVM by entering something like
#APPDIR#\plugins.svm
or multiple SMVs by entering something like
#APPDIR#\plugins.svm;#APPDIR#\plugins02.svm
or even use a wildcard by entering something like
#APPDIR#\*.svm
All of the above examples imply that the desired SVMs exist in the application's folder. Else, use a different path.
If multiple SVMs are specified in one search pattern through the use of the '*' wildcard, the SVMs are applied in reverse-alphabetical priority.
If SVMs are specified by name (not with a wildcard), then the SVMs specified first in the list will take precedence over SVMs specified later in the list.
You can also make specific svm files Required, by adding them to the "Required SVM name" list. In this case, the application won't start if it doesn't find the SVM file in the specified location and will instead give an error message that a required SVM was not located.
I hope this will be of help to people trying to capture large applications and hitting the 4GB limit with Turbo (Spoon) Studio.

Running two process in one command-line with split-screen

I need to split the command prompt window without making two windows. On one side I need a file to be read and on the other side (split with lines) to be command prompt gathering CPU Usage and RAM Usages. Things I need to know if I can do:
- Gather CPU and RAM Usage from command prompt or batch
- Have two process running side by side in the same window
- Read configuration files in a specific format (such as: server-dir=C:\Users...)
- Have both sides update every second with no glitches in graphics
Could it be done? An example of this would be handle (a minecraft server handler, can be seen here: http://goo.gl/t3741n)

What's the difference in Windows program invocation?

I have a program on a Windows XP computer on another continent. If I start it by double-clicking on an associated file, so that it runs the program according to the file-type association, it crashes at a certain point. If I start it by dragging an associated file to the program icon, it works fine. If I double-click on the icon and drag the associated file to the window, it works fine.
The guy on site assures me that he's triple-checked the file-type association, and it should be correct.
Assuming that the icon points to the same executable as the registry, what differences would there be in starting the program in these two different ways?
EDIT: In response to a comment, the machine I'm having problems on is running in Japanese, while my normal machine is US English.
One possible difference is the initial working directory: if you drag a file onto the executable, the initial working directory is set to the directory containing the executable, whereas if you double click the file, the initial working directory is set to some default value independent of where the file or executable is located.
If you want to get consistent behavior in all cases, you can use SetCurrentDirectory() to set the current working directory to whatever you want; I recommend the directory containing the executable, which can be found by calling GetModuleFileName(NULL, ...) and stripping off the executable name, or by examining argv[0] inside main().
When you double click the file, the program is run, and (usually) the name of the file that you double click, is passed in to the program as a command line argument.
When you are dragging onto the window, the program is already running.
The difference is obviously in the startup process that the program has. Is this software written in-house? Perhaps check how it handles starting up, and make sure that all appropriate code paths are still executed when there is a file in the command line arguments.
If you can't check the program code, or how it behaves at startup, about the only thing to check in the registry, and possibly change, is how the filename is passed in. Usually they are passed in inside talking marks, so that the path to the file can have spaces and not confuse the program. Something to try would be to make sure the association uses talking marks on the argument, or if it already does, try it without. Perhaps the program isn't handling the talking marks correctly.

Horizontally scroll a text-based/console program

I am trying to use TestDisk (partition and file recovery program) to recover some files that I have lost. TestDisk runs as a text-based/console program and prints a long list of deleted files, one per line. Each file is listed as it's path and because I am running this from a rescue live linux cd, I am limited to a 80 character console.
I need to go though this list of files a select the ones I want to be undeleted, however I can only see the start of each path and..
...cuments and Settings\kin
...cuments and Settings\kin
...cuments and Settings\kin
...doesn't give me much information to go on (this list is probably over a hundred entries long).
I have been thinking about running TestDisk inside a screen session and hopefully increase the virtual terminal width and then simple scroll horizontally to the right. But screen doesn't seem to support something like this.
Is there anything that does?
I should clarify that TestDisk is a interactive console program. Thus I can not take the output and parse it with something else. Additionally I need the interactivity because when I find the files I want to undelete I need to select then inside TestDisk and then proceed to the next step in TestDisk.
Scroll lock?
Run the output through emacs. Then you can have all the functionality you want!