Novahq.net Forum

Novahq.net Forum (https://novahq.net/forum/index.php)
-   Web design and Programming (https://novahq.net/forum/forumdisplay.php?f=32)
-   -   FSockOpen & SSH (https://novahq.net/forum/showthread.php?t=32987)

BeBop 02-03-2006 10:07 AM

FSockOpen & SSH
 
Issue:
PHP Code:

<?
    echo "Connecting to SSH:<br>";
    $con = fsockopen("localhost", 22, $errno, $errstr, 15);


       echo fgets($con, 1024);
   
?>

Displays:
Connecting to SSH:
SSH-1.99-OpenSSH_3.9p1

________________________________

I need to be able to login etc, with telnet i had ot send a header but so far a google search for an SSH header has been fruitless.

This is what the telnet one looked like:
Code:

$header1=chr(0xFF).chr(0xFB).chr(0x1F).chr(0xFF).chr(0xFB).
chr(0x20).chr(0xFF).chr(0xFB).chr(0x18).chr(0xFF).chr(0xFB).
chr(0x27).chr(0xFF).chr(0xFD).chr(0x01).chr(0xFF).chr(0xFB).
chr(0x03).chr(0xFF).chr(0xFD).chr(0x03).chr(0xFF).chr(0xFC).
chr(0x23).chr(0xFF).chr(0xFC).chr(0x24).chr(0xFF).chr(0xFA).
chr(0x1F).chr(0x00).chr(0x50).chr(0x00).chr(0x18).chr(0xFF).
chr(0xF0).chr(0xFF).chr(0xFA).chr(0x20).chr(0x00).chr(0x33).
chr(0x38).chr(0x34).chr(0x30).chr(0x30).chr(0x2C).chr(0x33).
chr(0x38).chr(0x34).chr(0x30).chr(0x30).chr(0xFF).chr(0xF0).
chr(0xFF).chr(0xFA).chr(0x27).chr(0x00).chr(0xFF).chr(0xF0).
chr(0xFF).chr(0xFA).chr(0x18).chr(0x00).chr(0x58).chr(0x54).
chr(0x45).chr(0x52).chr(0x4D).chr(0xFF).chr(0xF0);
$header2=chr(0xFF).chr(0xFC).chr(0x01).chr(0xFF).chr(0xFC).
chr(0x22).chr(0xFF).chr(0xFE).chr(0x05).chr(0xFF).chr(0xFC).chr(0x21);

I would just fputs($header) [1 and 2] and it would let me login like normal -

How can I do this with SSH via PHP?

Capers 02-03-2006 07:52 PM

Maybe if your server has it installed or you are able to get it installed you could use the Secure Shell2 functions?

http://uk2.php.net/manual/en/ref.ssh2.php

Not the best solution, especially with people finding it hard to use the functions. But i'm tired and can't think at the moment, lol.

DevilDog#1 02-03-2006 08:05 PM

I've seen this question before somewhere!! :eek:

BeBop 02-03-2006 08:30 PM

Cant use SSH2 its on shared hosting - but the server i need access to is on a dedicated were renting ^_^;;;;

Scott 02-03-2006 08:57 PM

I've never had to try and connect so I wouldnt know where to start but google, which seems to have plenty of tutorials..

http://www.google.com/search?q=php+ssh

BeBop 02-03-2006 10:53 PM

Thanks scott.


All times are GMT -5. The time now is 11:14 PM.

Powered by vBulletin®