Unix write command to message another user - unix

I have some handheld scanners that i would like to send messages to (running Unix) and after using the write command to send a message to a handheld scanner(computer) to someone on the warehouse floor, the message stays on the screen (we are using AML M7220 scanners). Does anyone know a way to either clear the screen or refresh the screen after the message session has ended. I have tried to email AML and call AML tech support but they don't give a crap about responding to emails and when calling, it is not even a valid phone number. AML needs to update their website!!

There are many commands available to send the message to another user in the same network
1.mesg
2.talk
3.write
4.wall
these commands are used to send the message to another users

write is a fairly low-level utility. It has no notion of the contents of the screen that is at the end of the remote terminal, and anything else that happens to be running on that terminal has no awareness that its screen has just been polluted by a write session. Actually UNIX ttys in general have no notion of what's being on displayed on them (they are more or less just character streams).
You cannot clear the screen at the end of a write session because the only way you could possibly do it would be to pass a terminal-clearing terminal emulation sequence through the write session and (modern) write won't let you do that (it will escape it).
You cannot repaint the remote terminal's screen if some kind of full screen application happens to be running because there is no way to ask that application to do that.

Related

Amazon Alexa Skills Fallback intent not working

I'm reading the docs for Alexa Skills and there seems to be a fallback intent
https://developer.amazon.com/docs/custom-skills/standard-built-in-intents.html#fallback
I've turned it on in my app (added to the list of intents), but when I enter an unknown command in the test area (either by voice or by typing) all I'm getting is an annoying error sound and no request is sent to my server. I was expecting to receive an Amazon.FallbackIntent request on my server.
UPDATE: more complete answer here: Why does the Fallback Intent not get called if you say ONE random word?
FallbackIntent is designed to catch out-of-domain requests when you're in your skill session. From what you describe it sounds that you're typing garbage in the simulator before opening your skill.
In order to test it, open your skill in the simulator ("alexa open xxxxx"), respond from the backend without closing the session and then try entering/saying garbage.

Automate Blackberry 10 simulator actions

I'm using the VMWare Player and the Blackberry 10 simulator image; I need to do some unit/integration tests automatically. I know I can use the VIX api to spin up a new Simulator and load the Blackberry image.
What I would love to be able to do is send 'key presses', launch specific apps, and perhaps send gestures. On android there's monkeyrunner and other similar apps. However I haven't found much with respect to BB10, I know it's new but I can't be the only one with this request.
Also, how powerful is the telnet option? I can telnet into an emulator and change directory into the apps dir, but I can't list its contents, SUDO, or run anything.
*****UPDATE*******
I've made some progress WRT to this, but not much. It seems that you can use the Windows API to send mouse_evt messages to the VMWare emulator; it's not 100% reliable but works enough to open apps. The big hole I have right now is being able to detect state after the action/swipe/touch is executed, aka "did the swipe I just execute work? Are we in the right app?". It would be hugely beneficial to query the device's process list, but the 'devuser' account given in the telnet example can't really do anything.
This gist has the basics for how to touch and swipe the screen based on my experiences.
https://gist.github.com/edgiardina/6188074
As you are on windows, have you tried Autohotkey (freeware) on the host machine that runs the VMWare Player? This software can send any key/mouse move/click combination and has several ways of analysing the VMWare Player Window output and react to it.
If in your example you want to check if a certain app has started and is visible, you can start it manually once and make a screenshot of a small part of the apps interface. Then you write a script that sends whatever mouse moves and key types are needed to start the app, make the script pause a while and then perform the ImageSearch command to search for this image on screen.
I don't know much about any of this but telnet.
When you telnet in, you're assigned a shell, which, if the shell is a restricted shell, will prevent you from doing exactly the things that you mentioned, are you able to change the default shell options for the devuser?
You can change the directory but not create files, list files anywhere but the home directory, see any of the filesystem, redirect output, set environment variables, etc.
Which shell does it give you?
Can you telnet as a different user? Create a new user with better privileges?
Dru
Srry, should be comment.

How to keep the browser open after test execution when using selenium web driver

My script searches for different strings in different tabs of a browser. Is there a way to keep the browser open after test execution is over so that results can be checked at a later time? Currently the browser closes automatically after 5 mins even though i am not using driver.quit().
Selenium: 2.33, Win 7, FF and Chrome
I don't know if you can let the browser open. But may I suggest you to use the TakeScreenshot functionality of Selenium in order to save the state of the browser when you want. That could help you to debug or to check that the page is as expected.
If this solution doesn't help you, could you please explain us exactly why you want to keep the browser open?
I was able to get the fix at least for my problem. I am using Remote Web Driver class and there is an option to provide timeout and browser_timeout parameters on the command line when the hub is started. Setting the value to 0 means the hub will wait indefinitely. For this scenario i wanted that only.
while 1==1:
pass
This will put your code into a loop, browser will stay responsive, and you ultimately kill the python program with control C. Just did this for the scripting of logging on to an application with encrypted credentials stored locally. This keeps plain text user ids and passwords out of the scripting code.

