Jump to content

Need help with my Remote Control Script


Recommended Posts

Hello.

I got an old script from the old AutoIt that needs to be rewrited

This script will be a Remote server.

Could anyone help me?

And:

winvnc.exe = The client that controls the server(this script)

#include <GuiConstants.au3>
#include "SysTray_UDF.au3"


Opt("GUIOnEventMode", 1)
Opt("TrayIconHide", 1)

; GUI
GuiCreate("Remote Control", 200, 300)

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

; PIC
GuiCtrlCreatePic("logo.bmp",10,10, 180,181,$SS_SUNKEN)

; BUTTON
$Button1=GuiCtrlCreateButton("Connect", 10, 250, 80, 30)
$Button2=GuiCtrlCreateButton("Close", 110, 250, 80, 30)

GUICtrlSetOnEvent($Button1, "ConnectButton")
GUICtrlSetOnEvent($Button2, "CloseButton")

; TEXT
GuiCtrlCreateLabel("", 5, 207, 190, 20,$SS_ETCHEDFRAME)
GuiCtrlCreateLabel("Tel :- 01467 622766 before Connect", 10, 210, 190, 20)
GUICtrlSetColor(-1,0xff0000); Red

GUISetState(@SW_SHOW)

; Open Windows XP SP2 Firewall
$os=@OSVersion
$ver=@OSServicePack
if $os="WIN_XP" And $ver>="Service Pack 2" Then
    Run("netsh firewall set allowedprogram winvnc.exe WinVNC ENABLE", "", @SW_HIDE)
    EndIf


; Idle around
While 1
  Sleep(100) 
WEnd

Func CLOSEClicked()
    $index = _SysTrayIconIndex("winvnc.exe"); Change this to some other application if needed
    $pos = _SysTrayIconPos($index)
    Run("winvnc.exe -kill")
      $PID = ProcessExists("winvnc.exe"); Will return the PID or 0 if the process isn't found.
      If $PID Then ProcessClose($PID)
    MouseMove($pos[0], $pos[1], 0)
    Sleep(1000)
       Exit
 EndFunc

Func ConnectButton()
    $remote_Station = INPUTBOX("Remote Control", "Remote Control Address", "", "", -1, 120)
    Run("winvnc.exe -connect " & $remote_station)
EndFunc

Func CloseButton()
    $index = _SysTrayIconIndex("winvnc.exe"); Change this to some other application if needed
    $pos = _SysTrayIconPos($index)
    Run("winvnc.exe -kill")
      $PID = ProcessExists("winvnc.exe"); Will return the PID or 0 if the process isn't found.
      If $PID Then ProcessClose($PID)
    MouseMove($pos[0], $pos[1], 0)
    Sleep(1000)
       Exit
EndFunc

And here is SysTray_UDF.au3 :)

SysTray_UDF.au3

Edited by Chris86
Link to comment
Share on other sites

1: SysTray_UDF.au3 contains the script which you have posted in the code tags.

2: VNC Viewer already has a view window which allows you to type a name and connect

3: This script has nothing in it to indicate that the script itself is a server (no TCP / UDP Functions).. all it does is add winvnc.exe to the firewall, kill winvnc.exe on exit, and allow you to connect to a VNC Server..

I do not see what part of it needs re-writing, from what I am viewing, it should work as is. And it should function to get a server up and running and let the user connect to a server on a remote computer.

I do note that it has a lack of ability to set a password to secure that connect, as such anyone running a port scanner on the network would easily see a chance to jump on the session and have some fun.

Link to comment
Share on other sites

1: SysTray_UDF.au3 contains the script which you have posted in the code tags.

2: VNC Viewer already has a view window which allows you to type a name and connect

3: This script has nothing in it to indicate that the script itself is a server (no TCP / UDP Functions).. all it does is add winvnc.exe to the firewall, kill winvnc.exe on exit, and allow you to connect to a VNC Server..

I do not see what part of it needs re-writing, from what I am viewing, it should work as is. And it should function to get a server up and running and let the user connect to a server on a remote computer.

I do note that it has a lack of ability to set a password to secure that connect, as such anyone running a port scanner on the network would easily see a chance to jump on the session and have some fun.

This is a script my friend used for customers.

if you look in the script that the customer has to call him.. so i dont need any password..

2. Like if im going to connect to your Pc doesn't you need a server first??

3. Thats the way i want it :)

Link to comment
Share on other sites

Ahh..

well, the only part you are missing is:

Run("winvnc.exe")

Park it just before the GUISetState()

And i see no reason it wouldn't work unless there is a command line parameter to getting winvnc.exe to up and run.

you will also need to do a fileinstall to carry the winvnc.exe file in the actual script.

FileInstall("C:\winvnc.exe", "C:\winvnc.exe")

and to keep your clients machines clean (and stop them kicking it off by accident), i would suggest deleting it after it is closed via the script:

FileDelete("C:\winvnc.exe")

I dont see why the client would need the ability to connect out to other places either.. only your end should need that.. just a simple GUI that alerts them to call you, and a button that says "Activate" would be a little nicer.. that why they don't have any controls to fiddle with that could cause hassle (thats just my opinion).

Ever looked at Hamachi?

Worth a look for this kind of thing, you can have it setup, and installed on each clients machine, but set to not run automatically, when a client has a problem that can just fire it up, and give you a buzz.. then you can use it to RDesktop into the computer.. OR, offer a windows help and support connection.. just alternatives.

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