Jump to content

My new program idea


Recommended Posts

Nice idea. I for one would set it up as a service then the moment a user loggin on any account, app reports back to a external server. where every thing is stored.

Since most likely a thief would only start upp the computer once or twise then reformat the computer. I would also suggest having a non locked user like guest, so you are sure the thief would be able to login and give the app the shance to report to server. (why, cuase windows service has very limited things it would be able to do)

Finding its location would be somewhat tricky since isp wont give the accurate location for a IP, but you would be able to get the area code. Another solution when users register a account you could ask them for the home adress, then you atleast have ip for the area nearby. (again this would aslo be very tricky cause most IP's are dynamic, and only lasts from days to a few months)

But still knowing its ip might help the cops catching the thief.

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

  • 1 year later...

A little over a year and I'm back to this topic. I've gone ahead and made a basic script of what I'm including in my app and thought I'd share it since I brought this up previously. All you have to do is set up your registry and the way you enter your settings the way you want...I left that portion alone because my app is going to handle this differently, so you can do it as an ini or set your registry paths the way you want.

I haven't really fleshed this out fully yet, so let me know.

#include <WindowsConstants.au3>
#include <INet.au3>
#include <GUIConstantsEx.au3>
#include <File.au3>
#Include <Timers.au3>
#include <IE.au3>
#Include <Date.au3>
#Include <Date.au3>
#include <_WinManagementEnhanced.au3>

Opt("TrayIconHide", 1)
Opt("WinTitleMatchMode", 1)
Opt("OnExitFunc", "_OnAutoItExit")
HotKeySet ( "{ENTER}", "_SecurityLogIn" );This shouldn't really be a hotkey...but I'm being really lazy right now, so someone make the enter key submit instead of making it a hotkey


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

Global $oIE
Global $LogIn_Timer
Global $Security_LogIn = True
Global $Security_Mail_Array[3]
Global $Access_Mail_Array[3]
Global $Access_BackUp_Mail_Array[4]
Global $oMyRet[2]
Global $Timer_Initialize = 120000;2 min
Global $Timer_Update = 1200000;20 min
Global $RegLocation = "HKEY_CURRENT_USER\SOFTWARE\INM\SECURITY\";<--------Change this how you want

$Security_Mail = RegRead($RegLocation, "Access")
$Security_Mail = StringSplit($Security_Mail, @LF)
For $i = 1 To UBound($Security_Mail) - 1
    $Security_Mail_Array[$i] = $Security_Mail[$i]
Next

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

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

$GUI_LogIn = GUICreate("Hello", 160, 35, @DesktopWidth - 175, @DesktopHeight - 120, -1, $WS_EX_TOPMOST)
    $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)
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE, $GUI_LogIn)
            _Timer_KillTimer($GUI_LogIn, $LogIn_Timer)
            $LogIn_Timer = _Timer_SetTimer($GUI_LogIn, $Timer_Initialize, "_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.
    EndSwitch

WEnd

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

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

    $oIE = _IECreate("http://www.tracemyip.org/", 0, 0)
    If @error Then Return

    $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)
    ;If Not IsObj($oElements1) Then Return
     _ObjectFindError($oElements1)
    $oElements2 = _IETagNameGetCollection($oElements1, "tr")
    ;If Not IsObj($oElements2) Then Return
     _ObjectFindError($oElements2)
    
    $i = 1
    For $oElement In $oElements2
        $Output &= $oElement.innertext & @CRLF
        $i += 1
        If $i = 7 Then ExitLoop
    Next
    
    $Security_Message = "The thiefs Information: " & @CRLF & @CRLF & $Output & @CRLF & "Get the sucka!!"
    
    $rc = _INetSmtpMailCom($Security_Mail_Array[1], "My Laptop", "Stolen@MyLaptop.com", $Security_Mail_Array[2], "I'm stolen damn it...HELP!!!", $Security_Message, "", "", "", $Access_Mail_Array[1], $Access_Mail_Array[2])
    If @error Then
        ;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 $Access_BackUp_Mail[1] = "Yahoo.com" Then
            ;_IENavigate
        ElseIf $Access_BackUp_Mail[1] = "Hotmail.com" Then
            ;_IENavigate
        ElseIf $Access_BackUp_Mail[1] = "Mail.com" Then
            _IENavigate($oIE, "mail.com")
            $oForm = _IEFormGetObjByName ($oIE, "mailcom")
            $Mail_User = _IEFormElementGetObjByName ( $oForm, "login")
            _IEFormElementSetValue ($Mail_User, $Access_BackUp_Mail_Array[2])
            $Mail_Pass = _IEFormElementGetObjByName ( $oForm, "password")
            _IEFormElementSetValue ($Mail_Pass, $Access_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_Mail_Array[2])
            $Mail_Subject = _IEFormElementGetObjByName ( $oForm, "subject")
            _IEFormElementSetValue ($Mail_Subject, "I'm stolen damn it...HELP!!!")

            $oFrame = _IEFrameGetCollection($oIE, 4)
            _IEDocWriteHTML($oFrame, $Security_Message)
            
            $Mail_Send = _IEGetObjByName ( $oIE, "send")
            _IEAction ( $Mail_Send, "Click" )
            _IELoadWait ( $oIE, 1000, 60000)
            ;
        ElseIf $Access_BackUp_Mail[1] = "Gmail.com" Then
            ;_IENavigate
        ElseIf $Access_BackUp_Mail[1] = "Live.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) = RegRead($RegLocation, "User") And GUICtrlRead($Security_Pass) = RegRead($RegLocation, "Pass") Then
            GUISetState(@SW_HIDE, $GUI_LogIn)
            GUICtrlSetData($Security_User, "")
            ControlFocus("Hello", "", $Security_User)
            GUICtrlSetData($Security_Pass, "")
            $Security_TimeOut = RegRead($RegLocation, "Reminder")
            _Timer_KillTimer($GUI_LogIn, $LogIn_Timer)
            If $Security_TimeOut <> "Exit" Then
                $LogIn_Timer = _Timer_SetTimer($GUI_LogIn, $Security_TimeOut, "_SecurityLogInShow")
            Else
                Exit
            EndIf
        EndIf
    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

A request to people who have mail providers like yahoo, hotmail, gmail, live, msn or whatever else, please provide navigation scripting with the IE UDF for sending mail. I've done it for the email provider I have "mail.com" so the rest would be great so I don't have to make accounts for all of them.

Edited by Champak
Link to comment
Share on other sites

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