Programmatically read Adobe game variables / interact with the game / game bot

Basicly, I'm trying to read a game's chat and catch actions from the user.
Here is the image which I will explain the situation with :
1: I took a message in the chat
2: I tryed to find it in the game's memory with Cheat-Engine
3: By examining every addresses where it was found, I ended up to this one, which contains the chat formated with what seems to be html..
That part is only the bottom part of the chat. (I see the rest of it if I scroll up)
So, I asked myself how could I read game variable to interact with the game.
Another thing I'm trying to achieve is to catch the user's actions so I can display some information in a winform.
I've just read about packet sniffing, it seems interesting for what I'm trying to do.
I tryed to read packets going in and out of this app with WireShark. Every action in game was sending a few packets, but I couldn't read them as they were just a bunch of weird characters. I tryed to decrypt them using a few methods I got on WireShark's forum without success. I was asking myself, even if I could see them in Wireshark, how am I gonna do that programmatically..
There is certainly a good way to do this, as we often see bots in this game.
Considering the number of bots playing "in team", I'm pretty sure they do not use clicks, but they run something in background that sends requests.
How do you make such a bot that fight, talk, interact with players automatically?
This game is Dofus, powered by Adobe Air.
I usually program with c++ and c#, but I was wondering what's the best way to do this.
I need a kick in the right direction!
Maybe trying a tcp/ip listner control (or use tcplistner class in c#) in your c# project with the appropriate port to catch requests (& responses). Information sended could be compressed so you may want to try some standard algo.
Did you try reverse engineer the AIR app ?

access scanner, barcode, camera with asp.net application

I have this weird requirement to access scanner, barcode reader, camera etc. from an asp.net application. Since these are local resources, i know its not possible to do that. I was wondering if there is some other solution to this problem.
I was thinking of creating an windows service that will run on local system and will open a port and listen to it and does the required job. I was wondering if there is a way to send some kind of message to the local port from an asp.net page using JS or some other library or activex.
If you have totally different solution, i am all ears.
We solved an analogous problem (ticket printer attached to serial port) by creating a tiny app (TCL/TK original, as it runs nicely on Win/Mac/Lin, but C#/.NET now since mono grew up), that
takes the user/password
creates the session with a web request.
opens the browser,
giving the session token in the URL as an anchor (http[s]://foo.bar/baz?x=y#sessiontoken)
This way it is never transmitted over the wire, but is available to the JS code in the client.
After the helper app has started the browser, it uses long polling and the session token (known to the browser and the helper app) to communicate with the webserver - as a client-sided app it can communicate with the peripherial quite naturally.
100's of 1000's of tickets printed this way ...
Edit:
Yes, I know this gets longer and longer, but I need (and was asked to) to elaborate.
If you want to avoid going the ActiveX/Silverlight/whatever route, which I strongly suggest, you need 4 players:
Webserver
Browser
Helper application ("Agent")
Device (Ticket printer, Barcode scanner, whatever)
Your basic problem is, that 1. needs to talk to 4., but can't. So you choose two parallell paths: Communication meant for the user is exchanged between server and browser, while communication meant for the device is exchanged between server and agent, the latter relaying it to the device (and ofcourse the other way round).
The agent is a quite simple application, that talks to the device via the OS facilities (how exactly this is done ofcourse depends on the device), and talks to the webserver via HTTP requests.
Depending, on which direction of information flow you need:
To facilitate information flow from the device to the server, simply
have activity on the device trigger a webrequest. (Input device, e.g. barcode scanner)
To facilitate information flow from the server to the devide, use long polling. (Output device, e.g. ticket printer)
For both directions do both (Server-triggered input device, e.g. camera)
Now the remaining problem is, how to correlate a human action in the browser with a device action - in short: How can the server send the ticket you chose in your browser to your ticket printer, not to whatever printer long-polls next.
To solve this, using the session ID is a natural fit - but it requires to have the browser and the agent both know the same session ID. For this to happen, you need to communicate it from one to the other. Since you can't communicate it from the browser to the agent (or this discussion would be moot), you need to communicate it the other way round - and the anchor in the URL is the vehicle to achieve this. You do the following:
User starts the agent (not the browser!) and enters his credentials
Agent calls sends a web request for a login to the server, and gets back a session token (please use some basic cryptography or go for HTTPS)
Agent then starts the browser (e.g. by executing cmd.exe /c start "http[s]://domain.tld/start.aspx?x=y#sessiontoken")
Since the session token is an anchor, it will not be sent over the wire, but will be available to the browser-sided code ... Bingo!
Now the two parallell paths are open: The browser for the human requests, knowing the session token, and the agent now going into the modes described above,
You can use ActiveX to do that or, maybe Silverlight (or Flash) which provide limited support for (at least in my experience Camera, Microphone and Scanner).
But, given a previously experience with something related to what you're trying to do I'll suggest you to better buy an SDK prebuilt.
Imaging:
http://www.viscomsoft.com/
Barcode:
http://www.tec-it.com/software/barcode-software/tbarcode/barcode-generator/Default.aspx

Resources