ostu - automating microsoft ftp client (by tony fortunato)

8
© 2009 www.thetechfirm.com Troubleshooting Tony Fortunato, Sr Network Specialist The Technology Firm Automating Microsoft’s FTP Client

Upload: lovemytool

Post on 10-May-2015

2.333 views

Category:

Technology


2 download

DESCRIPTION

Tony Fortunato is a Senior Network Specialist with experience in design, implementation, and troubleshooting of LAN/WAN/Wireless networks, desktops and servers since 1989. His background in financial networks includes design and implementation of trading floor networks. Tony has taught at local high schools, Colleges/Universities, Networld/Interop and many onsite private classroom settings to thousands of analysts.

TRANSCRIPT

Page 1: OSTU - Automating Microsoft FTP Client (by Tony Fortunato)

© 2009 www.thetechfirm.com

Troubleshooting

Tony Fortunato, Sr Network SpecialistThe Technology Firm

Automating Microsoft’s FTP Client

Page 2: OSTU - Automating Microsoft FTP Client (by Tony Fortunato)

© 2009 www.thetechfirm.com

What are you talking about?

I’m in the middle of a troubleshooting exercise and have to FTP a file to a server In this case I would like to automate this procedure so I can either schedule it, or

run it from a batch file

Why should I have to type all the various FTP commands, when I can automate it?

I have also used this tip when performing baseline measurements and upgrading network equipment after hours

Page 3: OSTU - Automating Microsoft FTP Client (by Tony Fortunato)

© 2009 www.thetechfirm.com

List of FTP commands for the Microsoft command-line FTP client

ftp [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-w:windowsize] [computer]

-v - Suppresses verbose display of remote server responses. -n - Suppresses auto-login upon initial connection. -i - Turns off interactive prompting during multiple file transfers. -d - Enables debugging, displaying all ftp commands passed between the client and

server. -g - Disables filename globbing, which permits the use of wildcard chracters in local

file and path names. -s:filename - Specifies a text file containing ftp commands; the commands will

automatically run after ftp starts. No spaces are allowed in this parameter. Use this switch instead of redirection (>).

-a - Use any local interface when binding data connection. -w:windowsize - Overrides the default transfer buffer size of 4096. computer - Specifies the computer name or IP address of the remote computer to

connect to. The computer, if specified, must be the last parameter on the line.

Page 4: OSTU - Automating Microsoft FTP Client (by Tony Fortunato)

© 2009 www.thetechfirm.com

Some Common FTP Commands

Open hostname – connects you to a ftp server Bin – sets you to binary mode Hash – shows those hash marks as you copy files Cd – Change remote directory Lcd – change local directory Get – download a file Mget – copies one or more remote files to the local computer Put or send – upload a file Delete – Deletes a file Bye – ends your session Disconnect – disconnects from the curent host, but keeps the ftp prompt up

Page 5: OSTU - Automating Microsoft FTP Client (by Tony Fortunato)

© 2009 www.thetechfirm.com

Example

Its pretty simple, FTP acme.txt to my ftp server as newfile.txt Login; student Password; password

script.txt will look something like this open r2d2 student password hash bin put acme.txt newfile.txt bye

Batch file (script.bat) or command to run the script ftp -s:script.txt

Page 6: OSTU - Automating Microsoft FTP Client (by Tony Fortunato)

© 2009 www.thetechfirm.com

Sample Output - Success

C:\testing123>script.batC:\testing123>ftp -s:script.txt ftp> open r2d2 Connected to r2d2. 220 Welcome to Quick 'n Easy FTP Server User (r2d2:(none)): 331 Password required for student 230 User successfully logged in. ftp> hash Hash mark printing On ftp: (2048 bytes/hash mark) . ftp> bin 200 Type set to BINARY ftp> put acme.txt newfile.txt 200 Port command successful. 150 Opening BINARY mode data connection for file transfer. 226 Transfer complete ftp: 1 bytes sent in 0.00Seconds 1000.00Kbytes/sec. ftp> bye 221 Bye

Page 7: OSTU - Automating Microsoft FTP Client (by Tony Fortunato)

© 2009 www.thetechfirm.com

Wireshark Training - QuickStart

Tony Fortunato, Sr Network SpecialistThe Technology Firm

Thank you

Page 8: OSTU - Automating Microsoft FTP Client (by Tony Fortunato)

© 2009 www.thetechfirm.com

For additional educational videos on Open Source Network Tools, please click on the following …

http://www.lovemytool.com/blog/ostu.html

LoveMyTool.com – Community for Network Tools