How to display version of Electron environment in an Electron app? - electron

I would like to find out which version of Electron an Electron desktop app like Signal Desktop or Visual Studio Code is using. Is there a simple way - like entering a command in the Development Console?
Thanks! Johannes
(Why? I would like to see if it is affected by bugs like https://www.trustwave.com/Resources/SpiderLabs-Blog/CVE-2018-1000136---Electron-nodeIntegration-Bypass/)

You can, if the App enabled developer tools and enabled nodeIntegration. take VS Code as an example:
open the Developer Tools, in the console tab, type
process.versions.electron
documentation here: https://electronjs.org/docs/api/process
or try parsing version from userAgent string
navigator.userAgent.match(/Electron\/([\d\.]+\d+)/)[1]

Open the Developer tools and in the Console tab type:
navigator.userAgent
For example in the Discord app I'm getting:
Mozilla/5.0 ... Electron/9.3.5 ...

Under a Unix-like or Linux system (and possibly under Windows using Cygwin or MSYS shells or WSL, but this is untested there), you can use the strings program even for progams that are built without the developer tools enabled.
Basically, you're just searching for a user-agent string in the binary itself.
Currently, I have been able to do the following:
$ strings example-electron-app-binary-file | grep '^Chrome/[0-9.]* Electron/[0-9]'
Chrome/98.0.4758.141 Electron/17.4.7
That regular expression searches for strings starting with Chrome/, followed by any number of numerical digit and dot characters, a single space, and then Electron/ with any numerical digit after it.
This won't work in all likelihood if your system uses UTF-16 strings, but since browsers tend to use UTF-8 internally there's still a chance it'd work on a Windows electron binary.

Related

Why is CP850 the default encoding in Windows 10 terminal?

I was working on a Ruby program and had issues that I finally found out were caused by the default encoding in Windows 10 terminal, which apparently is CP850, an encoding so old it doesn't even include the € symbol. I read that, of course, if I try to change this other programs around the computer will give issues.
Wikipedia indicates that CP850 has theorically been "largely replaced" by Windows-1252 and, later, Unicode, and yet it's here, right in the OS's terminal.
Picture attached as proof. It's in italian language but you'll see it under "Tabella codici corrente", aka "Current code table".
How's that possible?
This is historical.
DOS had cp437, and later cp850 (and e.g. also cp852) as standard code page.
Terminal in Windows was also known as "DOS prompt": so a way to run DOS programs in Windows, so they keep the code page of DOS. Microsoft dislikes non-backward compatible changes, so your DOS program should works also on Windows terminal without problem.
Windows-1252, as the name stress it out, was done for Windows, so no compatibility problem, and for Windows programs, but so, in order to gain graphical interface market, but keeping compatibility with many business applications, Microsoft maintained two different code page.

Printing postscript with GSView 5.0

I've been using GSView 5.0 and GhostScript 9.52 to do postscript printing on vellums. However, today GSView started throwing error codes on every .ps file I've attempted to print. I'm using Windows 10 Pro and the printer is an Epson Artisan 1430.
The error is as follows:
GPL Ghostscript 9.52: **** Could not open file 00000e60.
Unrecoverable error: invalidfileaccess in showpage
Operand stack:
--nostringval-- 1 true
gsapi_execute_cont returns -9
gsapi_exit returns 0
I've tried changing permissions for the files and different printer drivers to no avail. I'm sorry I can't be more descriptive on this issue as it's hard to articulate.
OK... You must have recently updated to a new version of Ghostscript. I can reproduce your problem, and it comes down to a recent (documented) change in behaviour for Ghostscript.
Due to the well-documented public disclosure of security exploits using Ghostscript a couple of years ago, the current version (and any version since 9.50) now defaults to running in SAFER mode.
When running in SAFER, Ghostscript prevents access by the PostScript interpreter to the file system. For those unaware of the problem; PostScript is a full-blown programming language and, by design, permits programs to access the underlying file system. SAFER mode prevents this so that malicious PostScript programs cannot, for example, run arbitrary code on your computer.
It seems that GSView is using Ghostscript in a way which requires it to read the PostScript program to be printed using the PostScript interpreter, instead of the more normal practice of specifying the input file as one of the arguments. For simplicity the input file is granted read availability by the Ghostscript executable. I suspect that GSview is using the DLL directly and not adding that extra information.
Now there are ways to permit access to specific files or folders, so that existing PostScript programs can continue to work, but obviously this requires some changes in the calling application. GSview has not changed in, literally, years so obviously it does not take any such action.
You can, however, get GSview to work as before. Under Options select Advanced Configure. In the resulting dialog look for the 'Ghostscript options' text box. In there add -dNOSAFER, that should get it to work again, though you may have to reboot the computer if the OS print subsystem has stalled.
Yes, this does open you up to the sorts of exploits I alluded to above, you should only do this with PostScript programs that you trust.

Create Windows 95, 98, 2000, XP NT, 7, 10

I come across the following link - https://github.com/felixrieseberg/windows95
Running windows 95 as Electron APP
Is it possible to create any existing application as portable or cross-platform using electron like above?
Can we use Windows 7 or 10 like above without Oracle Virtual Box or VM in an existing Windows 8 machine ?
Need more details on how it is possible to bring an application via electron
Thanks.
If I'm hearing you right, you're wondering if you can put a whole OS into a JS VM running in Electron - and then run your app on top of that.
Please don't do that. Electron is a fantastic cross-platform solution, but my project windows95 was mostly an educational experiment showcasing how powerful modern JavaScript and Electron can be.
This project uses another project called v86, which is capable of virtualising a x86 platform and display its output on a HTML element. Electron is browser-based so that is why this works.
But there are some limitations: It virtualises the x86 platform, which is pretty old by now, and when you have a look at the specification, it says it is at a Pentium-1 state. The demo links on the project's GitHub ReadMe also do not contain any "modern" OS because v86 does not support SSE(2). And since Microsoft requires its users to have a SSE2-compatible CPU* it is not possible to run anything like Windows 7 or newer (Linux may work, anyway).
OSses which support this kind of (deprecated) hardware, may work. As you can see from the "Compatibility" section of the project's ReadMe, some Linux versions and Windows XP "work" but older software, like OS/2, and even newer stuff, like Android, don't (really). So you can't say that everything will work as expected because the execution environment is really limited.
Now to answer your first point, no, I don't think that you can wrap every existing app into an Electron application and run it on new hardware. It may work with old software (which do not require SSE, if you use v86, and that would require a lot of hackery on the v86 side because it is designed to run OSses), but don't quote me on that.
* The section in question reads (at the time of writing) like this:
A Stop error occurs on computers that don't support Streaming Single Instructions Multiple Data (SIMD) Extensions 2 (SSE2).
Upgrade your machines with a processor that supports SSE2 or virtualize those machines.
(emphasis mine, source: https://support.microsoft.com/en-us/help/4088875/windows-7-update-kb4088875)

WAMP show logs in realtime in console

I'am using the WAMPServer, and it's located in d:/wamp/. Is there a way to show logging window or console in realtime as I'am crawling on my server web ?
On unix/linux boxes I tend to use the tail command to watch logs as I browse for debugging. Of course, Windows has no equivalent, but there are a few options. The one I settled with was mTAIL. It's a standalone app and not a command line program, but it does exactly what you'd expect:
I was going to suggest using unxtools, a suite of ported GNU tools that can be used on the command line, but it's out of date and trying it on more recent versions of Windows I had problems. You can download them from sourceforge if you want to take a look. Also tail for Windows, is another Windows app that unfortunately doesn't seem to work on later versions, but included here in case it saves anyone the time looking.
Of course, you may find that if you prefer the command line you want to look at getting cygwin installed, which contains a host of commands you could use for the task you have.

iPad writing custom apps and scripts

I have an iPad 1 with redsn0w jailbreak.
I have a little experience writing html & php and I can find my way around the command line on a Linux machine. I use PuTTY to connect to my iPad, and iOS seems to be very Linux like.
I am wondering about writing custom scripts and apps for the iPad. I did some search on Google and here on Stackoverflow, but I have come up with a blank (perhaps I am searching for wrong terms).
So on to my actual questions...
Question #1
Are there any free development platforms that let you develop and test apps for the iPad?
Question #2
Are there any free scripting languages available that will run from the iOS shell?
XCode is free, but you'll need a mac. If all you're doing are web apps, there's no need for any specific compiler like XCode, so you can obviously do your development on any machine in Vi, emacs, notepad, or whatever you want.
According to this post you'll need to install MobileTerminal and some other shell utilities to do any decent bash shell scripting.
My own advice: save yourself a boatload of hassle and invest in a used Mac Mini on craigslist and get xCode for free and you can do all the custom (and far more capable) programming for your iPad that you could ever wish for.

Resources