Results 1 to 6 of 6

Thread: Read/Send Data From Command Line app

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    25

    Question Read/Send Data From Command Line app

    Hi

    Im writing a small utill for my self basicly to see if it can be done, but ive ran into a small problem, Im using Plink for a ssh connection whilst i can successfuly connect to the remote box with some thing like this:

    VB Code:
    1. Dim Location as String
    2. Dim commands as String
    3. Dim username as String
    4. Dim serverip as String
    5. Dim password as String
    6.  
    7. username = txtUserName.Text
    8. serverip = txtServer.Text
    9. Location = "C:\plink"
    10. commands = " -ssh -pw " + password & username + "@" + serverip
    11. password = txtPassword.text
    12.  
    13. Shell Location + commands

    This connects and sends password with no problems how ever i choose to hide the command prompt as i dont know how to implement it into my app (yet and may not want to use the cli at all) now that the connection is working i would like away of reading whats comming from the remote host plus the ability to send data to the remote host too.

    The problem is i cannot seem to find away of reading or sending data to and from the reomte server. I did think about using winsock.getdata and senddata but im not too sure if this would work and if it did how to get it to do that with the connection already working, could some one please help me to see a way of been able to read and send data Please.

    Thanks for the time

    Ixl2

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Read/Send Data From Command Line app

    You could pipe the results into a file. Use > to overwrite, or >> to append.
    Then you'd have to read it back into your app.

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.   Shell ("C:\Windows\System32\cmd.exe /c  " & _
    5.      "C:\Windows\System32\ipconfig >> d:\myip.txt"), vbHide
    6. End Sub

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    25

    Re: Read/Send Data From Command Line app

    Thanks for the repliy.

    Is that the only way? i was hoping to be able to store the information that came from plink into a veriable of some sort then have that displayed in my app is there a way to display cmd inside my app? kind of like incorperate it.

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Read/Send Data From Command Line app

    Just read the file, and display it.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Read/Send Data From Command Line app

    Quote Originally Posted by Ixl2
    Thanks for the repliy.

    Is that the only way? i was hoping to be able to store the information that came from plink into a veriable of some sort then have that displayed in my app is there a way to display cmd inside my app? kind of like incorperate it.
    If it is creating an text file, then just read the contents of that text file into a multline textbox or a listbox in your app.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    25

    Re: Read/Send Data From Command Line app

    Hi

    Well thanks for the repliys truly greatful , how ever im not keen on the idea of putting the info into a text file and then reading the result, so i think its time to buy one of the activex/dll ssh classes ive seen.

    Any way thanks for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width