I am planning to do an App either in c++/C# (through Visual Studio) in Windows 7.
OK what this app does is it will accept input through studio elements like text box or buttons ..then it should create an command based on input and run these command on the Linux server.
E.g : One simple example is to restart a certain process on a Linux machine
Now to proceed to my problem:
How do I connect my App to Linux machine?
I don't want to install any third party application as i am not allowed to do so.
If possible please list me the different ways i can do this
Well, you can do this. I am already familiar with this scenario. I have several application setup working this way. The only option that will allow you to do this without any 3rd party application is using SSH protocol.
The SSH protocol is the well known and most power full tool of linux sysadmins. You can execute any command over it on a linux box from any part of the world or any piece of shit which can run an SSH client. Ask me on comment if you need more info on this.
EDIT
One example, if you want to restart certain process.. You can pass the command over SSH as below.
ssh user#server_ip '/etc/init.d/httpd restart"
The above will restart the HTTPD(Apache) service.
Some libraries you can use in .NET
http://www.codeproject.com/Articles/11966/sharpSsh-A-Secure-Shell-SSH-library-for-NET
https://sshnet.codeplex.com/
I have not used above libraries in .Net, Instead I have done several things using linux box with python and bash.
if I understand correctly, to solve this you can implemente WebService.
But when you said :
I dont want to install any third party application as i am not allowed
to do so
I'm afraid you can not setup WebService on Linux server ?
Other possibility, use SSH if already install on linux server (some chance that is) and you probably could find a .Net lib to make SSH
This link will help .Net class to execute remotely on Linux over SSH?
Related
I am making an simple application on PC by C# to send command to jailbroken iphone (exp: open app, get list application installed on iphone..e.t.c..) but I do not know how to send to iphone, searching google but can not find a thing to do this. Anyone know how to send command to iphone please point me out or some documents to learn about this.
Thank you.
in my opinion the best way to go is using SSH, here's the steps
On the Jailbroken device (Skip this steps if you already have an ssh server installed and running)
Download the SSH server from Cydia
Take note of your device's IP address
Default username: root and password: alpine Remember to change that!, also i would recommend creating another user for your app
In your application
Download and install the SSH.NET library from NuGET here
Implement your appropriate methods to connect,disconnect and send commands, se those examples:
using (var client = new SshClient("phoneIp", "phoneUsername", "phonePassword")) {
client.Connect();
//Open the Facebook app and show your profile
client.RunCommand("open fb://profile");
//Alternative method using `uiopen`
client.RunCommand("uiopen fb://profile");
//Read device network info (install network-cmds first)
Console.WriteLine(client.RunCommand("ifconfig"));
//List all apps installed via Cydia
Console.WriteLine(client.RunCommand("dpkg –list"));
//List all apps that are installed from iTunes/Appstore
Console.WriteLine(client.RunCommand("cat /private/var/mobile/Library/Caches/com.apple.mobile.installation.plist"));
client.Disconnect();
}
I haven't tested this code of course, and I have no Jailbroken iOS device, but this should put you on the right path at least!
First you have to create a daemon on your jailbroken iDevice. It will contain a TCP server, which accepts connections from your PC and translates them into your commands. After that commands will be executed by your daemon and you have to write code to process each type of command.
Another one easy solution would be to use Cycript in conjunction with SSH.
If Cycript is installed on the jailbroken phone and a SSH server is running, you could write some scripts and upload it to the phone.
By running them, it would output relevant informations to the standard output.
You would still have to do some very basic reversing stuff to know what you want to to display (i.e. asking the right SpringBoard controller to have the desired information)
I have desktop application that can be installed on the users computer with "setup" msi file like any other application.
I'm developing web application and I need somehow to integrate the desktop application with the web application. Web application is developed using PHP (desktop application is developed using C#), and when clicking on one button on the web application, the desktop application needs to be launched.
Is there a way of doing this? I was thinking about a few scenarios:
-Maybe if possible to install the app directly on the server and to launch it from there?
-Maybe to be required the user to have the app installed on his computer and to call the app from there?
If possible I would prefer to not use the second approach because it's better if the third party to not be involved - it will be more user friendly if the application is launched directly. But any help will be appreciated because at this point I'm not sure if that is possible to be done at all.
You can install app at server an run it with exec() or "`" operator - but to control gui of app you need to use some like autoit ant etc.
If you ultimately decide to require your users to have the client application installed and expect majority of the users to be on Windows, you could register your application to handle specific scheme and parse its command line when started. More on this here:
http://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx
You'd register a custom scheme and then intercept in in the application's command line arguments. The whole URL will be passed as an argument, e.g.:
myapp://parameter1,parameter2
The browser will mostly ask whether or not the user trusts the application to handle this scheme with an option to remember this setting.
If you don't have access to the source code of the client application, you can develop a middleware, some sort of a launcher that handles the URL and then runs the client application after maybe modifying some configuration files based on the URL or otherwise controlling the third-party application to do as you with.
As for solution #1, I don't think C# matters if your application can run on Mono, so you should be able to just run it from PHP. However, this probably won't work on web hosting and you will have to get a VPS for that.
There are very good (security) reasons why it is hard to launch client-side processes from web browsers.
Do you have access to the source code of the C# app? If so, you could consider modifying it to take advantage of Microsoft ClickOnce deployment.
Some references:
http://msdn.microsoft.com/en-us/library/t71a733d.aspx
http://msdn.microsoft.com/en-us/library/t71a733d(v=vs.80).aspx
http://msdn.microsoft.com/en-us/library/6ae39a7c.aspx
http://www.codemag.com/Article/0902031
Here's an old article on deploying WinForms applications via ClickOnce with Visual Studio 2005: http://msdn.microsoft.com/en-us/library/ms953320.aspx
It can possibly be done with IIS but it can be cumbersome setting it up to run as the current user, especially since it would probably also need to run elevated for an app that needs to attach to the current user's desktop.
Easiest is to install a Windows LAMP distro (like WAMP: http://www.wampserver.com/en/) and then run the httpd.exe directly from an elevated (Admin) command prompt; do not run apache as a service!
Once you do this performing and exec("command"); call in php will bring up a desktop app as if it was invoked from an admin command prompt. Obviously you need to set up the apache server to be accessible from outside the local system, etc.
I'm not sure where to get started with simply executing a remote script and returning the output to a web form. In this case we have an application server that executes some 3rd party tools. We'd like to write an interface for our power users that allow them to check the status of various processes and also execute some of the 3rd party admin tools that support has available. The issue is that we only connect to this Linux (RedHat) machine via Putty over SSH. I looked into PsExec but it doesn't seem to handle SSH. I'd like to avoid any large security holes, if possible, but this is intended to be a limited number of users in a closed network.
Thanks for any assistance getting started!
There are several options to do SSH in .NET - although you need a library for that since nothing is built-in:
http://www.codeproject.com/KB/IP/sharpssh.aspx
http://www.rebex.net/ssh-shell.net/ (commercial)
https://www.eldos.com/sbb/net-ssh.php (commercial)
http://sshnet.codeplex.com/
http://granados.sourceforge.net/
Hey guys, I was working on a simple chat program to brush up on my C#, and ran into a roadblock. I wanted to allow one computer to broadcast its location, and the other to find that computer, and display it (and any others) in a list.. Just a push in the right direction would be great,
Thanks,
Max
Mono.Zeroconf is a .NET library that provides common zeroconf opertations - service publish and discovery. It uses Apple's Bonjour for Windows as a transport on Windows.
Developers can publish services that will be exposed to other computers on the local network and also query the local machines on the network for services that could have been exposed.
See Peer-to-Peer Programming with WCF and .NET Framework 3.5.
All you need is to share destination PC. and then run your web-based application on the target pc IIS.
Updated Part :
If you have awindows application and want users use that application youhave some solution
create a Login form for your application
use from MarshalByRef object and create a Channel between user andaplication
create a MSI (setup) and run it from server (in entire Active Directory).this will install one application in each client
create a simple dot net setup. justRight click onyour windowsproject in VS and then select Publich, in the wizard walk through creating a network application
I think the last option is closest one to your request
Use AD (Active Directory)? Or some such [which would serve as] central messageboard mechanism - maybe even MSMQ?
I'm planning on writing a small program that uses the .NET framework to read disk capacities on remote Windows PCs.
I normally write in C#, so I'd like to stick with this. A number of us in our department need access to this program.
Should I write this as:
a desktop app
an MMC snap-in
an ASP.NET application with a service?
Any suggestions? Many thanks.
A different idea, what about a PowerShell cmdlet with WMI?
A service with WCF comes into my mind. Thus, a central application could query the service on each remote windows PC to get the information.
If these PC's already publish their disc capacities in some form (eg. via windows shares or something else), you could omit the service part and directly query the machines.
WMI already publishes this information. So all you need is a client. Depending on the needs of your users, it could be a WinForms app, an MMC SnapIn, a console app, etc etc.