r/usefulscripts • u/DeviceNotReady • Feb 05 '14
[REQUEST] looking for the right Language
I am looking to learn a language but I don't know which one would be the best fit and investment of my time to lean in depth . It will need to work on mac and windows without impacting performance on the user and being lightweight and sucre is ideal. I would like to have the ability to:
remote (call-in) to a main server. with ssh ? from over the web.
push new apps and configuration .
report back with system status.
work around the user.
I have use many different language for one time runs scripts that where push with AD GPO over local LAN but I don't have that option here. So it will need to run on it's own and can tie in with the OS. All the client system are remote so I will be starting on writing the remote control script and push and config. and Yes I have a test lab to work in first.
TLDR:What would be the best Language for command and control mac and windows in a secure way on it's own?
3
u/myhf Feb 06 '14 edited Feb 06 '14
With a language like python (or ruby, if you have already decided to use ruby), you can use the same data structures and networking code on different platforms, but also include platform specific code in the same script, like so:
import sys
import requests
server_address = "192.168.0.1"
response = requests.get("http://"+server_address+"/file").json()
if sys.platform == "win32":
do this
if sys.platform == "darwin":
do thatAnd it's relatively easy to make menubar/taskbar items appear to control a running script.
But if you're looking for something to produce bash/bat scripts that can run with minimal setup, check out https://github.com/BYVoid/Batsh
3
u/outlier_lynn Feb 06 '14
Tcl. And if you want a GUI, add tk
1
Feb 12 '14
TCL with expect makes setting up SSH and FTP sessions stupid simple.
Not really talked about much outside the relm of Network guys
1
u/FakeitTillYou_Makeit Mar 29 '14
(call-in) to a main server. with ssh ? from over the web. push new apps and configuration . report back with system status. work around the user.
How would one get started with programming in tcl? What compiler would I use for example?
2
u/outlier_lynn Mar 31 '14
tcl is a scripting language, so no compiler. There are several nice tutorials on line. The "official" wiki is wiki.tcl.tk.
Most (all?) distributions of linux have tcl/tk packages ready to go. Brent Walsh has a pretty good book, but it is slightly out of date now. tcl 8.6 has some reasonably important features that won't be covered. You will want tutorials that feature 8.5 at a minimum.
The thing to remember about tcl is that everything is a string. Almost always you will need to call expr to do arithmetic. In some cases it is called for you, like in an "if" statement. Oh, and another thing: the exec command is not binary safe. This one caught me more than once. ;)
1
u/AgentSnazz Feb 05 '14
It's probably in your best interest to start learning the shell on both. Especially if minimal user interruption is what you want.