FTP

By Paradox-Paradigm on Jan 26, 2013

Skeleton script to upload files to a FTP server with ftp.exe; automated by mIRC

From AutoHotkey's FTP documentation http://www.autohotkey.com/docs/commands/FileAppend.htm (at the bottom)

There's some self explanatory things you'll need to replace in the script… they all start with "FTP" or "PC" & are all capitalized

FTP TEXT

  • Creates a HTML file with a random name on the local PC containing predefined HTML page content & the current clipboard content (less than 3550 characters) from mIRC
  • Creates a text file with all of the commands that will be executed by ftp.exe with the -s switch
  • Runs ftp.exe & it reads the commands from FTP.txt which uploads the randomly named HTML file to the FTP server
  • Deletes the HTML file & FTP.txt ("for security reasons")

FTP IMAGE

  • Creates a text file with all of the commands that will be executed by ftp.exe with the -s switch & the file path to the first image it finds in the predefined directory
  • Runs ftp.exe & it reads the commands from FTP.txt which uses binary mode uploading, uploads the image to the FTP server & gives it a random name
  • Deletes the image & FTP.txt ("for security reasons")

Documentation
http://technet.microsoft.com/en-us/library/bb490910.aspx
http://technet.microsoft.com/en-us/library/bb490911.aspx - FTP Subcommands
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ftp.mspx?mfr=true

alias ftptext {
  var %R = $rand(0,999999), %C = 1
  while (%C <= $cb(0)) && ($len(%Clipboard) <= 3550) {
    set %Clipboard %Clipboard $+ $cb(%C) $+ $crlf
    inc %C
  }
  write -c %R $+ .html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> $+ $crlf $+ <html> $+ $crlf $+ <head> $+ $crlf $+ <title>FTP with mIRC & FTP.exe</title> $+ $crlf $+ <meta charset="utf-8" /> $+ $crlf $+ </head> $+ $crlf $+ <body> $+ $crlf $+ <textarea rows="30" cols="100"> $+ %Clipboard $+ </textarea> $+ $crlf $+ </body> $+ $crlf $+ </html>
  write -c FTP.txt open FTP_DOMAIN_OR_IP $+ $crlf $+ FTP_LOGIN_USERNAME $+ $crlf $+ FTP_LOGIN_PASSWORD $+ $crlf $+ cd FTP_DIRECTORY_TO_UPLOAD_TO $+ $crlf $+ send " $+ $mircdir $+ %R $+ .html" $+ $crlf $+ quit
  run -n ftp.exe -v -s:" $+ $mircdir $+ FTP.txt"
  .timer 1 30 remove FTP.txt $chr(124) remove %R $+ .html
}

alias ftpimage {
  var %R = $rand(0,999999)
  write -c FTP.txt open FTP_DOMAIN_OR_IP $+ $crlf $+ FTP_LOGIN_USERNAME $+ $crlf $+ FTP_LOGIN_PASSWORD $+ $crlf $+ cd FTP_DIRECTORY_TO_UPLOAD_TO $+ $crlf $+ binary $+ $crlf $+ send " $+ $findfile(PC_DIRECTORY_TO_SEARCH,*.png;*.gif;*.jpg;*.jpeg;*.bmp;*.ico,1,1) $+ " %R $+ .png $+ $crlf $+ quit
  run -n ftp.exe -v -s:" $+ $mircdir $+ FTP.txt"
  .timer 1 30 remove FTP.txt $chr(124) remove $findfile(PC_DIRECTORY_TO_SEARCH,*.png;*.gif;*.jpg;*.jpeg;*.bmp;*.ico,1,1)
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.