Debugging Playbook using SSH - debugging

I am using one of the cross platform sdk (marmalade if you need more details) to develop a game for blackberry playbook. The SDK do not provide any mechanism to debug apps on playbook device, so I've to use command line to do this. I've searched about this and I've got to know that I need to connect to playbook to my mac over SSH connection and get the log files stored in appdata.
I am successful in connection my playbook to my mac using SSH, now nowhere the next step is mentioned. I've never used SSH before and don't know how it can be used to transfer files. SO my question is how can I debug or get logs from playbook using SSH, once the SSH connection is done.
PS: Please tell the answer considering I've a Mac, not windows PC.

FInally got it. Actually I thought there'd be some command line utility to find the log files. I just downloaded FileZilla(Any sftp client will do), copied the added private key and connected to the already ssh connected playbook. I can now download the logs from the appdata.

Related

Copy files from remote Windows machines with command-line, through RDP

Our team has ~80 Windows development machines, and activities of each developer are logged as text files on the local storage of those machines.
To analyze the logged activities, I want to gather all log files from those machines. Additionally, the log files are updated constantly, so It is desirable to gather files with the command-line from my machine.
I’ve searched and found some solutions, but all of those are not suitable for our situation:
We cannot use PsExec, because tcp/135 and tcp/445 are both closed (countermeasure for WannaCry).
Administrative share is disabled.
telnet service is not up and is banned by security reasons.
WinRM is disabled on those machines by default.
It is difficult to install new software like OpenSSH on those machines (because of the rule of this project)
RDP is the only way to connect those machines. (I have an account on all machines)
How can I copy files from remote Windows machines with command-line through RDP?
Or, at least, is there any way to execute a command on remote Windows machines with command-line through RDP?
I think you can do this, though it is very hacky :)
For a basic setup, which just copies files once, what you would need to do is
Run a script in the remote session when it logs in. I can think of three ways to do this:
Use the "Alternate Shell" RDP file property. This runs a specified program in place of explorer.exe on login; you can use it to run "cmd.exe /c [your script]" for instance.
If that doesn't work (e.g. the remote machine doesn't respect it), you might be able to use a scheduled task that runs the script on login, but perhaps only for a specified user, or maybe the script could check the WinStation type to make sure this is actually an RDP connection before doing anything.
It's also possible to do this by connecting in RemoteApp mode and using the script as your "application", but that only works for Server and Enterprise editions of Windows.
Enable either drive redirection or clipboard redirection on the RDP connection, to give you a way to get data out.
Drive redirection is much simpler to script; you just have the remote script copy files to e.g. "\\tsclient\C\logs".
Clipboard redirection is theoretically possible - you have the remote script copy, then a local script paste - but would probably be a pain to get working in practice. I'm only mentioning it in case drive redirection isn't available for some reason.
You would probably want to script to then log the session off afterward.
You could then launch that from command-line by running "mstsc.exe [your RDP file]". The RDP files could be programmatically generated if needed (given you're working with 80 machines).
If you want a persistent connection you can execute commands over, that's more complicated, but still technically possible. Two ways I can think of:
Use the previous method to run a program on logon, but this time create a custom application that receives commands using a transport that isn't blocked and executes them in the session. I've done this with WCF over HTTP, for instance; it's not secure, of course.
Develop and install a service on the remote machine that opens an RDP virtual channel, and a corresponding RDP client plugin that communicates with it. You can then do whatever you want across the connection. While this solution would be the most likely to work, it's also the most heavyweight and time-consuming to implement so it's probably a last resort.

How would I create an SFTP connection if my application framework does not contain an API for it?

I am trying to connect to an SFTP server with my AIR application. It doesn't matter that it's an AIR application except that I haven't found any libraries or AIR API methods for it.
My first thought is to find a library in another language and rewrite it in ActionScript. I'd rather not do that and my lack of experience may introduce security issues.
My second thought is to call a native process or command such as sftp or sshpass or curl from my main application and pass the local and remote upload locations to it and let it do the work. The downside to this is if they don't have the command installed they have to install a separate program.
My questions are:
Are these SFTP commands available by default on both Mac and Windows?
Should I store the users login (I do not want to) or prompt them to enter it each time? Does SFTP / public key remove the need for that?
I've found two related questions here and here but some of it is over my head. They also seem to be specific to *nux (which may work for Mac as well but not Windows).
I do not have the experience in this area so I would welcome those with experience to give guidance if this is a good idea or not. Overview type answers are welcome for me as I can attempt to work out the details. If no answer is given, once I've figured it out I'll post an answer. Please do not close this question (rather suggest edits).
FYI I'm using AIR to make a native process call.
An AIR application in the extended desktop profile can execute a file,
as if it were invoked by the command line. It can communicate with the
standard streams of the native process. Standard streams include the
standard input stream (stdin), the output stream (stdout), the
standard error stream (stderr).
I can also create and call a scpt, sh or bat file.
Commands installed on my Mac:
curl_init(), curl_setopt()
ssh
sftp
Commands not installed on my Mac:
sshpass
Are these SFTP commands available by default on both Mac and Windows?
No. There is no sftp nor ssh on windows by default, unless you install it through cygwin or bundle them in your application (also solution).
Should I store the users login (I do not want to) or prompt them to enter it each time?
Prompt is preferred.
Does SFTP / public key remove the need for that?
Yes, but you will have to store private key, which is almost the same like storing password.

SSVNC command line arguments

I recently got SSVNC to connect a Windows VNC client to a Linux VNC server through a repeater with SSL encryption.
I am now trying to use SSVNC in Windows Command Prompt. What I have found so far online is that command line arguments are supported in Unix environments, but have not found the same documentation for Windows. So far the only command line argument that I have found for Windows ssvnc.exe is specifying the client, which is not adequate for what I am trying to do. In Unix, there is support for specifying a profile, so I opened one of those profile files in a text editor. This seemed like a possible option for what I am trying to do, but I am not sure if the Windows executable supports it/ haven't had success with it.
Basically what I am looking for is:
Is it possible to launch SSVNC with a batch file in Windows and have SSVNC establish an SSL connection between a Windows VNC client and Linux VNC server through a UVNC repeater?
Is it possible to launch SSVNC with a profile in Windows? This way I could specify certain settings before hand and SSVNC will handle the connection and launch a viewer.
Are there any other methods I have not thought of to make this work?
I have been able to make this work in a batch file. This took a few steps to get working.
To do so I had to launch a fresh instance of SSVNC. Then I populated all the fields with the necessary information and selected the options I needed in the Options and Advanced Options windows. After that I fetched and saved the SSL certificate. I saved this configuration as a new profile. I then restarted the SSVNC gui and loaded the profile, and most of the settings stuck. The connection was established and the VNC client launched.
To test that I could load it with a profile I opened Command Prompt and navigated to the directory that SSVNC is located. I issued the command "ssvnc.exe demo", demo being my profile name. This launched with (mostly) the correct settings and the SSL connection through the UVNC repeater was made and the VNC client launched fine.
After that, I made my batch file.
cd C:...\ssvnc\Windows
start ssvnc.exe demo
And this works

Using SSHFS on a Mac with a password-protected private key

Hey guys, I have a remote fileserver that I use to host my music/movies. I have a laptop and desktop, and wanted to share my files between the two, without the files actually being on either machine, so I employed an old dying laptop to host an SSH server, plugged into my external drive.
I have sshd configured on the server to accept connections using my password-protected private key, and it works great using applications like Cyberduck. The problem is, I want to be able to open iTunes and point it to my remote library. (Obviously iTunes would only work while the share is mounted.) Similarly, if I want to watch a movie, I don't want to have to copy it to my desktop, wait for the transfer to finish, then start watching. I want to double-click the file, and have it stream to my laptop as if it were a local file.
The problem is, I tried installing sshfs from this site:
sshfs for Mac OS X
But I can't figure out how to provide a private key, let alone a password-protected one. I'm new to SSH server configuration, so if I'm leaving out any crucial information, let me know.
Thanks!
You might first want to use the standard sshfs for OS X which is included with MacFuse here. Using that, it supports reading the $HOME/.ssh/config and ssh keys just like the standard command line ssh client. Try getting a connection working with ssh client and then use the same username and host name for the sshfs mount. I use exactly this setup with iTunes for accessing my music library remotely. However, if the machines involved are both OS X systems and on the same network (so that Bonjour discovery works), current versions of iTunes allow automatic sharing of music libraries, as long as you are willing to keep iTunes running on both. See iTunes -> Preferences -> Sharing.

How to ask a remote windows machine to automatically launch an application?

I have a windows server 2003 up in the internet.
But sometime I need to restart it.
After restart, I want one of the applications to run.
I want to do this all programatically.
I can now remotely restart the server.
But the question is how can I ask that piece of software to be executed (more precisely, I want to execute a .BAT file to ask a tomcat to run)?
Because I don't want to manually log in to the machine and start that application. That is time consuming. Is there any possible way, once the machine is started, my application will be run as well?
If you're developing an application that should always be running on the server, you probably need to implement it as a Windows service. For C#, see the classes in the System.ServiceProcess namespace -- you will need to inherit from ServiceBase.
Alternatively, you can set the program to be run as a scheduled task on boot. See the Task Scheduler API to do this.
You can install Cygwin and then do it the same way we'd do it on a Linux box: via ssh, using keys.
OpenSSH is not part of the default Cygwin install, so be sure to select it. It's in the Net category.
Then, after you've installed Cygwin and sshd, read /usr/share/doc/Cygwin/openssh.README to learn how to set up sshd as a service, so it will answer requests automatically, without you having to start the ssh daemon manually.
Finally, set up keys, as described in the link above.
Part of the ssh protocol is a way to ask a remote machine to launch a program. Setting it up with keys lets you do it without needing a password.
You could try xCmd, which is a freeware app to run a command on a remote machine.

Resources