On-Screen Keyboard hide and run within excel instance to use functionality - excel

To give a brief backstory to bring things up to my current position / reason for my question:
I originally wanted to use sendkeys to send keyboard presses to a Citrix Xenapp Remote Terminal Application (VT320 Emulator).
This does not work.
After some investigation it became apparent that this has been a reasonably common issue.
I eventually found a work-around that involved opening the windows 'On-Screen Keyboard' application and sending mouseclicks using VBA to the OSK app itself. The key transmissions would be successfully received in the remote terminal application.
This solution is a rather awkward and not very practical solution as it relies on many factors e.g. screen resolution, co-ordinates / current position of the OSK etc.
With the above in mind, I am looking to achieve a more full proof method and here's my thoughts:
Rather than using simulated mouseclicks I would ideally like to be able to either 'embed' the OSK app into the excel instance and reference each key
or hide the app and find a way to make the application receive the VBA keys requested.
I'm aware that Sendkeys has its limitations so I have also tried using SendInput via a Keyb_Event and this also didn't work.
To any half experienced expert, I'm clearly a beginner so I'm suffering from a lack of knowledge here perhaps.
If anyone can point me in the right direction for solving this issue, I'd really appreciate it!
Many thanks.
EDIT
I've looked into this a little more and found this post:
Finding the class name of the On-Screen Keyboard?
Which would suggest that if I know the class of the on screen keyboard, I could use its commands within excel VBA?
I did try to use the code within the question but couldn't get it to work.
So hopefully my question is a little easier to answer?
Can I use the class name of the on-screen keyboard app / declare an API function that will allow me to send simulated key functions as if it's the OSK app being clicked by the mouse?
Hopefully someone can help!!

Trying to automate apps locally can be quite fiddly. Doing it through a Citrix HDX connection is just painful.
Do you have any say over the Citrix environment? If so I'd try writing an automation app that actually runs on the Citrix server in the same session as the published app you're trying to automate. This has the advantage that you're effectively automating a local app which would make life easier.
Depending on how your automation works you may need to communicate between your automation app running in the Citrix session and your client. You could use WCF to bridge the two together.
So that's how I would try and do, as regarding your specific question I've provided some thoughts below...
OSK automation thoughts
I've done some limited automation of the OSK. There are actually two OSKs if you're using Win8. Osk.exe is the old one which has been around a while. TabTip.exe is the new Win8 specific OSK.
One problem to keep in mind is that both of these processes run as high integrity processes which means normal (medium) integrity processes have very limited abilities to automate them. So while I could automate some stuff, many messages would just get ignored. So this maybe why you are finding the OSK is not responding like you expect.
You can work around this by running your automation app as a high integrity process, but this generally means you need local admin (or local system) privilege to start the high integrity process. I never looked into the specifics of how you create high integrity processes. I know there's a command line tool you can use to force a process to run at a certain level (icacls.exe), e.g.
https://msdn.microsoft.com/en-us/library/bb625960.aspx
I imagine there would be APIs to do this as well.

Related

Execute user script node js (like CodingGame)

