kpu Posted January 6, 2005 Posted January 6, 2005 (edited) Yo, I'm sure ya all have something much better then this, but here some of the stuff I've been working on. If have any changes that would make it better, I'm all ears. I haven't gotton to play with any of the GUI part of Auto It. ..working on it though. I work as a Desktop tech and found using Auto-It to automate some of the daily tasks I do to make my job easier. Here is the first little program I worked on. I'm sure you can tell what it is by looking at the code, but here's a brief description. 1. Asks for a password to run the application. (I did this to try and keep our Administrator password unknown to anyone who might find this and try and run the app.) 2. Once access granted, it will launch another script called "wait.exe" the is a Message Box with the shortcut keys on it. It's used to monitor the process of the application. 3. It will then ask you for a PC you would like to connect to. (Of course you can use NetBIOS or IP.) 4. It will then try to connect to the IPC$ as a local Administrator so you can have full access certain features. 5. By pressing the Hot Keys you can launch and connect to the PC. Such as -Regedit -C$ -MMC Console -Telnet 6. The telnet is a little different. We use XP with Novell. I wrote this so I can remotely import a PC to DNS. Since when you connect to a telnet session on a PC, you have no network authentication. You have to map a network drive to a server. Once this is done you can import the workstation. 7. I also have it setup to play some sounds when the command completes successfully or when the application exits. It will also write to a file and read from it to see if the command completed. One thing is I know I need to change the Hot Key for CTRL-C Here it is: ------------------------------------------------------------------------- ; ---------------------------------------------------------------------------- ; Script Start ; ---------------------------------------------------------------------------- ; ---------------------------------------------------------------------------- ; Hot KEYS ; ---------------------------------------------------------------------------- HotKeySet("{F8}", "clipboard") HotKeySet("{F9}", "remove") HotKeySet("^r", "reg") HotKeySet("^m", "mmc") HotKeySet("^c", "cdrive") HotKeySet("^t", "telnet") ;------------------------------------------------------------------------------ ; LOG IN PASSWORD ;------------------------------------------------------------------------------ $password = inputBox("Enter Password", "Please enter Password", "", "*", -1, 100, 300, 300) ;Cancel Button Pushed IF @error = 1 then MsgBox(0, "Sorry", "Good Bye") Exit Endif IF $password = "akm" then ; MsgBox(4096, "Thanks", "Access Granted") SoundPlay ( "C:\Program Files\kpunderground\RemoteConnect\Rifle.wav", 1 ) else MsgBox(0, "Sorry", "Access Denied") Exit EndIf ;Checking to see if the use hits the Cancel button $answer = InputBox("Question", "What PC would you like to conntect to?", "", "", -1, 200, 300,300) if @error = 1 then MsgBox(064, "Thanks", "Closing Window") exit Endif ; ---------------------------------------------------------------------------- ; Run Monitor Program ;------------------------------------------------------------------------------ Run ( "wait.exe", "C:\Program Files\kpunderground\RemoteConnect\" , ) Sleep(500) WinMove ( "Wait", "", @DesktopHeight, 0 , ) ; ---------------------------------------------------------------------------- ; RUN PROGRAM -TRY TO MAP DRIVE TO IPC$ with Administrative Priviages ;------------------------------------------------------------------------------ RunWait(@ComSpec & " /c " & "net use \\" & $answer &"\IPC$ /U:Administrator --PASSWORD HERE-- > c:\temp.txt", "", @SW_HIDE) $info = FileReadLine ("C:\temp.txt" , 1 ) ; ---------------------------------------------------------------------------- ;Check to see if the command completed Successfull ; ---------------------------------------------------------------------------- if $info = "" then MsgBox(016, "Warning", "Command Did not complete operation.","") FileDelete ( "C:\temp.txt" ) WinClose ( "Wait" , "") exit else SoundPlay ( "C:\Program Files\kpunderground\RemoteConnect\Rifle.wav", 1 ) ;MsgBox(0,"Completed SuccessFull", $info, "") FileDelete ( "C:\temp.txt" ) EndIF ;------------------------------------ ;FUNCITION KEYS: ;----------------------------------- Func clipboard() ClipPut ( $answer ) EndFunc Func remove() RunWait(@ComSpec & " /c " & "net use" & " \\" & $answer & "\IPC$ /delete", "", @SW_HIDE) SoundPlay ( "C:\Program Files\kpunderground\RemoteConnect\swirl.wav", 1 ) ;MsgBox(0,"Completed SuccessFull"," Completed Successful", "") WinClose ( "Wait" , "") Exit 0 EndFunc Func reg() Run( "Regedit.exe", "",@SW_MAXIMIZE) WinWaitActive ( "Registry Editor","",) SEND("!F") SEND("C") SEND($ANSWER) SEND("{ENTER}") EndFunc Func mmc() Run(@ComSpec & " /c " & "compmgmt.msc /s", "", @SW_HIDE) WinWaitActive ( "Computer Management" ) SEND("!A") SEND("C") SEND($ANSWER) SEND("{ENTER}") EndFunc Func cdrive() IniWrite("C:\Program Files\Kpunderground\RemoteConnect\settings.ini", "Connections", "CShare", "1") send("{LWIN}R") sleep(500) send("\\" & $answer & "\c$") SEND("{ENTER}") EndFunc Func telnet() $server = inputBox("Enter Server", "Please Type in Server You would like to connect to:" & @LF & "Server1" & @LF & "Server2" & @LF & "Server3", "", "", -1, -1, 300,300) if @error = 1 then MsgBox(064, "Thanks", "Closing Window") exit Endif ; ---------- ; Set the RunAs parameters to use local adminstrator account RunAsSet("Administrator", @computername, "--PASSWORD HERE--",0) ; Run registry editor as admin Run("cmd.exe") WinWaitActive ( "C:\WINDOWS\System32\cmd.exe", "", ) Send("telnet -a " & $answer) Send("{ENTER}") WinWaitActive ( "Telnet "& $answer, "", ) sleep(2000) send("net use * \\" & $server & "\sys /user:USERNAME--PASSWORD HERE--") Send("{ENTER}") Send("zwsreg") ; Reset user's permissions RunAsSet() EndFunc WinWaitClose ( "Wait", "", ) RunWait(@ComSpec & " /c " & "net use" & " \\" & $answer & "\IPC$ /delete", "", @SW_HIDE) SoundPlay ( "C:\Program Files\kpunderground\RemoteConnect\swirl.wav", 1 ) ;MsgBox(0,"Completed SuccessFull", $answer & " has been deleted", "") WinClose ( "Wait" , "") Edited January 6, 2005 by kpu http://www.kpunderground.com
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now