After the first topic about
computer management via SMS, I received a lot of comments and suggestions. It turned out that the idea is not so crazy as it seemed at first glance.
Once the idea has taken root - I post a
new version .
I will not repeat and re-upload the full description of the program, it can be found in the
first topic , I will give only a list of changes and comments to some of them.
New:
- Added the ability to pass command line arguments when calling a script
- Added default action
- The program beats all incoming calls.
Changes:
- The program only logs errors
Errors:
- When checking new messages, in the absence of them there was a slight memory leak.
Passing command line arguments
In the incoming message, the first space is searched, if it is detected - the message string is divided into two parts, the first is interpreted as a command, the second as command line arguments.
For example, there is an action specified in the configuration file:
[123]
script = scripts\cmd.vbs
reply = 1
replyTo = 7917XXXXXX
allowedTo = 7917XXXXXX,7902YYYYYY
Send a message like
123 net stop dnscache . The received message will be broken,
123 will be interpreted as an action identifier, and
net stop dnscache will be passed to the script as an argument to the command line.
Default action
It is executed if no other actions with the specified identifier are found. The entire text of the incoming SMS message is passed as arguments to the command line.
[Default]
script = scripts\cmd.vbs
reply = 1
replyTo = 7917XXXXXX
allowedTo = 7917XXXXXX,7902YYYYYY
We send the message
net stop dnscache , if there is no action with the
net identifier the action
Default will be executed, the
net stop dnscache will be passed as arguments to the script.
')
When using the
cmd.vbs script, in the event that the action has the
reply = 1 flag, after the execution of the script an SMS message will be sent containing the console output of the command being called. For example, after performing
net stop dnscache, you will
receive an SMS with the text
The DNS Client service was successfully stopped.Thus it is possible to monitor the success of the sent command.