Script Login Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
davifrotak
Posts: 5
Joined: 26 Oct 2019, 18:25

Script Login

29 Oct 2019, 21:25

well I made a script, but I would like to create a login system in it, where I can release a login for the person (1 login can only be used by a pc) so making my file non-stealable, I would also like to encrypt my script ,can you help me? I'm new and I don't know much.
About this unique login, I was seeing about the fingerprint, that each computer, but could not do the login part, and one login per person.

my script is as follows, it's very simple

f1::suspend
q::
{
send {shift down}
sleep 85
send {shift up}
sleep 16
send {rbutton down}
sleep 146
send {rbutton up}
sleep 20
send {shift down}
sleep 58
send {shift up}
sleep 26
send {lbutton down}
sleep 443
send {lbutton up}
sleep 25
send {rbutton down}
sleep 58
send {rbutton up}
sleep 30
}


the topic I saw: https://autohotkey.com/board/topic/20952-how-to-generate-a-unique-hardware-id-fingerprint/

(sorry for my bad english,please help me <3)
aaffe
Posts: 192
Joined: 16 Jan 2014, 04:23

Re: Script Login

30 Oct 2019, 00:07

Sorry, but where is your Login script? I dont think it is the script posted. It has Nothing to do with a Login System.
gregster
Posts: 9034
Joined: 30 Sep 2013, 06:48

Re: Script Login  Topic is solved

30 Oct 2019, 00:16

aaffe wrote:
30 Oct 2019, 00:07
Sorry, but where is your Login script? I dont think it is the script posted. It has Nothing to do with a Login System.
I think that's the point. The OP wants to encrypt/personalize this piece of code and doesn't know how to do it.

I don't see why someone would see the need to do this with this rather trivial piece of code, but perhaps it's just general interest and for later use. 🤷‍♂️
davifrotak
Posts: 5
Joined: 26 Oct 2019, 18:25

Re: Script Login

30 Oct 2019, 05:48

this is a script for a game, i would like to sell it but i wanted to make a login system and i have no idea how to do that
aaffe
Posts: 192
Joined: 16 Jan 2014, 04:23

Re: Script Login

30 Oct 2019, 07:24

Ok, how much will you sell for the Login System Code?
;)

No, just a joke. I think no one will Code you a Login System that is more difficult than your script and you can sell it then.
Perhaps you are lucky and someone will do it, but I dont think so.
davifrotak
Posts: 5
Joined: 26 Oct 2019, 18:25

Re: Script Login

30 Oct 2019, 09:05

I don't need them to do it for me, I just need to be taught, my script is simple, but many tests have been done to get the precise speed, because 1ms difference and everything was already wrong
aaffe
Posts: 192
Joined: 16 Jan 2014, 04:23

Re: Script Login

30 Oct 2019, 09:39

ok, you can adapt this for you:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

IfnotExist,c:\tmp
	FileCreatedir,c:\tmp
ini:="c:\tmp\password.ini"

gsen := {"user1":"XXX"
,"user2":"YYY"}

for key, value in gsen
	gsstring.=key . "|"


Gui, Add, DropDownList, x22 y39 w250 h20 vuser r20 choose1, %gsstring%
Gui, Add, GroupBox, x12 y19 w290 h80 , User
Gui, Add, Button, x12 y129 w100 h30 gWeiter, OK
Gui, Add, Text, x22 y69 w50 h20 , password:
Gui, Add, Edit, x72 y69 w200 h20 vpassword,
ShowGui:
Gui, Show, x127 y87 h170 w331, Login
Return



Weiter:
Gui, Submit


If (password="")
{
	Msgbox,64,Passwort fehlt!,Sie haben kein Passwort angegeben!
	Goto,ShowGui
}
for key, value in gsen
{
	StringCaseSense,on
	if (key=user and value!=password)
	{
		Msgbox,52,Attention!,Wrong password!`n`nRetry?
		IfMsgbox,Yes
			Goto,ShowGui
		else
			Exitapp
	}
}
StringCaseSense,Off
Passwordcrypt:=RC4txt2hex(password,"Passwort")
IniWrite,%user%,%ini%, Login, user
IniWrite,%Passwordcrypt%,%ini%,Login, user_password

Gui, Destroy





Msgbox, Now I read user and passwort from the ini file

IniRead,userini,%ini%,Login,user
IniRead,PassVerschl,%ini%,Login,user_password
password_ini:=RC4hex2txt(PassVerschl,"Passwort")

Msgbox user: %userini% password: %password_ini%
  
  
ExitApp


;Passwort-Verschlüsselung
RC4txt2hex(Data,Pass) {
   Format := A_FormatInteger
   SetFormat Integer, Hex
   b := 0, j := 0
   VarSetCapacity(Result,StrLen(Data)*2)
   Loop 256 {
      a := A_Index - 1
      Key%a% := Asc(SubStr(Pass, Mod(a,StrLen(Pass))+1, 1))
      sBox%a% := a
   }
   Loop 256 {
      a := A_Index - 1
      b := b + sBox%a% + Key%a%  & 255
      T := sBox%a%
      sBox%a% := sBox%b%
      sBox%b% := T
   }
   Loop Parse, Data
   {
      i := A_Index & 255
      j := sBox%i% + j  & 255
      k := sBox%i% + sBox%j%  & 255
      Result .= SubStr(Asc(A_LoopField)^sBox%k%, -1, 2)
   }
   StringReplace Result, Result, x, 0, All
   SetFormat Integer, %Format%
   Return Result
}

