Jump to content

Password protect


Recommended Posts

HI,

may have a look at LoginWrapper. (see my sig)

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

This cant works for me .. But cause i wanted it to password protect the file and the user can only access the compiled exe by entering the username & password but cant access from the desktop or other where else.

REMEMBER , IT IS AN COMPILED EXE, so i cant edit the script

Link to comment
Share on other sites

HI,

if you cannot edit the exe then you need to wrap the exe with something else which does the job for you. This can be Winzip or an AutoitScript like LoginWrapper.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

WinZip cant do the job because i wanted a script like

$bLoop = 1
    While $bLoop = 1
    $text = InputBox("Password", "Please enter the assigned password to comfirm your identification.")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
       ; They clicked OK, but did they type the right thing?
        If $text <> "gamingforumz#dxwnd" then
            MsgBox(4096, "Error", "You typed in the wrong thing - try again!")
        Else
            $bLoop = 0   ; Exit the loop - ExitLoop would have been an alternative too :)
        EndIf
        EndIf
    Wend
            Run("FileName.exe")
WinWaitActive("BLABLA")
Send("The password of the password protect file inside the winZIP")

But it just cant works.

And LoginWrappers cant works because the user can just access from the path and to the file. So it cant works for me in boths ways. Any other ways ?

Link to comment
Share on other sites

This may help, found it in the example section titled Simple Password Script, Require Password to access/run script!

#NoTrayIcon
;InputBox features: Title=Yes, Prompt=Yes, Default Text=No, Pwd Char=*123, Mandatory
#cs
  $password = "Password001"; Password needed to access script!
  If Not IsDeclared("InputBoxAnswer") Then Local $InputBoxAnswer
  $MaxAttempts = 3
#ce
If Password(3, "me") Then
  MsgBox(1024, "Password was correct!", "You typed the correct Password. You may access this file!"); What to do if password was entered correctly!
 ; do rest of stuff here
ElseIf @error = 1 Then
  MsgBox(1024, "Password was wrong!", "Sorry, You can not access this file!"); What to do if password was not entered correctly!
 ; do other non-authorized attempt stuff here
  Exit
ElseIf @error = 2 Then
  MsgBox(1024, "You pressed the Cancel Button!", "A Password is requuired to access this file!")
 ; do other Cancelled stuff here
  Exit
ElseIf @error = 3 Then
 ; do inputbox failure stuff here
EndIf


Func Password($MaxAttempts, $Password)
 ;returns 1 if successfully authorized
 ;returns 0 if not and sets @error = 1 if not authorized,
 ;                        @error = 2 if cancelled authorization
 ;                        @error = 3 if Input box failed  to open
  $Attempts = 0
  Do
    $InputBoxAnswer = InputBox("Password Prompt!", "Please type in a password to access this program!", "", "*M", "-1", "-1", "-1", "-1")
    Select
      Case @error = 0;OK - The string returned is valid
        If $InputBoxAnswer == $Password Then
          Return 1
        Else
          If $Attempts < $MaxAttempts - 1 And $MaxAttempts <> 1 Then
            MsgBox(1024, "Password was wrong!", "You typed the Wrong Password. You may try again " & ($MaxAttempts - 1) - $Attempts & " time(s)"); What to do if password was not entered correctly!
          Else
            SetError(1)
            Return 0
          EndIf
          $Attempts += 1
         ;Exit
        EndIf
      Case @error = 1;The Cancel button was pushed
        SetError(2)
        Return 0
      Case @error = 3;The InputBox failed to open
        SetError(3)
        Return 0
    EndSelect
  Until $Attempts = $MaxAttempts
EndFunc  ;==>Password
Link to comment
Share on other sites

Have you looked at using a third party utility then? And CAPS LOCK is considered at yelling, you yell at people, you are less likely to get help. Also, calm down a bit? :)

Link to comment
Share on other sites

How big is the exe ??? You could make a script that would install and delete the exe.... (Though they could while running the program find the exe - but anyway they would be able to do that if you cant change the exe)

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Link to comment
Share on other sites

Have you looked at using a third party utility then? And CAPS LOCK is considered at yelling, you yell at people, you are less likely to get help. Also, calm down a bit? :)

Im sorry for yelling , And anyway , what do you mean by third party utility? Can you provide me with a link ?

How big is the exe ??? You could make a script that would install and delete the exe.... (Though they could while running the program find the exe - but anyway they would be able to do that if you cant change the exe)

The size is 260KB. How do i make a script that will install and delete the exe ?

