Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/davidwalter0/go-ftp

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/davidwalter0/go-ftp

  • v0.0.0-20170904021725-3fc38f5a0fb5
  • Source
  • Go
  • Socket score

Version published
Created
Source

Status: Experimental


Example unit test

  • configure an ftp server | tested with a phone ftp app
  • modify the ftp.environment.example and save as your file name to source
  • source the modified environment file
  • run the tests
    . ftp.environment
    go test

TODO:

  • Log in. -- Done
  • Download a file. -- Done
  • Upload a file to an existing directory. -- Done
  • List contents of remote directory.
  • Create a new directory.
  • Delete a a directory or a file.

FTP Protocol Command Summary

  • To Download a file:
    • Log in USER username PASS password

    • Set the TYPE TYPE I (binary) for binary files or TYPE A (ascii) for text files

      Sample Response: 200 Type set to A or I

    • Set Passive transfer mode PASV Computing the destination port from the actual respone (127,0,0,1,201,208) The first four octets are the IP address while the last two octets comprise the port that will be used for the data connection. To find the actual port multiply the fifth octet by 256 and then add the sixth octet to the total

      Sample Response: 227 Entering Passive Mode (127,0,0,1,201,208)
      
    • Retrieve the file RETR [file] After you call RETR the data port will open and be available to download the file. RETR doesn't return immediately, but waits until you open a connection to the data port and download the file.

      Sample Response: 150 opening connection
      
    • Open connection to data port Read data bytes to a file Sample Response: 226 Transfer complete

    • Close data port

    • Close the connection (optional, if you want to download multiple files in one session) QUIT

Sample Protocol Session (control session only):

$ telnet localhost 21
220 ProFTPD 1.3.2c Server (ProFTPD Test Server) [127.0.0.1]
USER
500 USER: command requires a parameter
USER anonymous
331 Anonymous login ok, send your complete email address as your password
PASS foo
230 Anonymous access granted, restrictions apply

TYPE I
200 Type set to I
PASV
227 Entering Passive Mode (127,0,0,1,201,208).

RETR test_file.txt
150 Opening BINARY mode data connection for test_file.txt (12 bytes)
226 Transfer complete
QUIT
221 Goodbye.

FAQs

Package last updated on 04 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc