Jump to content

Theft Alert


Champak
 Share

Recommended Posts

I made this as part of my other app and decided to share it by itself. The theft locator is actually an independent program that is included with INavMedia named INavMediaTA. It sends an e-mail hidden in the background to the address of

your choosing if a User ID and Password is not entered correctly or within 2 minutes of the application's automatic launch when windows starts up, and then every 20 minutes updating the location. The information contained in the e-mail is as follows(if internet connection is available, and gps info for the location):

_________________________________________________

Current Time/Date: 12/22/2008 22:23:31

IP Address: XX.XXX.XX.XXX

Your ISP: VERIZON.NET

Hostname: nycmny.east.verizon.net

Country: United States

State: New York

Hub City: New York (Routed Internet Connection)

Timezone: America/New_York

GPS Latitude: XX.XXXXX

GPS Longitude: XX.XXXXX

__________________________________________________

Once the information is entered correctly, INavMediaTA can be set to prompt for the login credentials in 1-24 hourly increments or to exit until the next time the computer is started.

Do to ISP restrictions if the computer is stolen the info set up for your personal/primary e-mail account may not work. To resolve this there is an option to set up a secondary e-mail account through other e-mail providers (yahoo, hotmail, mail, gmail). If the primary e-mail does not go through, the secondary e-mail will kick in and send.

Do to the nature of this INavMediaTA and security, once the info is entered, you cannot edit or update the information, so just make something to delete the registry entries.

This will set it self to automatically launch when windows starts.

#include <WindowsConstants.au3>
#include <INet.au3>
#include <GUIConstantsEx.au3>
#include <File.au3>
#Include <Timers.au3>
#include <IE.au3>
#Include <Date.au3>
#Include <Misc.au3>
;#Include <array.au3>

Opt("TrayIconHide", 1)
Opt("WinTitleMatchMode", 1)
Opt("GUIOnEventMode", 1)
Opt("OnExitFunc", "_OnAutoItExit")
;HotKeySet ( "{ENTER}", "_SecurityLogIn" );Change this to ispressed when 

_IEErrorHandlerRegister("_MyErrFunc")
_IEErrorHandlerDeRegister()
_IEErrorHandlerRegister()

Global $oIE
Global $LogIn_Timer
Global $Security_LogIn = True
Global $Security_Access_Array[3]
Global $Security_Main_Mail_Array[4]
Global $Security_BackUp_Mail_Array[4]
Global $oMyRet[2]
Global $Security_Input_Array[12]
Global $Timer_Initialize = 120000;2 min
Global $Timer_Update = 1200000;20 min

;================================================================
;================================================================
;================================================================
;================================================================


Global $RegLocation = "HKEY_CURRENT_USER\SOFTWARE\INM\Security\";<--------Change this how/where you want


;================================================================
;================================================================
;================================================================
;================================================================

