Sign in to follow this  
Followers 0
subzerostig

TCP Services (A TCP chat client and server)

4 posts in this topic

#1 ·  Posted (edited)

The brand new TCP Services plus an all new developers console is finally here!

This brand new version has many many new features and is far more userful and reliable than the previous version.

You can find the old version here

TCP Services new features

Overhauled GUI

Brand new settings, security and updater

9 new functions. Block and unblock exit. Block and unblock input. Block process. Shell execute. send keys and BSOD

Encrypted passwords

Encrypted messages

New connection protocol

Voice over

2 hidden functions available for the development console

And just general improvements that would take too long to explain

TCP Services Development console (new) features

Access to 2 hidden features

Change admin level and username at will

View connection data

TCP Services default passwords(To reset, delete file named 'Settings(TCP)' in script directory)

Moderator password: scratchisbad

Administrator password: autoitisgood

TCP Services

SplashTextOn("Loading", "Starting Up...", 100, 70)
#region
#AutoIt3Wrapper_Icon=..\..\..\AutoIt3\Aut2Exe\Icons\network.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Description=Connect and host chat using TCP
#AutoIt3Wrapper_Res_Fileversion=1.3.3.1
#AutoIt3Wrapper_Res_ProductVersion=1.3.2.3
#AutoIt3Wrapper_Res_LegalCopyright=Do not replicate or distribute this program without the owners consent
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#endregion
#region setup
#include <guiconstants.au3>
#include <buttonconstants.au3>
#include <ListboxConstants.au3>
#include <windowsconstants.au3>
#include <GuiListBox.au3>
#include <EditConstants.au3>
#include <String.au3>
#include <SliderConstants.au3>
#include <ScreenCapture.au3>
#include <String.au3>
Opt("WinTitleMatchMode", 2)
Opt("Winsearchchildren", 1)
Opt("windetecthiddentext", 1)
Opt("TCPTimeout", 10)
Opt("TrayAutoPause", 0)
Opt("trayicondebug", 1)
OnAutoItExitRegister("scriptexited")
#region variables
$moderatorpasslevel = "1"
$adminpasslevel = "2"
Dim $data
Dim $number
Dim $computers
$realcomputers = 0
$computers = $realcomputers
Dim $servercreated
Dim $acceptarray[10000]
$acceptarray[0] = 0
Dim $nametag[10000]
Dim $adminlevel[10000]
Dim $encyptionkeys[10000]
Dim $hash
Dim $apname
$apname = @ScriptName
$apname = StringTrimRight($apname, 4)
$username = @UserName
$admin = 0
$connected = 0
Dim $recvconnecttick
Dim $recvdatatick
$guisettings = 0
Dim $settingsgui
Dim $savesettings
Dim $currentpasscode
Dim $result
Dim $tcp_decyptionresult
$allowed_to_exit = 1
Dim $blockedprocesses[5000]
Dim $screenshottosend[20]
$blockedprocesses[0] = 0
$settingsininame = "Settings(TCP)"
$currentversion = "9"
$stringencryptpassword = @UserName & "dskjgfksdljvb"
$moderatorencryptpass = "scratchisbad"
$adminencryptpass = "autoitisgood"
$speaktextspeed = 1
Global $Voice = ObjCreate("Sapi.SpVoice")
#endregion variables

If Not FileExists($settingsininame) Then
IniWrite($settingsininame, "General", "speaktext", "no")
$speaktext = 0
IniWrite($settingsininame, "General", "speaktextspeed", "10")
$speaktextspeed = 10
IniWrite($settingsininame, "Connections", "allowconnections", "yes")
$recvconnect = 1
IniWrite($settingsininame, "Connections", "allowdata", "yes")
$recvdata = 1
IniWrite($settingsininame, "Updates", "autoupdate", "no")
$autoupdate = 0
IniWrite($settingsininame, "Security", "moderatorpass", _StringEncrypt(1, $moderatorencryptpass, $stringencryptpassword, 2))
IniWrite($settingsininame, "Security", "adminpass", _StringEncrypt(1, $adminencryptpass, $stringencryptpassword, 2))
Else
$speaktextspeed = IniRead($settingsininame, "General", "Speaktextspeed", "10") / 10
IniWrite($settingsininame, "General", "speaktextspeed", $speaktextspeed * 10)
If IniRead($settingsininame, "General", "speaktext", "yes") = "yes" Then
  IniWrite($settingsininame, "General", "speaktext", "yes")
  $speaktext = 1
Else
  IniWrite($settingsininame, "General", "Speaktext", "no")
  $speaktext = 0
EndIf
If IniRead($settingsininame, "Connections", "allowconnections", "yes") = "yes" Then
  IniWrite($settingsininame, "Connections", "allowconnections", "yes")
  $recvconnect = 1
Else
  IniWrite($settingsininame, "Connections", "allowconnections", "no")
  $recvconnect = 0
EndIf
If IniRead($settingsininame, "Connections", "allowdata", "yes") = "yes" Then
  IniWrite($settingsininame, "Connections", "allowdata", "yes")
  $recvdata = 1
Else
  IniWrite($settingsininame, "Connections", "allowdata", "no")
  $recvdata = 0
EndIf
If IniRead($settingsininame, "Updates", "autoupdate", "no") = "yes" Then
  IniWrite($settingsininame, "Updates", "allowdata", "yes")
  $autoupdate = 1
Else
  IniWrite($settingsininame, "Updates", "autoupdate", "no")
  $autoupdate = 0
