Jump to content

call a pw from a ftp server


Recommended Posts

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

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

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 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

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

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

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 by nilsidedose
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...