If RegRead($RegLocation, "Security Set") = "" Then
    
    $INMTA = GUICreate("INavMedia Theft Alert Set Up", 400, 470, -1, -1, -1, $WS_EX_TOPMOST)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_EXIT")
        GUICtrlCreateLabel("This is a theft notification setup. If you do not have internet capabilities on your CarPuter or Laptop this is unnecessary." & @CRLF & "Once you save any info, do to its security, you will not be able to edit or update it at a later time, you will have to uninstall and reinstall INavMedia. To enter info later, do not enter ANYTHING now.", 10, 10, 380, 100)
        GUICtrlSetFont(-1, 9, 700, "")

        GUICtrlCreateLabel("User Name", 10, 90, 70, 25)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
        GUICtrlSetFont(-1, 9, 700, "")
        $Security_Input_Array[1] = GUICtrlCreateInput("", 90, 90, 100, 25)

        GUICtrlCreateLabel("Password", 220, 90, 100, 25)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
        GUICtrlSetFont(-1, 9, 700, "")
        $Security_Input_Array[2] = GUICtrlCreateInput("", 290, 90, 100, 25)


        GUICtrlCreateLabel("'Send To'  E-Mail address", 10, 125, 160, 25)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
        GUICtrlSetFont(-1, 9, 700, "")
        $Security_Input_Array[3] = GUICtrlCreateInput("", 170, 125, 160, 25)


        GUICtrlCreateGroup("Primary Email Account Info", 5, 150, 390, 110)
        GUICtrlSetState(-1, $GUI_DISABLE)
        
        GUICtrlCreateLabel("", 335, 170, 30, 85)
        GUICtrlSetBkColor(-1, 0x00FF00)

        GUICtrlCreateLabel("Outgoing SMTP", 10, 170, 160, 25)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
        GUICtrlSetFont(-1, 9, 700, "")
        $Security_Input_Array[4] = GUICtrlCreateInput("", 170, 170, 160, 25)

        GUICtrlCreateLabel("Main E-Mail User ID", 10, 200, 160, 25)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
        GUICtrlSetFont(-1, 9, 700, "")
        $Security_Input_Array[5] = GUICtrlCreateInput("", 170, 200, 160, 25)
        
        GUICtrlCreateLabel("Main E-Mail Password", 10, 230, 160, 25)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
        GUICtrlSetFont(-1, 9, 700, "")
        $Security_Input_Array[6] = GUICtrlCreateInput("", 170, 230, 160, 25)
        
        
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        
        
        GUICtrlCreateGroup("BackUp Email Account Info", 5, 270, 390, 110)
        GUICtrlSetState(-1, $GUI_DISABLE)
        
        GUICtrlCreateLabel("", 335, 290, 30, 85)
        GUICtrlSetBkColor(-1, 0x00FFFF)
        
        GUICtrlCreateLabel("Back Up E-Mail Site", 10, 290, 160, 25)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
        GUICtrlSetFont(-1, 9, 700, "")
        $Security_Input_Array[7] = GUICtrlCreateCombo("", 170, 290, 160, 25)
        GUICtrlSetData(-1, "Hotmail.com|Mail.com", "Select")

        GUICtrlCreateLabel("Back Up E-Mail User ID", 10, 320, 160, 25)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
        GUICtrlSetFont(-1, 9, 700, "")
        $Security_Input_Array[8] = GUICtrlCreateInput("", 170, 320, 160, 25)
        
        GUICtrlCreateLabel("Back Up E-Mail Password", 10, 350, 160, 25)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
        GUICtrlSetFont(-1, 9, 700, "")
        $Security_Input_Array[9] = GUICtrlCreateInput("", 170, 350, 160, 25)

        GUICtrlCreateLabel("Reminder", 10, 385, 160, 25)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
        GUICtrlSetFont(-1, 9, 700, "")
        $Security_Input_Array[10] = GUICtrlCreateCombo("", 170, 385, 160, 25)
        GUICtrlSetData(-1, "1 hour|2 hours|3 hours|4 hours|5 hours|6 hours|7 hours|8 hours|9 hours|10 hours|11 hours|12 hours|13 hours|14 hours|15 hours|16 hours|17 hours|18 hours|19 hours|20 hours|21 hours|22 hours|23 hours|24 hours|EXIT", "Select")

        $Security_Button_Test = GUICtrlCreateButton("Test Settings", 10, 420, 70, 40)
        GUICtrlSetOnEvent($Security_Button_Test, "_Security_Click_1")
        $Security_Input_Test = GUICtrlCreateCombo("", 90, 430, 120, 25)
        GUICtrlSetData(-1, "Primary Account|Backup Account", "Primary Account")
        
        $Security_Button_Help = GUICtrlCreateButton("Help", 240, 420, 70, 40)
        GUICtrlSetOnEvent($Security_Button_Help, "_Security_Click_3")
        $Security_Button_Save = GUICtrlCreateButton("Continue", 325, 420, 70, 40)
        GUICtrlSetOnEvent($Security_Button_Save, "_Security_Click_2")

    GUISetState()

    Do
        Sleep(200)
    Until Not WinExists($INMTA)

EndIf

$Security_Access = RegRead($RegLocation, "UserPass")
$Security_Access = StringSplit($Security_Access, @LF)
For $i = 1 To UBound($Security_Access) - 1
    $Security_Access_Array[$i] = $Security_Access[$i]
Next

$Security_Main_Mail = RegRead($RegLocation, "Main Mail")
$Security_Main_Mail = StringSplit($Security_Main_Mail, @LF)
For $i = 1 To UBound($Security_Main_Mail) - 1
    $Security_Main_Mail_Array[$i] = $Security_Main_Mail[$i]
Next

$Security_BackUp_Mail = RegRead($RegLocation, "BackUp Mail")
$Security_BackUp_Mail = StringSplit($Security_BackUp_Mail, @LF)
For $i = 1 To UBound($Security_BackUp_Mail) - 1
    $Security_BackUp_Mail_Array[$i] = $Security_BackUp_Mail[$i]
Next

Global $Security_EmailAddress = RegRead($RegLocation, "EMail Address")
Global $Security_TimeOut = RegRead($RegLocation, "Reminder")

Sleep(2000)
If ProcessExists("INavMedia.exe") Then WinWaitClose("SplashIntro", "Loading", 40)

