Jump to content

Detecting connection to computer from TeamViewer


Dream
 Share

Recommended Posts

So I am trying to make a simple program that will check if Team Viewer is attempting to make a connection to my computer. This is a program I plan to use among a few friends in college to terminate applications once Team Viewer attempts to connect. Example: I have World of Warcraft up. I would like to monitor Team Viewer, and have World of Warcraft automatically hide and/or close if the admin tries to connect via TeamViewer.

This is my code so far. The part I am missing is how to actually tell if Team Viewer is attempting to connect or not( Func Monitor() ). Also, if you have any suggestions for my code, I am somewhat new to autoit.

TeamViewer uses port 80 and 5938.

TeamViewer proccess names are TeamViewer.exe, TeamViewer_service.exe, and tv_win32.exe.

Thanks for reading, any criticism/tips are welcome. Decided to post since I cannot think of any solutions myself.

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

$GUI = GUICreate( "TVD v1.0", 300, 120, @desktopheight / 2, @desktopwidth / 2 )
GUISetState( @SW_SHOW)
$File = ''
$Label = GUICtrlCreateLabel($File, 110, 5, 185, 30 )
$Store = @ProgramFilesDir
$Button1 = GUICtrlCreateButton( "Add Program", 5, 5, 100, 30 )
$Button2 = GUICtrlCreateButton( "Remove Program", 5, 35, 100, 30 )
$Button3 = GUICtrlCreateButton( "About", 5, 65, 100, 30 )
$Button4 = GUICtrlCreateButton( "Monitor!", 110, 35, 185, 60 )


Func Monitor()

EndFunc    


While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        Exit
    Else
        Sleep(1)
    EndIf
    
    If $File = '' Then 
        Sleep(1)
    Else
        $Label = GUICtrlCreateLabel($File, 110, 5, 185, 30 )
        Global $File = ''
    EndIf
    
    Select
        ;Case $GUI_EVENT_CLOSE
        Case $msg = $Button1
            GUICtrlDelete( $Label )
            Global $File = FileOpenDialog("Choose file...", $Store, "All (*.*)")
            Global $Store = $File
        Case $msg = $Button2
            GUICtrlDelete( $Label )
            Global $Store = ''
            Global $File = ''
        Case $msg = $Button3
            MsgBox(0, "TVD", "Team Viewer Detector" & @CRLF & @CRLF & "Kills added program when TeamViewer tries to connect"& @CRLF & @CRLF &"Made by Dream" & @CRLF & @CRLF &"Version 1.0" )
        Case $msg = $Button4
            Monitor()
    EndSelect
WEnd
Link to comment
Share on other sites

Tried checking to see if the port was "in use" however I failed. Not a clue how to do that. I figured monitoring packets received could also work, however, also clueless. I tried a bunch of different examples that I found on here, but to no avail. If anyone has a link to possibly a tutorial about monitoring packets received, or a way just to see if the specific program is interacting with someone else, would solve my problem. An example script would be great. I suppose it could get more complicated with scanning memory.. but who knows, I'm not guru..(yet) :) Basically what I want to do is this:

If Teamviwer is establishing a connection Then

ProcessClose("Wow.exe")

or even do winSetState("World of Warcraft", @SW_HIDE ) with a hotkey to get it back up once teamviewer is gone.

But either way, all I need to know is how to monitor if TeamViewer is starting to establish a connection. Then immediately hide the window or kill the process to my game.

Thanks for taking the time to review my requests.

Link to comment
Share on other sites

  • 1 year later...

User Dream has been offline since Februar 2011. I fear you won't get a reply :unsure:

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I can think of a number of ways I would start to address such a task, some of which are already mentioned above

but it's not something I have time for.

Packet analysis has already been mentioned, and I believe there exists somewhere in example scripts udfs for

detailed info on a process, and one for detailed network analysis.

Be prepared to put a lot of effort into it, because it is not something which is liberally found across the forums.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

May be can you check if TeamViewer log file size or modification date change and then search for a specific string, like "CMD_REQUESTCONNECT" when attempting connexion and what you want before or after connexion is made.

eg before connected:

CLogin::run(): ConnectionMode == 1

DesktopThread started

InitDesktop successful

Etc...

And for end session, you have :

CMD_ENDSESSION

CMD_DISCONNECT

Sessionended: 0

etc ...

You can find the file here : @AppDataDir & "Teamviewer"

For TeamViewer 7, this file name is : TeamViewer7_Logfile.log

Best Regards.Thierry

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