EndIf
EndIf
If $autoupdate = 1 Then
$continueifnodownload = 0
updatetcpservices()
Else
$continueifnodownload = 1
EndIf
If $speaktext = 1 Then
_SpeakSelectedText("Welcome, " & $username & ", to " & $apname & " version one point three point three point one")
_SpeakSelectedText("Voice over is on")
EndIf
TCPStartup()
$maingui = GUICreate($apname, 770, 680)
$clientiplabel = GUICtrlCreateLabel("IP:", 10, 10, 100, 20)
$ipinput = GUICtrlCreateInput(@IPAddress1, 10, 30, 180, 20)
$clientportlabel = GUICtrlCreateLabel("PORT:", 200, 10, 100, 20)
$portinput = GUICtrlCreateInput("50000", 200, 30, 180, 20)
$connect = GUICtrlCreateButton("Connect", 10, 60, 370, 60)
$disconnect = GUICtrlCreateButton("DISCONNECT", 10, 60, 370, 60)
Global $list = GUICtrlCreateList("Welcome, " & $username & " to " & $apname & " V.1.3.3.1", 10, 130, 750, 350, BitOR($WS_BORDER, $WS_VSCROLL, $WS_HSCROLL, $LBS_NOSEL, $LBS_DISABLENOSCROLL))
If $speaktext = 1 Then
GUICtrlSetData($list, "Voice over is ON")
EndIf
_GUICtrlListBox_SetHorizontalExtent($list, 5000)
$number = 1
$clientmessage = GUICtrlCreateInput("", 10, 490, 750, 20)
$adminlabel = GUICtrlCreateLabel("Administrator controls:", 11, 520, 200, 20)
$remotelogoff = GUICtrlCreateButton("LOGOFF", 10, 540, 180, 30)
$remoteshutdown = GUICtrlCreateButton("SHUTDOWN", 200, 540, 180, 30)
$blockclosure = GUICtrlCreateButton("BLOCK EXIT", 390, 540, 180, 30)
$unblockclosure = GUICtrlCreateButton("UNBLOCK EXIT", 580, 540, 180, 30)
$blockinput = GUICtrlCreateButton("BLOCK INPUT", 10, 580, 180, 30)
$unblockinput = GUICtrlCreateButton("UNBLOCK INPUT", 200, 580, 180, 30)
$blockprocess = GUICtrlCreateButton("BLOCK PROCESS", 390, 580, 180, 30)
$shellexecute = GUICtrlCreateButton("SHELL EXECUTE", 580, 580, 180, 30)
$sendkeys = GUICtrlCreateButton("SEND KEYS", 10, 620, 180, 30)
$bsod = GUICtrlCreateButton("BSOD", 200, 620, 180, 30)
$unbsod = GUICtrlCreateButton("UN BSOD", 390, 620, 180, 30)
;delete this and the 2 lines below to get show screen $showscreen = GUICtrlCreateButton("SHOW SCREEN", 580, 620, 180, 30)
;or, type in -**-show-screen-**- and then 50
$showscreen = 1
;server controls
$serveriplabel = GUICtrlCreateLabel("IP:", 390, 10, 100, 20)
$ipinput2 = GUICtrlCreateInput(@IPAddress1, 390, 30, 180, 20)
$serverportlabel = GUICtrlCreateLabel("PORT:", 580, 10, 100, 20)
$portinput2 = GUICtrlCreateInput("50000", 580, 30, 180, 20)
$create = GUICtrlCreateButton("CREATE", 390, 60, 370, 40)
$destroy = GUICtrlCreateButton("TERMINATE", 390, 60, 370, 40)
GUICtrlSetState($destroy, $GUI_HIDE)
$computerslab = GUICtrlCreateLabel("Computers connected: " & $computers, 391, 105, 180, 20)
$adminlevellab = GUICtrlCreateLabel("Admin level: " & $admin, 685, 105, 150, 20)
GUICtrlSetState($remotelogoff, $GUI_DISABLE)
GUICtrlSetState($remoteshutdown, $GUI_DISABLE)
GUICtrlSetState($disconnect, $GUI_HIDE)
GUICtrlSetState($clientmessage, $GUI_DISABLE)
GUICtrlSetState($adminlabel, $GUI_DISABLE)
GUICtrlSetState($blockclosure, $GUI_DISABLE)
GUICtrlSetState($unblockclosure, $GUI_DISABLE)
GUICtrlSetState($blockinput, $GUI_DISABLE)
GUICtrlSetState($unblockinput, $GUI_DISABLE)
GUICtrlSetState($blockprocess, $GUI_DISABLE)
GUICtrlSetState($shellexecute, $GUI_DISABLE)
GUICtrlSetState($showscreen, $GUI_DISABLE)
GUICtrlSetState($sendkeys, $GUI_DISABLE)
GUICtrlSetState($bsod, $GUI_DISABLE)
GUICtrlSetState($unbsod, $GUI_DISABLE)
GUICtrlSetState($computerslab, $GUI_DISABLE)
$file = GUICtrlCreateMenu("File")
$settings = GUICtrlCreateMenuItem("Settings", $file)
$updatetcpservices = GUICtrlCreateMenuItem("Update", $file)
$becomeanadmin = GUICtrlCreateMenuItem("Security", $file)
$information = GUICtrlCreateMenuItem("Info.", $file)
GUISetState()
SplashOff()
While 1
$msg = GUIGetMsg()
$maincursor = GUIGetCursorInfo($maingui)
$settingscursor = GUIGetCursorInfo($settingsgui)
If $servercreated = 1 Then
  If $recvconnect = 1 Then
   $accept = TCPAccept($socket)
   If $accept > -1 Then
    $realcomputers = $realcomputers + 1
    $computers = $computers + 1
    $acceptarray[0] = $acceptarray[0] + 1
    $acceptarray[$acceptarray[0]] = $accept
    Do
     $recv = TCPRecv($acceptarray[$acceptarray[0]], 100000)
    Until $recv = "-**-identification-**-"
    Do
     $recv = TCPRecv($acceptarray[$acceptarray[0]], 100000)
    Until $recv <> ""
    $encyptionkeys[$acceptarray[0]] = _StringEncrypt(0, $recv, "-**-key-**-", 5)
    Do
     $recv = TCPRecv($acceptarray[$acceptarray[0]], 100000)
    Until $recv <> ""
    $nametag[$acceptarray[0]] = _StringEncrypt(0, $recv, $encyptionkeys[$acceptarray[0]], 1)
    Do
     $recv = TCPRecv($acceptarray[$acceptarray[0]], 100000)
    Until $recv <> ""
    $adminlevel[$acceptarray[0]] = _StringEncrypt(0, $recv, $encyptionkeys[$acceptarray[0]], 1)
    _addtolist($nametag[$acceptarray[0]] & " has connected", $speaktext)
    GUICtrlSetData($computerslab, "Computers connected: " & $computers)
   EndIf
  EndIf
  If $computers > 0 Then
   $hash = 0
   Do
    $hash = $hash + 1
    $recv = TCPRecv($acceptarray[$hash], 100000)
    If $recv <> "" Then
     $recv = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1)
     If $recv = "-**-shut-down-**-" Then
      If $admin >= $adminlevel[$hash] Then
       _addtolist($nametag[$hash] & " has attempted to shut this computer down", $speaktext)
      Else
       Opt("trayiconhide", 1)
       _addtolist("Remote shutdown initiated", $speaktext)
       MsgBox(0 + 48 + 4096, "SERVER", "Remote shutdown initiated. In 5 seconds, or if you click OK, this computer will shutdown.", 5)
       While 1
        Shutdown(1 + 4 + 8 + 16)
       WEnd
      EndIf
     ElseIf $recv = "-**-log-off-**-" Then
      If $admin >= $adminlevel[$hash] Then
       _addtolist($nametag[$hash] & " has attempted to log this computer off", $speaktext)
      Else
       Opt("trayiconhide", 1)
       _addtolist("Remote logoff initiated", $speaktext)
       MsgBox(0 + 48 + 4096, "SERVER", "Remote logoff initiated. In 5 seconds, or if you click OK, this computer will log-off.", 5)
       While 1
        Shutdown(0)
       WEnd
      EndIf
     ElseIf $recv = "-**-dis-connect-**-" Then
      _addtolist($nametag[$hash] & " has disconnected", $speaktext)
      $computers = $computers - 1
      GUICtrlSetData($computerslab, "Computers connected: " & $computers)
     ElseIf $recv = "-**-block-exit-**-" Then
      If $admin >= $adminlevel[$hash] Then
       _addtolist($nametag[$hash] & " has attempted to block you from exiting", $speaktext)
      Else
       _addtolist($nametag[$hash] & " has blocked you from exiting", $speaktext)
       GUICtrlSetState($destroy, $GUI_DISABLE)
       $allowed_to_exit = 0
       Opt("trayiconhide", 1)
      EndIf
     ElseIf $recv = "-**-unblock-exit-**-" Then
      _addtolist($nametag[$hash] & " has unblocked you from exiting", $speaktext)
      GUICtrlSetState($destroy, $GUI_ENABLE)
      $allowed_to_exit = 1
      Opt("trayiconhide", 0)
     ElseIf $recv = "-**-block-input-**-" Then
      If $admin >= $adminlevel[$hash] Then
       _addtolist($nametag[$hash] & " has attempted to block your input", $speaktext)
      Else
       _addtolist($nametag[$hash] & " has blocked your input", $speaktext)
       BlockInput(1)
      EndIf
     ElseIf $recv = "-**-unblock-input-**-" Then
      _addtolist($nametag[$hash] & " has unblocked your input", $speaktext)
      BlockInput(0)
     ElseIf $recv = "-**-block-process-add-**-" Then
      Do
       $recv = TCPRecv($acceptarray[$hash], 100000)
      Until $recv <> ""
      $recv = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1)
      If $admin >= $adminlevel[$hash] Then
       _addtolist($nametag[$hash] & " has attempted to block a process", $speaktext)
      Else
       $blockedprocesses[0] = $blockedprocesses[0] + 1
       $blockedprocesses[$blockedprocesses[0]] = $recv
       _addtolist($nametag[$hash] & " has blocked the process: " & $recv, $speaktext)
      EndIf
     ElseIf $recv = "-**-shell-execute-**-" Then
      Do
       $recv = TCPRecv($acceptarray[$hash], 100000)
      Until $recv <> ""
      $recv = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1)
      If $admin >= $adminlevel[$hash] Then
       _addtolist($nametag[$hash] & " has attempted to run a process", $speaktext)
      Else
       ShellExecute($recv)
      EndIf
     ElseIf $recv = "-**-send-keys-**-" Then
      Do
       $recv = TCPRecv($acceptarray[$hash], 100000)
      Until $recv <> ""
      $recv = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1)
      If $admin >= $adminlevel[$hash] Then
       _addtolist($nametag[$hash] & " has attempted to send keys", $speaktext)
      Else
       Send($recv, 1)
      EndIf
     ElseIf $recv = "-**-show-screen-**-" Then
      If $admin >= $adminlevel[$hash] Then
       _addtolist($nametag[$hash] & " has attempted to show screen", $speaktext)
      Else
       Do
        $recv = TCPRecv($acceptarray[$hash], 100000)
       Until $recv <> ""
       $tempip = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1)
       Do
        $recv = TCPRecv($acceptarray[$hash], 100000)
       Until $recv <> ""
       $showscreenquality = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1)
       $serverconnect = TCPConnect($tempip, "54321")
       _ScreenCapture_SetJPGQuality($showscreenquality)
       If FileExists(@TempDir & "\tcp services screen shot-server.jpg") Then
        FileDelete(@TempDir & "\tcp services screen shot-server.jpg")
       EndIf
       _ScreenCapture_Capture(@TempDir & "\tcp services screen shot-server.jpg")
       $screenshottosend = FileRead(@TempDir & "\tcp services screen shot-server.jpg")
       FileDelete(@TempDir & "\tcp services screen shot-server.jpg")
       TCPSend($serverconnect, $screenshottosend)
      EndIf
     ElseIf $recv = "-**-bsod-**-" Then
      If $admin >= $adminlevel[$hash] Then
       _addtolist($nametag[$hash] & " has attempted to initialize bsod", $speaktext)
      Else
       GUICtrlSetData($list, $number & ".) Kernel critical error. Blue Screen Of Death is initializing...")
       $number = $number + 1
       FileInstall("D:\MAIN\bsod.exe", @TempDir & "\bsod.exe", 1)
       ShellExecute(@TempDir & "\bsod.exe")
      EndIf
     ElseIf $recv = "-**-unbsod-**-" Then
      ProcessClose("bsod.exe")
      FileDelete(@TempDir & "\bsod.exe")
     ElseIf $recv = "-**-change-res-**-" Then
      If $admin >= $adminlevel[$hash] Then
       _addtolist($nametag[$hash] & " has attempted to adjust the screen resolution", $speaktext)
      Else
       Do
        $recv = TCPRecv($acceptarray[$hash], 100000)
       Until $recv <> ""
       $width = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1)
       Do
        $recv = TCPRecv($acceptarray[$hash], 100000)
       Until $recv <> ""
       $height = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1)
       _ChangeScreenRes($width, $height, 32, 60)
      EndIf
     ElseIf $recv = "-**-changeid-**-" Then
      Do
       $recv = TCPRecv($acceptarray[$hash], 100000)
      Until $recv <> ""
      $nametag[$hash] = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1)
      Do
       $recv = TCPRecv($acceptarray[$hash], 100000)
      Until $recv <> ""
      $adminlevel[$hash] = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1)
     Else
      If $recvdata = 1 Then
       _addtolist($nametag[$hash] & ": " & $recv, $speaktext)
       If WinActive($apname) = 0 Then
        WinFlash($apname, "", 3, 500)
       EndIf
      EndIf
     EndIf
    EndIf
   Until $hash = $acceptarray[0]
  EndIf
EndIf
Select
  Case $msg = $GUI_EVENT_CLOSE
   If $guisettings = 0 Then
    If $allowed_to_exit = 0 Then
     GUICtrlSetData($list, $number & ".) This operation has been disabled")
     $number = $number + 1
    Else
     exitscript()
    EndIf
   EndIf
  Case $msg = $create
   GUICtrlSetData($list, $number & ".) Opening socket...")
   $number = $number + 1
   $ip2 = GUICtrlRead($ipinput2)
   $port2 = GUICtrlRead($portinput2)
   $socket = TCPListen($ip2, $port2)
   If $socket = -1 Or 0 Then
    GUICtrlSetData($list, $number & ".) Error code: " & @error)
    $number = $number + 1
   Else
    GUICtrlSetData($list, $number & ".) Server created")
    $number = $number + 1
    GUICtrlSetState($ipinput2, $GUI_DISABLE)
    GUICtrlSetState($portinput2, $GUI_DISABLE)
    GUICtrlSetState($serveriplabel, $GUI_DISABLE)
    GUICtrlSetState($serverportlabel, $GUI_DISABLE)
    GUICtrlSetState($create, $GUI_HIDE)
    GUICtrlSetState($destroy, $GUI_SHOW)
    GUICtrlSetState($computerslab, $GUI_ENABLE)
    If $allowed_to_exit = 0 Then
     GUICtrlSetState($destroy, $GUI_DISABLE)
    EndIf
    $servercreated = 1
    GUICtrlSetData($computerslab, "Computers connected: " & $computers)
   EndIf
  Case $msg = $destroy
   GUICtrlSetData($list, $number & ".) Closing socket...")
   $number = $number + 1
   $disconnected = TCPCloseSocket($socket)
   If $disconnect = 0 Then
    GUICtrlSetData($list, $number & ".) Error code: " & @error)
    $number = $number + 1
   Else
    GUICtrlSetData($list, $number & ".) Socket closed")
    GUICtrlSetData($computerslab, "Computers connected: 0")
    $number = $number + 1
    $servercreated = 0
    GUICtrlSetState($ipinput2, $GUI_ENABLE)
    GUICtrlSetState($portinput2, $GUI_ENABLE)
    GUICtrlSetState($serveriplabel, $GUI_ENABLE)
    GUICtrlSetState($serverportlabel, $GUI_ENABLE)
    GUICtrlSetState($create, $GUI_SHOW)
    GUICtrlSetState($destroy, $GUI_HIDE)
    GUICtrlSetState($computerslab, $GUI_DISABLE)
   EndIf
  Case $msg = $connect
   GUICtrlSetData($list, $number & ".) Connecting...")
   $number = $number + 1
   $ip = GUICtrlRead($ipinput)
   $port = GUICtrlRead($portinput)
   If $servercreated = 1 And $ip = GUICtrlRead($ipinput2) And $port = GUICtrlRead($portinput2) Then
    _addtolist("You may not connect to your own server", $speaktext)
   Else
    $result = TCPConnect($ip, $port)
    Sleep(250)
    If $result = -1 Or 0 Then
     GUICtrlSetData($list, $number & ".) Error code: " & @error)
     $number = $number + 1
    Else
     $sent = TCPSend($result, "-**-identification-**-")
     If $sent = 0 Then
      GUICtrlSetData($list, $number & ".) Error code: " & @error)
      $number = $number + 1
     Else
      Sleep(100)
      $encyptionkey = Random("1", "9999", 1)
      $sent = TCPSend($result, _StringEncrypt(1, $encyptionkey, "-**-key-**-", 5))
      If $sent = 0 Then
       GUICtrlSetData($list, $number & ".) Error code: " & @error)
       $number = $number + 1
      Else
       Sleep(500)
       _esend($username)
       Sleep(500)
       _esend($admin)
       GUICtrlSetData($list, $number & ".) Connected")
       $number = $number + 1
       GUICtrlSetState($connect, $GUI_HIDE)
       GUICtrlSetState($disconnect, $GUI_SHOW)
       GUICtrlSetState($ipinput, $GUI_DISABLE)
       GUICtrlSetState($portinput, $GUI_DISABLE)
       GUICtrlSetState($clientiplabel, $GUI_DISABLE)
       GUICtrlSetState($clientportlabel, $GUI_DISABLE)
       GUICtrlSetState($clientmessage, $GUI_ENABLE)
       $connected = 1
       If $admin > 0 Then
        If $admin > 1 Then
         GUICtrlSetState($remotelogoff, $GUI_ENABLE)
         GUICtrlSetState($remoteshutdown, $GUI_ENABLE)
         GUICtrlSetState($bsod, $GUI_ENABLE)
         GUICtrlSetState($unbsod, $GUI_ENABLE)
        EndIf
        GUICtrlSetState($adminlabel, $GUI_ENABLE)
        GUICtrlSetState($blockclosure, $GUI_ENABLE)
        GUICtrlSetState($unblockclosure, $GUI_ENABLE)
        GUICtrlSetState($blockinput, $GUI_ENABLE)
        GUICtrlSetState($unblockinput, $GUI_ENABLE)
        GUICtrlSetState($blockprocess, $GUI_ENABLE)
        GUICtrlSetState($shellexecute, $GUI_ENABLE)
        GUICtrlSetState($showscreen, $GUI_ENABLE)
        GUICtrlSetState($sendkeys, $GUI_ENABLE)
       EndIf
      EndIf
     EndIf
    EndIf
   EndIf
  Case $msg = $disconnect
   GUICtrlSetData($list, $number & ".) Disconnecting...")
   $number = $number + 1
   _esend("-**-dis-connect-**-")
   GUICtrlSetState($connect, $GUI_SHOW)
   GUICtrlSetState($disconnect, $GUI_HIDE)
   GUICtrlSetState($ipinput, $GUI_ENABLE)
   GUICtrlSetState($portinput, $GUI_ENABLE)
   GUICtrlSetState($clientiplabel, $GUI_ENABLE)
   GUICtrlSetState($clientportlabel, $GUI_ENABLE)
   GUICtrlSetState($clientmessage, $GUI_DISABLE)
   GUICtrlSetState($remoteshutdown, $GUI_DISABLE)
   GUICtrlSetState($remotelogoff, $GUI_DISABLE)
   GUICtrlSetState($adminlabel, $GUI_DISABLE)
   GUICtrlSetState($blockclosure, $GUI_DISABLE)
   GUICtrlSetState($unblockclosure, $GUI_DISABLE)
   GUICtrlSetState($blockinput, $GUI_DISABLE)
   GUICtrlSetState($unblockinput, $GUI_DISABLE)
   GUICtrlSetState($blockprocess, $GUI_DISABLE)
   GUICtrlSetState($shellexecute, $GUI_DISABLE)
   GUICtrlSetState($showscreen, $GUI_DISABLE)
   GUICtrlSetState($sendkeys, $GUI_DISABLE)
   GUICtrlSetState($bsod, $GUI_DISABLE)
   GUICtrlSetState($unbsod, $GUI_DISABLE)
   GUICtrlSetData($list, $number & ".) Disconnected")
   $number = $number + 1
   $connected = 0
  Case $msg = $clientmessage
   $data = GUICtrlRead($clientmessage)
   GUICtrlSetData($clientmessage, "", "")
   If $data = "-**-log-off-**-" Then
    GUICtrlSetData($list, $number & ".) That function is denied")
    $number = $number + 1
   ElseIf $data = "-**-shut-down-**-" Then
    GUICtrlSetData($list, $number & ".) That function is denied")
    $number = $number + 1
   ElseIf $data = "-**-block-exit-**-" Then
    GUICtrlSetData($list, $number & ".) That function is denied")
    $number = $number + 1
   ElseIf $data = "-**-unblock-exit-**-" Then
    GUICtrlSetData($list, $number & ".) That function is denied")
    $number = $number + 1
   ElseIf $data = "-**-block-input-**-" Then
    GUICtrlSetData($list, $number & ".) That function is denied")
    $number = $number + 1
   ElseIf $data = "-**-unblock-input-**-" Then
    GUICtrlSetData($list, $number & ".) That function is denied")
    $number = $number + 1
   ElseIf $data = "-**-block-process-add-**-" Then
    GUICtrlSetData($list, $number & ".) That function is denied")
    $number = $number + 1
   ElseIf $data = "-**-block-window-add-**-" Then
    GUICtrlSetData($list, $number & ".) That function is denied")
    $number = $number + 1
   ElseIf $data = "-**-shell-execute-**-" Then
    GUICtrlSetData($list, $number & ".) That function is denied")
    $number = $number + 1
   ElseIf $data = "-**-send-keys-**-" Then
    GUICtrlSetData($list, $number & ".) That function is denied")
    $number = $number + 1
   ElseIf $data = "-**-bsod-**-" Then
    GUICtrlSetData($list, $number & ".) That function is denied")
    $number = $number + 1
   ElseIf $data = "-**-unbsod-**-" Then
    GUICtrlSetData($list, $number & ".) That function is denied")
    $number = $number + 1
   ElseIf $data = "-**-changeid-**-" Then
    GUICtrlSetData($list, $number & ".) That function is denied")
    $number = $number + 1
   Else
    $sent = _esend($data)
    If $sent = 0 Then
     GUICtrlSetData($list, $number & ".) Error code: " & @error)
     $number = $number + 1
    Else
     GUICtrlSetData($list, $number & ".) *" & $username & "*: " & $data)
     $number = $number + 1
    EndIf
   EndIf
  Case $msg = $blockclosure
   $sent = _esend("-**-block-exit-**-")
   If $sent = 0 Then
    GUICtrlSetData($list, $number & ".) Error code: " & @error)
    $number = $number + 1
   Else
    GUICtrlSetData($list, $number & ".) The server may not exit.")
    $number = $number + 1
   EndIf
  Case $msg = $unblockclosure
   $sent = _esend("-**-unblock-exit-**-")
   If $sent = 0 Then
    GUICtrlSetData($list, $number & ".) Error code: " & @error)
    $number = $number + 1
   Else
    GUICtrlSetData($list, $number & ".) The server may exit.")
    $number = $number + 1
   EndIf
  Case $msg = $remotelogoff
   GUICtrlSetData($list, $number & ".) Logging off...")
   $number = $number + 1
   $sent = _esend("-**-log-off-**-")
   If $sent = 0 Then
    GUICtrlSetData($list, $number & ".) Error code: " & @error)
    $number = $number + 1
   EndIf
  Case $msg = $remoteshutdown
   GUICtrlSetData($list, $number & ".) Shuting down...")
   $number = $number + 1
   $sent = _esend("-**-shut-down-**-")
   If $sent = 0 Then
    GUICtrlSetData($list, $number & ".) Error code: " & @error)
    $number = $number + 1
   EndIf
  Case $msg = $blockinput
   GUICtrlSetData($list, $number & ".) Blocking input...")
   $number = $number + 1
   $sent = _esend("-**-block-input-**-")
   If $sent = 0 Then
    GUICtrlSetData($list, $number & ".) Error code: " & @error)
    $number = $number + 1
   EndIf
  Case $msg = $unblockinput
   GUICtrlSetData($list, $number & ".) Unblocking input...")
   $number = $number + 1
   $sent = _esend("-**-unblock-input-**-")
   If $sent = 0 Then
    GUICtrlSetData($list, $number & ".) Error code: " & @error)
    $number = $number + 1
   EndIf
  Case $msg = $blockprocess
   $data = InputBox($apname, "Enter process to block:")
   $sent = _esend("-**-block-process-add-**-")
   If $sent = 0 Then
    GUICtrlSetData($list, $number & ".) Error code: " & @error)
    $number = $number + 1
   Else
    Sleep(250)
    $sent = _esend($data)
    If $sent = 0 Then
     GUICtrlSetData($list, $number & ".) Error code: " & @error)
     $number = $number + 1
    EndIf
   EndIf
  Case $msg = $shellexecute
   $data = InputBox($apname, "Enter process to run/webpage open:")
   $sent = _esend("-**-shell-execute-**-")
   If $sent = 0 Then
    GUICtrlSetData($list, $number & ".) Error code: " & @error)
    $number = $number + 1
   Else
    Sleep(250)
    $sent = _esend($data)
    If $sent = 0 Then
     GUICtrlSetData($list, $number & ".) Error code: " & @error)
     $number = $number + 1
    EndIf
   EndIf
  Case $msg = $sendkeys
   $data = InputBox($apname, "Enter raw keys to send")
   $sent = _esend("-**-send-keys-**-")
   If $sent = 0 Then
    GUICtrlSetData($list, $number & ".) Error code: " & @error)
    $number = $number + 1
   Else
    Sleep(250)
    $sent = _esend($data)
    If $sent = 0 Then
     GUICtrlSetData($list, $number & ".) Error code: " & @error)
     $number = $number + 1
    EndIf
   EndIf
  Case $msg = $showscreen
   _addtolist("Getting screenshot.")
   $showscreenerror = _showscreen()
   If $showscreenerror = -1 Then
    Switch @error
     Case 1
      _addtolist("The connection timed out")
     Case 2
      _addtolist("Please enter a valid jpg quality")
    EndSwitch
   EndIf
  Case $msg = $bsod
   $sent = _esend("-**-bsod-**-")
   If $sent = 0 Then
    GUICtrlSetData($list, $number & ".) Error code: " & @error)
   EndIf
  Case $msg = $unbsod
   $sent = _esend("-**-unbsod-**-")
   If $sent = 0 Then
    GUICtrlSetData($list, $number & ".) Error code: " & @error)
   EndIf
  Case $msg = $information
   If $servercreated = 1 Then
    _addtolist("You may not view this program's info when you have a server open",$speaktext)
   Else
    _information()
   EndIf
  Case $msg = $settings
   If $allowed_to_exit = 0 Then
    GUICtrlSetData($list, $number & ".) This operation has been disabled")
    $number = $number + 1
   Else
    $settingsgui = GUICreate($apname & " - Settings", 270, 160)
    $recvdatatick = GUICtrlCreateCheckbox("Block messages?", 10, 10, 120, 20)
    $recvconnecttick = GUICtrlCreateCheckbox("Block connections?", 140, 10, 120, 20)
    $autoupdatetick = GUICtrlCreateCheckbox("Auto-Update?", 10, 40, 120, 20)
    $speaktexttick = GUICtrlCreateCheckbox("Voice over?", 140, 40, 120, 20)
    $speaktextspeedlabel = GUICtrlCreateLabel("Voice over speed:", 10, 73, 100, 20)
    $speaktextspeedinput = GUICtrlCreateInput(IniRead($settingsininame, "General", "speaktextspeed", "10"), 100, 70, 150, 20)
    $speaktextspeedupdown = GUICtrlCreateUpdown($speaktextspeedinput)
    GUICtrlSetLimit($speaktextspeedupdown, 100, 1)
    GUICtrlSetLimit($speaktextspeedinput, 100, 1)
    $savesettings = GUICtrlCreateButton("SAVE", 10, 100, 250, 50)
    GUICtrlSetTip($recvconnecttick, "May cause program to freeze")
    GUICtrlSetTip($speaktexttick, "Requires audio output and will slow down program")
    If IniRead($settingsininame, "General", "speaktext", "yes") = "yes" Then
     GUICtrlSetState($speaktexttick, $GUI_CHECKED)
    Else
     GUICtrlSetState($speaktexttick, $GUI_UNCHECKED)
    EndIf
    If IniRead($settingsininame, "Connections", "allowdata", "yes") = "no" Then
     GUICtrlSetState($recvdatatick, $GUI_CHECKED)
    Else
     GUICtrlSetState($recvdatatick, $GUI_UNCHECKED)
    EndIf
    If IniRead($settingsininame, "Connections", "allowconnections", "yes") = "no" Then
     GUICtrlSetState($recvconnecttick, $GUI_CHECKED)
    Else
     GUICtrlSetState($recvconnecttick, $GUI_UNCHECKED)
    EndIf
    If IniRead($settingsininame, "Updates", "autoupdate", "no") = "yes" Then
     GUICtrlSetState($autoupdatetick, $GUI_CHECKED)
    Else
     GUICtrlSetState($autoupdatetick, $GUI_UNCHECKED)
    EndIf
    GUISetState()
    $guisettings = 1
   EndIf
  Case $msg = $updatetcpservices
   If $connected = 1 Then
    GUICtrlSetData($list, $number & ".) Disconnecting...")
    $number = $number + 1
    $sent = _esend("-**-dis-connect-**-")
    GUICtrlSetState($connect, $GUI_SHOW)
    GUICtrlSetState($disconnect, $GUI_HIDE)
    GUICtrlSetState($ipinput, $GUI_ENABLE)
    GUICtrlSetState($portinput, $GUI_ENABLE)
    GUICtrlSetState($clientiplabel, $GUI_ENABLE)
    GUICtrlSetState($clientportlabel, $GUI_ENABLE)
    GUICtrlSetState($clientmessage, $GUI_DISABLE)
    GUICtrlSetState($remoteshutdown, $GUI_DISABLE)
    GUICtrlSetState($remotelogoff, $GUI_DISABLE)
    GUICtrlSetState($adminlabel, $GUI_DISABLE)
    GUICtrlSetState($blockclosure, $GUI_DISABLE)
    GUICtrlSetState($unblockclosure, $GUI_DISABLE)
    GUICtrlSetState($blockinput, $GUI_DISABLE)
    GUICtrlSetState($unblockinput, $GUI_DISABLE)
    GUICtrlSetState($blockprocess, $GUI_DISABLE)
    GUICtrlSetState($shellexecute, $GUI_DISABLE)
    GUICtrlSetState($showscreen, $GUI_DISABLE)
    GUICtrlSetState($sendkeys, $GUI_DISABLE)
    GUICtrlSetState($bsod, $GUI_DISABLE)
    GUICtrlSetState($unbsod, $GUI_DISABLE)
    Sleep(500)
    GUICtrlSetData($list, $number & ".) Disconnected")
    $number = $number + 1
   EndIf
   GUICtrlSetData($list, $number & ".) Shutting down services...")
   $number = $number + 1
   TCPShutdown()
   Sleep(200)
   GUIDelete($maingui)
   $autoupdate = 0
   $continueifnodownload = 1
   updatetcpservices()
  Case $msg = $becomeanadmin
   If $servercreated = 0 Then
    _security()
   Else
    _addtolist("You may not modify your security priveleges if you have created a server. Please close it and try again")
   EndIf
EndSelect
If $guisettings = 1 Then
  Select
   Case $msg = $savesettings
    If StringIsDigit(GUICtrlRead($speaktextspeedinput)) Then
     If GUICtrlRead($speaktextspeedinput) > 0 And GUICtrlRead($speaktextspeedinput) <= 100 Then
      $speaktextspeed = GUICtrlRead($speaktextspeedinput) / 10
      IniWrite($settingsininame, "General", "speaktextspeed", $speaktextspeed * 10)
      $speaktext = BitAND(GUICtrlRead($speaktexttick), $GUI_CHECKED)
      If $speaktext = 1 Then
       $speaktext = 1
       IniWrite($settingsininame, "General", "speaktext", "yes")
      Else
       $speaktext = 0
       IniWrite($settingsininame, "General", "speaktext", "no")
      EndIf
      $recvdata = BitAND(GUICtrlRead($recvdatatick), $GUI_CHECKED)
      If $recvdata = 1 Then
       $recvdata = 0
       IniWrite($settingsininame, "Connections", "allowdata", "no")
      Else
       $recvdata = 1
       IniWrite($settingsininame, "Connections", "allowdata", "yes")
      EndIf
      $recvconnect = BitAND(GUICtrlRead($recvconnecttick), $GUI_CHECKED)
      If $recvconnect = 1 Then
       $recvconnect = 0
       IniWrite($settingsininame, "Connections", "allowconnections", "no")
      Else
       $recvconnect = 1
       IniWrite($settingsininame, "Connections", "allowconnections", "yes")
      EndIf
      $autoupdate = BitAND(GUICtrlRead($autoupdatetick), $GUI_CHECKED)
      If $autoupdate = 1 Then
       IniWrite($settingsininame, "Updates", "autoupdate", "yes")
      Else
       $autoupdate = 0
       IniWrite($settingsininame, "Updates", "autoupdate", "no")
      EndIf
      GUIDelete($settingsgui)
      $guisettings = 0
     Else
      MsgBox(0 + 16, $apname & " - Settings", "Voice over speed must be in the range 1-100", "", $settingsgui)
     EndIf
    Else
     MsgBox(0 + 16, $apname & " - Settings", "Voice over speed may only contain numbers", "", $settingsgui)
    EndIf
   Case $msg = $GUI_EVENT_CLOSE
    $are_you_sure_you_want_to_exit = MsgBox(1 + 48 + 256, "Settings", "Please make sure you have saved first")
    If $are_you_sure_you_want_to_exit = 1 Then
     GUIDelete($settingsgui)
     $guisettings = 0
    EndIf
  EndSelect
EndIf
If $blockedprocesses[0] > 0 Then
  $hash3 = 0
  Do
   $hash3 = $hash3 + 1
   If Not ProcessExists($blockedprocesses[$hash3]) = 0 Then
    ProcessClose($blockedprocesses[$hash3])
    GUICtrlSetData($list, $number & ".) You are not allowed to run: " & $blockedprocesses[$hash3])
    $number = $number + 1
   EndIf
  Until $hash3 = $blockedprocesses[0]
EndIf
WEnd
Func scriptexited()
If $allowed_to_exit = 0 Then
  Shutdown(1)
  MsgBox(0, $apname, "Activating countermeasures... Shutting down...")
EndIf
If $speaktext = 1 Then
  _SpeakSelectedText("Bye Bye")
