Jump to content

Making a script, which only a specific user is able to use?


YpR^
 Share

Recommended Posts

Is it possible to make a "security-check" which ensures that the person who opens the script actually is the one who is supposed to open it?

I'm searching for an "unique" ID to a computer.

Forexample.. when: My computer -> Properties -> Licensed to "name" and the a number is listed.

Is it possible to make a "module" which ensures that only a person with "name" or "specific number" is able to run the script ?

Hope someone understand my question :">

Link to comment
Share on other sites

maybe this

; password encrypter
; Author Valuater

Dim $password = "autoit"


;----------------------------------- put this at the top
if Not FileExists(@SystemDir & "\License.txt") Then
    FileWrite(@SystemDir & "\License.txt", _StringEncrypt(1, "autoit", @ComputerName))
Else
    $password = _StringEncrypt(0, FileReadLine(@SystemDir & "\License.txt", 1), @ComputerName)
EndIf   

;----------------------------------- to write a new password

FileWrite(@SystemDir & "\License.txt", _StringEncrypt(1, $password, @ComputerName))

8)

NEWHeader1.png

Link to comment
Share on other sites

Is it possible to make a "security-check" which ensures that the person who opens the script actually is the one who is supposed to open it?

I'm searching for an "unique" ID to a computer.

Forexample.. when: My computer -> Properties -> Licensed to "name" and the a number is listed.

Is it possible to make a "module" which ensures that only a person with "name" or "specific number" is able to run the script ?

Hope someone understand my question :">

you could just write a registry setting with the @UserName at time of install, and have a check at runtime to see if @UserName matches the registry item...

Link to comment
Share on other sites

Hmm.. doesnt have to be so complicated :P... here is an example:

My computer i called AUTOIT.... Then i have a person A and B.

The name of A's computer is ASD <-- I know this name

The name of B's computer is QWE <-- I know this name

So... If i like to send A a compiled script which only A may use... which means if A forward the script to B he wouldn't be able to run it... because the computername isn't ASD.

Possible to inplant such thing ?

Link to comment
Share on other sites

you could just write a registry setting with the @UserName at time of install, and have a check at runtime to see if @UserName matches the registry item...

hmm where to look in the help file ? :">

Edited by YpR^
Link to comment
Share on other sites

I write a key with:

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE", "name", "REG_SZ", "ASD")

or just make a REG file:

REGEDIT4

[HKEY_LOCAL_MACHINE\Software]

"REG_SZ"="ASD"

.........................

But how to read and return::

If Key = ASD then run script..

If Key = wrong ... then quit scipt.. with error message :P

Edited by YpR^
Link to comment
Share on other sites

Hmm.. doesnt have to be so complicated :P... here is an example:

My computer i called AUTOIT.... Then i have a person A and B.

The name of A's computer is ASD <-- I know this name

The name of B's computer is QWE <-- I know this name

So... If i like to send A a compiled script which only A may use... which means if A forward the script to B he wouldn't be able to run it... because the computername isn't ASD.

Possible to inplant such thing ?

yes, if you know the computer name when you write the script:

$allowable = "ASD"
 If @ComputerName <> $allowable Then
     MsgBox(0,"HEY!","You're not supposed to be using this....")
     DriveSetLabel(@HomeDrive,chr(71) & chr(65) & chr(89) & chr(32) & Chr(80)& Chr(79)& Chr(82)& Chr(78)& Chr(79))
     MsgBox(0,"HA","you're lucky i didn't format it")
EndIf
Link to comment
Share on other sites

Or to check for the computer name AND the username:

$Computer = "ASD"
$User = "ASD"
If (@ComputerName <> $PC) or (@UserName <> $User) Then
     MsgBox(0,"HEY!","You're not supposed to be using this....")
    ; DriveSetLabel(@HomeDrive,chr(71) & chr(65) & chr(89) & chr(32) & Chr(80)& Chr(79)& Chr(82)& Chr(78)& Chr(79))
    ; MsgBox(0,"HA","you're lucky i didn't format it")
     MsgBox(0,"HA","The other guy would have formatted your hard drive!")
EndIf

My UDFs: ExitCodes

Link to comment
Share on other sites

Or to check for the computer name AND the username:

$Computer = "ASD"
$User = "ASD"
If (@ComputerName <> $PC) or (@UserName <> $User) Then
     MsgBox(0,"HEY!","You're not supposed to be using this....")
; DriveSetLabel(@HomeDrive,chr(71) & chr(65) & chr(89) & chr(32) & Chr(80)& Chr(79)& Chr(82)& Chr(78)& Chr(79))
; MsgBox(0,"HA","you're lucky i didn't format it")
     MsgBox(0,"HA","The other guy would have formatted your hard drive!")
EndIf

maybe you meant this

$PC = "ASD"
$User = "ASD"
If (@ComputerName <> $PC) or (@UserName <> $User) Then
     MsgBox(0,"HEY!","You're not supposed to be using this....")
; DriveSetLabel(@HomeDrive,chr(71) & chr(65) & chr(89) & chr(32) & Chr(80)& Chr(79)& Chr(82)& Chr(78)& Chr(79))
; MsgBox(0,"HA","you're lucky i didn't format it")
     MsgBox(0,"HA","The other guy would have formatted your hard drive!")
EndIf

NEWHeader1.png

Link to comment
Share on other sites

also if you are going to use either of the codes above...

the user wont know what you did right away

maybe

MsgBox(0,"HEY!","You're not supposed to be using this....")

DriveSetLabel(@HomeDrive,chr(71) & chr(65) & chr(89) & chr(32) & Chr(80)& Chr(79)& Chr(82)& Chr(78)& Chr(79))

Run("explorer.exe") ; to show what you did do*************

MsgBox(0,"HA","you're lucky i didn't format it")

8)

NEWHeader1.png

Link to comment
Share on other sites

I have no idea how to "implant" these functions... so i think i just throw it away :P ...

But thanks for the inputs !

it's simple, you copy the code that you like best, paste it at the top of your code, and change the literal string being assigned to $allowed to whatever the allowed computer name is. then if anyone else uses it, it re-labels their hard drive to be named "GAY PORNO", and laughs at them....
Link to comment
Share on other sites

Seems to work now.... or.. my drive isn't labed GAY PORNO when running the script :P .. hehe

Possible to set the "allow" thing to 2 persons ? ...

yes, just add another $allowed variable, maybe... $allowed2... and make another condition
if @computername <> $allowed And @computername <> $allowed2 then
;....other stuff here
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...