Jump to content

Utility for an Auditor?


mdwerne
 Share

Recommended Posts

Hello,

We are going to have some auditors check the configuration of some of our servers. The auditors have asked us to give them the things to check...NICE!!

Anyway, I thought I'd go a step further and write a utility that they could run that had a nice gui with Green and Red led's for each item checked.

For example, if the computer has a certain registry value set to 1, the check passes and the led goes green, if the value is 0 the led goes red. Nice and easy for an auditor to see if my server passes or not.

Make sense?

What I'm looking for is a way within my gui check a condition and set the led, check another condition and set another led, etc..

Does anyone have a suggestion or a link to an example that might push me in the right direction?

Not looking for a handout, just a hand.

Thanks,

-Mike

Link to comment
Share on other sites

You were asking a very simple thing - you could have worked out that by yourself.

Here you go: a basic script.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 132, 122, 192, 124)
$Label1 = GUICtrlCreateLabel("Item Check 1", 16, 16, 67, 17)
$Label2 = GUICtrlCreateLabel("Item Check 2", 16, 37, 67, 17)
$Label3 = GUICtrlCreateLabel("Item Check 3", 16, 59, 67, 17)
$Label4 = GUICtrlCreateLabel(" ", 96, 16, 15, 17, $WS_BORDER)
$Label5 = GUICtrlCreateLabel(" ", 96, 37, 15, 17, $WS_BORDER)
$Label6 = GUICtrlCreateLabel(" ", 96, 59, 15, 17, $WS_BORDER)
$Button1 = GUICtrlCreateButton("Test", 24, 88, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            If @OSVersion = "WIN_32NT" Then
                GUICtrlSetBkColor($Label4, 0x00ff00)
            Else
                GUICtrlSetBkColor($Label4, 0xff0000)
            EndIf
            If Ping("yahoo.com") <> 0 Then
                GUICtrlSetBkColor($Label5, 0x111111)
            Else
                GUICtrlSetBkColor($Label5, 0x666666)
            EndIf
            If StringInStr(@UserName,"admin")  Then
                GUICtrlSetBkColor($Label6, 0xaa00aa)
            Else
                GUICtrlSetBkColor($Label6, 0xbb55bb)
            EndIf
    EndSwitch
WEnd

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

You were asking a very simple thing - you could have worked out that by yourself.

Thanks for the suggestion enaiman...I was using as my base and was making this harder than it needed to be.

Originally I was looking at swapping out pretty graphics for my red and green leds, not just toggling the background color.

After looking at your code I can see your way makes more sense for simplicity sake.

Thanks again!

-Mike

Edited by mdwerne
Link to comment
Share on other sites

Ooh i like that idea, thanks enaiman

So i used it for this hope you dont mind

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("OS Detection", 160, 250, 192, 124)
;;
$Label1 = GUICtrlCreateLabel("Windows 98", 16, 18, 95, 37)
$Label2 = GUICtrlCreateLabel("Windows 2000", 16, 39, 95, 37)
$Label3 = GUICtrlCreateLabel("Windows 2003", 16, 60, 95, 37)
$Label4 = GUICtrlCreateLabel("Windows XP", 16, 81, 97, 37)
$Label5 = GUICtrlCreateLabel("Windows Vista", 16, 102, 95, 37)
$Label6 = GUICtrlCreateLabel("Windows  2008", 16, 123, 95, 37)
$Label7 = GUICtrlCreateLabel("Windows  2008 R2", 16, 144, 95, 37)
$Label8 = GUICtrlCreateLabel("Windows  7 ", 16, 165, 95, 37)
;;
$Label21 = GUICtrlCreateLabel(" ", 126, 16, 15, 17, $WS_BORDER)
$Label22 = GUICtrlCreateLabel(" ", 126, 37, 15, 17, $WS_BORDER)
$Label23 = GUICtrlCreateLabel(" ", 126, 58, 15, 17, $WS_BORDER)
$Label24 = GUICtrlCreateLabel(" ", 126, 79, 15, 17, $WS_BORDER)
$Label25 = GUICtrlCreateLabel(" ", 126, 100, 15, 17, $WS_BORDER)
$Label26 = GUICtrlCreateLabel(" ", 126, 121, 15, 17, $WS_BORDER)
$Label27 = GUICtrlCreateLabel(" ", 126, 142, 15, 17, $WS_BORDER)
$Label28 = GUICtrlCreateLabel(" ", 126, 163, 15, 17, $WS_BORDER)
;;
GUISetState(@SW_SHOW)

local $os_check
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $os_check
If @OSVersion = "WIN_98" Then
                GUICtrlSetBkColor($Label21, 0xff0000)
;
ElseIf @OSVersion = "WIN_2000" Then
                GUICtrlSetBkColor($Label22, 0xff0000)
;
ElseIf @OSVersion = "WIN_2003" Then
                GUICtrlSetBkColor($Label23, 0xff0000)
;
ElseIf @OSVersion = "WIN_XP" Then
                GUICtrlSetBkColor($Label24, 0xff0000)
;
ElseIf @OSVersion = "WIN_VISTA" Then
                GUICtrlSetBkColor($Label25, 0xff0000)
;
ElseIf @OSVersion = "WIN_2008" Then
                GUICtrlSetBkColor($Label26, 0xff0000)
;
ElseIf @OSVersion = "WIN_2008R2" Then
                GUICtrlSetBkColor($Label27, 0xff0000)
;
ElseIf @OSVersion = "WIN_7" Then
                GUICtrlSetBkColor($Label28, 0xff0000)
            EndIf
    EndSwitch
WEnd
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...