#include <GuiConstants.au3>
#include <String.au3>
Opt("GuiOnEventMode", 1)
GUICreate("Keylogger Defense", 200, 100)
$go = GUICtrlCreateButton("Passwort einsetzen", 10, 10, 180)
$pw = GUICtrlCreateButton("Passwort einstellen", 10, 40, 180)
$newpw = GUICtrlCreateButton("Neues Passwort anlegen", 10, 70, 180)
GUISetOnEvent($GUI_EVENT_CLOSE, "close")
GUICtrlSetOnEvent($pw, "pw")
GUICtrlSetOnEvent($newpw, "newpw")
GUICtrlSetOnEvent($go, "go")
GUISetState(@SW_SHOW)
$masterkey = "Warlord"
$gokey = ""

Func close()
	Exit
EndFunc

Func go()
	Sleep(2000)
	Send($gokey)
EndFunc

Func pw()
	If FileExists("./passwords.ini") Then
		$rosections = InputBox("Passwort", "Bitte Section eingeben")
		$rosection = _StringEncrypt(1, $rosections, $masterkey)
		$gokeys = IniRead("passwords.ini", "passwords", $rosection, "")
		$gokey = _StringEncrypt(0, $gokeys, $masterkey)
	Else
		MsgBox(0, "Fehler", "Keine Passwörter verfügbar")
	EndIf
EndFunc

Func newpw()
	$section = InputBox("Neues Passwort", "Bitte Section eingeben")
	$key = InputBox("Neues Passwort", "Bitte Passwort eingeben")
	$sectionend = _StringEncrypt(1, $section, $masterkey)
	$keyend = _StringEncrypt(1, $key, $masterkey)
	IniWrite("passwords.ini", "passwords", $sectionend, $keyend)
EndFunc

While 1
	Sleep(1)
WEnd
