SSH Automation on server - sockets

I am faced with the task of automating a process to interact with a server via ssh (it lauches a program, which can be navigated by keypresses).
At a certian point, it then will need to scrape some data, and once taken, enter a few more characters, and close the connection.
How would I approach such a problem? Any Programming language and linux/windows servers are pretty much fair game.
Is there any examples of a similar setup already in place? All feedback is apprecited
Thanks,
Steven

C
libssh
libssh2
Java
JSch
Ganymed SSH-2
Perl
Net::SSH::Perl
Python
paramiko
Conch
Ruby
Net::SSH

Related

Deploying Meteor App to own server

I have a completed meteor project and is currently deployed on the meteor website. I would like to move it to my own website, which is currently hosted by GoDaddy.
How do I install Node and Mongo on my server (linux) and then run my meteor project? I received ssh access to my server, so I assume I can do this, but I'm just not sure how.
So how exactly do I proceed?
Additional Info:
I'm not exactly sure what of linux it is. On GoDaddy, it simply says linux.
When I ssh, it shows me:
-bash-3.2$:
Also, I having my website simply show the myapp.meteor.com webpage would work too. An explanation on how to do this would work.
Discover Meteor has a chapter on deployment which helps to answer this question. For ubuntu-based servers they recommend meteor-up. I haven't used it, but it's probably worth checking out. Previous versions of the book recommended meteoric.
I wrote my own set of bash scripts using a few ideas from meteoric, but I already had a lot of experience doing deployment scripting. Frankly there's nothing quite like figuring it all out yourself, but doing sysadmin tasks doesn't appeal to everyone and it can be hard to pick up in a hurry.

Create a Virtual Machine from php, perl, or python? Is it possible or has it been done?

I had this thought experiment of installing an OS on a php server over http.
So, what I am asking: Would it be possible to build a VM player (using the server's resources) from a server language like perl, php, or python? Or is my understanding of servers and security lacking in a way that would show this to be impossible?
It's not as outlandish as you might think.
UeberHacker Fabrice Bellard (the guy who created QEMU, among many other notable achievements) recently did precisely that. He created a VM in Javascript. That runs a virtual Linux system in your Web browser:
http://linuxhelp.blogspot.com/2011/05/pc-emulator-in-javascript-run-linux-in.html

Can you write Windows services in Powershell

I have written a program in PowerShell that loops and checks stuff.
I would like to convert this into a Windows service.
I've created a Windows service (in Admin->Services) but I can't start it.
I'm pretty sure I'm missing the proper interface that the system needs to call into in order to start/stop/pause/etc the service.
I can find plenty of examples when it comes to doing it in VB/C#/MS-lang but nothing about how to do it using PowerShell. Is there any documentation (or preferably code examples) out there to help with this?
There are a few items at issue here:
Are you sure that you really need a service? I agree with the comments about using the scheduler for running periodic tasks. The scheduler can start tasks as Administrator.
Services call a special set of APIs to communicate with the Service Control Manager, so an ordinary program can't be used directly.
The Service Control Manager uses CreateProcessAsUser to start the service process, so you need to point the SCM to an executable binary, as opposed to a script.
If you can't use the scheduler (though I strongly encourage you to try), I suppose that you could write an executable binary that acts as a service. It would then execute PowerShell and your script on your behalf. I'm thinking something like the srvany program that used to be included with the Windows Server 2003 Resource Kit could bootstrap the service for you.
If you absolutly want to execute your PowerShell code into a service, I think you can write a C# service wrapper for PowerShell code.
You found examples of how to create a service with C#, and it's simple to call Powershell from C#. So I'am surprised that as small SrvAny oriented PowerShell does not exists yet.
My advice here, you better rewrite your code in C# as a service.
You can use the Compile Script into Service option of PowerGUI: http://documents.software.dell.com/DOC144271
I think what you are looking for is SrvAny.exe from Microsoft (I don't know that they support it any longer, but it has been around in the Windows 2000 Resource Kit for years. It will essentially turn just about any executable (.exe, .cmd, etc...) into a service. I have VBScripts running as quasi-services using Srvany.exe and it works on Windows 2003 and Windows 2008 (even 64 bit). It is a little limited in that it does not provide 100% service functionality (stopping a running script may be difficult) but if you now a bit about programming and the Windows environment you can adapt it to work pretty well (i.e. it will launch the program after server Restart/Startup as you would likely need from a service. There is some documentation with SrvAny.exe (although it can be a little obtuse and difficult to find). It is however Free and built for Windows so it should work for you.
I agree for simplicity that the Scheduled Task idea is worth thinking about as it is even more simplistic that srvany.exe
http://www.firedaemon.com/
Will allows you start littery anything as a service. There are also free alternatives to this application, that does the same.

How can I integrate Perl and Abyss Web Server?

I don't know Perl. I don't even love it, but i'm obliged to use a script that is coded in Perl.
I have Abyss websever on my PC (I use it both for .net and PHP), I want to know if I can simply download the needed files and link them to the current server; if no can some one link me to a simple Perl server that works.
Thanks
Have a look at Aprelium's instructions for integrating ActiveState and Abyss.
You could have just downloaded free Apache Server to handle the job

Portable USB Webserver

I have project that I'm working on that is going to require a webserver. The webserver will be used to remotely control a presentation using a mobile device.
I see there are quite a few options out there and I'm wondering if someone could provide some recommendations.
My criteria include:
Portable, fits on a USB key
Easy to
run. A user can just click on an
icon, or ideally it would include an
autorun command.
Open Source. I would prefer something licensed under the GPL or similar.
Runs a dynamic server-side language. I see that most have PHP which works perfectly, but I'm open to other languages.
Cross platform if possible.
Right now I'm leaning towards XAMPP, but I would love to hear some suggestions.
XAMPP is perfect for this.
I recommend XAMPP, so I think you are on the right track.
Have not used this, but it looks like it would be right up your alley:
http://www.blackdot.be/?inc=apache/httpserveronusb
Supports perl + php by default.
From the page:
If you are a web developer I'm sure you have had that moment where you went:
"If only I had a web server handy right now!"
Then HTTP Server On USB is something for you! HTTP Server On USB is a fully configured web server that runs from your USB-Key. Plug it in and off you go!
It can be use to show of a website to a costumer, share files with your friends (both ways thanks to DAV) or simply impress people but acting all geeky!
Are you special and do you depend on exotic 3rd party module?
Just drop them in the module folder and edit the configuration file!
Features:
Management Application
Apache 2.2.11
mod_deflate
mod_ssl
mod_security
mod_perl
PHP 5.2.8
ActiveState Perl 5.10
Requirements:
Windows 2000, Windows XP or Windows 2003
256mb USB-key
I have had no luck with XAMPP Lite or USBWebserver. What is currently working really well is Server2Go. I could never get XAMPP to run and USBWebserver would not allow me to install Drupal or Wordpress.
With Server2Go, I was able to install Drupal 7 on the USB Flash Drive, however, only with SQLite. I did need to go to the php folder and copy and rename the production-php.ini file to php.ini. There is a php.ini setting that needs to be set for the MySQL DB to be recognized. It is running well with SQLite for Development purposes though.
LAMPPIX - looks like not up to date, but should do the job.
I would suggest Apache, pretty lightweight and has everything you'll need (PHP).