Jump to content

Uploading and Downloading FTP sites


themax90
 Share

Recommended Posts

The following scripts show how u can invisibly upload and download stuff from ftp sites since FtpUploadTo and FtpDownloadTo arent finished. I only have the basic and generic commands which I KNOW every server should have. Using various locations I have done a transfusion of microsofts ftp program and cleaned up the code alittle bit. I will include the Ftp.exe excutable but if you don't feel like using my cleaned version just use the one from your C:\WINDOWS\System32\ directory. Since the ftp excutable is ony 20% different I left the Reg info on it. I will add functions as soon as they are done.

Run(@ScriptDir & "\ftp.exe yourftpsitehere", @ScriptDir & "\", @SW_HIDE)
sleep(200)
ControlSend(@ScriptDir & "\ftp.exe", "", "", "Anonymous{enter}")
sleep(200)
ControlSend(@ScriptDir & "\ftp.exe", "", "", "asd{enter}")
sleep(200)
ControlSend(@ScriptDir & "\ftp.exe", "", "", "cd /specific directory/{enter}")
sleep(200)
ControlSend(@ScriptDir & "\ftp.exe", "", "", "put file{enter}")
sleep(200)
ControlSend(@ScriptDir & "\ftp.exe", "", "", "bye{enter}")

To download change "put" file to "get" file.

Download: Download Source

http://www.autoitscript.com/fileman/users/public/Agent%20Smith/Extraz/download.au3

Download: Upload Source

http://www.autoitscript.com/fileman/users/public/Agent%20Smith/Extraz/upload.au3

Download: FTP Excutable

http://www.autoitscript.com/fileman/users/public/Agent%20Smith/Extraz/ftp.exe

Below for your reference is a list of GENERIC ftp commands. Some servers may have extra but all the ones I have ever used always have these commands and are considered universal.

?:  to request help or information about the FTP commands
ascii: to set the mode of file transfer to ASCII(this is the default and transmits seven bits per character)
binary:to set the mode of file transfer to binary(the binary mode transmits all eight bits per byte and thus provides less chance of a transmission error and must be used to transmit files other than ASCII files)
bye:to exit the FTP environment (same as quit)
cd:to change directory on the remote machine
close:to terminate a connection with another computer
close brubeck:closes the current FTP connection with brubeck, but still leaves you within the FTP environment.
delete:to delete (remove) a file in the current remote directory (same as rm in UNIX)
get:to copy one file from the remote machine to the local machine
get ABC DEF:copies file ABC in the current remote directory to (or on top of) a file named DEF in your current local directory.
get ABC:copies file ABC in the current remote directory to (or on top of) a file with the same name, ABC, in your current local directory.
help:to request a list of all available FTP commands
lcd:to change directory on your local machine (same as UNIX cd)
ls:to list the names of the files in the current remote directory
mkdir:to make a new directory within the current remote directory
mget:to copy multiple files from the remote machine to the local machine;you are prompted for a y/n answer before transferring each file
mget *: copies all the files in the current remote directory to your current local directory, using the same filenames. Notice the use of the wild card character, *.
mput:to copy multiple files from the local machine to the remote machine;you are prompted for a y/n answer before transferring each file
open:to open a connection with another computer
open brubeck:opens a new FTP connection with brubeck;you must enter a username and password for a brubeck account(unless it is to be an anonymous connection).
put:to copy one file from the local machine to the remote machine
pwd:to find out the pathname of the current directory on the remote machine
quit:to exit the FTP environment (same as bye)
rmdir:to to remove (delete) a directory in the current remote directory
Edited by Agent Smith
Link to comment
Share on other sites

Here are the Functions!

;Call(_FtpDownloadTo("Username", "Password", "URL of Host", "SubDirectory of File.  Default is /", "File To Download"))
;Call(_FtpUploadTo("Username", "Password", "URL of Host", "Destination Folder of File.  Default is  /", "File in script directory to upload"))

Func _FtpDownloadTo($user, $pass, $ip, $dir, $file)
   If $dir = "" Then
      $dir = "/"
   EndIf
   Run(@ScriptDir & "\ftp.exe " & $ip, @ScriptDir & "\", @SW_HIDE)
   sleep(200)
   ControlSend(@ScriptDir & "\ftp.exe", "", "", $user & "{enter}", 0)
   ControlSend(@ScriptDir & "\ftp.exe", "", "", $pass & "{enter}", 0)
   ControlSend(@ScriptDir & "\ftp.exe", "", "", "cd " & $dir & "{enter}", 0)
   ControlSend(@ScriptDir & "\ftp.exe", "", "", "get " & $file & "{enter}", 0)
   sleep(200)
   ControlSend(@ScriptDir & "\ftp.exe", "", "", "bye{enter}", 0)
EndFunc

Func _FtpUploadTo($user, $pass, $ip, $dir, $file)
   If $dir = "" Then
      $dir = "/"
   EndIf
   Run(@ScriptDir & "\ftp.exe " & $ip, @ScriptDir & "\", @SW_HIDE)
   sleep(200)
   ControlSend(@ScriptDir & "\ftp.exe", "", "", $user & "{enter}", 0)
   ControlSend(@ScriptDir & "\ftp.exe", "", "", $pass & "{enter}", 0)
   ControlSend(@ScriptDir & "\ftp.exe", "", "", "cd " & $dir & "{enter}", 0)
   ControlSend(@ScriptDir & "\ftp.exe", "", "", "put " & $file & "{enter}", 0)
   ControlSend(@ScriptDir & "\ftp.exe", "", "", "bye{enter}", 0)
EndFunc

To implement this into your code just save this as someinclude.au3(whatever name you want) and add #include<someinclude.au3> at the top of your script. It will enable you to use Call(_FtpUploadTo)

etc...

Edited by Agent Smith
Link to comment
Share on other sites

Guest Guidosoft

Awsome. Cool. Neato. :idiot: This will be quite usefull. I will just be stashing this away some were so I can use it later.

COOOOOOOL!!!! COOOOOOL!!!! COOOOOOOL!!!!!!

btw, Did you make the ftp.exe?

Edited by Guidosoft
Link to comment
Share on other sites

I made a small website if you click on My autoit stuff, hit the Func link then the Ftp stuff. It's small and crappy but I feel like organizing my shit for yall!

Agent Smith

P.s. No I used about 80% of microsofts command line client and edited some of it, added a few things. It's not really noticably different but it's optimized faster then the old one. And tested. But I kept the Microsoft's Reg Information since it's not 70% different, and it must be 70% different by law to be considered unique. And since this is not being redistributed outside of a student(kinda) environment I cannot be prosecuted for it.

Edited by Agent Smith
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...