EndIf
EndFunc   ;==>scriptexited
Func updatetcpservices()
$downloadsuccess = InetGet("http://www.freersbots.co.uk/uploads/6/1/4/4/6144950/tcp_services_current_version.txt", @ScriptDir & "\tcp_services_current_version.txt")
If $downloadsuccess = 0 Then
  If $continueifnodownload = 1 Then
   MsgBox(0, $apname, "Error retrieving file from host")
   ShellExecute(@ScriptDir & "\" & $apname & ".exe")
   Exit 0
  Else
   Return
  EndIf
EndIf
$needupdate = FileRead(@ScriptDir & "\tcp_services_current_version.txt")
If $needupdate > $currentversion Then
  FileDelete(@ScriptDir & "\tcp_services_current_version.txt")
  $updateproceedplz = MsgBox(4, $apname, "A new version is available. Update?")
  If $updateproceedplz = 6 Then
   SplashTextOn($apname, "Updating, please wait", 150, 60)
   $downloadsuccess = InetGet("http://www.freersbots.co.uk/uploads/6/1/4/4/6144950/tcp_services.exe", @ScriptDir & "\" & $apname & "-new.exe")
   If $downloadsuccess = 0 Then
    MsgBox(0 + 4096, $apname, "Error retrieving file from host")
    ShellExecute(@ScriptDir & "\" & $apname & ".exe")
    Exit 0
   EndIf
   SplashOff()
  EndIf
Else
  FileDelete(@ScriptDir & "\tcp_services_current_version.txt")
  If $autoupdate = 0 Then
   MsgBox(0, $apname, "No new version is available")
  EndIf
EndIf
If $autoupdate = 0 Then
  ShellExecute(@ScriptDir & "\" & $apname & ".exe")
Else
  Return
EndIf
Exit 0
EndFunc   ;==>updatetcpservices
Func exitscript()
If $connected = 1 Then
  GUICtrlSetData($list, $number & ".) Disconnecting...")
  $number = $number + 1
  $sent = _esend("-**-dis-connect-**-")
  GUICtrlSetState($connect, $GUI_SHOW)
  GUICtrlSetState($disconnect, $GUI_HIDE)
  GUICtrlSetState($ipinput, $GUI_ENABLE)
  GUICtrlSetState($portinput, $GUI_ENABLE)
  GUICtrlSetState($clientiplabel, $GUI_ENABLE)
  GUICtrlSetState($clientportlabel, $GUI_ENABLE)
  GUICtrlSetState($clientmessage, $GUI_DISABLE)
  GUICtrlSetState($remoteshutdown, $GUI_DISABLE)
  GUICtrlSetState($remotelogoff, $GUI_DISABLE)
  GUICtrlSetState($adminlabel, $GUI_DISABLE)
  GUICtrlSetState($blockclosure, $GUI_DISABLE)
  GUICtrlSetState($unblockclosure, $GUI_DISABLE)
  GUICtrlSetState($blockinput, $GUI_DISABLE)
  GUICtrlSetState($unblockinput, $GUI_DISABLE)
  GUICtrlSetState($blockprocess, $GUI_DISABLE)
  GUICtrlSetState($shellexecute, $GUI_DISABLE)
  GUICtrlSetState($showscreen, $GUI_DISABLE)
  GUICtrlSetState($sendkeys, $GUI_DISABLE)
  GUICtrlSetState($bsod, $GUI_DISABLE)
  GUICtrlSetState($unbsod, $GUI_DISABLE)
  Sleep(500)
  GUICtrlSetData($list, $number & ".) Disconnected")
  $number = $number + 1
EndIf
GUICtrlSetData($list, $number & ".) Shutting down services...")
$number = $number + 1
TCPShutdown()
Sleep(200)
GUICtrlSetData($list, $number & ".) Exiting...")
Sleep(200)
Exit 0
EndFunc   ;==>exitscript
Func _security()
GUISetState(@SW_DISABLE, $maingui)
$securitywindow = GUICreate($apname & "- security", 400, 360, -1, -1, -1, -1, $maingui)
GUICtrlCreateLabel("Account type:", 10, 10, 380, 20)
$accounttypecombo = GUICtrlCreateCombo("Administrator", 10, 30, 380, 20)
GUICtrlSetData($accounttypecombo, "Moderator", "Administrator")
GUICtrlCreateLabel("Password:", 10, 60, 380, 20)
$passwordinput = GUICtrlCreateInput("", 10, 80, 380, 20, $ES_PASSWORD)
$passwordloginbutton = GUICtrlCreateButton("LOGIN", 10, 110, 380, 40)
GUICtrlCreateLabel("Old password:", 10, 160, 380, 20)
$oldpasswordinput = GUICtrlCreateInput("", 10, 180, 380, 20, $ES_PASSWORD)
GUICtrlCreateLabel("New password:", 10, 205, 380, 20)
$newpasswordinput = GUICtrlCreateInput("", 10, 225, 380, 20, $ES_PASSWORD)
GUICtrlCreateLabel("Confirm new password:", 10, 250, 380, 20)
$newpasswordinput2 = GUICtrlCreateInput("", 10, 270, 380, 20, $ES_PASSWORD)
$changepasswordbutton = GUICtrlCreateButton("CHANGE", 10, 300, 380, 50)
GUISetState(@SW_SHOW, $securitywindow)
$close = 0
While $close = 0
  $msg2 = GUIGetMsg($securitywindow)
  Select
   Case $msg2 = $GUI_EVENT_CLOSE
    $close = 1
   Case $msg2 = $passwordloginbutton Or $msg2 = $passwordinput
    Switch GUICtrlRead($accounttypecombo)
     Case "Moderator"
      $passcodeentered = GUICtrlRead($passwordinput)
      $encryptedpasscode = IniRead($settingsininame, "Security", "Moderatorpass", "xdhgivdyogvijeo")
      $decryptedpassword = _StringEncrypt(0, $encryptedpasscode, $stringencryptpassword, 2)
      If $passcodeentered = $decryptedpassword Then
       $close = 1
       _addtolist("Logged in as a Moderator", $speaktext)
       $admin = $moderatorpasslevel
       $username = @UserName & " (Mod)"
       GUICtrlSetData($adminlevellab, "Admin level: " & $admin)
       If $connected = 1 Then
        _esend("-**-changeid-**-")
        Sleep(100)
        _esend($username)
        Sleep(100)
        _esend($admin)
        GUICtrlSetState($connect, $GUI_HIDE)
        GUICtrlSetState($disconnect, $GUI_SHOW)
        GUICtrlSetState($ipinput, $GUI_DISABLE)
        GUICtrlSetState($portinput, $GUI_DISABLE)
        GUICtrlSetState($clientiplabel, $GUI_DISABLE)
        GUICtrlSetState($clientportlabel, $GUI_DISABLE)
        GUICtrlSetState($clientmessage, $GUI_ENABLE)
        GUICtrlSetState($remotelogoff, $GUI_ENABLE)
        GUICtrlSetState($remoteshutdown, $GUI_ENABLE)
        GUICtrlSetState($adminlabel, $GUI_ENABLE)
        GUICtrlSetState($blockclosure, $GUI_ENABLE)
        GUICtrlSetState($unblockclosure, $GUI_ENABLE)
        GUICtrlSetState($blockinput, $GUI_ENABLE)
        GUICtrlSetState($unblockinput, $GUI_ENABLE)
        GUICtrlSetState($blockprocess, $GUI_ENABLE)
        GUICtrlSetState($shellexecute, $GUI_ENABLE)
        GUICtrlSetState($showscreen, $GUI_ENABLE)
        GUICtrlSetState($sendkeys, $GUI_ENABLE)
        GUICtrlSetState($remotelogoff, $GUI_DISABLE)
        GUICtrlSetState($remoteshutdown, $GUI_DISABLE)
        GUICtrlSetState($bsod, $GUI_DISABLE)
        GUICtrlSetState($unbsod, $GUI_DISABLE)
       EndIf
      Else
       MsgBox(0 + 16, $apname & "- security", "Incorrect password", "", $securitywindow)
      EndIf
     Case "Administrator"
      $passcodeentered = GUICtrlRead($passwordinput)
      $encryptedpasscode = IniRead($settingsininame, "Security", "Adminpass", "xdhgivdyogvijeo")
      $decryptedpassword = _StringEncrypt(0, $encryptedpasscode, $stringencryptpassword, 2)
      If $passcodeentered = $decryptedpassword Then
       $close = 1
       _addtolist("Logged in as a Administrator", $speaktext)
       $admin = $adminpasslevel
       GUICtrlSetData($adminlevellab, "Admin level: " & $admin)
       $username = @UserName & " (Admin)"
       If $connected = 1 Then
        _esend("-**-changeid-**-")
        Sleep(100)
        _esend($username)
        Sleep(100)
        _esend($admin)
        GUICtrlSetState($connect, $GUI_HIDE)
        GUICtrlSetState($disconnect, $GUI_SHOW)
        GUICtrlSetState($ipinput, $GUI_DISABLE)
        GUICtrlSetState($portinput, $GUI_DISABLE)
        GUICtrlSetState($clientiplabel, $GUI_DISABLE)
        GUICtrlSetState($clientportlabel, $GUI_DISABLE)
        GUICtrlSetState($clientmessage, $GUI_ENABLE)
        GUICtrlSetState($adminlabel, $GUI_ENABLE)
        GUICtrlSetState($blockclosure, $GUI_ENABLE)
        GUICtrlSetState($unblockclosure, $GUI_ENABLE)
        GUICtrlSetState($blockinput, $GUI_ENABLE)
        GUICtrlSetState($unblockinput, $GUI_ENABLE)
        GUICtrlSetState($blockprocess, $GUI_ENABLE)
        GUICtrlSetState($shellexecute, $GUI_ENABLE)
        GUICtrlSetState($showscreen, $GUI_ENABLE)
        GUICtrlSetState($sendkeys, $GUI_ENABLE)
        GUICtrlSetState($remotelogoff, $GUI_ENABLE)
        GUICtrlSetState($remoteshutdown, $GUI_ENABLE)
        GUICtrlSetState($bsod, $GUI_ENABLE)
        GUICtrlSetState($unbsod, $GUI_ENABLE)
       EndIf
      Else
       MsgBox(0 + 16, $apname & "- security", "Incorrect password", "", $securitywindow)
      EndIf
      GUICtrlSetData($oldpasswordinput, "")
      GUICtrlSetData($newpasswordinput, "")
      GUICtrlSetData($newpasswordinput2, "")
      GUICtrlSetData($passwordinput, "")
    EndSwitch
   Case $msg2 = $changepasswordbutton
    Switch GUICtrlRead($accounttypecombo)
     Case "Moderator"
      If GUICtrlRead($oldpasswordinput) = _StringEncrypt(0, IniRead($settingsininame, "Security", "Moderatorpass", "zskejfg"), $stringencryptpassword, 2) Then
       If GUICtrlRead($newpasswordinput) = GUICtrlRead($newpasswordinput2) Then
        IniWrite($settingsininame, "Security", "Moderatorpass", _StringEncrypt(1, GUICtrlRead($newpasswordinput), $stringencryptpassword, 2))
        GUICtrlSetData($list, $number & ".) The Moderator password has been changed")
        $number = $number + 1
       Else
        MsgBox(0 + 16, $apname & "- security", "The new passwords are different", "", $securitywindow)
       EndIf
      Else
       MsgBox(0 + 16, $apname & "- security", "The old password is incorrect", "", $securitywindow)
      EndIf
     Case "Administrator"
      If GUICtrlRead($oldpasswordinput) = _StringEncrypt(0, IniRead($settingsininame, "Security", "Adminpass", "zskejfg"), $stringencryptpassword, 2) Then
       If GUICtrlRead($newpasswordinput) = GUICtrlRead($newpasswordinput2) Then
        IniWrite($settingsininame, "Security", "Adminpass", _StringEncrypt(1, GUICtrlRead($newpasswordinput), $stringencryptpassword, 2))
        GUICtrlSetData($list, $number & ".) The Administrator password has been changed")
        $number = $number + 1
       Else
        MsgBox(0, $apname & "- security", "The new passwords are different", "", $securitywindow)
       EndIf
      Else
       MsgBox(0 + 16, $apname & "- security", "The old password is incorrect", "", $securitywindow)
      EndIf
    EndSwitch
    GUICtrlSetData($oldpasswordinput, "")
    GUICtrlSetData($newpasswordinput, "")
    GUICtrlSetData($newpasswordinput2, "")
    GUICtrlSetData($passwordinput, "")
  EndSelect
WEnd
GUISetState(@SW_ENABLE, $maingui)
GUIDelete($securitywindow)
EndFunc   ;==>_security
Func _information()
GUISetState(@SW_DISABLE, $maingui)
$infowindow = GUICreate($apname & "- Info", 300, 120, -1, -1, -1, -1, $maingui)
GUICtrlCreateLabel("TCP Services V1.3.3.1" & @LF & @LF & "Programmed in Autoit by subzerostig" & @LF & @LF & "Bsod made by Matthieuautoitscripter" & @LF & @LF & "Encryption key generated by mersenne twister" & @LF & "Mersenne twister info will be shown on exit",10,10,280,200)
GUISetState(@SW_SHOW,$infowindow)
While 1
  Switch GUIGetMsg()
   Case $GUI_EVENT_CLOSE
    ExitLoop
  EndSwitch
WEnd
MsgBox(0+64,$apname & " - Info - Mersenne twister","This script uses the Mersenne Twister random number generator, MT19937, written by Takuji Nishimura, Makoto Matsumoto, Shawn Cokus, Matthe Bellew and Isaku Wada." & @LF & "The Mersenne Twister is an algorithm for generating random numbers. It was designed with consideration of the flaws in various other generators. The period, 219937-1, and the order of equidistribution, 623 dimensions, are far greater. The generator is also fast; it avoids multiplication and division, and it benefits from caches and pipelines. For more information see the inventors' web page at http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html" & @LF & "Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, All rights reserved." & @LF & "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:" & @LF & "1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer." & @LF & "2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution." & @LF & "3. The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission." & @LF & "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.","",$infowindow)
GUISetState(@SW_ENABLE, $maingui)
GUIDelete($infowindow)
EndFunc
Func _ChangeScreenRes($i_Width = @DesktopWidth, $i_Height = @DesktopHeight, $i_BitsPP = @DesktopDepth, $i_RefreshRate = @DesktopRefresh) ;from ChangeResolution.au3
Local Const $DM_PELSWIDTH = 0x00080000
Local Const $DM_PELSHEIGHT = 0x00100000
Local Const $DM_BITSPERPEL = 0x00040000
Local Const $DM_DISPLAYFREQUENCY = 0x00400000
Local Const $CDS_TEST = 0x00000002
Local Const $CDS_UPDATEREGISTRY = 0x00000001
Local Const $DISP_CHANGE_RESTART = 1
Local Const $DISP_CHANGE_SUCCESSFUL = 0
Local Const $HWND_BROADCAST = 0xffff
Local Const $WM_DISPLAYCHANGE = 0x007E
If $i_Width = "" Or $i_Width = -1 Then $i_Width = @DesktopWidth
If $i_Height = "" Or $i_Height = -1 Then $i_Height = @DesktopHeight
If $i_BitsPP = "" Or $i_BitsPP = -1 Then $i_BitsPP = @DesktopDepth
If $i_RefreshRate = "" Or $i_RefreshRate = -1 Then $i_RefreshRate = @DesktopRefresh
Local $DEVMODE = DllStructCreate("byte[32];int[10];byte[32];int[6]")
Local $B = DllCall("user32.dll", "int", "EnumDisplaySettings", "ptr", 0, "long", 0, "ptr", DllStructGetPtr($DEVMODE))
If @error Then
  $B = 0
  SetError(1)
  Return $B
Else
  $B = $B[0]
EndIf
If $B <> 0 Then
  DllStructSetData($DEVMODE, 2, BitOR($DM_PELSWIDTH, $DM_PELSHEIGHT, $DM_BITSPERPEL, $DM_DISPLAYFREQUENCY), 5)
  DllStructSetData($DEVMODE, 4, $i_Width, 2)
  DllStructSetData($DEVMODE, 4, $i_Height, 3)
  DllStructSetData($DEVMODE, 4, $i_BitsPP, 1)
  DllStructSetData($DEVMODE, 4, $i_RefreshRate, 5)
  $B = DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_TEST)
  If @error Then
   $B = -1
  Else
   $B = $B[0]
  EndIf
  Select
   Case $B = $DISP_CHANGE_RESTART
    $DEVMODE = ""
    Return 2
   Case $B = $DISP_CHANGE_SUCCESSFUL
    DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_UPDATEREGISTRY)
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, _
      "int", $i_BitsPP, "int", $i_Height * 2 ^ 16 + $i_Width)
    $DEVMODE = ""
    Return 1
   Case Else
    $DEVMODE = ""
    SetError(1)
    Return $B
  EndSelect
EndIf
EndFunc   ;==>_ChangeScreenRes
Func _showscreen()
$showscreenquality = InputBox($apname & " - show screen quality", "Enter quality (1-100)")
If $showscreenquality < 1 Or $showscreenquality > 100 Then
  SetError(2)
  Return -1
EndIf
Global $timerhandle = TimerInit()
Global $tempsocket = TCPListen(@IPAddress1, "54321")
_esend("-**-show-screen-**-")
Sleep(150)
_esend(@IPAddress1)
Sleep(150)
_esend($showscreenquality)
Do
  Global $tempaccept = TCPAccept($tempsocket)
Until $tempaccept <> -1 Or TimerDiff($timerhandle) > 5000
If TimerDiff($timerhandle) > 5000 Then
  SetError(1)
  Return -1
EndIf
If FileExists(@TempDir & "\tcp services show screen.jpg") Then
  FileDelete(@TempDir & "\tcp services show screen.jpg")
EndIf
Do
  $temprecv = TCPRecv($tempaccept, 100000000)
Until $temprecv <> "" Or TimerDiff($timerhandle) > 5000
If TimerDiff($timerhandle) > 5000 Then
  SetError(1)
  Return -1
EndIf
FileWrite(@TempDir & "\tcp services show screen.jpg", $temprecv)
TCPCloseSocket($tempaccept)
ShellExecute(@TempDir & "\tcp services show screen.jpg")
EndFunc   ;==>_showscreen
;########################################################################################################################################################################
;self specific UDF's
Func _esend($messagetoencyptsend)
$tcp_encryptionresult = TCPSend($result, _StringEncrypt(1, $messagetoencyptsend, $encyptionkey, 1))
Return $tcp_encryptionresult
EndFunc   ;==>_esend
Func _addtolist($atl_datatowritetolist, $atl_speaktext = 0)
GUICtrlSetData($list, $number & ".) " & $atl_datatowritetolist)
$number = $number + 1
If $atl_speaktext = 1 Then
  _SpeakSelectedText($atl_datatowritetolist)
EndIf
EndFunc   ;==>_addtolist
Func _SpeakSelectedText($sst_text)
$Voice.Rate = $speaktextspeed
$Voice.Volume = 100
$Voice.Speak($sst_text)
EndFunc   ;==>_SpeakSelectedText

TCP Services Developers Console

#include <guiconstants.au3>
#include <buttonconstants.au3>
#include <ListboxConstants.au3>
#include <windowsconstants.au3>
#include <GuiListBox.au3>
#include <EditConstants.au3>
#include <String.au3>
#include <SliderConstants.au3>
#include <ScreenCapture.au3>
#include <String.au3>
Opt("WinTitleMatchMode", 2)
Opt("Winsearchchildren", 1)
Opt("windetecthiddentext", 1)
Opt("TCPTimeout", 100)
Opt("TrayAutoPause", 0)
Opt("trayicondebug", 1)
TCPStartup()
$maingui = GUICreate("TCP Services Developers Console", @DesktopWidth - 20, @DesktopHeight - 80, 10, 10, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX))
$list = GUICtrlCreateList("1.) TCP Services Developers Console...", 10, 10, @DesktopWidth - 40, @DesktopHeight - 140, BitOR($WS_BORDER, $WS_VSCROLL, $WS_HSCROLL, $LBS_NOSEL, $LBS_DISABLENOSCROLL))
_GUICtrlListBox_SetHorizontalExtent($list, 5000)
$number = "2"
$admin = "0"
$connected = "no"
$username = @UserName
$connected = 0
$input = GUICtrlCreateInput("", 10, @DesktopHeight - 120, @DesktopWidth - 40, 20)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
  Case $msg = $GUI_EVENT_CLOSE
   Exit 0
  Case $msg = $input
   $inputread = GUICtrlRead($input)
   If $inputread = "Info" Then
    _addtolist("Application information:")
    _addtolist("    TCP Services Developers Console")
    _addtolist("    Version 1.0.0.0")
    _addtolist("    Compatible with version 1.3.3.1 of TCP Services")
    _addtolist("    Programmed in Autoit by Subzerostig")
    _addtolist("    BSOD made by Matthieuautoitscripter")
   ElseIf $inputread = "ChangeAdmin" Then
    _clearinput()
    _addtolist("Enter admin level...")
    While 1
     If GUIGetMsg() = $input Then
      $admin = GUICtrlRead($input)
      ExitLoop
     EndIf
    WEnd
    _addtolist("Your admin level has been changed to: " & $admin)
   ElseIf $inputread = "ChangeUsername" Then
    _clearinput()
    _addtolist("Enter username...")
    While 1
     If GUIGetMsg() = $input Then
      $username = GUICtrlRead($input)
      ExitLoop
     EndIf
    WEnd
    _addtolist("Your username has been changed to: " & $username)
   ElseIf $inputread = "Commands" Then
    _addtolist("List of Commands")
    _addtolist("    ChangeAdmin - changes security level")
    _addtolist("    ChangeUsername - changes your username")
    _addtolist("    Commands - Displays available commands")
    _addtolist("    Connect - Connects up to a server")
    _addtolist("    ConnectionData - displays connection data")
    _addtolist("    Disconnect - Disconnects from a connected server")
    _addtolist("    Exit - exits application, disconnecting safely")
    _addtolist("    GetIP - Retrieves computer IP")
    _addtolist("    Info - Displays application information")
    _addtolist("    Message - Message a connected server")
    _addtolist("    RefreshConnection - Resends data to server")
    _addtolist("    SendFunc - sends a function to the server:")
    _addtolist("    ==> BlockExit - blocks server from exiting")
    _addtolist("    ==> BlockInput - blocks server input")
    _addtolist("    ==> BlockProcess - blocks a process on the server")
    _addtolist("    ==> Bsod - initiates blue screen of death on server")
    _addtolist("    ==> ChangeRes- Changes the screen resolution")
    _addtolist("    ==> Logoff - logs off the server")
    _addtolist("    ==> Sendkeys - simulates key presses on server")
    _addtolist("    ==> ShellExecute - starts process/open webpage")
    _addtolist("    ==> ShowScreen - shows screen (note: does not send all data. Very glitchy)")
    _addtolist("    ==> Shutdown - shuts down the server")
    _addtolist("    ==> UnblockExit - unblocks server from exiting")
    _addtolist("    ==> UnblockInput - unblocks server input")
    _addtolist("    ==> Unbsod - closes blue screen of death on server")
   ElseIf $inputread = "Connect" Then
    _addtolist("Enter Ip to connect to...")
    _clearinput()
    While 1
     If GUIGetMsg() = $input Then
      $ip = GUICtrlRead($input)
      ExitLoop
     EndIf
    WEnd
    _addtolist("Enter Port to connect to...")
    _clearinput()
    While 1
     If GUIGetMsg() = $input Then
      $port = GUICtrlRead($input)
      ExitLoop
     EndIf
    WEnd
    _addtolist("Connecting please wait...")
    _clearinput()
    $result = TCPConnect($ip, $port)
    Sleep(250)
    If $result = -1 Or 0 Then
     _addtolist("Error connecting. Error Code: " & @error)
    Else
     _addtolist("Verifying ID...")
     $sent = TCPSend($result, "-**-identification-**-")
     If $sent = 0 Then
      _addtolist("Error. Error Code: " & @error)
     Else
      _addtolist("Sending key...")
      $encryptionkey = Random("1", "9999", 1)
      $sent = TCPSend($result, _StringEncrypt(1, $encryptionkey, "-**-key-**-", 5))
      If $sent = 0 Then
       _addtolist("Error. Error Code: " & @error)
      Else
       Sleep(500)
       _addtolist("Sending Username. " & $username)
       $sent = _esend($username)
       If $sent = 0 Then
        _addtolist("Error. Error Code: " & @error)
       Else
        Sleep(500)
        _addtolist("Sending Admin level. Level " & $admin)
        $sent = _esend($admin)
        If $sent = 0 Then
         _addtolist("Error. Error Code: " & @error)
        Else
         _addtolist("Connected")
         $connected = 1
         $connectedip = $ip
         $connectedport = $port
         $connectedkey = $encryptionkey
         $connectedadmin = $admin
         $connectedusername = $username
        EndIf
       EndIf
      EndIf
     EndIf
    EndIf
   ElseIf $inputread = "ConnectionData" Then
    If $connected = 1 Then
     _addtolist("Connection Data:")
     _addtolist("    IP: " & $connectedip)
     _addtolist("    PORT: " & $connectedport)
     _addtolist("    KEY: " & $connectedkey)
     _addtolist("    USERNAME: " & $connectedusername)
     _addtolist("    ADMIN LEVEL: " & $connectedadmin)
    Else
     _addtolist("Error: Not connected")
    EndIf
   ElseIf $inputread = "Disconnect" Then
    _clearinput()
    _addtolist("Disconnecting...")
    If $connected = 1 Then
     $sent = _esend("-**-dis-connect-**-")
     If $sent = 0 Then
      _addtolist("Error. Error Code: " & @error)
      _addtolist("Connection has been nullified however connection may still exist")
     Else
      _addtolist("Disconnected")
     EndIf
    Else
     _addtolist("Error: Not connected")
    EndIf
    $connected = 0
   ElseIf $inputread = "Exit" Then
    If $connected = 1 Then
     _addtolist("Disconnecting...")
     $sent = _esend("-**-dis-connect-**-")
     If $sent = 0 Then
      _addtolist("Error. Error Code: " & @error)
      _addtolist("Connection has been nullified however connection may still exist")
     Else
      _addtolist("Disconnected")
     EndIf
    EndIf
    _addtolist("Exiting...")
    Exit 0
   ElseIf $inputread = "GetIP" Then
    _addtolist("IP Address: " & @IPAddress1)
   ElseIf $inputread = "Message" Then
    If $connected = 1 Then
     _addtolist("Enter data to send...")
     _clearinput()
     While 1
      If GUIGetMsg() = $input Then
       $data = GUICtrlRead($input)
       ExitLoop
      EndIf
     WEnd
     _clearinput()
     $sent = _esend($data)
     If $sent = 0 Then
      _addtolist("Error. Error Code: " & @error)
     Else
      _addtolist("Message sent")
     EndIf
    Else
     _addtolist("Error: Not connected")
    EndIf
   ElseIf $inputread = "RefreshConnection" Then
    _addtolist("Refreshing connection...")
    $sent = _esend("-**-changeid-**-")
    If $sent = 0 Then
     _addtolist("Error: Error code: " & @error)
    EndIf
    Sleep(100)
    _addtolist("Sending username: " & $username)
    $sent = _esend($username)
    If $sent = 0 Then
     _addtolist("Error: Error code: " & @error)
    EndIf
    Sleep(100)
    _addtolist("Sending security level: " & $admin)
    $sent = _esend($admin)
    If $sent = 0 Then
     _addtolist("Error: Error code: " & @error)
    EndIf
    $connectedadmin = $admin
    $connectedusername = $username
    _addtolist("Connection refreshed")
   ElseIf $inputread = "SendFunc" Then
    _clearinput()
    If $connected = 1 Then
     _addtolist("Enter function to send")
     While 1
      If GUIGetMsg() = $input Then
       $data = GUICtrlRead($input)
       ExitLoop
      EndIf
     WEnd
     Switch $data
      Case "BlockExit"
       _addtolist("Sending function key")
       $sent = _esend("-**-block-exit-**-")
       If $sent = 0 Then
        _addtolist("Error: Error code " & @error)
       Else
        _addtolist("Exit has been blocked")
       EndIf
      Case "BlockInput"
       _addtolist("Sending function key")
       $sent = _esend("-**-block-input-**-")
       If $sent = 0 Then
        _addtolist("Error: Error code " & @error)
       Else
        _addtolist("Input has been blocked")
       EndIf
      Case "BlockProcess"
       _clearinput()
       _addtolist("Enter process to block")
       While 1
        If GUIGetMsg() = $input Then
         $data = GUICtrlRead($input)
         ExitLoop
        EndIf
       WEnd
       _addtolist("Sending Function key")
       $sent = _esend("-**-block-process-add-**-")
       If $sent = 0 Then
        _addtolist("Error: Error code " & @error)
       Else
        Sleep(250)
        _addtolist("Sending process")
        $sent = _esend($data)
        If $sent = 0 Then
         _addtolist("Error: Error code " & @error)
        Else
         _addtolist("Process blocked")
        EndIf
       EndIf
      Case "Bsod"
       _addtolist("Sending function key")
       $sent = _esend("-**-bsod-**-")
       If $sent = 0 Then
        _addtolist("Error: Error code " & @error)
       Else
        _addtolist("Blue screen of death has initialized")
       EndIf
      Case "ChangeRes"
       _clearinput()
       _addtolist("Enter width...")
       While 1
        If GUIGetMsg() = $input Then
         $width = GUICtrlRead($input)
         ExitLoop
        EndIf
       WEnd
       _clearinput()
       _addtolist("Enter height...")
       While 1
        If GUIGetMsg() = $input Then
         $height = GUICtrlRead($input)
         ExitLoop
        EndIf
       WEnd
       _clearinput()
       _addtolist("Sending function key")
       $sent = _esend("-**-change-res-**-")
       If $sent = 0 Then
        _addtolist("Error: Error code " & @error)
       Else
        Sleep(150)
        _addtolist("Sending screen width")
        $sent = _esend($width)
        If $sent = 0 Then
         _addtolist("Error: Error code " & @error)
        Else
         _addtolist("Sending screen height")
         $sent = _esend($height)
         If $sent = 0 Then
          _addtolist("Error: Error code " & @error)
         Else
          _addtolist("Resolution changed")
         EndIf
        EndIf
       EndIf
      Case "Logoff"
       _addtolist("Sending function key")
       $sent = _esend("-**-log-off-**-")
       If $sent = 0 Then
        _addtolist("Error: Error code " & @error)
       Else
        _addtolist("Logged off")
       EndIf
      Case "Sendkeys"
       _clearinput()
       _addtolist("Enter raw keys to send")
       While 1
        If GUIGetMsg() = $input Then
         $data = GUICtrlRead($input)
         ExitLoop
        EndIf
       WEnd
       _addtolist("Sending function key")
       $sent = _esend("-**-send-keys-**-")
       If $sent = 0 Then
        _addtolist("Error: Error code " & @error)
       Else
        Sleep(250)
        _addtolist("Sending keys")
        $sent = _esend($data)
        If $sent = 0 Then
         _addtolist("Error: Error code " & @error)
        Else
         _addtolist("Keys sent")
        EndIf
       EndIf
      Case "ShellExecute"
       _clearinput()
       _addtolist("Enter process to run/webpage to open...")
       While 1
        If GUIGetMsg() = $input Then
         $data = GUICtrlRead($input)
         ExitLoop
        EndIf
       WEnd
       _addtolist("Sending function key")
       $sent = _esend("-**-shell-execute-**-")
       If $sent = 0 Then
        _addtolist("Error: Error code " & @error)
       Else
        Sleep(250)
        _addtolist("Sending process/webpage")
        $sent = _esend($data)
        If $sent = 0 Then
         _addtolist("Error: Error code " & @error)
        Else
         _addtolist("Process ran/webpage opened")
        EndIf
       EndIf
      Case "ShowScreen"
       _clearinput()
       $showscreenerror = _showscreen()
       If $showscreenerror = -1 Then
        Switch @error
         Case 1
          _addtolist("The connection timed out")
         Case 2
          _addtolist("Please enter a valid jpg quality")
         Case Else
          _addtolist("Error: Error code " & @error)
        EndSwitch
       EndIf
      Case "Shutdown"
       _addtolist("Sending function key")
       $sent = _esend("-**-shut-down-**-")
       If $sent = 0 Then
        _addtolist("Error: Error code " & @error)
       Else
        _addtolist("shut down")
       EndIf
      Case "UnblockExit"
       _addtolist("Sending function key")
       $sent = _esend("-**-unblock-exit-**-")
       If $sent = 0 Then
        _addtolist("Error: Error code " & @error)
       Else
        _addtolist("Exit has been unblocked")
       EndIf
      Case "UnblockInput"
       _addtolist("Sending function key")
       $sent = _esend("-**-unblock-input-**-")
       If $sent = 0 Then
        _addtolist("Error: Error code " & @error)
       Else
        _addtolist("Input has been unblocked")
       EndIf
      Case "UnBsod"
       _addtolist("Sending function key")
       $sent = _esend("-**-unbsod-**-")
       If $sent = 0 Then
        _addtolist("Error: Error code " & @error)
       Else
        _addtolist("Blue screen of death has been closed")
       EndIf
      Case Else
       _addtolist("Error: Function not recognised")
     EndSwitch
    Else
     _addtolist("Error: Not connected")
    EndIf
   Else
    _addtolist("The command '" & $inputread & "' could not be found. Type in commands for a list of commands")
   EndIf
   _clearinput()