$GUI_LogIn = GUICreate("Hello", 160, 35, @DesktopWidth - 175, @DesktopHeight - 120, -1, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Security_Click_4")
    $Security_User = GUICtrlCreateInput("", 5, 5, 70, 25)
    $Security_Pass = GUICtrlCreateInput("", 85, 5, 70, 25)
GUISetState()

$LogIn_Timer = _Timer_SetTimer($GUI_LogIn, $Timer_Initialize, "_SecurityContact")

While 1

    Sleep(50)

    If WinActive($GUI_LogIn) Then
        If _IsPressed("0D") Then _SecurityLogIn();ENTER key
    EndIf

WEnd

Func _Security_Click_1();Test Settings
    
    $SuccessConnect = False
    $InputEmpty = False
    
    If GUICtrlRead($Security_Input_Array[3]) = "" Then $InputEmpty = True
    
    If GUICtrlRead($Security_Input_Test) = "Primary Account" Then
        For $i = 4 To 6
            If GUICtrlRead($Security_Input_Array[$i]) = "" Then $InputEmpty = True
        Next
        $SettingsCheck = "Primary account"
    Else
        For $i = 7 To 9
            If GUICtrlRead($Security_Input_Array[$i]) = "" Then $InputEmpty = True
        Next
        $SettingsCheck = "Backup account"
    EndIf
    If $InputEmpty = True Then 
        MsgBox(262144 + 16, "Error", $SettingsCheck & " info incomplete. You must complete it before testing.")
        Return
    EndIf


    ;If no internet connection, exit
    $IsCon = DllCall("WinInet.dll", "int", "InternetGetConnectedState", "int_ptr", 0, "int", 0)
    If $IsCon[0] = 0 Then
        MsgBox(262144 + 16, "Error", "Unable to test account settings, no internet connection detected.")
        Return
    EndIf

    ;If can't get the website, exit
    $oIE = _IECreate("http://www.tracemyip.org/");, 0, 0)
    If @error Then
        MsgBox(262144 + 16, "Error", "Unable to gather info for email. INavMediaTA will still attempt to test email with default info.")
        _IEQuit($oIE)
        $Output = "Current Time/Date: 12/22/2008 22:23:31" & @CRLF & "IP Address: XX.XXX.XX.XXX"  & @CRLF & "Your ISP: VERIZON.NET"  & @CRLF & "Hostname: nycmny.east.verizon.net"  & @CRLF & "Country: United States"  & @CRLF & "State: New York"  & @CRLF & "Hub City: New York"  & @CRLF & " (Routed Internet Connection)"  & @CRLF & "Timezone: America/New_York"  & @CRLF & "GPS Location: 45.36343, 76.436363"
    Else
        $sDT = _Date_Time_GetLocalTime()
        $Output = "Current Time/Date: " & _Date_Time_SystemTimeToDateTimeStr($sDT) & @CRLF;Although time/date comes with every email, it sometimes lags, so this is here
        $Output &= "IP Address: " & _GetIP() & @CRLF
        ;Add GPS coordinates to info to send if present
        
        $oElements1 = _IETagNameGetCollection($oIE, "tbody", 7)
        _ObjectFindError($oElements1)
        ;If Not IsObj($oElements1) Then Return

        $oElements2 = _IETagNameGetCollection($oElements1, "tr")
        _ObjectFindError($oElements2)
        ;If Not IsObj($oElements2) Then Return
        
        $i = 1
        For $oElement In $oElements2
            $Output &= $oElement.innertext & @CRLF
            $i += 1
            If $i = 7 Then ExitLoop
        Next
    EndIf
    
    $Security_Message = "The thiefs Information: " & @CRLF & @CRLF & $Output & @CRLF & "Get the sucka!!"
    
                            ;($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password )
    If GUICtrlRead($Security_Input_Test) = "Primary Account" Then
        $rc = _INetSmtpMailCom(GUICtrlRead($Security_Input_Array[4]), "My Laptop", "Stolen@MyLaptop.com", GUICtrlRead($Security_Input_Array[3]), "I'm stolen damn it...HELP!!!", $Security_Message, "", "", "", GUICtrlRead($Security_Input_Array[5]), GUICtrlRead($Security_Input_Array[6]))
        If @error Then
            MsgBox(262144 + 16, "Error", "This error is do to one of the following:" & @CRLF & @CRLF & _
                                            "1/ One of your settings is incorrect." & @CRLF & _
                                            "2/ Your ISP is down or having problems." & @CRLF & _
                                            "3/ You are not currently on your own ISP.")
            Return
        Else
            $SuccessConnect = True
        EndIf
    Else
        ;The excessive error checking is to make sure if it breaks down it can be tracked to the exact point of the problem
        MsgBox(262144 + 48, "Attention", "Make sure your email provider is the correct one or you may get a false negative.")
        
        $Site = GUICtrlRead($Security_Input_Array[7])
        
        If $Site = "Yahoo.com" Then
            ;_IENavigate
        ElseIf $Site = "Hotmail.com" Then
            
            _IENavigate($oIE, "hotmail.com")

            ;Put this first, because if the user is logged in, an errror will occur with the first few functions exiting this function
            $Mail_SignOut = _IEGetObjByName ( $oIE, "c_signout")
            If Not @error Then
                _IEAction ( $Mail_SignOut, "Click" )
                _IELoadWait ( $oIE, 1000, 60000)
                _IENavigate($oIE, "hotmail.com")
            EndIf

            $oForm = _IEFormGetObjByName ($oIE, "f1")
            If @error Then
                _Security_Click_1_Helper($Site, 1)
                Return
            EndIf
            $Mail_User = _IEFormElementGetObjByName ( $oForm, "login")
            If @error Then
                _Security_Click_1_Helper($Site, 2)
                Return
            EndIf
            _IEFormElementSetValue ($Mail_User, GUICtrlRead($Security_Input_Array[8]))
            $Mail_Pass = _IEFormElementGetObjByName ( $oForm, "passwd")
            If @error Then
                _Security_Click_1_Helper($Site, 3)
                Return
            EndIf
            _IEFormElementSetValue ($Mail_Pass, GUICtrlRead($Security_Input_Array[9]))
            _IEFormSubmit ( $oForm, 0 )
            If @error Then
                _Security_Click_1_Helper($Site, 4)
                Return
            EndIf
            _IELoadWait ( $oIE, 1000, 60000)
            $oElements1 = _IEGetObjByName($oie, "iNUCont")
            $oElements2 = _IETagNameGetCollection($oElements1, "td")
            For $Error In $oElements2
                If $Error.classname = "cssError" And $Error.classname <> "0" Then
                    MsgBox(262144 + 16, "Error", "Unable to login. Incorrect User ID and/or Password for " & $Site)
                    Return
                EndIf
            Next
            _IELinkClickByText ($oIE, "New")
            If @error Then
                _Security_Click_1_Helper($Site, 6)
                Return
            EndIf
            _IELoadWait ( $oIE, 1000, 60000)
            $oElements1 = _IETagNameGetCollection($oIE, "div")
            If @error Then
                _Security_Click_1_Helper($Site, 7)
                Return
            EndIf
            $oForm = _IEFormGetObjByName ($oIE, "aspnetForm")
            If @error Then
                _Security_Click_1_Helper($Site, 8)
                Return
            EndIf
            $Mail_To =_IEFormElementGetObjByName  ( $oForm, "AutoCompleteTo$InputBox" )
            If @error Then
                _Security_Click_1_Helper($Site, 9)
                Return
            EndIf
            _IEAction ( $Mail_To, "focus" )
        ;   Sleep(5000)
            _IEFormElementSetValue ($Mail_To, GUICtrlRead($Security_Input_Array[3]))
        ;   Sleep(5000)
            $Mail_Subject =_IEFormElementGetObjByName  ( $oForm, "fSubject" )
            If @error Then
                _Security_Click_1_Helper($Site, 10)
                Return
            EndIf
            _IEAction ( $Mail_Subject, "focus" )
            _IEFormElementSetValue ($Mail_Subject, "I'm stolen damn it...HELP!!!")
            $Mail_Body = _IEGetObjByName($oIE, "RichTextEditor_surface")
            If @error Then
                _Security_Click_1_Helper($Site, 11)
                Return
            EndIf
            _IEAction ( $Mail_Body, "focus" )
            _IEDocInsertHTML ( $Mail_Body, $Security_Message, "beforeend" )
            $Mail_Send = _IEGetObjByName ( $oIE, "SendMessage")
            If @error Then
                _Security_Click_1_Helper($Site, 12)
                Return
            EndIf
            _IEAction ( $Mail_Send, "Click" )
            If @error Then
                _Security_Click_1_Helper($Site, 13)
                Return
            EndIf
            _IELoadWait ( $oIE, 1000, 60000)
            $Mail_SignOut = _IEGetObjByName ( $oIE, "c_signout")
            _IEAction ( $Mail_SignOut, "Click" )
            _IELoadWait ( $oIE, 1000, 60000)
            
            $SuccessConnect = True
        ElseIf $Site = "Mail.com" Then
            _IENavigate($oIE, "mail.com")
            $oForm = _IEFormGetObjByName ($oIE, "mailcom")
            If @error Then
                _Security_Click_1_Helper($Site, 1)
                Return
            EndIf
            $Mail_User = _IEFormElementGetObjByName ( $oForm, "login")
            If @error Then
                _Security_Click_1_Helper($Site, 2)
                Return
            EndIf
            _IEFormElementSetValue ($Mail_User, GUICtrlRead($Security_Input_Array[8]))
            $Mail_Pass = _IEFormElementGetObjByName ( $oForm, "password")
            If @error Then
                _Security_Click_1_Helper($Site, 3)
                Return
            EndIf
            _IEFormElementSetValue ($Mail_Pass, GUICtrlRead($Security_Input_Array[9]))
            _IEFormSubmit ( $oForm, 0 )
            If @error Then
                _Security_Click_1_Helper($Site, 4)
                Return
            EndIf
            _IELoadWait ( $oIE, 1000, 60000)
            $TestLogIn = _IEGetObjByName ($oIE, "warning")
            If IsObj($TestLogIn) Then
                MsgBox(262144 + 16, "Error", "Unable to login. Incorrect User ID and/or Password for " & $Site)
                Return
            EndIf
            _IENavigate($oIE, "http://mail01.mail.com/scripts/mail/Outblaze.mail?compose=1", 5)
            $oForm = _IEFormGetObjByName ($oIE, "composeForm")
            If @error Then
                _Security_Click_1_Helper($Site, 5)              
                Return
            EndIf
            $Mail_To = _IEFormElementGetObjByName ( $oForm, "to")
            If @error Then
                _Security_Click_1_Helper($Site, 6)              
                Return
            EndIf
            _IEFormElementSetValue ($Mail_To, GUICtrlRead($Security_Input_Array[3]))
            $Mail_Subject = _IEFormElementGetObjByName ( $oForm, "subject")
            If @error Then
                _Security_Click_1_Helper($Site, 7)              
                Return
            EndIf
            _IEFormElementSetValue ($Mail_Subject, "I'm stolen damn it...HELP!!!")
            $Mail_Body = _IEFrameGetCollection($oIE, 4)
            If @error Then
                _Security_Click_1_Helper($Site, 8)              
                Return
            EndIf
            _IEDocWriteHTML($Mail_Body, $Security_Message)
            $Mail_Send = _IEGetObjByName ( $oIE, "send")
            If @error Then
                _Security_Click_1_Helper($Site, 9)              
                Return
            EndIf
            _IEAction ( $Mail_Send, "Click" )
            If @error Then
                _Security_Click_1_Helper($Site, 10)             
                Return
            EndIf
            _IELoadWait ( $oIE, 1000, 60000)
            _IENavigate($oIE, "http://mail01.mail.com/scripts/mail/Outblaze.mail?logout=1")
            _IELoadWait ( $oIE, 1000, 60000)
            
            $SuccessConnect = True
        ElseIf $Site = "Gmail.com" Then
            ;_IENavigate
        EndIf
    EndIf

    If $SuccessConnect = True Then  MsgBox(262144 + 64, "Success", "The " & $SettingsCheck & " E-Mail test is successful.")

    _IEQuit($oIE)

EndFunc

Func _Security_Click_1_Helper($sSite, $sError)

    MsgBox(262144 + 16, "Error", "Unable to send test email through " & $sSite & " do to changes to the site." & @CRLF & "Contact developer to inform about this change to " & $sSite & "."  & @CRLF & "Error: " & $sError)
    _IEQuit($oIE)

EndFunc

Func _Security_Click_2();Save

    $Info = False
    For $i = 1 To UBound($Security_Input_Array) - 1
        If GUICtrlRead($Security_Input_Array[$i]) <> "" Then
            $Info = True
            ExitLoop
        EndIf
    Next


    If $Info = False Then Exit


    For $i = 1 To 3
        If GUICtrlRead($Security_Input_Array[$i]) = "" Then
            MsgBox(262144 + 16, "Error", "You must enter a User Name and/or Password and/or Send Email Address to continue.")
            Return
        EndIf
    Next


    RegWrite($RegLocation, "UserPass", "REG_MULTI_SZ", GUICtrlRead($Security_Input_Array[1]) & @LF & _
            GUICtrlRead($Security_Input_Array[2]))
            
    RegWrite($RegLocation, "Email Address", "REG_SZ", GUICtrlRead($Security_Input_Array[3]))
            
    RegWrite($RegLocation, "Main Mail", "REG_MULTI_SZ", GUICtrlRead($Security_Input_Array[4]) & @LF & _
            GUICtrlRead($Security_Input_Array[5]) & @LF & _
            GUICtrlRead($Security_Input_Array[6]))          

    RegWrite($RegLocation, "BackUp Mail", "REG_MULTI_SZ", GUICtrlRead($Security_Input_Array[7]) & @LF & _
            GUICtrlRead($Security_Input_Array[8]) & @LF & _
            GUICtrlRead($Security_Input_Array[9]))

    $Time = StringRegExp(GUICtrlRead($Security_Input_Array[10]), "[1-9]", 1)
    RegWrite($RegLocation, "Reminder", "REG_SZ", $Time[0] * 36000000)
    
    RegWrite($RegLocation, "Security Set", "REG_SZ", 1)
    
    RegWrite ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "INavMediaTA", "REG_SZ", @ScriptDir & "\INavMediaTA.exe")

    GUIDelete($INMTA)

EndFunc

Func _Security_Click_3();Help
    Run("hh.exe C:\iNav iGuidance\CarPC Response\INavMedia.chm")
EndFunc

Func _Security_Click_4();X close

    GUISetState(@SW_HIDE, $GUI_LogIn)
    _SecurityContact("", "", "", "")
    _Timer_KillTimer($GUI_LogIn, $LogIn_Timer)
    $LogIn_Timer = _Timer_SetTimer($GUI_LogIn, $Timer_Update, "_SecurityLogInShow");Bring login box back in case the person has moved their location...or instead of bringing the login box back, just have this automatically fire _SecurityLogIn() in the background since you the owner already knows not to close it by the X button.

EndFunc

Func _EXIT()

    Exit
    ;GUIDelete($INMTA)

EndFunc

Func _SecurityContact($hWnd, $Msg, $iIDTimer, $dwTime)

    Local $Lat, $Long

    ;If no internet connection, exit
    $IsCon = DllCall("WinInet.dll", "int", "InternetGetConnectedState", "int_ptr", 0, "int", 0)
    If $IsCon[0] = 0 Then Return

    ;If can't get the website, exit
    $oIE = _IECreate("http://www.tracemyip.org/", 0, 0)
    If @error Then
        _IEQuit($oIE)
        Return
    EndIf

    $sDT = _Date_Time_GetLocalTime()
    $Output = "<b>Current Time/Date:</b> " & _Date_Time_SystemTimeToDateTimeStr($sDT) & '<br>' & @CRLF;Although time/date comes with every email, it sometimes lags, so this is here
    $Output &= "<b>IP Address:</b> " & _GetIP() & '<br>' & @CRLF
    ;Add GPS coordinates to info to send if present

    $oElements1 = _IETagNameGetCollection($oIE, "tbody", 7)
    _ObjectFindError($oElements1)
    ;If Not IsObj($oElements1) Then Return

    $oElements2 = _IETagNameGetCollection($oElements1, "tr")
    _ObjectFindError($oElements2)
    ;If Not IsObj($oElements2) Then Return


    ;StringReplace ( "string", "searchstring" or start, "replacestring" [, count [, casesense]] )
    $i = 1
    For $oElement In $oElements2
        $Output &= "<b>" & StringReplace($oElement.innertext, ":", ":</b>") & '<br>' & @CRLF
        $i += 1
        If $i = 7 Then ExitLoop
    Next


    If ProcessExists("INavMedia.exe") Then
        $Lat = ControlGetText("Compass", "", 984)
        $Long = ControlGetText("Compass", "", 986)
        
        If ControlGetText("Compass", "", 978) = "No Fix" Then
            $Output &= @CRLF & "<br><b>Currently there is no GPS Fix, but the following is the most recent coordinates.</b>" & '<br>' & @CRLF
        EndIf
        $Output &= "<b>GPS Latitude:</b> " & $Lat & @CRLF & "<br><b>GPS Longitude:</b> " & $Long & @CRLF
    EndIf


    $Security_Message = "The thiefs Information: " & @CRLF & @CRLF & '<br>' & '<br>' & $Output & @CRLF  & '<br><br>' & "Get the sucka!!"
    
    _ConsoleWrite($Security_Message)
    ;_ConsoleWrite($Security_Main_Mail_Array[1])
    ;_ConsoleWrite($Security_Main_Mail_Array[2])
    ;_ConsoleWrite($Security_Main_Mail_Array[3])

                            ;($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password )

    $rc = _INetSmtpMailCom($Security_Main_Mail_Array[1], "My Laptop", "Stolen@MyLaptop.com", $Security_EmailAddress, "I'm stolen damn it...HELP!!!", $Security_Message, "", "", "", $Security_Main_Mail_Array[2], $Security_Main_Mail_Array[3])
    If @error And $Security_BackUp_Mail_Array[2] <> "" Then;If error and backup email address is detected
        ;Call out to a backup internet mail system like yahoo, hotmail, mail or some other one behind the scenes
        ;This is needed because jumping onto someone elses IP address the log in will fail.
        ;Use the IE UDF for this, have to set up a different contact for each of the mail contacts.
        ;msgbox(0,"Error sending message","Error code:" & @error & "  Description:" & $rc)
        
        If $Security_BackUp_Mail[1] = "Yahoo.com" Then
            ;_IENavigate
        ElseIf $Security_BackUp_Mail[1] = "Hotmail.com" Then
            _IENavigate($oIE, "hotmail.com")
            $oForm = _IEFormGetObjByName ($oIE, "f1")
            $Mail_User = _IEFormElementGetObjByName ( $oForm, "login")
            _IEFormElementSetValue ($Mail_User, $Security_BackUp_Mail_Array[2])
            $Mail_Pass = _IEFormElementGetObjByName ( $oForm, "passwd")
            _IEFormElementSetValue ($Mail_Pass, $Security_BackUp_Mail_Array[3])
            _IEFormSubmit ( $oForm, 0 )
            _IELoadWait ( $oIE, 1000, 60000)
            _IELinkClickByText ($oIE, "New")
            _IELoadWait ( $oIE, 1000, 60000)
            $oElements1 = _IETagNameGetCollection($oIE, "div")
            $oForm = _IEFormGetObjByName ($oIE, "aspnetForm")
            $Mail_To =_IEFormElementGetObjByName  ( $oForm, "AutoCompleteTo$InputBox" )
            _IEAction ( $Mail_To, "focus" )
            _IEFormElementSetValue ($Mail_To, $Security_EmailAddress)
            $Mail_Subject =_IEFormElementGetObjByName  ( $oForm, "fSubject" )
            _IEAction ( $Mail_Subject, "focus" )
            _IEFormElementSetValue ($Mail_Subject, "I'm stolen damn it...HELP!!!")
            $Mail_Body = _IEGetObjByName($oIE, "RichTextEditor_surface")
            _IEAction ( $Mail_Body, "focus" )
            _IEDocInsertHTML ( $Mail_Body, $Security_Message, "beforeend" )
            $Mail_Send = _IEGetObjByName ( $oIE, "SendMessage")
            _IEAction ( $Mail_Send, "Click" )
            _IELoadWait ( $oIE, 1000, 60000)
            $Mail_SignOut = _IEGetObjByName ( $oIE, "c_signout")
            _IEAction ( $Mail_SignOut, "Click" )
            _IELoadWait ( $oIE, 1000, 60000)
    #cs     
            $oElements1 = _IETagNameGetCollection($oIE, "a")
            $y = 1
            For $555 In $oElements1
                _ConsoleWrite("! " & $y)
                _ConsoleWrite("Tagname " & $555.tagname)
                _ConsoleWrite("id " & $555.id)
                _ConsoleWrite("innertext " & $555.innertext)
                _ConsoleWrite("outertext " & $555.outertext)
                _ConsoleWrite("-----------------------------------------------------------------------------------------------------" & @CRLF)
                $y += 1
            Next
    #ce
        ElseIf $Security_BackUp_Mail[1] = "Mail.com" Then
            _IENavigate($oIE, "mail.com")
            $oForm = _IEFormGetObjByName ($oIE, "mailcom")
            $Mail_User = _IEFormElementGetObjByName ( $oForm, "login")
            _IEFormElementSetValue ($Mail_User, $Security_BackUp_Mail_Array[2])
            $Mail_Pass = _IEFormElementGetObjByName ( $oForm, "password")
            _IEFormElementSetValue ($Mail_Pass, $Security_BackUp_Mail_Array[3])
            _IEFormSubmit ( $oForm, 0 )
            _IELoadWait ( $oIE, 1000, 60000)
            _IENavigate($oIE, "http://mail01.mail.com/scripts/mail/Outblaze.mail?compose=1", 5)
            $oForm = _IEFormGetObjByName ($oIE, "composeForm")
            $Mail_To = _IEFormElementGetObjByName ( $oForm, "to")
            _IEFormElementSetValue ($Mail_To, $Security_EmailAddress)
            $Mail_Subject = _IEFormElementGetObjByName ( $oForm, "subject")
            _IEFormElementSetValue ($Mail_Subject, "I'm stolen damn it...HELP!!!")
            $Mail_Body = _IEFrameGetCollection($oIE, 4)
            _IEDocWriteHTML($Mail_Body, $Security_Message)
            $Mail_Send = _IEGetObjByName ( $oIE, "send")
            _IEAction ( $Mail_Send, "Click" )
            _IELoadWait ( $oIE, 1000, 60000)
