Jump to content

IT-Helper


sandman
 Share

Recommended Posts

Are you sick of being called down to the first floor of the office to help with a petty problem, then only to be called back down again as soon as you return to your own floor? Solution.

Posted ImagePosted ImagePosted Image

Just in case you didn't see the pictures, this is BETA SOFTWARE. It's functional, enough to test and say, "Wow, that's great!", but not enough to actually use in a professional situation. Currently only the screenshot and IP currently works (see bottom if you feel like giving me some help on this).

Okay.... the source!

#include <File.au3>
#include <GUIConstants.au3>
#include <INet.au3>

HotKeySet("#h", "HelpMe")

Global $buffer
Global $port = IniRead("options.ini", "Settings", "port", "9050")
Global $vVariable[10]

TCPStartup()

If IniRead("options.ini", "Settings", "listen", "0") = "1" Then
    $MainSocket = TCPListen("127.0.0.1", $port)
    While 1
        $ConnectedSocket = TCPAccept($MainSocket)
        If $ConnectedSocket >= 0 Then
            $recv = TCPRecv($ConnectedSocket, 4)
            If $recv = "HELP" Then
                $buffer = Binary($buffer)
                Do
                    $f = TCPRecv($ConnectedSocket, 65535)
                    $buffer &= $f
                Until $f = ""
                FileDelete("help.zip")
                $a = FileOpen("help.zip", 18)
                FileWrite($a, $buffer)
                FileClose($a)
                DirRemove("help")
                PluginOpen("Au3Zip.dll")
                _ZipUnZip("help.zip", @ScriptDir)
                $win = GUICreate("IT-Helper :: View Help Request", 390, 100, -1, -1)
                $menufile = GUICtrlCreateMenu("File")
                $menufilebackup = GUICtrlCreateMenuItem("Save this request", $menufile)
                $menufilesep = GUICtrlCreateMenuItem("", $menufile)
                $menufileexit = GUICtrlCreateMenuItem("Exit", $menufile)
                $processes = GUICtrlCreateButton("View Process List", 10, 10, 125, 25, 0)
                $windows = GUICtrlCreateButton("View Window List", 150, 10, 115, 25, 0)
                $screen = GUICtrlCreateButton("View Screenshot", 280, 10, 95, 25, 0)
                $lbl = GUICtrlCreateLabel("Request sent by " & FileRead("help\myip.txt") & @CRLF & "at " & @HOUR & ":" & @MIN & ", " & @MON & "." & @MDAY & "." & @YEAR & ".", 10, 50, 394, 27)
                GUISetState(@SW_SHOW)
                While 1
                    $nMsg = GUIGetMsg()
                    Switch $nMsg
                        Case $GUI_EVENT_CLOSE
                            GUIDelete($win)
                            ExitLoop
                        Case $processes
                            Run(@ComSpec & " /c Start help\processes.txt")
                        Case $windows
                            Run(@ComSpec & " /c Start help\windows.txt")
                        Case $screen
                            Run(@ComSpec & " /c Start help\screen.jpg")
                        Case $menufilebackup
                            $save = FileSaveDialog("IT-Helper :: Save Request", @DesktopDir, "ZIP archive (*.zip)")
                            If FileExists($save) Then
                                $ovrwrite = MsgBox(4, "IT-Helper :: Confirm File Overwrite", "The file """ & $save & """ already exists. Are you sure you want to overwrite this file?")
                                If $ovrwrite = 6 Then
                                    FileMove("help.zip", $save, 1)
                                EndIf
                            EndIf
                    EndSwitch
                WEnd
            EndIf
        EndIf
    WEnd
Else
    While 1
        Sleep(100)
    WEnd
EndIf

Func HelpMe()
    $ip = InputBox("Enter recipient IP", "Please enter the IP of the recipient of this help request, in the normal format of XXX.XXX.XXX.XXX. For example: 192.168.0.19")
    DirCreate("help")
    $processes = ProcessList()
;~  _FileWriteFromArray("help\processes.txt", $processes)
;~  $file = FileOpen("help\processes.txt", 1)
;~  For $i = 0 To UBound($processes, 1) - 1 Step 1
;~      FileWrite($file, $processes[$i] & @CRLF)
;~  Next
;~  FileClose($file)
;~  EmptyVar($i, $file)
;~  $windows = WinList()
;~  _FileWriteFromArray("help\windows.txt", $windows)
;~  $file = FileOpen("help\windows.txt", 1)
;~  For $i = 0 To UBound($windows) - 2 Step 1
;~      FileWrite($file, $windows[$i] - 1 & @CRLF)
;~  Next
;~  FileClose($file)
;~  EmptyVar($i, $file)
    $myip = _GetIP()
    FileWrite("help\myip.txt", $myip)
    CaptureScreen("help\screen.jpg")
    $zipplug = PluginOpen("Au3Zip.dll")
    $zip = _ZipCreate("help.zip")
    _ZipAddDir($zip, "help", 1)
    _ZipClose($zip)
    PluginClose("Au3Zip.dll")       ; try using the handle from $zipplug if that doesnt work
    $sock = TCPConnect($ip, $port)
    If $sock = -1 Then TrayTip("Error connecting.", "An error occurred while trying to connect to a consultant. Please verify that you and the consultant have a working internet connection.", 15)
    TCPSend($sock, "HELP")
    $a = FileOpen("help.zip", 16)
    $buffer = FileRead($a)
    FileClose($a)
    While BinaryLen($buffer)
        $a = TCPSend($sock,$buffer)
        Sleep(100)
        $buffer = BinaryMid($buffer,$a+1,BinaryLen($buffer)-$a)
    WEnd
    TrayTip("Request sent!", "Your help request has been sent to the specified IP address.", 15)
    DirRemove("help", 1)
EndFunc

Func CaptureScreen($sOutFile)
    DllCall("captdll.dll", "int:cdecl", "CaptureScreen", "str", $sOutFile, "int", 85)
EndFunc

Func FileRename($sOriginal, $sNew, $iFlag = 0)
    Local $move = FileMove($sOriginal, $sNew, $iFlag)
    If $move = 0 Then Return -1
    Return 1
EndFunc

;~ Func EmptyVar(ByRef $vVariable[0], ByRef $vVariable[1] = "", ByRef $vVariable[2] = "", ByRef $vVariable[3] = "", ByRef $vVariable[4] = "", ByRef $vVariable[5] = "", ByRef $vVariable[6] = "", ByRef $vVariable[7] = "", ByRef $vVariable[8] = "", ByRef $vVariable[9] = "", ByRef $vVariable[10] = "")
;~  Local $params
;~  If $vVariable[1] <> "" Then
;~      For $i = 0 To 10 Step 1
;~          If $vVariable[$i] <> "" Then
;~              ContinueLoop
;~          Else
;~              $params = $i
;~              ExitLoop
;~          EndIf
;~      Next
;~  Else
;~      $vVariable[0] = ""
;~  EndIf
;~ EndFunc

Func OnAutoItExit()
    TCPShutdown()
EndFunc

So, if you would like to try this out, just download the ZIP below, extract somewhere uninhabited, run the script, and press Win+H. I suggest using 127.0.0.1 as your target IP for testing, so it'll get sent right back to you, but if you would like to help out and test on something other than 127.0.0.1 (or even a local network, for that matter) please do so. This is my first foray into TCP networking via AutoIt functions, so it's probably not the best it could be.

Posted Image IT-Helper.zip (74.1K) Number of downloads: Posted Image

Some shout outs here:

  • Larry: For binary file transfer examples
  • Lazycat: Screen Capture UDF
  • eltorro: Au3Zip Plugin
For those who would like to help in a different way, I'm having a bit of trouble with writing the list of processes to a file. I've combined ProcessList() and _FileWriteFromArray(), but apparently there's something wrong with the File UDF in 3.2.6.0, because it keeps erring out. Same problem with windows, when I've used WinList and FileWriteFromArray. I got sick of this, and didn't want to mess with the UDF, so I tried doing it my own way. Well, that didn't work out either. If anyone has a brain that can think more logically than I can, please help me out with this! Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Link to comment
Share on other sites

Any comments, please?

u have alot of stuff commented out and a lot of code mistakes like :

C:\Documents and Settings\KJ\Desktop\IT-Helper\IT-Helper.au3(91,12) : ERROR: syntax error (illegal character)
     FileWrite("

C:\Documents and Settings\KJ\Desktop\IT-Helper\IT-Helper.au3(37,37) : ERROR: _ZipUnZip(): undefined function.
                 _ZipUnZip("help.zip", @ScriptDir)

and many more of the sort.

Link to comment
Share on other sites

Oh, forgot.... you need to have eltorro's ZIP plugin to make this work. It needs to be in the same folder. Hold on, I'll add it to the ZIP..

edit: It's already in the ZIP. Are you sure you have it extracted? I'm not getting any errors when I run it here at all.

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Link to comment
Share on other sites

Oh, forgot.... you need to have eltorro's ZIP plugin to make this work. It needs to be in the same folder. Hold on, I'll add it to the ZIP..

edit: It's already in the ZIP. Are you sure you have it extracted? I'm not getting any errors when I run it here at all.

i have the file but it still wont run and errors like:

C:\Documents and Settings\KJ\Desktop\IT-Helper\IT-Helper.au3(91,12) : ERROR: syntax error (illegal character)
     FileWrite("

have nothing to do with the plugin, plz recheck and repost it again, maybe u changed the code or didnt copy it correctly.

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