Home AMX User Forum NetLinx Studio

? IP_CLIENT_OPEN to ssh port 22

bobbob Independent ProgrammerPosts: 296
Hi there,

is it possible to login to an IP device (Linux fileserver) to port 22 (ssh)?

The command
IP_CLIENT_OPEN(dvIP.PORT, '192.168.1.2", 22, IP_TCP)
doesn't provide for additional parameters like username!?

The string which I have to execute to connect to the fileserver is
"ssh -l root 192.168.1.2"
or
"ssh [email protected]"

just
"ssh 192.168.1.2"
(what IP_CLIENT_OPEN() is certainly executing) doesn't work as there is no provision for the user name. Connecting through ssh is slightly different in comparisson to telnet where after a successful connection a username and password are input separately (in the STRING section of the corresponding DATA_EVENT). With ssh the username must be specified as part of the command and then only a password request is available, but not for the username.

Thanks much,
Bob
«1

Comments

  • viningvining X Member Posts: 4,368
    Yes, it should be possible. You need to know the protocol for the fileserver, if its like FTP once the socket is open you send it soemthing like "user USER" and it will reply something like "password required for user USER" to which you reply "pass PASSWORD". It's been awhile since I last played w/ FTP so this may not be accurate. Your best best would be to telnet into the server and find out what works and what doesn't.
  • bobbob Independent Programmer Posts: 296
    telnet is disabled due to security reasons, only ssh to the file server is allowed. it basicall acts like telnet but the user must bespecified right away on the comamndline with the command
    "ssh -l root 192.168.1.2" or "ssh [email protected]" and not as with
    telnet 192.168.1.2
    and then you enter username and password on the prompt.

    With ssh only a password prompt is presented and if the username is not already specified with the login command you can not login.

    The ssh protocol is TCP and the port is 22, it is just as I said I need to specify "-l root" with the IP_CLIENT_OPEN and I don't see a possibility to do that?! Would an "IP_CLIENT_OPEN(dvIP.PORT, '[email protected]", 22, IP_TCP)" work (notice the [email protected] with the IP-address)?

    Just "ssh 192.168.1.2" doesn't work so do not IP_CLIENT_OPEN. In contrast to that "telnet 192.168.1.2" would work so do IP_CLIENT_OPEN with telnet (port 23). I am just not allowed to use telnet and am looking how to specify the username with IP_CLIENT_OPEN() when making the ssh-connection to the fileserver.

    Thanks again!
  • yuriyuri Junior Member Posts: 861
    you can't SSH.
    only thing you could do is build an SSH tunnel (http://www.amx.com/techsupport/techNote.asp?id=721) and connect through that
  • bobbob Independent Programmer Posts: 296
    Thanks Yuri, but this is not what I want to do. I would like to connect from the master to a file server in order to control it. They are both on the same LAN, so I am not doing anything WAN->LAN through a Firewall and I don't need DynDNS. All I need is how I can specify more parameters with IP_CLIENT_OPEN()
  • jweatherjweather Junior Member Posts: 320
    Bob,

    While it's theoretically possible, I don't think you're going to be able to do it unless somebody has already written an SSH client module. There is no AMX support for SSH connections, so you'd have to write an SSH client from scratch in NetLinx, which I don't recommend -- the SSH protocol is extremely complex.

    IP_CLIENT_OPEN is more closely equivalent to "telnet" rather than "ssh", which is why there are no parameters to support SSH logins. If you can telnet to something from the command line, you can talk to it via AMX.

    As yuri mentioned, you can use an SSH client running on a PC to create a tunnel. PuTTY is one Windows-based client that will do tunnels. There's a command-line version of it called PLink that can be run from a batch file to create the tunnel. On Unixy systems, just run SSH with the correct parameters (look for -L in the man page for a local-to-remote forward)

    Jeremy
  • bobbob Independent Programmer Posts: 296
    Thanks, seems clear now!

    I have changed to telnet, however I still can't login. Here is the code, don't know what I am doing wrong:
    DEFINE_DEVICE
    dvIPFileServer = 0:2:0
    
    DEFINE_VARIABLE
    FileServer_BUFF[512]
    INTEGER nIPFileServerConnEstablished = 0  
    INTEGER nIPFileServerLogedIn = FALSE  
    
    DEFINE_START
    CREATE_BUFFER dvIPFileServer, FileServer_BUFF
    
    DATA_EVENT[dvIPFileServer]
    {
      ONLINE:
      { 
        nIPFileServerConnEstablished = TRUE
      }
      OFFLINE:
      {
        nIPFileServerConnEstablished = FALSE
        nIPFileServerLogedIn = FALSE
      }
      STRING:
      {
      }
    }
    
    DEFINE_PROGRAM
    IF (LENGTH_STRING(FileServer_BUFF))           
    {
        IF (FIND_STRING(FileServer_BUFF, 'login: ',1))
        {
          trash = REMOVE_STRING(FileServer_BUFF, 'login: ',1)
          SEND_STRING dvIPFileServer, "'username',$0D" 
        }
        IF (FIND_STRING(FileServer_BUFF,'Password: ',1))   // request for password
        {
          trash = REMOVE_STRING(FileServer_BUFF, 'Password: ',1)
          SEND_STRING dvIPFileServer, "'passwd',$0D"   
        }
        IF (FIND_STRING(FileServer_BUFF,'servername: ',1))  // this is the prompt after login
        {
          trash = REMOVE_STRING(FileServer_BUFF, 'servername: ',1)
          nIPFileServerLogedIn = TRUE
        }
    }
    
    
    PUSH [dvVPN2_4, 37]                       // turn off file server
    {
      IF (!nIPFileServerConnEstablished)
        IP_CLIENT_OPEN(dvIPFileServer.PORT, '192.168.1.2', 23, IP_TCP) 
    
      WAIT_UNTIL (nIPFileServerConnEstablished) AND (nIPFileServerLogedIn))
      {
        SEND_STRING dvIPFileServer, "'/sbin/halt',$0D"
        SEND_STRING dvIPFileServer, "'exit',$0D"
        IP_CLIENT_CLOSE(23)  // this is the port for telnet
        nIPFileServerConnEstablished = FALSE
        nIPFileServerLogedIn = FALSE
      }
    }
    
    
  • jweatherjweather Junior Member Posts: 320
    You could try terminating your commands with $0D,$0A rather than just $0D. I believe this is what most telnet apps do by default. Also check your program in the debugger to see if it's FIND_STRINGing the responses you're expecting to find.

    Jeremy
  • bobbob Independent Programmer Posts: 296
    Thanks, Jeremy! I have tried sending $0D,$0A with the same effect. Will try debugging. Is otherwise the logic of making the telnet connection correct?

    Should I call IP_CLIENT_CLOSE for port 23 or for the localport "dvIPFileServer.PORT"?

    Greetings,
    Bob.
  • funkyskierfunkyskier Junior Member Posts: 48
    PUSH [dvVPN2_4, 37] // turn off file server
    {
    IF (!nIPFileServerConnEstablished)
    IP_CLIENT_OPEN(dvIPFileServer.PORT, '192.168.1.2', 23, IP_TCP)

    Do you have IP_TCP defined somewhere else in your code? If I remember correctly IP_TCP need to be = 1.
  • Joe HebertJoe Hebert Junior Member Posts: 2,159
    funkyskier wrote:
    Do you have IP_TCP defined somewhere else in your code? If I remember correctly IP_TCP need to be = 1.
    It's defined in Netlinx.axi
    CHAR IP_TCP = 1
  • bobbob Independent Programmer Posts: 296
    Do I have t include Netlinx.axi or do anything special with it? I don't so far..
  • viningvining X Member Posts: 4,368
    Bob wrote:
    Do I have t include Netlinx.axi or do anything special with it? I don't so far..
    This is a system include file found at C:\Program Files\Common Files\AMXShare\AXIs. It contains all sorts of system constants and values. This is automatically pulled into your system during compiling and I think to answer your question, no, don't touch it or do anything with it. Just let it be. It's nice to look at an see what constant values are already declared for you that you can use w/o having to create your own.
  • HedbergHedberg Junior Member Posts: 671
    Getting a Netlinx telnect client to work

    Tech note 286 discusses using Netlinx as a telnet client and suggests that a Netlinx client session should probably work with most telnet server software without a lot of work:
    Note the most Telnet servers (i.e. device that accept telnet command) do require the use of the Telnet escape codes. It is possible that a Telnet server will not establish a connection until the Telnet negotiation sequence as been entered. How do you know if this is the problem you might be seeing? Telnet escape codes begin with the character 0xFF ($FF, 255 or HEX FF). If a device sends you this character and will not respond to any of the command you are sending, it probably requires the Telnet negotiation sequence. Most devices we have encountered so far do not require this: in our experience, the negotiation sequence is not required for the Netlinx master, Polycom codecs, All Windows Telnet servers, most Unix/Linux Telnet servers.

    That was not my experience with a known working Windows XP Telnet server (supplied with Windows XP Professsional). The server kept halting after sending escape code sequences and, apparently, not getting the desired reply from the Netlinx client. By accessing the Windows telnet server from a networked computer running Windows Telnet client and watching the traffic with Ethereal I was able to identify valid responses for the strings coming from the server.The telnet protocol reference in the Tech note explains what the strings mean though I couldn't compose a valid response without watching the sample traffic.

    This is the string section from the ip client data_event that enabled me to connect to the Windows telnet server. Once properly connected, valid "DOS" commands would work. I don't know if other responses would be necessary for other servers.
       STRING:
       {
    	sFromServer = DATA.TEXT
    	IF(FIND_STRING(sFromServer,"$FF,$FD,$27,$FF,$FD,$1F,$FF,$FD,$00",1))
    	{
    	    SEND_STRING 0:5:0,"$FF,$FC,$25"
    	}
    	IF(FIND_STRING(sFromServer,"'Welcome to Microsoft Telnet Service'",1))
    	{
    	    SEND_STRING 0:5:0,"$FF,$FC,$27"	
    	}
    	IF(FIND_STRING(sFromServer,"13,'password:'",1))
    	{
    	    SEND_STRING 0:5:0,"spassword,13,10"	
    	}
    	IF(FIND_STRING(sFromServer,"13,'login:'",1))
    	{
    	    SEND_STRING 0:5:0,"susername,13,10"	
    	}
    	IF(FIND_STRING(sFromServer,"$FF,$FD,$18",1))
    	{
    	    SEND_STRING 0:5:0,"$FF,$FB,$18"	
    	}
    	IF(FIND_STRING(sFromServer,"$FF,$FA,$18,$01,$FF,$F0",1))
    	{
    	    SEND_STRING 0:5:0,"$FF,$FA,$18,$00,$6E,$6F,$6E,$65,$FF,$F0"
    	}
       }
    
  • yuriyuri Junior Member Posts: 861
    bob wrote:
    Thanks Yuri, but this is not what I want to do. I would like to connect from the master to a file server in order to control it. They are both on the same LAN, so I am not doing anything WAN->LAN through a Firewall and I don't need DynDNS. All I need is how I can specify more parameters with IP_CLIENT_OPEN()

    i understand what you are trying to do, im just saying this is the only possibility you have :p
  • bobbob Independent Programmer Posts: 296
    Thanks much for all suggestions. Is there any possibility to watch the traffic on the network? You mentioned Ethereal - as I am trying to connect to a SUSE 9.3 Linux fileserver, will it work with Linux or is it Windows only? Any other programs to monitor/debug the traffic when doing a manual telnet connection in order to get the sequences straight?
  • jweatherjweather Junior Member Posts: 320
    Ethereal has a Linux version as well. There is also tcpdump, but it is significantly less intuitive, doesn't do any protocol decoding, etc.

    Jeremy
  • bobbob Independent Programmer Posts: 296
    When snooping for the traffic do I run Ethereal on the server computer (where telnetd is running) or on any other computer on the network (like on the client)?
  • bobbob Independent Programmer Posts: 296
    This Netlinx type of TCP/IP communication is really weird. Just debugging with ethereal and it turns out that IP_CLIENT_OPEN() will NOT negotiate with the client about the communication settings. The client sends some commands like $FF $FD $18 (do terminal type), etc. and then stops awaiting an answer from the master. As the master doesn't check this particular command strings in its STRING part of the corresponding DATA_EVENT the connection never establishes!

    I traced the telnet communication between a WinXP box and also an Apple Powermac computer to this particular SUSE Linux fileserver and those commsetting commands are a little bit different meaning that (while snooping with ethereal between the master and the file server) I have to do trial and error fiddling with sending strings until I get to the server login prompt :-(

    Hedberg wrote:
    Tech note 286 discusses using Netlinx as a telnet client and suggests that a Netlinx client session should probably work with most telnet server software without a lot of work:



    That was not my experience with a known working Windows XP Telnet server (supplied with Windows XP Professsional). The server kept halting after sending escape code sequences and, apparently, not getting the desired reply from the Netlinx client. By accessing the Windows telnet server from a networked computer running Windows Telnet client and watching the traffic with Ethereal I was able to identify valid responses for the strings coming from the server.The telnet protocol reference in the Tech note explains what the strings mean though I couldn't compose a valid response without watching the sample traffic.

    This is the string section from the ip client data_event that enabled me to connect to the Windows telnet server. Once properly connected, valid "DOS" commands would work. I don't know if other responses would be necessary for other servers.
       STRING:
       {
    	sFromServer = DATA.TEXT
    	IF(FIND_STRING(sFromServer,"$FF,$FD,$27,$FF,$FD,$1F,$FF,$FD,$00",1))
    	{
    	    SEND_STRING 0:5:0,"$FF,$FC,$25"
    	}
    	IF(FIND_STRING(sFromServer,"'Welcome to Microsoft Telnet Service'",1))
    	{
    	    SEND_STRING 0:5:0,"$FF,$FC,$27"	
    	}
    	IF(FIND_STRING(sFromServer,"13,'password:'",1))
    	{
    	    SEND_STRING 0:5:0,"spassword,13,10"	
    	}
    	IF(FIND_STRING(sFromServer,"13,'login:'",1))
    	{
    	    SEND_STRING 0:5:0,"susername,13,10"	
    	}
    	IF(FIND_STRING(sFromServer,"$FF,$FD,$18",1))
    	{
    	    SEND_STRING 0:5:0,"$FF,$FB,$18"	
    	}
    	IF(FIND_STRING(sFromServer,"$FF,$FA,$18,$01,$FF,$F0",1))
    	{
    	    SEND_STRING 0:5:0,"$FF,$FA,$18,$00,$6E,$6F,$6E,$65,$FF,$F0"
    	}
       }
    
  • funkyskierfunkyskier Junior Member Posts: 48
    what works for me

    Here is some snippets of code that work for me connecting to an xperinet media server. This is a linux platform running the fedora core. It should work for you application.

    IP_CLIENT_OPEN(ipXPN.PORT, '192.168.1.30',23,TCP) // Open IP port for Xperinet control

    IF(FIND_STRING(xpn_string,'Login:',1)) { SEND_STRING ipXPN, "'Username',$0D, $0A" }
    IF(FIND_STRING(xpn_string,'Password:',1)) { SEND_STRING ipXPN, "'password',$0D, $0A" }

    You cant monitor TCP/IP traffic through netlinx, but you can create a char array and see what the Telnet Server is returning, so you can figure out what to look for.
  • HedbergHedberg Junior Member Posts: 671
    When I was connecting to the built-in Windows XP telnet server, I watched the traffic from the command line Windows telnet client and also from a telnet client called Indigo (from Shade Blue -- you can download a trial). I would watch the string handler in Netlinx and see what the last string sent was and then run the other telnet clients to see what the response to that string was (in Ethereal). The Ethereal diagnostics would give the id number of the message that a string was in response to, so it was relatively easy to find which response string would work. I had to do this a couple times as each time I got one response correct, the server would hang waiting for a response to a different negotiation string. It took a couple hours in all to figure out, but once I realized that I could sniff out the negotiations with Ethereal and a working client, it only took about 15 minutes.

    I would think that you could copy the dialog by watching any telnet client (Hyper term, a Linux client, etc) that successfully connects to the server you want to connect to, but I haven't tried any server but the one that's built into Window XP Pro.

    After studying the telnet protocol stuff for a while, I thought that I could teach the Netlinx IP Client to anticipate the negotiation stuff and send notifications to the server rather than waiting for a particular string and then responding, but I was not able to figure out how to do it in the brief amount of time that I had. In other words, I tried a little and gave up as I had already solved the basic problem I had (connecting to the particular server).

    Good luck with this stuff. I know for me it's like trying to learn Russian by listening to a Russian read War and Peace in the original with nothing to go by but a really poor inter-language dictionary. Or, perhaps with a Russian to French dictionary along with a French to English.
  • bobbob Independent Programmer Posts: 296
    DATA_EVENT for telnet connection to a SUSE 9.3 Linux box

    Got it reverseengineered from snooping a connection. In case anyone is interested here is the code. I have emulated within the DATA_EVENT the telnet connection from a WinXP box to a SUSE 9.3 Linux server as this involved the least commands for handshake and negotiation. Enjoy and thanks everyone for the help and comments!
    DATA_EVENT[dvIPFileServer]
    { 
      ONLINE: 
      { 
        nIPFileServerConnEstablished = TRUE
      }
      OFFLINE:
      {
        nIPFileServerConnEstablished = FALSE
        nIPFileServerLogedIn = FALSE
      }
      STRING:
      {
          // Command: Do Terminal Type
          // Command: Do Terminal Speed
          // Command: Do X Display Location
          // Command: Do New Environment Option
          IF (FIND_STRING(DATA.TEXT, "$FF,$FD,$18,$FF,$FD,$20,$FF,$FD,$23,$FF,$FD,$27",1)) 
          {
            // Command: Will Terminal Type
    	// Command: Will Negotiate about Window Size
    	SEND_STRING dvIPFileServer, "$FF,$FB,$18,$FF,$FB,$1F"  
          }
          // Command: Do Negotiate about Window Size
          IF (FIND_STRING(DATA.TEXT, "$FF,$FD,$1F",1)) 
          {
            // Command: Won't Terminal Speed
    	// Command: Won't X Display Location
    	// Command: Will New Environment Option 
    	SEND_STRING dvIPFileServer, "$FF,$FC,$20,$FF,$FC,$23,$FF,$FB,$27"   
    	// Suboption Begin: Negotiate About Window Size
    	SEND_STRING dvIPFileServer, "$FF,$FA,$1F,$00,$64,$00,$32,$FF,$F0" 
          }      
          // Suboption Begin: New Environment Option
          IF (FIND_STRING(DATA.TEXT, "$FF,$FA,$27,$01,$FF,$F0,$FF,$FA,$18,$01,$FF,$F0",1))
          {
            // Suboption Begin: New Environment Option
    	SEND_STRING dvIPFileServer, "$FF,$FA,$27,$00,$FF,$F0"     
    	// Suboption Begin: Terminal Type
    	SEND_STRING dvIPFileServer, "$FF,$FA,$18,$00,$41,$4E,$53,$49,$FF,$F0" 
          }
          // Command: Will Supress Go Ahead
          // Command: Do Echo
          // Command: Will Status
          // Command: Do Remote Flow Control
          IF (FIND_STRING(DATA.TEXT, "$FF,$FB,$03,$FF,$FD,$01,$FF,$FB,$05,$FF,$FD,$21",1)) 
          {
            // Command: Do Supress Go Ahead
    	SEND_STRING dvIPFileServer, "$FF,$FD,$03" 
    	// Command: Will Echo
    	// Command: Don't Status
    	// Command: Won't Remote Flow Control
    	SEND_STRING dvIPFileServer, "$FF,$FB,$01,$FF,$FE,$05,$FF,$FC,$21" 
          }
          // Command: Don't Echo
          // Command: Will Echo
          // Data: Welcome 
          IF (FIND_STRING(DATA.TEXT, "$FF,$FE,$01,$FF,$FB,$01,$57,$65,$6C,$63,$6F,$6D,$65",1)) 
          {
            // Command: Won't Echo
    	SEND_STRING dvIPFileServer, "$FF,$FC,$01" 
          }      
          IF (FIND_STRING(DATA.TEXT, 'fileserver login: ',1)) // change this to match your server login prompt
          {
            // Command: Do Echo
    	SEND_STRING dvIPFileServer, "$FF,$FD,$01"  
            // username
            SEND_STRING dvIPFileServer, "'sUsername',$0D" // no need to send $0A  
          }
          IF (FIND_STRING(DATA.TEXT,'Password: ',1))  // change this to match your server passwd prompt
          {
            SEND_STRING dvIPFileServer, "'sPassword',$0D" // no need to send $0A
          }
          IF (FIND_STRING(DATA.TEXT,'fileserver:',1))  // got a prompt - change this to match your prompt
          {
            nIPFileServerLogedIn = TRUE
          } 
      }  
    }
    
  • Chip MoodyChip Moody Junior Member Posts: 727
    That's encouraging to see! Once upon a time, connections made with IP_CLIENT_OPEN would not pass telnet negotiation messages through to DATA_EVENT -> STRING: handlers, and you couldn't do this at all! For whatever reason at the time, the Netlinx OS trapped those sequences - didn't respond to them, didn't pass them to your program, nothing! It was really frustrating. If they announced when this changed, I'm sorry I missed it. :(

    - Chip
  • bobbob Independent Programmer Posts: 296
    The thing is that by opening a telnet connection to a more sophisticated client running a more complex telnet daemon, the client will respond with Do-Someting commands and wait forever until on the other end is reaction/answer to *exactly* the same commands! Which commands this are and in which order they are expected depends on the client's telnet implementation meaning one has to snoop the connection and found out exactly what it wants to be replied. www.ethereal.com is great (free) program for snooping available for almost all OS'es.
  • jweatherjweather Junior Member Posts: 320
    Nice detective work with the telnet options, bob. The only time I've run afoul of this is with a Tandberg 1000MXP codec, which just wanted something simple (window size, I think?) before it would talk to me.

    I would love to see more protocol support from AMX for common TCP/IP protocols in the future (telnet, SSH, FTP, HTTP, HTTPS, maybe others?). It seems like having fully-fledged protocol handlers would really open up some additional options in integration.

    Jeremy
  • bobbob Independent Programmer Posts: 296
    DATA_EVENT for telnet connection to an Apple Mac OS X 10.4 box

    Guys, here the Netlinx code to login to an Apple computer running Mac OS X 10.4. You may then control iTunes via AppleScript from the command line, pull out track/artist information and readin back in Netlinx, sleep the computer or do whatever you want. Have fun (especially try this one in terminal interactive mode (controlled from the netlinx telnet) - http://blog.experimentalworks.net/archives/19-iTunes-Remote-Control.html)!

    I also verified the code section from Harold Hedberg to login to a Windows XP Professional box and it also works like a charm. Thanks very much again!
    DATA_EVENT[dvIPAppleServer]
    {
      ONLINE:
      { 
        nIPAppleServerConnEstablished = TRUE
      }
      OFFLINE:
      {
        nIPAppleServerConnEstablished = FALSE
        nIPAppleServerLogedIn = FALSE
      }
      STRING:
      {
          // Command: Do Terminal Type
          // Command: Do Terminal Speed
          // Command: Do X Display Location
          // Command: Do New Environment Option
          // Command: Do Environment Option
          IF (FIND_STRING(DATA.TEXT, "$FF,$FD,$18,$FF,$FD,$20,$FF,$FD,$23,$FF,$FD,$27,$FF,$FD,$24",1)) 
          {
            // Command: Will Terminal Type
    	// Command: Will Negotiate about Window Size
    	SEND_STRING dvIPAppleServer, "$FF,$FB,$18,$FF,$FB,$1F"  
          
            // Command: Do Negotiate about Window Size
            WAIT_UNTIL (FIND_STRING(DATA.TEXT, "$FF,$FD,$1F",1)) 
            {
              // Command: Won't Terminal Speed
    	  // Command: Won't X Display Location
    	  // Command: Will New Environment Option 
    	  // Command: Won't Environment Option
    	  SEND_STRING dvIPAppleServer, "$FF,$FC,$20,$FF,$FC,$23,$FF,$FB,$27,$FF,$FC,$24"   
    	  // Suboption Begin: Negotiate About Window Size
    	  // Command: Suboption End
    	  SEND_STRING dvIPAppleServer, "$FF,$FA,$1F,$00,$67,$00,$1C,$FF,$F0" 
            }      
            // Suboption Begin: New Environment Option
            WAIT_UNTIL (FIND_STRING(DATA.TEXT, "$FF,$FA,$27,$01,$FF,$F0,$FF,$FA,$18,$01,$FF,$F0",1))
            {
              // Suboption Begin: New Environment Option
    	  SEND_STRING dvIPAppleServer, "$FF,$FA,$27,$00,$FF,$F0"     
    	  // Suboption Begin: Terminal Type
    	  SEND_STRING dvIPAppleServer, "$FF,$FA,$18,$00,$41,$4E,$53,$49,$FF,$F0" 
            }
            // Command: Will Supress Go Ahead
            // Command: Do Echo
    	// Command: Do Linemode
            // Command: Will Status
            // Command: Do Remote Flow Control
            WAIT_UNTIL (FIND_STRING(DATA.TEXT, "$FF,$FB,$03,$FF,$FD,$01,$FF,$FD,$22,$FF,$FB,$05,$FF,$FD,$21",1)) 
            {
              // Command: Do Supress Go Ahead
    	  SEND_STRING dvIPAppleServer, "$FF,$FD,$03" 
    	  // Command: Will Echo
    	  // Command: Won't Linemode
    	  // Command: Don't Status
    	  // Command: Won't Remote Flow Control
    	  SEND_STRING dvIPAppleServer, "$FF,$FB,$01,$FF,$FC,$22,$FF,$FE,$05,$FF,$FC,$21" 
            }
            // Command: Don't Echo
            // Command: Will Echo
            // Command: Do Timing Mark
            WAIT_UNTIL (FIND_STRING(DATA.TEXT, "$FF,$FE,$01,$FF,$FB,$01,$FF,$FD,$06",1)) 
            {
              // Command: Won't Echo
    	  SEND_STRING dvIPAppleServer, "$FF,$FC,$01" 
    	  // Command: Do Echo
    	  // Command: Won't Timing Mark
    	  SEND_STRING dvIPAppleServer, "$FF,$FD,$01,$FF,$FC,$06"
            }      
            WAIT_UNTIL (FIND_STRING(DATA.TEXT, 'login:',1))
            {
              SEND_STRING dvIPAppleServer, "sUsername,$0D"  
            }
            WAIT_UNTIL (FIND_STRING(DATA.TEXT,'Password:',1))  
            {
              SEND_STRING dvIPAppleServer, "sPassword,$0D"
            }
            WAIT_UNTIL (FIND_STRING(DATA.TEXT,'appleserver:',1))  // got a prompt - change this to match your prompt
            {
              nIPAppleServerLogedIn = TRUE
            }
          }  
      }   
    }        
    
  • Chip MoodyChip Moody Junior Member Posts: 727
    Especially when you figure the Unix-ish OS that Netlinx sits on top of would already have support for those, right? I've asked about secure (SSH/HTTPS) connection support ever since Netlinx processors appeared, with not terribly encouraging responses. Then when Duet was around the corner, I got excited as there were already methods built in to Java for secure connections. Of course, those were among things that got stripped out to make Duet fit. :( (And without any other really compelling reason to write in Java, my copy of Cafe Duet has been collecting dust)

    - Chip

    jweather wrote:
    I would love to see more protocol support from AMX for common TCP/IP protocols in the future (telnet, SSH, FTP, HTTP, HTTPS, maybe others?). It seems like having fully-fledged protocol handlers would really open up some additional options in integration.
  • Chip MoodyChip Moody Junior Member Posts: 727
    Now are you going to post the instructions showing how to enable the Telnet server? :) (Or is it on by default these days?)
    bob wrote:
    Guys, here the Netlinx code to login to an Apple computer running Max OS X 10.4.
  • bobbob Independent Programmer Posts: 296
    Chip, yeah, forgot to mention that :-) Just execute "/sbin/service telnet start" as root, or via the sudo command "sudo /sbin/service telnet start". And don't forget to open the telnet port 23 on any firewally you may have.
  • Chip MoodyChip Moody Junior Member Posts: 727
    It may have changed, but there used to be a config file that you could edit - uncommenting the line that by default prevents the Telnet service from launching took care of things automatically. (I know, terribly specific - can you tell I'm a Unix wiz?) I think a Google search on Mac OS Telnet would probably make it easy to find.

    - Chip
  • bobbob Independent Programmer Posts: 296
    Chip, you are referring to the standard inetd daemon and its configuration in /etc/inetd.conf - this one is still there but changing it isn't recommended anymore, as internet services are now controlled by xinetd.
Sign In or Register to comment.