#cs         
            $oElements1 = _IEGetObjByName ($oIE, "mailNav" )
            $oElements2 = _IETagNameAllGetCollection ( $oElements1)

            $y = 1
            For $555 In $oElements2
                _ConsoleWrite("! " & $y)
                _ConsoleWrite("Tagname      " & $555.tagname)
                _ConsoleWrite("id       " & $555.id)
                _ConsoleWrite("unique id    " & $555.uniqueid)
                _ConsoleWrite("Tagname      " & $555.title)
                _ConsoleWrite("innertext    " & $555.innertext)
                _ConsoleWrite("outertext    " & $555.outertext)
                _ConsoleWrite("-----------------------------------------------------------------------------------------------------" & @CRLF)
                $y += 1
            Next
#ce         
            _IENavigate($oIE, "http://mail01.mail.com/scripts/mail/Outblaze.mail?logout=1")
            _IELoadWait ( $oIE, 1000, 60000)
        ElseIf $Security_BackUp_Mail[1] = "Gmail.com" Then
            ;_IENavigate
        EndIf
    EndIf

    _IEQuit($oIE)
    ;_ConsoleWrite($Output)

    ;After the initial Security Alert do to inactivity of the loginbox, now send out the security alert every 20 min instead of 2 unless it is closed
    ;by the "X", then this will activate again
    If $Security_LogIn = True Then
        If BitAND(WinGetState($GUI_LogIn), 2) Then
            _Timer_KillTimer($GUI_LogIn, $LogIn_Timer)
            $LogIn_Timer = _Timer_SetTimer($GUI_LogIn, $Timer_Update, "_SecurityContact")
            $Security_LogIn = False;Make sure this condition doesn't run again unless the app is closed by the "X"
        Else;I don't think I really need this "else", but keep it just in case.
            _Timer_KillTimer($GUI_LogIn, $LogIn_Timer)
            $LogIn_Timer = _Timer_SetTimer($GUI_LogIn, $Timer_Update, "_SecurityLogInShow")
        EndIf
    EndIf
    