RC4hex2txt(Data,Pass) {
   b := 0, j := 0, x := "0x"
   VarSetCapacity(Result,StrLen(Data)//2)
   Loop 256 {
      a := A_Index - 1
      Key%a% := Asc(SubStr(Pass, Mod(a,StrLen(Pass))+1, 1))
      sBox%a% := a
   }
   Loop 256 {
      a := A_Index - 1
      b := b + sBox%a% + Key%a%  & 255
      T := sBox%a%
      sBox%a% := sBox%b%
      sBox%b% := T
   }
   Loop % StrLen(Data)//2 {
      i := A_Index  & 255
      j := sBox%i% + j  & 255
      k := sBox%i% + sBox%j%  & 255
      Result .= Chr((x . SubStr(Data,2*A_Index-1,2)) ^ sBox%k%)
   }
   Return Result
}

davifrotak
Posts: 5
Joined: 26 Oct 2019, 18:25

Re: Script Login

30 Oct 2019, 10:40

aaffe wrote:
30 Oct 2019, 09:39
ok, you can adapt this for you:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

IfnotExist,c:\tmp
	FileCreatedir,c:\tmp
ini:="c:\tmp\password.ini"

gsen := {"user1":"XXX"
,"user2":"YYY"}

for key, value in gsen
	gsstring.=key . "|"


Gui, Add, DropDownList, x22 y39 w250 h20 vuser r20 choose1, %gsstring%
Gui, Add, GroupBox, x12 y19 w290 h80 , User
Gui, Add, Button, x12 y129 w100 h30 gWeiter, OK
Gui, Add, Text, x22 y69 w50 h20 , password:
Gui, Add, Edit, x72 y69 w200 h20 vpassword,
ShowGui:
Gui, Show, x127 y87 h170 w331, Login
Return



Weiter:
Gui, Submit


If (password="")
{
	Msgbox,64,Passwort fehlt!,Sie haben kein Passwort angegeben!
	Goto,ShowGui
}
for key, value in gsen
{
	StringCaseSense,on
	if (key=user and value!=password)
	{
		Msgbox,52,Attention!,Wrong password!`n`nRetry?
		IfMsgbox,Yes
			Goto,ShowGui
		else
			Exitapp
	}
}
StringCaseSense,Off
Passwordcrypt:=RC4txt2hex(password,"Passwort")
IniWrite,%user%,%ini%, Login, user
IniWrite,%Passwordcrypt%,%ini%,Login, user_password

Gui, Destroy





Msgbox, Now I read user and passwort from the ini file

IniRead,userini,%ini%,Login,user
IniRead,PassVerschl,%ini%,Login,user_password
password_ini:=RC4hex2txt(PassVerschl,"Passwort")

Msgbox user: %userini% password: %password_ini%
  
  
ExitApp


;Passwort-Verschlüsselung
RC4txt2hex(Data,Pass) {
   Format := A_FormatInteger
   SetFormat Integer, Hex
   b := 0, j := 0
   VarSetCapacity(Result,StrLen(Data)*2)
   Loop 256 {
      a := A_Index - 1
      Key%a% := Asc(SubStr(Pass, Mod(a,StrLen(Pass))+1, 1))
      sBox%a% := a
   }
   Loop 256 {
      a := A_Index - 1
      b := b + sBox%a% + Key%a%  & 255
      T := sBox%a%
      sBox%a% := sBox%b%
      sBox%b% := T
   }
   Loop Parse, Data
   {
      i := A_Index & 255
      j := sBox%i% + j  & 255
      k := sBox%i% + sBox%j%  & 255
      Result .= SubStr(Asc(A_LoopField)^sBox%k%, -1, 2)
   }
   StringReplace Result, Result, x, 0, All
   SetFormat Integer, %Format%
   Return Result
}

RC4hex2txt(Data,Pass) {
   b := 0, j := 0, x := "0x"
   VarSetCapacity(Result,StrLen(Data)//2)
   Loop 256 {
      a := A_Index - 1
      Key%a% := Asc(SubStr(Pass, Mod(a,StrLen(Pass))+1, 1))
      sBox%a% := a
   }
   Loop 256 {
      a := A_Index - 1
      b := b + sBox%a% + Key%a%  & 255
      T := sBox%a%
      sBox%a% := sBox%b%
      sBox%b% := T
   }
   Loop % StrLen(Data)//2 {
      i := A_Index  & 255
      j := sBox%i% + j  & 255
      k := sBox%i% + sBox%j%  & 255
      Result .= Chr((x . SubStr(Data,2*A_Index-1,2)) ^ sBox%k%)
   }
   Return Result
}

Last edited by davifrotak on 30 Oct 2019, 10:58, edited 1 time in total.
davifrotak
Posts: 5
Joined: 26 Oct 2019, 18:25

Re: Script Login

30 Oct 2019, 10:48

now just put my script at the end?
aaffe
Posts: 192
Joined: 16 Jan 2014, 04:23

Re: Script Login

03 Nov 2019, 23:20

come on, do something on your own!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Araphen, ShatterCoder and 315 guests