Is there a way to see what a .cgi file contains scripting wise? - linux

I work with remotely installed cameras that have a linux build installed in them. Our previous models allowed us to use SSH and run simple commands within their terminal to focus the image, reboot, factory default and the such without having to go to the remote location. We have swapped to a new kind of camera that still has a linux build inside but the previous commands are not as easily accessible if at all. These new cameras have a simple website that can do these actions instead but this can - and has - go wrong with a need for the SSH solution.
There is no way to directly access the camera (that I know of), all of this is through a cat6. I checked the source for the simple website trying to see what the focus button actually runs onclick and found its javascript refers to "/cgi-bin/focus.cgi" (I can provide the chunk of code if needed). I am familiar with programming but not to any pro degree and much less web development but I figure that .cgi might be my ticket to finding out how to activate this stuff from the linux terminal.
I tried making a python script to see if I could read the file in plain text or something but that's a no go. Don't know the first thing about web dev so if there is a neat tech way to open the server on the camera to pick its brains I don't know what it is and don't know where to start. Currently bouncing around all the directories in the camera trying to find some kind of command or clue to where the camera functions are. Double tab doesn't seem to have the commands I'm looking for, and they didn't include a manual with man command. I'm completely lost.

Related

Drag'n'Drop local file to browser window via Command Line for uploading

Not quite sure if it possible at all, so decided to ask here.
I need to automate some things and search the way to drag'n'drop local file to browser window (with specific URL) via Terminal command for uploading.
I use Mac, but I think Linux will fit here as well.
If there is any solution or module on Bash / Python / Node.js I will gladly give it a try.
take a look at requests package in python language.
you can make a POST request and send information you want to the web server.

It is possible to track what apps are in use and what file is opened with nodejs

For a future project, I need to track user activity to record their productivity time. I want to detect which file is currently open in apps like Adobe Photoshop for example and detect when the user switches to other app or another file/tab.
To make my desktop app, I wish to use electron JS
Can you just give me some tracks to follow ?I don't find any nodejs library that allow me to do that, but I know that is possible because it already done with electron apps like:
Chronos https://electronjs.org/apps/chronos-timetracker
Paymo https://electronjs.org/apps/paymo-time-tracker
ScreenAware https://electronjs.org/apps/screenaware
And an other App which not seems to be built with electron :
https://desktime.com/features
Thanks for your help
node.js doesn't have the capabilities you require, however it can call external programs to get the job done. The way I see it, you would need to have a PowerShell script (or C# program) to get the active window from the operating system, and find all open file handles for the process behind that window. You would invoke this script from node, and build your gui around it.
A good starting point is this module active-window which works exacty as I described: a nodejs process calls some external scripts (in bash/PowerShell) that use OS specific primitives to get the active window.
To get the list of files opened by a process, you could use the handle utility from Sysinternals. However you may run into a small problem: apps like Photoshop usually don't keep the file handle open, they just open it when saving the file. This means that you won't always be able to detect open files. I guess trial and error is your friend here.
To find open tabs, it's more complicated. Tabs usually indicate the internal state of an app, and this information is held in memory. Some apps might offer an API, but that's not guaranteed. I guess screenshots are the way to go here.

Configuring Bash Script to work on other people's computers

I've created a bash script that I'd like to share for other people to use
The script downloads video files, stores them in appropriate folders (which are essential to the app) and allows the user to cycle between them, using getopts so the user can send specific commands via flags
I've never done this before so I'm unsure of what "configuration" requirements I'd need to have so it works on other peoples computers. I want them to be easily able to download using homebrew or another package manager, automatically set up the required components and have them be able to use it
I know I have to create folders and a man page for them at the appropriate location. Does this require a makefile?
What other things should I be considering? My google search skills are sucking, so any links would be much appreciated
Package a precompiled busybox (https://busybox.net/downloads/binaries/latest/) next to your script, and use busybox functions only.

Creating a menu item generically in Linux

For part of a large university project I have built a large java based application. To make "installation" cleaner I am aiming to write a script to copy the jar to a hidden file in the users home directory then add a menu &/Or desktop launcher.
Since I do not know what platform the markers shall be using it seems sensible to make this generic so I was going to build a shell script and a batch file.
The shell script starts off simple, check the directory doesnt already exist, make it and copy the file accross.
Then it comes to making a launcher of some kind. I presume each desktop environment shall do things differently.
After 10 minutes with google it seems everything suggested is autotools but since I have no knowledge of this it seems a bit overkill.
Is there an easy way to achieve what i need?
Thanks
These days, basically all of the desktop environments uses desktop files. For the specification for those files, see the Desktop Entry Specification.
Normally, they're put in /usr/share/applications on the system. Those files are then read and used to construct the menu.
If you have the ability to write to the system /usr/share/applications directory, that's obviously simplest, but if you had that, you would probably be putting the JAR file somewhere other than a hidden directory in the user's home directory.
If not, the path that's supposed to be honored is ~/.local/share/applications. If you drop a desktop file in there, it should show up for the user. (This is somewhat newer; I don't think GNOME 2 supports, it for example. Older desktop environments had various special places for these files.)
Then, the problem basically reduces to figuring out what to write for the Exec line in the desktop file. (See the desktop files on your system in /usr/share/applications for some examples.) If you're lucky, you can get away with just sticking a java command in there, but the details will depend on your application.

Creating a CD auto-start dialog

For me, compact discs and these customized auto-start dialogs are somewhat outdated and waste...
However, I have to create such a dialog as an index for a CD consisting of a few PDF files. Making one to work on Microsoft Windows is quite easy. As there might be users from different platforms (Unix, Apple,...), the question raises how to offer them such a (auto-starting) dialog as well.
Java is of course an option, but I think it's overloaded and naturally too slow for this purpose.
Now, I think of a single webpage that will appear in the local browser. Using all these web standards this could a very creative, light-weight approach working on most systems.
Do you see any problems that might occur here? Probably, there is a different and more elegant solution to this issue?
I can't really recommend something precisely but I've seen lots of CD open a Adobe Flash dialog. It's also been a long time I've played around with flash but I think they're a setting in File > Publish that allows you to export to a dialog.
The CD auto-start is an autorun.ini file added to the root of the CD. You could create a folder on the CD named autorun or something. Insert all your Flash/HTML files then point the open parameter of the autorun.ini file to an HTML/Flash file.
Some documentation below (or Google “autorun.ini”).
http://support.microsoft.com/kb/818804
Notice however not all computer will have Flash installed by default.

Resources