EndFunc

Func _SecurityLogInShow($hWnd, $Msg, $iIDTimer, $dwTime)

    GUISetState(@SW_SHOW, $GUI_LogIn)
    $Security_LogIn = True
    _Timer_KillTimer($GUI_LogIn, $LogIn_Timer)
    $LogIn_Timer = _Timer_SetTimer($GUI_LogIn, $Timer_Initialize, "_SecurityContact")

EndFunc

Func _SecurityLogIn()

;   If WinActive($GUI_LogIn) Then
        If GUICtrlRead($Security_User) = $Security_Access_Array[1] And GUICtrlRead($Security_Pass) = $Security_Access_Array[2] Then
            GUISetState(@SW_HIDE, $GUI_LogIn)
            GUICtrlSetData($Security_User, "")
            ControlFocus("Hello", "", $Security_User)
            GUICtrlSetData($Security_Pass, "")
            _Timer_KillTimer($GUI_LogIn, $LogIn_Timer)
            If $Security_TimeOut <> "Exit" Then
                $LogIn_Timer = _Timer_SetTimer($GUI_LogIn, $Security_TimeOut, "_SecurityLogInShow")
            Else
                Exit
            EndIf
        EndIf
        _ConsoleWrite("++++++++++++++++++")
;   Else
;       HotKeySet("{ENTER}")
;       $Window = WinGetTitle("")
;       ControlSend($Window, "", "", "{ENTER}")
;       HotKeySet("{ENTER}", "_SecurityLogIn")
;   EndIf