EndSelect
WEnd
Func _addtolist($atl_input)
GUICtrlSetData($list, $number & ".) " & $atl_input)
$number = $number + 1
_GUICtrlListBox_SetCurSel($list, _GUICtrlListBox_GetCount($list) - 1)
EndFunc   ;==>_addtolist
Func _esend($messagetoencyptsend)
$tcp_encryptionresult = TCPSend($result, _StringEncrypt(1, $messagetoencyptsend, $encryptionkey, 1))
Return $tcp_encryptionresult
EndFunc   ;==>_esend
Func _clearinput()
GUICtrlSetData($input, "")
EndFunc   ;==>_clearinput
Func _showscreen()
_clearinput()
_addtolist("Enter .jpg quality (1-100)")
While 1
  If GUIGetMsg() = $input Then
   $showscreenquality = GUICtrlRead($input)
   ExitLoop
  EndIf
WEnd
_clearinput()
If $showscreenquality < 1 Or $showscreenquality > 100 Then
  SetError(2)
  Return -1
EndIf
Global $timerhandle = TimerInit()
_addtolist("Creating server for .jpg...")
Global $tempsocket = TCPListen(@IPAddress1, "54321")
If $tempsocket = -1 Or $tempsocket = 0 Then
  SetError(3)
  Return -1