Sorry for all the troubles because im quite new to autoIT =\

Link to comment
Share on other sites

Im sorry for yelling , And anyway , what do you mean by third party utility? Can you provide me with a link ?

Look at your first reply. That should be your answer.
Link to comment
Share on other sites

But the utility is using a program which is in the comp.

And the program is not password protected so the user can just access the file through the path.

Because the script i wanted to use was

$bLoop = 1
    While $bLoop = 1
    $text = InputBox("Password", "Please enter the assigned password to comfirm your identification.")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
      ; They clicked OK, but did they type the right thing?
        If $text <> "gamingforumz#dxwnd" then
            MsgBox(4096, "Error", "You typed in the wrong thing - try again!")
        Else
            $bLoop = 0  ; Exit the loop - ExitLoop would have been an alternative too :)
        EndIf
        EndIf
    Wend

and if the user entered the right password ,

Run("FileName.rar (which is inside the RAR folder)")
WinWaitActive("BLABLA")
Send("The password for the password protect file inside the winZIP")
Link to comment
Share on other sites

Link to comment
Share on other sites

Im sorry for yelling , And anyway , what do you mean by third party utility? Can you provide me with a link ?

The size is 260KB. How do i make a script that will install and delete the exe ?

Sorry for all the troubles because im quite new to autoIT =\

Install

http://www.autoitscript.com/autoit3/docs/f...FileInstall.htm

And for delete...

http://www.autoitscript.com/autoit3/docs/f.../FileDelete.htm

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Link to comment
Share on other sites

But again IF he can spot where to you install the exe, he WILL be able to copy it to another place - hence you can't delete it. This is though not average user info. (And he could terminate your process that kills the program etc etc etc...

What you want, can't be done 100 % because you can't edit the exe.

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Link to comment
Share on other sites

The best thing I can imagine being able to do is something like the following...

$sFileNameRandom = @TempDir & '\' & Hex(Random(0, 0x7fffffff), 8) & '.txt'
$sPassword = InputBox('Password Required', 'Enter Password:', '', '*')
If Not @error And $sPassword = 'cookies' Then
     FileInstall('FileName.exe', $sFileNameRandom)
     RunWait($sFileNameRandom)
     FileDelete($sFileNameRandom)
EndIf

At least they're not likely to find the program to run it alone. Otherwise I'd say you're hooped. There are a lot of ways to do it if you can edit the file.

Might I ask what it is exactly that you're doing?

Link to comment
Share on other sites

THis is my code. Could you guys kindly please tell me where to put it ? or what to edit ?

; 30 Day Trial
; Author MSLx Fanboy

#include<date.au3>
#include<string.au3>

If RegRead("HKCU\Software\Microsoft\Windows\Current Version", "XPClean Menu") = "" Then
    RegWrite("HKCU\Software\Microsoft\Windows\Current Version", "XPClean Menu", "REG_SZ", _StringEncrypt(1, _NowCalc(), @ComputerName))
    SetError(0)
EndIf
$startdate = _StringEncrypt(0, RegRead("HKCU\Software\Microsoft\Windows\Current Version", "XPClean Menu"), @ComputerName)

If _Datediff("D", $startdate, _NowCalc()) > 1 Then
    MsgBox(0, "*XPClean Menu*", "You have 19 more days till your trial expires")
    
EndIf
If _Datediff("D", $startdate, _NowCalc()) > 2 Then
    MsgBox(0, "*XPClean Menu*", "You have 18 more days till your trial expires")
    
EndIf
If _DateDiff("D", $startdate, _NowCalc()) > 20 Then
    MsgBox(0, "*XPClean Menu*", "You're registration period has expired.")
    Exit
EndIf

           $bLoop = 1
    While $bLoop = 1
    $text = InputBox("Password", "Please enter the assigned password to comfirm your identification.")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
      ; They clicked OK, but did they type the right thing?
        If $text <> "gamingforumz#dxwnd" then
            MsgBox(4096, "Error", "You typed in the wrong thing - try again!")
        Else
            $bLoop = 0  ; Exit the loop - ExitLoop would have been an alternative too :)
        EndIf
        EndIf
    Wend
Link to comment
Share on other sites

Just add this in the end

$sFileNameRandom = @TempDir & '\' & Hex(Random(0, 0x7fffffff), 8) & '.txt'

FileInstall('FileName.exe', $sFileNameRandom)

RunWait($sFileNameRandom)

FileDelete($sFileNameRandom)

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

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