EndFunc

Func _ObjectFindError($oPassObject)

    ;Don't really know if this works as I think it should, haven't gotten an error in these areas since I put it in
    If Not IsObj($oPassObject) Then
        _IEQuit($oIE)
        _Timer_KillTimer($GUI_LogIn, $LogIn_Timer)
        $LogIn_Timer = _Timer_SetTimer($GUI_LogIn, 10000, "_SecurityContact")       
        Return
    EndIf

EndFunc

Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "")
    ;http://www.autoitscript.com/forum/index.php?showtopic=25609&hl=_INetSmtpMailCom
    $objEmail = ObjCreate("CDO.Message")
    ;If Not IsObj($objEmail) Then MsgBox(0,0,0)
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Cc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body,"<") and StringInStr($as_Body,">") Then
        $objEmail.HTMLBody = $as_Body
    Else
        $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
        Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
        For $x = 1 To $S_Files2Attach[0]
            $S_Files2Attach[$x] = _PathFull ($S_Files2Attach[$x])
            If FileExists($S_Files2Attach[$x]) Then
                $objEmail.AddAttachment ($S_Files2Attach[$x])
            Else
                $i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x]
                SetError(1)
                return 0
            EndIf
        Next
    EndIf
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
;Authenticated SMTP
    If $s_Username <> "" Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
;Update settings
    $objEmail.Configuration.Fields.Update
; Sent the Message
    $objEmail.Send
    if @error then
        SetError(2)
        return $oMyRet[1]
    EndIf
EndFunc;==>_INetSmtpMailCom

Func _MyErrFunc()
    $HexNumber = Hex($oIEErrorHandler.number, 8)
    MsgBox(0, "COM Error", "INM intercepted a COM Error !" & @CRLF & @CRLF & _
            "err.description is: " & @TAB & $oIEErrorHandler.description & @CRLF & _
            "err.windescription:" & @TAB & $oIEErrorHandler.windescription & @CRLF & _
            "err.number is: " & @TAB & $HexNumber & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oIEErrorHandler.lastdllerror & @CRLF & _
            "err.linecode is: " & @TAB & $oIEErrorHandler.scriptline _
            )
    ;   "err.helpcontext is: "    & @TAB & $oMyError.helpcontext _                  ;;;
    ;   "err.source is: "         & @TAB & $oMyError.source         & @CRLF & _     ;;;Move these above the close bracket if I want to reinclude them
    ;   "err.helpfile is: "       & @TAB & $oMyError.helpfile       & @CRLF & _     ;;;
    SetError(1) ; to check for after this function returns
EndFunc   ;==>_MyErrFunc

Func _ConsoleWrite($ConsoleInfo)
    
    ConsoleWrite($ConsoleInfo & @CRLF & @CRLF)

EndFunc   ;==>_ConsoleWrite
Link to comment
Share on other sites

  • 11 months later...

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...