nilsidedose Posted May 21, 2007 Share Posted May 21, 2007 hi peaple i have a au3 script.i want to protect the file with a password the password is safeed on a ftp server on a text document i want that the script calles the pw fom the ftp then finally the script start when the password is right pls help i have no ideas sry for my bad englisch thanks for your help Link to comment Share on other sites More sharing options...
GMK Posted May 21, 2007 Share Posted May 21, 2007 I would use INetGet() to get the text file where the password is stored, then use FileReadLine() to read the password to a variable. For security, I would then delete the text file from where you downloaded it. Link to comment Share on other sites More sharing options...
nilsidedose Posted May 21, 2007 Author Share Posted May 21, 2007 i imagine that the scipt see like that. open ie underground(http://nilsdiedose.ni.funpic.de/pw.txt) file read line then safe the pw and than the password queries comes sry for bad english Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 21, 2007 Share Posted May 21, 2007 (edited) I would do it more like this: 1. Create the password file: #include <string.au3> $File = "Test_PW.txt" $InternalPassword = "tklhGjkHG&(6*&^%56dudty#234sdtUI(&*67" $PassPhrase = "This is a valid password file." $LocalFile = @ScriptDir & "\Test_PW.txt" $hFile = FileOpen($LocalFile, 2) If $hFile <> -1 Then FileWrite($hFile, _StringEncrypt(1, $PassPhrase, $InternalPassword) FileClose($hFile) Else MsgBox(16, "Error", "Failed to open file for write: " & $LocalFile) EndIf Edit: This is for a silent verification using a networked file. Just change the compare (and maybe an easier pw) if you wanted the operator to enter the password. Edited May 21, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
nilsidedose Posted May 21, 2007 Author Share Posted May 21, 2007 hmm here is my script but it didnt work pls help me InetGet("http://nilsdiedose.ni.funpic.de/pw.txt", "pw.exe", 1, 1) While @InetGetActive TrayTip("Downloading", "Bytes = " & @InetGetBytesRead, 10, 16) Sleep(250) Wend sleep(5000) $file = FileOpen("pw.exe", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) $line = InputBox ( "Password Needed", "Please Enter you password" , "" , "*") If @error = 1 Then Exit; exit if cancle is pressed If $line = $line Then msgbox(0, "", "Correct!") ExitLoop Else msgbox(0, "", "WRONG!!!! Re-Enter") EndIf WEnd FileClose($file) Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 21, 2007 Share Posted May 21, 2007 I don't see why you are reading multiple lines in a loop. Read the password once from the file with FileReadLine() and then go into the loop for the operator entry to compare with. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
nilsidedose Posted May 21, 2007 Author Share Posted May 21, 2007 (edited) InetGet("http://nilsdiedose.ni.funpic.de/pw.txt", "pw.exe", 1, 1) While @InetGetActive TrayTip("Downloading", "Bytes = " & @InetGetBytesRead, 10, 16) Sleep(250) Wend sleep(5000) $file = FileOpen("pw.exe", 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 $file1 = FileReadLine($file) $line = InputBox ( "Password Needed", "Please Enter you password" , "" , "*") If @error = 1 Then Exit If $line = $file1 Then msgbox(0, "", "Correct!") ExitLoop Else msgbox(0, "", "WRONG!!!! Re-Enter") EndIf WEnd FileClose($file) yeah it works Edited May 21, 2007 by nilsidedose 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