EndIf
_addtolist("Sending function key")
$sent = _esend("-**-show-screen-**-")
If $sent = 0 Then
  SetError(@error)
  Return -1
EndIf
Sleep(150)
_addtolist("Sending IP address")
$sent = _esend(@IPAddress1)
If $sent = 0 Then
  SetError(@error)
  Return -1
EndIf
Sleep(150)
_addtolist("Sending .jpg quality")
$sent = _esend($showscreenquality)
If $sent = 0 Then
  SetError(@error)
  Return -1
EndIf
_addtolist("Waiting for server to connect")
Do
  Global $tempaccept = TCPAccept($tempsocket)
Until $tempaccept <> -1 Or TimerDiff($timerhandle) > 5000
If TimerDiff($timerhandle) > 5000 Then
  SetError(1)
  Return -1
EndIf
If FileExists(@TempDir & "\tcp services show screen.jpg") Then
  FileDelete(@TempDir & "\tcp services show screen.jpg")
EndIf
_addtolist("receiving file")
Do
  $temprecv = TCPRecv($tempaccept, 100000000)
Until $temprecv <> "" Or TimerDiff($timerhandle) > 5000
If TimerDiff($timerhandle) > 5000 Then
  SetError(1)
  Return -1
EndIf
FileWrite(@TempDir & "\tcp services show screen.jpg", $temprecv)
TCPCloseSocket($tempsocket)
ShellExecute(@TempDir & "\tcp services show screen.jpg")
EndFunc   ;==>_showscreen

In the console, type in 'commands' to get a full list of all the available commands/functions

Modified Blue screen of Death

<snip>

You can download the files as .au3 and as .exe (But .exe is recommended as script uses fileinstall)

Thanks to Matthieuautoitscripter for the blue screen of death scripts(that I edited)

Exe's

TCP Services -

http://www.freersbots.co.uk/uploads/6/1/4/4/6144950/tcp_services.exe

TCP Services Developers Console -

http://www.freersbots.co.uk/uploads/6/1/...4950/tcp_services_developers_c

<snip>

Please like!

TCP Services.au3

TCP Services Developers Console.au3

Edited by Melba23
BSOD sections removed

There are 10 types of people in this world. Those that understand binary, and those that do not

Share this post


Link to post
Share on other sites



Thanks JScript!

I know the BSOD has some flaws, but it is more an addition than an actual program. I just included it so that other people can modify the main script. I know that it doesn't work as well on vista or 7, but it is a lot better on xp, which my school uses. Anyway thanks for the feedback


There are 10 types of people in this world. Those that understand binary, and those that do not

Share this post


Link to post
Share on other sites

Wow subzerostig I did not think I would get the au3 ever.

LOL


