Jump to content

Internet Cafe Your Pc


RichE
 Share

Recommended Posts

Wrote this as a project for the school i work at, replaces the explorer shell, initially locks the pc, can be unlocked with user password which runs iexplorer in kiosk mode.

once unlocked with user password you will be asked to select the timer 15,30,45 or 1 hour, then iexplorer will run for the alloted timer then relock on expiry.

if unlocked with the admin password, you can change the user password and the admin password.

note: compile as cafe.exe and place on c:\

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:        Riche
;
; Script Function:
;   Internet cafe Pc locker and session timer
;
; ----------------------------------------------------------------------------



#include <GuiConstants.au3>
;read user and admin passwords from registry
$apass = regread("HKEY_LOCAL_MACHINE\Software\Icafe", "apass")
$upass = regread("HKEY_LOCAL_MACHINE\Software\Icafe", "pass")

if $apass = -1 then
RegWrite("HKEY_LOCAL_MACHINE\Software\Icafe\", "apass", "REG_SZ", "letmein")
RegWrite("HKEY_LOCAL_MACHINE\Software\Icafe\", "pass", "REG_SZ", "password")
Else
    EndIf
$apass = regread("HKEY_LOCAL_MACHINE\Software\Icafe", "apass")
$upass = regread("HKEY_LOCAL_MACHINE\Software\Icafe", "pass")
Opt("GUIOnEventMode", 1)

$X = BitOr($WS_POPUP, $WS_BORDER )

;login box
$frmparent = GuiCreate("CCHS_Internet_Cafe", 331, 130,-1,-1, $X)
GUISetBkColor("0xE0FFFF")
GuiCtrlCreateLabel(@ComputerName & " Locked", 2, 2, 340, 30 )
GuiCtrlCreateLabel("Please enter password to unlock", 10, 30, 310, 20 )

$pass = GuiCtrlCreateInput("", 10, 50, 310, 20, $ES_PASSWORD)
$ok = GuiCtrlCreateButton("OK", 150, 90, 70, 30,$BS_DEFPUSHBUTTON)
GUICtrlSetOnEvent(-1, "ok")
$cancel = GuiCtrlCreateButton("Cancel", 250, 90, 70, 30)
GUICtrlSetOnEvent(-1, "cancel")

;password change box
$frmpwdcng = GuiCreate("Kiosk Admin", 337, 272,(@DesktopWidth-337)/2, (@DesktopHeight-272)/2 , $WS_OVERLAPPEDWINDOW +  $WS_CLIPSIBLINGS + @SW_HIDE)

GuiCtrlCreateLabel("Enter Password", 20, 30, 160, 20)
$UPass1 = GuiCtrlCreateInput("", 20, 50, 160, 20,$ES_PASSWORD)
GuiCtrlCreateLabel("Confirm Password", 20, 80, 160, 20)
$upass2 = GuiCtrlCreateInput("", 20, 100, 160, 20,$ES_PASSWORD)
GuiCtrlCreateGroup("Kiosk Password", 10, 10, 320, 120)
$uchange = GuiCtrlCreateButton("Change", 210, 100, 110, 20)
GUICtrlSetOnEvent(-1, "uchange")
        
GuiCtrlCreateGroup("Admin Password", 10, 140, 320, 120)
GuiCtrlCreateLabel("Enter Password", 20, 160, 160, 20,$ES_PASSWORD)
$apass1 = GuiCtrlCreateInput("", 20, 180, 160, 20,$ES_PASSWORD)
GuiCtrlCreateLabel("Confirm Password", 20, 210, 160, 20)
$apass2 = GuiCtrlCreateInput("", 20, 230, 160, 20,$ES_PASSWORD)
$achange = GuiCtrlCreateButton("Change", 210, 230, 110, 20)
GUICtrlSetOnEvent(-1, "achange")

;session timer
$timer = GuiCreate("Time", 207, 278,(@DesktopWidth-207)/2, (@DesktopHeight-278)/2 , $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + @SW_HIDE)

GuiCtrlCreateGroup("Select Time", 10, 10, 190, 210)
$start = GuiCtrlCreateButton("START", 20, 230, 170, 40, $BS_DEFPUSHBUTTON)
GUICtrlSetOnEvent(-1, "timer")
$15 = GuiCtrlCreateRadio("15 minutes", 20, 30, 170, 30)
GUICtrlSetState ($15,$GUI_CHECKED)
$30 = GuiCtrlCreateRadio("30 minutes", 20, 70, 170, 40)
$45 = GuiCtrlCreateRadio("45 minutes", 20, 120, 170, 40)
$1h = GuiCtrlCreateRadio("1 hour", 20, 170, 170, 40)

GUISwitch($frmparent)
GUISetState(@SW_SHOW)

;timer function
Func timer()
    if guictrlread($15) = 1 then 
        $time = 900000
    Else
        if guictrlread($30) = 1 then 
            $time = 1800000
        Else
            if guictrlread($45) = 1 then 
                $time = 2700000
            Else
                if guictrlread($1h) = 1 then 
                    $time = 3600000
                Else
            EndIf
        EndIf
    EndIf
EndIf
Run(@ProgramFilesDir & "\internet explorer\iexplore.exe -k http://www.google.co.uk", @ProgramFilesDir & "\internet explorer")
GUIsetstate(@SW_hide, $timer)
sleep($time)
ProcessClose("IEXPLORE.EXE")
Exit
EndFunc

;cancel function
func cancel()
    run("c:\cafe.exe", "")
    Exit
EndFunc

;ok function
func ok()
if guictrlread($pass) <> $upass And guictrlread($pass) <> $apass then
    msgbox(48, "Warning!", "Password Incorrect", 5)
Else
    if guictrlread($pass) = $upass then
    GUIsetstate(@SW_HIDE, $frmparent)
    GUIsetstate(@SW_show, $timer)
    ElseIf   guictrlread($pass) = $apass then
    GUIsetstate(@SW_HIDE, $frmparent)
    guisetstate(@sw_show, $frmpwdcng)
    
EndIf
endif


EndFunc

    
;change user password
func uchange()
    if guictrlread($upass1) = "" or guictrlread($upass2) = "" then 
        msgbox(48, "Warning!", "a password box is empty", 3)
    Else
        if guictrlread($upass1) <> guictrlread($upass2) Then
            Msgbox(48,"Warning!", "Passwords do not match, please retype the password", 3)
            Else
            RegWrite("HKEY_LOCAL_MACHINE\Software\Icafe", "pass", "REG_SZ", guictrlread($upass2))
            msgbox(64, "password change", "password changed", 3)
            $upass = regread("HKEY_LOCAL_MACHINE\Software\Icafe", "pass")
            GUICtrlSetData($pass, "","")
            GUICtrlSetData($upass1, "","")
            GUICtrlSetData($upass2, "","")
            
            GUIsetstate(@SW_show, $frmparent)
            guisetstate(@sw_hide, $frmpwdcng)
    
        EndIf
    EndIf
EndFunc

;change admin password
func achange()
    if guictrlread($apass1) = "" or guictrlread($apass2) = "" then 
        msgbox(48, "Warning!", "a password box is empty", 3)
    Else
        if guictrlread($apass1) <> guictrlread($apass2) Then
            Msgbox(48,"Warning!", "Passwords do not match, please retype the password", 3)
            Else

            if guictrlread($apass2) = $upass Then
                msgbox(48,"warning","the admin password cannot be the same as the user password", 3)
                Else
            RegWrite("HKEY_LOCAL_MACHINE\Software\Icafe", "apass", "REG_SZ", guictrlread($apass2))
            msgbox(64, "password change", "password changed", 3)
            $apass = regread("HKEY_LOCAL_MACHINE\Software\Icafe", "apass")
            GUICtrlSetData($pass, "","")
            GUIsetstate(@SW_show, $frmparent)
            guisetstate(@sw_hide, $frmpwdcng)
            EndIf
        EndIf
    EndIf
EndFunc




GuiSetState()
While 1 
     Sleep ( 200 )
WEnd 
Exit
Edited by l15ard

RichE

[font="'Arial Narrow';"]Current projects[/font]

[font="'Arial Narrow';"]are on my site [/font]Sellostring

Link to comment
Share on other sites

nice idea

i think i might use this at work for our customer-internet-pc

thx for sharing

no problem, like i said on one of my other posts, i'm not a programmer by trade, and have taught myself, so I'm always willing to share my code, so someone can improve on it

RichE

[font="'Arial Narrow';"]Current projects[/font]

[font="'Arial Narrow';"]are on my site [/font]Sellostring

Link to comment
Share on other sites

what is the admin password by default, by reading your script i thought it was password but it doesnt work, only the blank password works

EDIT: i noticed that there is no icafe key in my registry, i have administrator privileges and it doesnt work

Here is a fix:

CODE
; ----------------------------------------------------------------------------

;

; AutoIt Version: 3.1.0

; Author: Riche

;

; Script Function:

; Internet cafe Pc locker and session timer

;

; ----------------------------------------------------------------------------

#include <GuiConstants.au3>

;read user and admin passwords from registry

$apass = regread("HKEY_LOCAL_MACHINE\SOFTWARE\Icafe", "apass")

$upass = regread("HKEY_LOCAL_MACHINE\SOFTWARE\Icafe", "pass")

if @error then

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Icafe", "apass", "REG_SZ", "password2")

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Icafe", "pass", "REG_SZ", "password")

Else

EndIf

$apass = regread("HKEY_LOCAL_MACHINE\SOFTWARE\Icafe", "apass")

$upass = regread("HKEY_LOCAL_MACHINE\SOFTWARE\Icafe", "pass")

Opt("GUIOnEventMode", 1)

$X = BitOr($WS_POPUP, $WS_BORDER )

;login box

$frmparent = GuiCreate("CCHS_Internet_Cafe", 331, 130,-1,-1, $X)

GUISetBkColor("0xE0FFFF")

GuiCtrlCreateLabel(@ComputerName & " Locked", 2, 2, 340, 30 )

GuiCtrlCreateLabel("Please enter password to unlock", 10, 30, 310, 20 )

$pass = GuiCtrlCreateInput("", 10, 50, 310, 20, $ES_PASSWORD)

$ok = GuiCtrlCreateButton("OK", 150, 90, 70, 30,$BS_DEFPUSHBUTTON)

GUICtrlSetOnEvent(-1, "ok")

$cancel = GuiCtrlCreateButton("Cancel", 250, 90, 70, 30)

GUICtrlSetOnEvent(-1, "cancel")

;password change box

$frmpwdcng = GuiCreate("Kiosk Admin", 337, 272,(@DesktopWidth-337)/2, (@DesktopHeight-272)/2 , $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + @SW_HIDE)

GuiCtrlCreateLabel("Enter Password", 20, 30, 160, 20)

$UPass1 = GuiCtrlCreateInput("", 20, 50, 160, 20,$ES_PASSWORD)

GuiCtrlCreateLabel("Confirm Password", 20, 80, 160, 20)

$upass2 = GuiCtrlCreateInput("", 20, 100, 160, 20,$ES_PASSWORD)

GuiCtrlCreateGroup("Kiosk Password", 10, 10, 320, 120)

$uchange = GuiCtrlCreateButton("Change", 210, 100, 110, 20)

GUICtrlSetOnEvent(-1, "uchange")

GuiCtrlCreateGroup("Admin Password", 10, 140, 320, 120)

GuiCtrlCreateLabel("Enter Password", 20, 160, 160, 20,$ES_PASSWORD)

$apass1 = GuiCtrlCreateInput("", 20, 180, 160, 20,$ES_PASSWORD)

GuiCtrlCreateLabel("Confirm Password", 20, 210, 160, 20)

$apass2 = GuiCtrlCreateInput("", 20, 230, 160, 20,$ES_PASSWORD)

$achange = GuiCtrlCreateButton("Change", 210, 230, 110, 20)

GUICtrlSetOnEvent(-1, "achange")

;session timer

$timer = GuiCreate("Time", 207, 278,(@DesktopWidth-207)/2, (@DesktopHeight-278)/2 , $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + @SW_HIDE)

GuiCtrlCreateGroup("Select Time", 10, 10, 190, 210)

$start = GuiCtrlCreateButton("START", 20, 230, 170, 40, $BS_DEFPUSHBUTTON)

GUICtrlSetOnEvent(-1, "timer")

$15 = GuiCtrlCreateRadio("15 minutes", 20, 30, 170, 30)

GUICtrlSetState ($15,$GUI_CHECKED)

$30 = GuiCtrlCreateRadio("30 minutes", 20, 70, 170, 40)

$45 = GuiCtrlCreateRadio("45 minutes", 20, 120, 170, 40)

$1h = GuiCtrlCreateRadio("1 hour", 20, 170, 170, 40)

GUISwitch($frmparent)

GUISetState(@SW_SHOW)

;timer function

Func timer()

if guictrlread($15) = 1 then

$time = 900000

Else

if guictrlread($30) = 1 then

$time = 1800000

Else

if guictrlread($45) = 1 then

$time = 2700000

Else

if guictrlread($1h) = 1 then

$time = 3600000

Else

EndIf

EndIf

EndIf

EndIf

Run(@ProgramFilesDir & "\internet explorer\iexplore.exe -k http://www.google.co.uk", @ProgramFilesDir & "\internet explorer")

GUIsetstate(@SW_hide, $timer)

sleep($time)

ProcessClose("IEXPLORE.EXE")

Exit

EndFunc

;cancel function

func cancel()

run("c:\cafe.exe", "")

Exit

EndFunc

;ok function

func ok()

if guictrlread($pass) <> $upass And guictrlread($pass) <> $apass then

msgbox(48, "Warning!", "Password Incorrect", 5)

Else

if guictrlread($pass) = $upass then

GUIsetstate(@SW_HIDE, $frmparent)

GUIsetstate(@SW_show, $timer)

ElseIf guictrlread($pass) = $apass then

GUIsetstate(@SW_HIDE, $frmparent)

guisetstate(@sw_show, $frmpwdcng)

EndIf

endif

EndFunc

;change user password

func uchange()

if guictrlread($upass1) = "" or guictrlread($upass2) = "" then

msgbox(48, "Warning!", "a password box is empty", 3)

Else

if guictrlread($upass1) <> guictrlread($upass2) Then

Msgbox(48,"Warning!", "Passwords do not match, please retype the password", 3)

Else

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Icafe", "pass", "REG_SZ", guictrlread($upass2))

msgbox(64, "password change", "password changed", 3)

$upass = regread("HKEY_LOCAL_MACHINE\SOFTWARE\Icafe", "pass")

GUICtrlSetData($pass, "","")

GUICtrlSetData($upass1, "","")

GUICtrlSetData($upass2, "","")

GUIsetstate(@SW_show, $frmparent)

guisetstate(@sw_hide, $frmpwdcng)

EndIf

EndIf

EndFunc

;change admin password

func achange()

if guictrlread($apass1) = "" or guictrlread($apass2) = "" then

msgbox(48, "Warning!", "a password box is empty", 3)

Else

if guictrlread($apass1) <> guictrlread($apass2) Then

Msgbox(48,"Warning!", "Passwords do not match, please retype the password", 3)

Else

if guictrlread($apass2) = $upass Then

msgbox(48,"warning","the admin password cannot be the same as the user password", 3)

Else

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Icafe", "apass", "REG_SZ", guictrlread($apass2))

msgbox(64, "password change", "password changed", 3)

$apass = regread("HKEY_LOCAL_MACHINE\SOFTWARE\Icafe", "apass")

GUICtrlSetData($pass, "","")

GUIsetstate(@SW_show, $frmparent)

guisetstate(@sw_hide, $frmpwdcng)

EndIf

EndIf

EndIf

EndFunc

GuiSetState()

While 1

Sleep ( 200 )

WEnd

Exit

I only changed this, regread returns @error not in the variable and admin password should be different to user password

if @error then
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Icafe", "apass", "REG_SZ", "passwordd")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Icafe", "pass", "REG_SZ", "password")
Edited by RazerM
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

what is the admin password by default, by reading your script i thought it was password but it doesnt work, only the blank password works

EDIT: i noticed that there is no icafe key in my registry, i have administrator privileges and it doesnt work

oops thanks for pointing that one out, i made a quick change this afternoon, to write the registry entires but forgot about the password can't be the same...DOH!

i've amend the code so the two passwords are different

username password = password

admin password = letmein

sorry about that muck up

RichE

[font="'Arial Narrow';"]Current projects[/font]

[font="'Arial Narrow';"]are on my site [/font]Sellostring

Link to comment
Share on other sites

it's ok sometimes its only when someone else looks at your code that a problem is found.

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
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...