Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Secure-Shell
[Top] [All Lists]

Send SSH-Password over C-Program

Subject: Send SSH-Password over C-Program
Date: Thu, 11 Oct 2007 15:23:07 -0700 (PDT)

Hello @all!
I'd like to start a ssh-connection over a c-program. I've tried it with
"pope". It looks like that:
//CODE
#include <iostream>
#include <string>
using namespace std;

int main()
{

 FILE *write_fp;
 char password[50];
 char command[50];
 sprintf(password, "thats_the_ssh_password");
 sprintf(command, "date");
 write_fp = popen("ssh -l root server", "w");
 fwrite(password, sizeof(char), strlen(password), write_fp);
 fwrite(command, sizeof(char), strlen(command), write_fp);
 pclose(write_fp);
}
//CODE
You see i try to:
- start "ssh -l root server"
- send the password to the "root@server's password: " prompt
- send a command ("date") over SSH to the server.

I've found out that SSH doesn't expect the password over the
"normal-channel". 
Does anybody know if there is the possibility to insert the password into
the "ssh -l root server"-command?
That would solve the problem...

Thank you!
Best regards,
Mike
-- 
View this message in context: 
http://www.nabble.com/Send-SSH-Password-over-C-Program-tf4610322.html#a13165923
Sent from the SSH (Secure Shell) mailing list archive at Nabble.com.

<Prev in Thread] Current Thread [Next in Thread>