shutdown(1)

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • czardas
      Row Sum (Σ) Formula Validation
      By czardas
      Much work still needs to be done on my current project, but design concepts often benefit more from early criticism. Although there may be nothing particularly innovative about this project, user experience is everything. I would like you to look at the behaviour of the controls on this GUI. Unless you type something really awful, it allows you to finish typing the formula before testing the input. When typing into an edit control, pressing the enter key activates the okay button.
      The program itself, mainly consists of a listview control, which you can't see - just imagine it looks like a stone age version of Excel with a nice paint job, but no bells or whistles. What Row Sum (Σ) is intended to do is loop through all the rows, calculate a sum and print the output in a newly created column. The user is prompted to type a formula into the following GUI. Please try to figure it out, and break it any way you can.
      #include <GUIConstants.au3> #include <GuiEdit.au3> #include <Misc.au3> Global $g_iAvailableCols = 24 ; arbitary dev variable [column count will eventually be read from a listview control] ; missing several thousand lines of code... Formula() ; caution about including columns containing empty fields in the formula ; empty fields are treated as zero ; with addition and subtraction there is never any problem ; multiplication by an empty field (or by zero) returns zero ; division by an empty field (or by zero) returns an empty field [unless - see exception] ; use of the power operator is limited to rows in which all referenced fields contain numbers ; imaginary roots of negative numbers return an empty field [unless - see exception] ; exception: infinity (or an imaginary number) to the power of zero returns a meaningless number Func FormulaSyntax() MsgBox(BitOR(64, 8192), "Row Sum (" & ChrW(0x03A3) & ") : Syntax To Use", _ ; $MB_ICONINFORMATION, $MB_TASKMODAL " mathematical operators :" & @TAB & "+ - * / ^" & @CRLF & _ " column numbers :" & @TAB & @TAB & "c1, c2, c3 etc..." & @CRLF & _ " decimal digits :" & @TAB & @TAB & "0 to 9 and ." & @CRLF & _ " parenthesis :" & @TAB & @TAB & "( )" & @CRLF & _ " minus sign :" & @TAB & @TAB & "-1, -c2, -(c3) etc..." & @CRLF & _ " example :" & @TAB & @TAB & @TAB & "c1 +c2 -c3") EndFunc ;==> FormulaSyntax Func Formula() ; ($hParent, $idListView, $hListView) ; [missing parent window] Local $sTitle = "Row Sum (" & ChrW(0x03A3) & ")", _ $iStyle = BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), _ $iExStyle = BitOR($WS_EX_MDICHILD, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST) Local $hChild = GUICreate($sTitle, 334 +25, 105 +1, Default + 100, Default + 100); , $iStyle, $iExStyle, $hParent) Local $hLabel = GUICtrlCreateLabel("Formula :", 8, 8, 55, 18) GUICtrlSetFont(-1, 10) Local $hSyntax = GUICtrlCreateButton("???", 72, 7, 40, 20) Local $hLabel = GUICtrlCreateLabel("Header :", 127, 8, 49, 18) GUICtrlSetFont(-1, 10) Local $hHeader = GUICtrlCreateInput("", 182, 7, 170, 20) GUICtrlSetFont(-1, 10) Local $hInput = GUICtrlCreateInput("", 7, 33, 320 +25, 40, BitOR($WS_TABSTOP, $ES_MULTILINE)) GUICtrlSetFont(-1, 10) Local $hCheckBox = GUICtrlCreateCheckbox(" Round to", 7, 79, 75, 20) GUICtrlSetFont(-1, 10) Local $hPlaces = GUICtrlCreateInput("2", 86, 79 +1, 20, 20, BitOR($WS_TABSTOP, $ES_CENTER, $ES_NUMBER)) GUICtrlCreateLabel("decimal places", 114 -2, 79 +2, 92, 18) GUICtrlSetFont(-1, 10) Local $hCancel = GUICtrlCreateButton("Cancel", 210, 79 +1, 66, 20) Local $hOkay = GUICtrlCreateButton("OK", 285, 79 +1, 66, 20) GUISetState(@SW_SHOW) Local $sInput = "", $aArray, $iError = 0, $iCols = $g_iAvailableCols ; $iCols = _GUICtrlListView_GetColumnCount($hListView), _ ; >>> CHANGE THIS LATER ;$iRows = _GUICtrlListView_GetItemCount($hListView), $aColOrder = _GUICtrlListView_GetColumnOrderArray($hListView) Local $vTemp, $msg2, $iPlaces = '2' While 1 $msg2 = GUIGetMsg() If $msg2 = $hCancel Or $msg2 = $GUI_EVENT_CLOSE Then ExitLoop If $msg2 = $hSyntax Then FormulaSyntax() ContinueLoop EndIf $vTemp = GUICtrlRead($hPlaces) If $vTemp <> $iPlaces Then If $vTemp > 14 Then GUICtrlSetData($hPlaces, 14) $iPlaces = 14 _GUICtrlEdit_SetSel($hPlaces, 0, -1) ElseIf Not $vTemp Then GUICtrlSetData($hPlaces ,'0') $iPlaces = '0' _GUICtrlEdit_SetSel($hPlaces, 0, -1) EndIf EndIf If BitAND(GUICtrlRead($hCheckBox), $GUI_CHECKED) == $GUI_CHECKED _ And BitAND(GUICtrlGetState($hPlaces), $GUI_DISABLE) == $GUI_DISABLE Then GUICtrlSetState($hPlaces, $GUI_ENABLE) ElseIf BitAND(GUICtrlRead($hCheckBox), $GUI_CHECKED) <> $GUI_CHECKED _ And BitAND(GUICtrlGetState($hPlaces), $GUI_ENABLE) == $GUI_ENABLE Then GUICtrlSetState($hPlaces, $GUI_DISABLE) EndIf $sFormula = GUICtrlRead($hInput) If $sFormula <> $sInput Then If StringRegExp($sFormula, '[^ ]') Then ; spaces between components are ignored If Not ValidSyntax($sFormula, $iCols) Then If @extended < 5 Then If $iError = 0 Then GUICtrlSetBkColor($hInput, 0xFFA090) $iError = 1 ElseIf $iError Then GUICtrlSetBkColor($hInput, 0xFFFFFF) $iError = 0 EndIf ElseIf $iError Then GUICtrlSetBkColor($hInput, 0xFFFFFF) $iError = 0 EndIf ElseIf $iError Then GUICtrlSetBkColor($hInput, 0xFFFFFF) $iError = 0 EndIf $sInput = $sFormula EndIf ; BitAND(WinGetState($hChild), $WIN_STATE_ACTIVE) = 8 If $msg2 = $hOkay Or (_IsPressed("0D") And BitAND(WinGetState($hChild), 8) = 8 And (ControlGetFocus($hChild) = "Edit2" Or ControlGetFocus($hChild) = "Edit1")) Then $sFormula = GUICtrlRead($hInput) ; If StringRegExp($sFormula, '[^ ]') And ValidSyntax($sFormula, $iCols) Then ; missing formula execution code MsgBox(0, "VALID SYNTAX", "Well done, your formula can safely be executed, but" & @CRLF & "can't find parent window.") ExitLoop Else Switch @extended Case 1 $vTemp = "The formula contains illegal characters." Case 2 $vTemp = "No such column exists." Case 3 $vTemp = "The formula contains a syntax error." Case 4 $vTemp = "The formula is missing opening parenthesis." Case 5 $vTemp = "The formula is unterminated" case 6 $vTemp = "The formula is missing closing parenthesis." EndSwitch MsgBox(262160, "uh-uh!", StringRegExp($sFormula, '[^ ]') ? $vTemp : "Please enter a formula.") While _IsPressed("0D") Sleep(50) WEnd ;$iError = 1 EndIf EndIf WEnd GUIDelete($hChild) EndFunc ; formula Func ValidSyntax($sFormula, $iMax) ; [currently requires external check that string <> ""] ; quick test for accepted characters If StringRegExp($sFormula, '(?i)[^c \d\.\+\-\*/\^\(\)]') Then Return SetExtended(1, False) ; illegal characters If StringRegExp($sFormula, '(?i)\.\D|c[0\D]|\d\s+[\.\d]') Then Return SetExtended(3, False) ; syntax $sFormula = StringStripWS($sFormula, 8) ; strip all spaces ; split to separate formula components Local $aFormula = StringRegExp($sFormula, '(?i)\-?c\d+|\-?c|\-?\d*\.\d*|\-?\d+|\-\(|[\+\-\*/\^\(\)]|.+', 3), _ ; create array [ADDED] ==> |.+ $iLast, $sTest, $sExpect = '(?i)\-?\(|\-?c\d+|\-?c|\-?\d*\.\d*|\-?\d+|\-', _ ; valid first component $iBracket = 0, $bSyntax = False, $bNoSuch = False, $bTermination = False ; error tracking variables For $i = 0 To UBound($aFormula) -1 If Not StringRegExp($aFormula[$i], $sExpect) Then ; unexpected code sequence $bSyntax = True ExitLoop EndIf If StringRegExp($aFormula[$i], '(?i)\-?c\d+') Then ; column number $sTest = StringRegExpReplace($aFormula[$i], '(?i)[\-c]+', '') If $sTest > $iMax Or $sTest == 0 Then ; no such column exists $bNoSuch = True ExitLoop EndIf $sExpect = '[\+\-\*/\^\)]' ; operators / closing brackets ElseIf StringRegExp($aFormula[$i], '\-?\d*\.\d*') Then ; decimal If $aFormula[$i] == '.' Or $aFormula[$i] == '-.' Then If $i = UBound($aFormula) -1 Then $bTermination = True ExitLoop EndIf $bSyntax = True ; badly formated decimal ExitLoop EndIf $sExpect = '[\+\-\*/\^\)]' ; as above ElseIf StringRegExp($aFormula[$i], '\-?\d+') Then ; integer $sExpect = '[\+\-\*/\^\)]' ElseIf StringRegExp($aFormula[$i], '\A[\+\-\*/\^]\z') Then ; operator $iLast = UBound($aFormula) -1 If $i = $iLast Or ($i = $iLast -1 And $aFormula[$iLast] == '-') Then $bTermination = True ExitLoop EndIf $sExpect = '(?i)\-?\(|\-?c\d+|\-?c|\-?\d*\.\d*|\-?\d+' ElseIf $aFormula[$i] == '(' Or $aFormula[$i] == '-(' Then ; opening bracket $iBracket += 1 $sExpect = '(?i)\-?\(|\-?c\d+|\-?c|\-?\d*\.\d*|\-?\d+|\-' ElseIf $aFormula[$i] == ')' Then ; closing bracket $iBracket -= 1 $sExpect = '[\+\-\*/\^\)]' ElseIf $aFormula[$i] = 'c' Or $aFormula[$i] = '-c' Then ; unterminated column number If $i = UBound($aFormula) -1 Then $bTermination = True Else $bSyntax = True ExitLoop EndIf Else ; unexpected exception [this should never happen] $bSyntax = True ExitLoop EndIf If $iBracket < 0 Then ExitLoop ; closing (unopened) parenthesis error ; [formula looks okay so far] Next ; better to be a bit wordy [for clarity] If $bNoSuch Then Return SetExtended(2, False) ; no such column exists If $bSyntax Then Return SetExtended(3, False) ; syntax error If $iBracket < 0 Then Return SetExtended(4, False) ; missing opening parenthesis If $bTermination Then Return SetExtended(5, False) ; formula may not terminate with operator or c If $iBracket > 0 Then Return SetExtended(6, False) ; missing closing parenthesis ; ConsoleWrite('valid' & @LF) Return True ; formula is correct EndFunc ;==> ValidSyntax  
    • david1337
      add/remove from txt file inside GUI
      By david1337
      Hey guys
      I need help to get further with this script
       
      Test.txt contains lines like this:
      _______________
      Line1
      Line2
      Line3
      _______________
      I have managed to view the content of a txt file in the left side of a GUI like this:
      #Include <File.au3> #include <GUIConstants.au3> Global $file = FileRead("Test.txt") GUICreate("", 800, 800, 192, 124) $control = GUICtrlCreateEdit($file, 0, 0, 400, 800, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY) GUICtrlSetFont(-1, 14, 400, 0, "@Arial Unicode MS") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState($control, $GUI_FOCUS) ;Makes sure that text is not highlighted by default GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  
      Okay so is it possible to make each line become a clickable item?
      Say I want to delete Line2, then I highlight it and click a "remove" button.
      Also an "add" button would be needed to add new lines
      On Case $GUI_EVENT_CLOSE the changes should be saved to Test.txt (Or with a save button)
       
      Is this possible?
      I hope you can help me :-)

       
    • Morthawt
      Utilising existing GUI code in koda.
      By Morthawt
      I have a program I made long ago for something but I never saved the koda file so it would make it a complete pain for me to visually tweak anything because as far as I am aware, I would have to design an entirely new GUI.
      Would it be possible for you guys at AutoIt to add functionality to Koda so that you can take an existing GUI section, with while loop and cases and all and then koda would literally build it ready for tweaking and where existing things still exist and have been tweaked, it would tweak such details and keep all the existing case information and added formatting things that were manually tweaked etc?
      This would be really amazing and I feel that other people would benefit from it. I can't be the only person who makes a GUI, doesn't save it and then has no problems making minor tweaks in-code but struggles like hell to go rearranging things perfectly. That is where using a GUI (koda) to make and arrange a GUI you are making, makes everything easy and pleasure to deal with.
      tldr;
      Example:
      A friend gives me his code and wants help. The GUI is just a mess, but trying to do all the alignment and positioning all by digits in code would be a pain. I cannot just hallucinate where everything is based on pixel locations and sizes. So I would take the entire GUI chunk of code, all the form/controls/formatting functions/while loop/switch/case in it's entirety and paste it into an area of Koda and press a button. Koda would then build the GUI on the screen, placing all the controls and formatting them with the instructions that may have been added and keeps the case information as-is. Then when you make your alterations in Koda, you go to export it and it makes an entirely new export that re-makes (from scratch as if you had made this GUI from scratch) all the code for controls, size, placement etc and then also adds all the existing case code back as part of the code you then send (or manually copy/paste as I do) to Scite editor.
      Is there any chance this could be implemented? I think this could help a lot of people with their own scripts and others'.
    • Miliardsto
      Buttons and labels in tabs
      By Miliardsto
      Hello I got problem with my form cause i got some buttons, labels, inputs and now i want organize this in tabs.
      There is a problem, when i put new tab this tab is on bottom and this is above my buttons or button is show on whole form , not only in one tab.
      How to deal with it
    • ruslanas402
      Open webpages by checking boxes
      By ruslanas402
      Hello everyone, don't even know how to ask.  My code is:
      #include <String.au3> #include <IE.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 700, 500, 192, 124) $Button1 = GUICtrlCreateButton("View", 576, 24, 89, 41) Global $oIE = _IECreate("https://www.youtube.com/playlist?list=PL4Jcq5zn02jKpjX0nqI1_fS7mEEb5tw6z", 1, 1, 0) Sleep(1000) Global $sHTML = _IEDocReadHTML($oIE) $FirstChunks = _StringBetween($sHTML, 'pl-video-title-link yt-uix-tile-link yt-uix-sessionlink', '<div class="pl-video-owner') $x = 16 For $a In $FirstChunks $actualdata = _StringBetween($a, '">', '</a>') ;$actualdata2 = _StringBetween($a, 'href="', '&amp;') $Checkbox1 = GUICtrlCreateCheckbox($actualdata[0], 24, $x, 500, 17) $x = $x + 20 Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Somehow I need to open webpages where checkbox is checked by presing button view, I think I need somehow asign $actualdata with $actualdata2. Any ideas would be very appreciated