Re: Anyone know how to complete this script?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: David H. Lipman (DLipman~nospam~_at_Verizon.Net)
Date: 01/27/05


Date: Thu, 27 Jan 2005 13:05:14 -0500

You can use a "for loop" and start with a range like 4420 - 4424

Then you can set an envionmental variable such as "DAT" and call it in a script

Then you can create a text file (FTP-CMD.TXT) of commands that can then be used by using FTP
with the switch -s:FTP-CMD.TXT

In the batch file use file redirection such as the following to create the text file ...

echo open ftp.nai.com >FTP-CMD.TXT
echo anonymous >>FTP-CMD.TXT
echo nospam@spam.com >>FTP-CMD.TXT
echo cd pub/antivirus/superdat/intel >>FTP-CMD.TXT
echo lcd C:\ >>FTP-CMD.TXT
echo bin >>FTP-CMD.TXT
echo hash >>FTP-CMD.TXT
echo prompt >>FTP-CMD.TXT
echo get sdat%DAT%.exe >>FTP-CMD.TXT
echo quit >>FTP-CMD.TXT

%comspec% /c start /wait FTP -s:FTP-CMD.TXT

FTP Command Syntax
----------------------------
Transfers files to and from a computer running an FTP server service
(sometimes called a daemon). Ftp can be used interactively.

FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-w:windowsize] [-A] [host]

  -v Suppresses display of remote server responses.
  -n Suppresses auto-login upon initial connection.
  -i Turns off interactive prompting during multiple file
                 transfers.
  -d Enables debugging.
  -g Disables filename globbing (see GLOB command).
  -s:filename Specifies a text file containing FTP commands; the
                 commands will automatically run after FTP starts.
  -a Use any local interface when binding data connection.
  -A login as anonymous.
  -w:buffersize Overrides the default transfer buffer size of 4096.
  host Specifies the host name or IP address of the remote
                 host to connect to.

Notes:
  - mget and mput commands take y/n/q for yes/no/quit.
  - Use Control-C to abort commands.

-------------

The following is my TEST.BAT

If you use TEST.BAT 4423 it will download SDAT4423.exe. You can use that as the basis to in
your script to either manually feed the current revision or loop throuugh a series of
numbers represnting the latest McAfee DAT revision.

test.bat
---------
echo off
set DAT=%1
echo open ftp.nai.com >FTP-CMD.TXT
echo anonymous >>FTP-CMD.TXT
echo nospam@spam.com >>FTP-CMD.TXT
echo cd pub/antivirus/superdat/intel >>FTP-CMD.TXT
echo lcd C:\ >>FTP-CMD.TXT
echo bin >>FTP-CMD.TXT
echo hash >>FTP-CMD.TXT
echo prompt >>FTP-CMD.TXT
echo get sdat%DAT%.exe >>FTP-CMD.TXT
echo quit >>FTP-CMD.TXT
%comspec% /c start /wait FTP -s:FTP-CMD.TXT

-- 
Dave
"Zak" <fj@somewhere.net> wrote in message news:u%23Qf6YJBFHA.3576@TK2MSFTNGP11.phx.gbl...
| I'm trying to create a batch file to automatically download the sdat file
| from McAfee.  Is there a wildcard for ftp?
| I need to have a wildcard for the "get sdat????.exe"  as the ???? part of
| the file name is a changing number.
|
| open ftp.nai.com
| anonymous
| nospam@spam.com
| cd pub/antivirus/superdat/intel
| lcd C:\
| bin
| hash
| prompt
| get sdat????.exe
| quit
|
| Thanks,
|
| Z
|
|


Relevant Pages

  • [Full-disclosure] Spam exploiting MS05-016
    ... It is not spam, ... the "agreement.txt " file contained a script to write a text ... via its "-s" option and further commands to run ftp with those scripted ...
    (Full-Disclosure)
  • Spam exploiting MS05-016
    ... It is not spam, ... the "agreement.txt " file contained a script to write a text ... via its "-s" option and further commands to run ftp with those scripted ...
    (Bugtraq)
  • Re: ftp in shell scripts
    ... Julius Plenz wrote: ... >>I need some help on shell script and I'm a newbie on this. ... so I've thought the best way should be using ftp. ... and ftp will be quite happy to carry out the commands unattended. ...
    (comp.unix.shell)
  • Re: FTP problem in Solaris 5.8
    ... I saw a mainframe FTP setup that would always return 0 ... > script worked on an HP box do you mean the identical script ... to some mainframe communcations newsgroup or mailing list. ... contained a bunch of MODE kind of commands, ...
    (comp.unix.solaris)
  • FTP script and return codes
    ... One of group pointed me in the right direction and I have got the FTP ... This is part of activex script in an SQL ... This is the first script and would like to verify success before ... objTextFile.WriteLine "mdelete *.dat" ...
    (microsoft.public.windows.server.scripting)