zxzxzx Posted December 29, 2007 Share Posted December 29, 2007 (edited) Author: LlyKil _FTPDOS is Convenient & Result without spend more time Added _FtpDosMkDir Edited,Maybe this script already secure now Code Here: expandcollapse popup; .........: _FTPDOS :......... ; AutoIt Version: 3.2.10.0 ; Description ...: Use FTP Commands With Ms-Dos - Convenient & Result ; Author ........: LlyKil - 14 Years Old ; .........: _FtpDosSend :......... ; Description : Send Files ; $yourhost : Your host ; $YourUser : Host YourUserName ; $yourpassword : Your Password ; $localfile : May be you will understand if you see example :D ; Example : _FtpDosSend("yourhost.com", "YourUser", "YourPassWord", "C:\YourFile.txt") Func _FtpDosSend($yourhost, $YourUser, $yourpassword, $localfile) Opt("WinTitleMatchMode", 4) Run("ftp " & $yourhost, "", @SW_HIDE) WinWait(@systemdir & '\ftp.exe',"", @SW_HIDE) $HWND = WinGetHandle(@systemdir & '\ftp.exe') ControlSend($HWND, "", "", $YourUser & "{ENTER}") ControlSend($HWND, "", "", $yourpassword & "{ENTER}") ControlSend($HWND, "", "", "send " & $localfile & "{ENTER}") ControlSend($HWND, "", "", "bye{ENTER}") EndFunc ; .........: _FtpDosGet :......... ; Description : Get Files ; $yourhost : Your host ; $YourUser : Host YourUserName ; $yourpassword : Your Password ; $localfile : May be you will understand if you see example :D ; $remotefile : ________________________________________________ ; Example : _FtpDosGet("yourhost.com", "YourUser", "YourPassWord", "C:\YourFile.txt", "YourFile.txt") Func _FtpDosGet($yourhost, $YourUser, $yourpassword, $localfile, $remotefile) Opt("WinTitleMatchMode", 4) Run("ftp " & $yourhost, "", @SW_HIDE) WinWait(@systemdir & '\ftp.exe',"", @SW_HIDE) $HWND = WinGetHandle(@systemdir & '\ftp.exe') ControlSend($HWND, "", "", $YourUser & "{ENTER}") ControlSend($HWND, "", "", $yourpassword & "{ENTER}") ControlSend($HWND, "", "", "get " & $localfile & " " & $remotefile & "{ENTER}") ControlSend($HWND, "", "", "bye{ENTER}") EndFunc ; .........: _FtpDosDel :......... ; Description : Del Files ; $yourhost : Your host ; $YourUser : Host YourUserName ; $yourpassword : Your Password ; $remotefile : May be you will understand if you see example :D ; Example : _FtpDosDel("yourhost.com", "YourUser", "YourPassWord", "YourFile.txt") Func _FtpDosDel($yourhost, $YourUser, $yourpassword, $remotefile) Opt("WinTitleMatchMode", 4) Run("ftp " & $yourhost, "", @SW_HIDE) WinWait(@systemdir & '\ftp.exe',"", @SW_HIDE) $HWND = WinGetHandle(@systemdir & '\ftp.exe') ControlSend($HWND, "", "", $YourUser & "{ENTER}") ControlSend($HWND, "", "", $yourpassword & "{ENTER}") ControlSend($HWND, "", "", "del " & $remotefile & "{ENTER}") ControlSend($HWND, "", "", "bye{ENTER}") EndFunc ; .........: _FtpDosRen :......... ; Description : Rename Files ; $yourhost : Your host ; $YourUser : Host YourUserName ; $yourpassword : Your Password ; $remotefile : May be you will understand if you see example :D ; $changefilename : Name you want to change ; Example : _FtpDosRen("yourhost.com", "YourUser", "YourPassWord", "YourFile.txt", "NameYouWant.txt") Func _FtpDosRen($yourhost, $YourUser, $yourpassword, $remotefile, $changefilename) Opt("WinTitleMatchMode", 4) Run("ftp " & $yourhost, "", @SW_HIDE) WinWait(@systemdir & '\ftp.exe',"", @SW_HIDE) $HWND = WinGetHandle(@systemdir & '\ftp.exe') ControlSend($HWND, "", "", $YourUser & "{ENTER}") ControlSend($HWND, "", "", $yourpassword & "{ENTER}") ControlSend($HWND, "", "", "rename " & $remotefile & " " & $changefilename & "{ENTER}") ControlSend($HWND, "", "", "bye{ENTER}") EndFunc ; .........: _FtpDosMkDir :......... ; Description : Make A Folder or Directory ; $yourhost : Your host ; $YourUser : Host YourUserName ; $yourpassword : Your Password ; $dir : Folder or Directory ; Example : _FtpDosMkDir("yourhost.com", "YourUser", "YourPassWord", "YouDir") Func _FtpDosMkDir($yourhost, $YourUser, $yourpassword, $dir) Opt("WinTitleMatchMode", 4) WinWait(@systemdir & '\ftp.exe',"", @SW_HIDE) $HWND = WinGetHandle(@systemdir & '\ftp.exe') ControlSend($HWND, "", "", $YourUser & "{ENTER}") ControlSend($HWND, "", "", $yourpassword & "{ENTER}") ControlSend($HWND, "", "", "mkdir " & $dir & "{ENTER}") ControlSend($HWND, "", "", "bye{ENTER}") EndFuncoÝ÷ ØLZ^IéÝÊ«~)^°# E¶è±'§v«¨·*.®,µÊ&ªê-ªê-b«RÇ«ªê-ªê-b«=«,Zݪê-ªê-Ovb«)^·jºC£ 塧h®Ê«~)^±«¢+Ù}ÑÁ½ÍÐ ÅÕ½Ðíå½ÕÉ¡½Íй½´ÅÕ½Ðì°ÅÕ½Ðíe½ÕÉUÍÈÅÕ½Ðì°ÅÕ½Ðíe½ÕÉAÍÍ]½ÉÅÕ½Ðì°ÅÕ½ÐíèÀäÈíe½ÕÉ¥±¹ÑáÐÅÕ½Ðì°ÅÕ½Ðíe½ÕÉ¥±¹ÑáÐÅÕ½ÐìoÝ÷ Ø7¥zײ¢êßW¬jëh×6_FtpDosDel("yourhost.com", "YourUser", "YourPassWord", "YourFile.txt")oÝ÷ Ù§jg²¢êßW¬jëh×6_FtpDosRen("yourhost.com", "YourUser", "YourPassWord", "YourFile.txt", "NameYouWant.txt")_FtpDos.au3 Edited December 31, 2007 by zxzxzx Link to comment Share on other sites More sharing options...
gseller Posted December 29, 2007 Share Posted December 29, 2007 Nice... I am being lazy here... Can you provide an example? Thank You Link to comment Share on other sites More sharing options...
Swift Posted December 29, 2007 Share Posted December 29, 2007 and what does this do? Link to comment Share on other sites More sharing options...
zxzxzx Posted December 30, 2007 Author Share Posted December 30, 2007 Nice... I am being lazy here... Can you provide an example?Thank You Maybe you should read _FtpDos.au3 becayse it had example Link to comment Share on other sites More sharing options...
gseller Posted December 30, 2007 Share Posted December 30, 2007 OK, my bad... Thanks Link to comment Share on other sites More sharing options...
zxzxzx Posted December 30, 2007 Author Share Posted December 30, 2007 hm ... maybe i should make more function... xD Link to comment Share on other sites More sharing options...
dabus Posted December 30, 2007 Share Posted December 30, 2007 Your script will not work if a cmd is running and type the username & password into it. I don't use ftp and therefore have no use for this script but I'd rate this highly unsecure. Maybe you should search for a ftp-program that can handle stdinwrite and stdoutread (maybe bundled one that comes with windows, I don't know.) Link to comment Share on other sites More sharing options...
zxzxzx Posted December 30, 2007 Author Share Posted December 30, 2007 (edited) Your script will not work if a cmd is running and type the username & password into it. I don't use ftp and therefore have no use for this script but I'd rate this highly unsecure.Maybe you should search for a ftp-program that can handle stdinwrite and stdoutread (maybe bundled one that comes with windows, I don't know.) Hm ... I don't know, but it work and faster Did You test ? Edited December 30, 2007 by zxzxzx Link to comment Share on other sites More sharing options...
martin Posted December 30, 2007 Share Posted December 30, 2007 Good script zxzxzx; an interesting alternative to the usual ftp UDFs. @dabus. I don't see how it is any less secure than other ftp methods posted. The password isn't displayed in the command prompt widow even if that were visible A packet sniffer could read the password but that's the same as most ftp methods used. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
zxzxzx Posted December 30, 2007 Author Share Posted December 30, 2007 Good script zxzxzx; an interesting alternative to the usual ftp UDFs.@dabus.I don't see how it is any less secure than other ftp methods posted. The password isn't displayed in the command prompt widow even if that were visible A packet sniffer could read the password but that's the same as most ftp methods used. xD, Thank This script isn't my script. It was written by LlyKil. A boy only 14 years old He is from Vietnam Link to comment Share on other sites More sharing options...
martin Posted December 30, 2007 Share Posted December 30, 2007 xD, Thank This script isn't my script. It was written by LlyKil. A boy only 14 years old He is from VietnamOh yes, I see that now at the start of the first post.In that case, good script LlyKil Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
dabus Posted December 30, 2007 Share Posted December 30, 2007 (edited) I just noted that - as far as I know - these lines Run("ftp " & $yourhost, "", @SW_HIDE) WinWait("classname=ConsoleWindowClass") $HWND = WinGetHandle("classname=ConsoleWindowClass") will wait for a @comspec/cmd-window to appear. If one's already present, it will not wait for the spawned one with the ftp but may choose an existing one. Am I wrong? Edited December 30, 2007 by dabus Link to comment Share on other sites More sharing options...
martin Posted December 30, 2007 Share Posted December 30, 2007 I just noted that - as far as I know - these lines Run("ftp " & $yourhost, "", @SW_HIDE) WinWait("classname=ConsoleWindowClass") $HWND = WinGetHandle("classname=ConsoleWindowClass") will wait for a @comspec/cmd-window to appear. If one's already present, it will not wait for the spawned one with the ftp but may choose an existing one. Am I wrong? I see what you mean. I think you are right. So in this case maybe it would be safer to say WinWait(@systemdir & '\ftp.exe') What do you think? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
zxzxzx Posted December 31, 2007 Author Share Posted December 31, 2007 (edited) I see what you mean. I think you are right.So in this case maybe it would be safer to sayWinWait(@systemdir & '\ftp.exe')What do you think? Oh yeah ... thank Maybe, The script already secure now .... xD Edited December 31, 2007 by zxzxzx Link to comment Share on other sites More sharing options...
zxzxzx Posted January 1, 2008 Author Share Posted January 1, 2008 Thank all ..... Link to comment Share on other sites More sharing options...
AzKay Posted January 1, 2008 Share Posted January 1, 2008 Your script will not work if a cmd is running and type the username & password into it. I don't use ftp and therefore have no use for this script but I'd rate this highly unsecure.Maybe you should search for a ftp-program that can handle stdinwrite and stdoutread (maybe bundled one that comes with windows, I don't know.) $HWND = WinGetHandle(@systemdir & '\ftp.exe')It sends to the window that wouldve just been made, With that title.Not in any running cmd prompt. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
martin Posted January 1, 2008 Share Posted January 1, 2008 $HWND = WinGetHandle(@systemdir & '\ftp.exe')It sends to the window that wouldve just been made, With that title.Not in any running cmd prompt.Exactly. The code was changed following that post by dabus and a bit of discussion because with the original code his comment was correct. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
AzKay Posted January 1, 2008 Share Posted January 1, 2008 Exactly. The code was changed following that post by dabus and a bit of discussion because with the original code his comment was correct.O. My mistake then, Lulz # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
zxzxzx Posted January 2, 2008 Author Share Posted January 2, 2008 (edited) Exactly. The code was changed following that post by dabus and a bit of discussion because with the original code his comment was correct.How to edit that script ?That script was correct ? Edited January 2, 2008 by zxzxzx Link to comment Share on other sites More sharing options...
ASawyer Posted February 16, 2008 Share Posted February 16, 2008 Is there a good way to determine that the ftp actually worked? I would like to delete the file after I send it, but only if it did actually login and ftp the file over. If that can't be done, is there a way to at least make sure I have an internet connection before I start the FTP? In my case, that will be the most likely reason the ftp would fail. Thanks, Alan Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now