I'm currently building a CodingGame like platform for a school project and I wondered how I could handle user script validation.
The goal is to have multiple exercises to solve with an expected response.
For example, there's an error to correct in the exercise and when corrected it should output "hello".
I don't want users to actually do "console.log('hello')" in the IDE on the website if possible :)
The most difficult part is that i don't know how to do execute the actual script given (sent as text to the API).
I just want to start with NodeJS available for the user, no Php or C...
Save the script as localfile wouldn't be a good option I think, that's how we do it for now but I don't know how Coding test platforms actually do it.
The API is hosted on AWS EC2 Amazon Linux instances.
Thank you for your help :)
This is rather an elaborate business requirement and not simply a doubt, but some points that could help you to progress in your project further -
A program is only a program when it is understood by some other program as instruction. Otherwise there's no difference in program.js and program.txt
Validating and running a program are two different things
Running a program on your own system vs allowing anyone to run the same program in your system are entirely different situations in terms of everything. (This is where the web & it's virtues come to play)
There will always be some risk when letting others provide instructions to your systems, as no validation is 100% effective, even if you check for all destructive commands, there will always be more of them. But then again, you'll have to consider this while setting up a virtual machine for the sole purpose of public use. (Like, keeping in mind that this machine can be lost at any moment, so the architecture should be able to handle such losses, either by spinning up a new machine or having a set of replaceable machines for this.)
Isolation & sandboxing of execution is the key in these kind of requirements. So you can have a look at tools like Docker, which could be a bit complex to understand initially, but if it suites your needs then simplicity is just one complexity away.

Prevent from screen recording

I am working on an educational e-commercial website .. In which the user need to authenticate and then the videos on particular topics will be available.. so how can I prevent my video to be screen-recorded...
Different OS's and applications support different mechanisms to try to tackle this - for example:
Microsoft Edge on Windows 10 uses integrated 'Protected Media Path' for encrypted content which will stop simple screenshots working
Website and web app developers may use a number of CCS 'tricks' to achieve a similar affect, although these can usually be workaround with standard web developer and debug tools.
Mobile video typically uses protected memory for encrypted content which will usually give a black screen on capture.
As mentioned in comments and other answers these are all 'barriers' but they don't make it impossible to copy the content - the best example being pointing a camera at the screen a copying that way.
The idea is generally to make it hard enough compared to the value of the content so that people are not prepared to invest the time to work around your barriers.
It is not possible, for a variety of reasons:
There is no Web API for that.
Even if there was, it would be possible to reverse engineer the browser/OS to allow for screen recording.
Even if, for some reason, you couldn't access and modify the software running on the computer, you could connect the computer to a capture card instead of your monitor.
And if you also couldn't do that, you could just point a camera at the screen and start recording.

How to pass arguments to a program from a web page?

I'll be the first to admit that my programming experience and skill in web services is practically non-existent. I usually program things that run completely isolated or locally, with either C or assembly. I'm proficient enough to get a website going, with some basic authentication and directory read access on the system. That's about it.
I'm trying to do a project that's well outside of my comfort zone and get some experience in controlling stuff remotely/via web. Using a Raspberry Pi running Debian, I'm running a program on it in C that takes in information such as video and UART data, does some crunching and triggers some outputs and writes events to a file/folder. This component is fairly straightforward to get running automatically. Getting a webserver up so a remote user can look at the files and pictures the driver program creates is also extremely easy.
The problem for me comes in trying to make a GUI on a webpage that can be used to manually control these outputs. I'm going to need some scripting to handle the button presses on the web page, clearly, but is there a scripting language in particular that stands out for using kernel objects/system calls so I can actually talk to that process? I figure the best way is to use message queues, but I don't know if Python or PHP (or another scripting language) are capable of doing this, and if there are any that are better at this than others. What is the preferred way of doing this?
I know it's possible since we've all seen those kitten-cams with the flash container where you can move the camera or trigger things. I just have no idea where to start.
Thanks for any help
Java can call native commands via JNI (http://en.wikipedia.org/wiki/Java_Native_Interface) from within a JVM. So if you already have C code that can handle the controls, it's just a matter of getting Java code to call them.
As for the scripts to handle button presses, there are several options. One way is to do it asynchronously via AJAX (which requires some JavaScript knowledge) or the other is by doing the traditional page refresh on each press. Sorry to be a bit vague on the answer, but this requires a lengthy explanation of how the whole JSP (Java Server Pages)/Servlets eco system works.
Here's a good place to start:
http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/

Spy++ for PowerBuilder applications

I'm trying to write a tool which lets me inspect the state of a PowerBuilder-based application. What I'm thinking of is something like Spy++ (or, even nicer, 'Snoop' as it exists for .NET applications) which lets me inspect the object tree (and properties of objects) of some PowerBuilder-based GUI.
I did the same for ordinary (MFC-based) applications as well as .NET applications already, but unfortunately I never developed an application in PowerBuilder myself, so I'm generally thinking about two problems at this point:
Is there some API (preferably in Java or C/C++) available which lets one traverse the
tree of visual objects of a PowerBuilder application? I read up a bit on the PowerBuilder Native Interface system, but it seems that this is meant to write PowerBuilder extensions in C/C++ which can then be called from the PowerBuilder script language, right?
If there is some API available - maybe PowerBuilder applications even expose some sort of IPC-enabled API which lets me inspect the state of a PowerBuilder object hierarchy without being within the process of the PowerBuilder application? Maybe there's an automation interface available, or something COM-based - or maybe something else?
Right now, my impression is that probably need to inject a DLL into the process of the PowerBuilder application and then gain access to the running PowerBuilder VM so that I can query it for the object tree. Some sort of IPC mechanism will then let me transport this information out of the PowerBuilder application's process.
Does anybody have some experience with this or can shed some light on whether anybody tried to do this already?
Best regards,
Frerich
First, the easy answer: I think what you're trying to do has been done, sort of. Rex from Enable does what I think you're after, but IIRC from talking with the developers, it depends on code hooks built into the application.
Which leads to the suggestion that I don't think you'll be able to do what I think you're trying to do completely externally from the application. You can grab window handles with WinAPIs and do some basic things with that, but not as much as you want. And getting information about DataWindows with WinAPIs? Forget it.
I believe I've heard of an API like the one you're asking about, but I've never heard of anyone other that automated testing software tool manufacturers getting their hands on it. If this is true (and the quality of this information is along the lines of "heard it in the hallway"), I suspect there might be some application security issues in letting this get out. (I know you'd never want to infect my application, or poke around and find out my secrets. grin)
Even with hooks into the PowerBuilder VM memory space, I'm not aware of being able to get a list of objects in memory without some PowerScript framework hooks (e.g. populating a list on every open and constructor with object handles). Once you've got a window handle, you can easily traverse its control arrays (and its subclasses control arrays) to get a list of objects on the window, but things like handles to NVO instance variables would be problematic.
I admire the idea. I wish I had better news (other than maybe Rex might solve your problem without the headaches of doing it yourself). Now I'm looking forward even more to what eran may release! grin
Good luck,
Terry.
I've just created such a tool, but I cheated a bit. Was actually about to ask the same question myself on the PB newsgroups. My solution is made of two parts:
Spy-like tool - a stand-alone app that like Spy++, i.e. lets you drag a target onto a control, using Windows API functions (though written in PB).
Internal infrastructure for target applications - located at the ancestor of all of the application's windows. Once given a certain (windows) handle, it goes through the Control[] array and looks for the control whose handle matches the given one. If necessary, it also recurses into control-containers such as tabs.
When the user selects a control, the spy tool first looks for its containing window using Windows API. When found, the tool sends a custom message to that window, which is then handled by the app's infrastructure. The control is then located in the PB app, and its details are finally sent back to the spy tool, which presents them to the user.
I suspect the infrastructure part can be replaced with some external thing, as I've seen tools that seem to be able to do that (Visual Expert, QTP). However, I haven't had the time to further investigate, and this solution was relatively easy to develop.
I've got to say, your question comes on a surprising timing. See this recent question of mine. If you're interested in the tool I've created, drop me a comment.

Keystroke dynamics in Linux

I'm thinking of implementing a keystroke dynamics (authenticating people based on their typing patterns) application for Linux. As I see it, I have two alternatives:
Extend the Linux logon to support keystroke dynamics
Create a desktop-locker program which "locks" the screen and can only be unlocked by a typist with a particular typing pattern
Is alternative 1 possible? Windows supports extending the logon process via msgina.dll, does Linux support something of the sort?
For altenative 2, is is possible to disable the mouse and keyboard?
libpam has plugin ability. so yes, totally possible, like the (in)famous msgina :)
locking the screen is mmm rather touchy - who is responsible? window manager, X server, session manager, the screen saver process, ?
I'm afraid different desktop environments (Gnome, KDE...) might have different opinions. Although these days, I'm pretty positive all of them will share some kind of FreeDesktop dbus interface to coordinate this type of functionality.
Assuming this is more than just a toy (in other words, if you plan to distribute), be sure you think about how to get around the typing pattern analysis when things go wrong. My typing patterns probably change quite a bit over time, as I've got wrist problems that flare up now and then. When they do, my typing probably changes markedly. I wouldn't be too surprised if my typing changes somewhat from morning to night even, as I am more or less tired and/or caffeinated.
Hey, Linux is open source, you could do anything you want :-)
It is very likely that you don't need to modify the kernel. For example, terminal login is controlled by the login program. Changing the source and rebuilding it will definitely allow you to do what you need to, although how difficult it is I've no idea :-)
Graphical login is taken care of by the window manager, so which program to change depends on which window manager you use.
EDIT: On a second thought, I'm not sure if login is executed early enough to catch the keystroke dynamics. Besides, it is a bit risky because if your version of login fails, it could make it difficult to login and fix the problem. You might need to take a look at getty and see how it invokes login. If you do it in a graphical interface it might be easier since you can always fall back to text terminal to fix any problem.
The proper way to do this would probably be through a PAM authentication module. Check out the module writers guide here: http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/Linux-PAM_MWG.html
Basically you can just add your module to the PAM stack, have it do its keystroke analysis, and then pass either success or fail to the system. This lets you integrate it with the console login process, and even SSH if PAM is enabled there. I'm not quite sure how it would work with a graphical login such as KDM or GDM. I know you can use PAM modules with those, but of course the interaction is done through the GUI textbox.

Resources