daslick Posted October 2, 2006 Posted October 2, 2006 Here is the code I have... I know it can be done better, but I have only been using autoit for 3 days now, so please bear with me. expandcollapse popupRunAsSet("Admin", @Computername, "a") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit RunAsSet("Administrator", @Computername, "a") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit RunAsSet("Administrator", @Computername, "b") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit RunAsSet("Administrator", @Computername, "c") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit RunAsSet("Administrator", @Computername, "d") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit RunAsSet("Administrator", @Computername, "e") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit RunAsSet("Administrator", @Computername, "f") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit RunAsSet("Administrator", @Computername, "g") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit RunAsSet("Administrator", @Computername, "h") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit RunAsSet("Administrator", @Computername, "i") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit RunAsSet("Administrator", @Computername, "j") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit RunAsSet("Administrator", @Computername, "k") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit RunAsSet("Administrator", @Computername, "l") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit RunAsSet("Administrator", @Computername, "m") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit RunAsSet("Administrator", @Computername, "n") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit RunAsSet("Administrator", @Computername, "o") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($text) if FileExists ("C:\Drivers\verify.tmp") Then exit I had it creating a text file so it wouldnt run a file twice, once on admin, again on administrator... That part is a little buggy, so let me know if you think of something better. I need a function that works like this _myrunfunction($myfilename) I just don't know where to start on it. Thanks in advanced for the help.
Uten Posted October 2, 2006 Posted October 2, 2006 How about: Func _myrunfunction($myfilename) RunAsSet("Admin", @Computername, "a") Run(@ComSpec & " /c " & "echo Running on the Administrator!>" & $myfilename, "", @SW_HIDE) Run($myfilename) if FileExists ("$myfilename") Then exit EndFunc I don't know what your after and sure cracking passwords can be a inspiration boost to learn programming but I don't think you should as people to help you with the task. You should rather try to isolate the problem you have and make a "legal" case of that problem. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
daslick Posted October 2, 2006 Author Posted October 2, 2006 (edited) Its not cracking passwords... I have a database of about 13 passwords at my work location, and I am creating this program to perform different functions which require admin access... so I have to account for the fact that the passwords could be any one of the 13.... It would take FOREVER to bruteforce a password in this manner. - Thanks for the function - I'll try it out.... Edited October 2, 2006 by daslick
daslick Posted October 3, 2006 Author Posted October 3, 2006 Sorry about the double post.... I've been working on the function and I'm wondering how I can fix this. Func _ra($file) RunAsSet("Admin", @Computername, "a") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($file) if FileExists ("C:\Drivers\verify.tmp") Then EndFunc else next RunAsSet("Administrator", @Computername, "b") Run(@ComSpec & " /c " & "echo Running on the Administrator!>C:\Drivers\verify.tmp", "", @SW_HIDE) Run($file) if FileExists ("C:\Drivers\verify.tmp") Then EndFunc I want it to end the function if it can create the text file using the admin account, and if it cannot, to continue through the rest of the function. Thanks for the fast help.
Uten Posted October 3, 2006 Posted October 3, 2006 Plausible scenario, I agree to that Just make sure you have the passwords stored away "safely". You could to that by crating a master password you had to give to use the application then use md5 to "encrypt" your passwords in a file (ini or registry) Done like this you don't get a headache when the executable (and or passwordfile) is lost. So stuff you have to look up in the help file is: _StringEncrypt(...): (md5 or stronger schemes are found in scripts & scraps) INIRead(...) INIWrite(...) Also: When you use Run with RunAsSet you have to make sure that Run() is running in a directory where the RunAsSet user has privileges. You don't get much of a hint for the errors you get if Run under RunAsSet fails. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
daslick Posted October 3, 2006 Author Posted October 3, 2006 (edited) After I get the core of the program working, I will take a look at encryption. But wouldn't it be very difficult to extract the passwords out of the compiled exe? Because I am not at the moment storing the passwords in any other file than the compiled script. Could someone take a look at the function I put in my last post? I think its close but I get a lot of errors I don't know how to fix. EDIT: added code below ---> Func _ra($file) RunAsSet("Admin", @Computername, "a") $reg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BISD", "verify") Run($file) if $reg = "verify" then EndFunc RunAsSet("Administrator", @Computername, "b") $reg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BISD", "verify") Run($file) if $reg = "verify" then EndFunc Edited October 3, 2006 by daslick
daslick Posted October 3, 2006 Author Posted October 3, 2006 Can someone please tell me how to rewrite this code so it works? RunAsSet("Administrator", @Computername, "pickle") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BISD", "verify", "REG_SZ", "success") Run($file) $reg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BISD", "verify") if $reg = "verify" then EndFunc The error I'm getting says I can't use endfunc after then... how do I work around that? PLEASE!!!!
lcgreenwald Posted October 3, 2006 Posted October 3, 2006 Can someone please tell me how to rewrite this code so it works? RunAsSet("Administrator", @Computername, "pickle") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BISD", "verify", "REG_SZ", "success") Run($file) $reg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BISD", "verify") if $reg = "verify" then EndFunc The error I'm getting says I can't use endfunc after then... how do I work around that? PLEASE!!!! Func _ra ($file) RunAsSet("Admin", @ComputerName, "a") $reg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BISD", "verify") Run($file) If $reg = "verify" Then Return RunAsSet("Administrator", @ComputerName, "b") $reg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BISD", "verify") Run($file) If $reg = "verify" Then Return EndFunc ;==>_ra
daslick Posted October 3, 2006 Author Posted October 3, 2006 What does Then Return do? What does it do if $reg not = "verify"? Thanks
Uten Posted October 3, 2006 Posted October 3, 2006 (edited) Then ReturnoÝ÷ Ø:³Z·*.¶.ZºÚ"µÍ[[[oÝ÷ Û .×hjëh×6 Func <name>(<args>) ; Some Code Return <value> EndFunc oÝ÷ Ø[§pIÝéÜr·µënZâ²Zµë"*.)¡÷(u殶s`¤b÷&gV÷C´FÖæ7G&F÷"gV÷C²ÂgV÷C¶"gV÷C²FVâ'VåvB6ö×7V2fײgV÷C²ô2F"ô"gV÷C²¤b÷&gV÷CµW6W#gV÷C²ÂgV÷C·6V7&WBgV÷C²FVâ'VåvB6ö×7V2fײgV÷C²ô2F"ô"gV÷C² ¤gVæ2÷&b33c·W6W"Âb33c·vB¢'Vä56WBb33c·W6W"Â6ö×WFW&æÖRÂb33c·vB¢´7&VFRFW7BfÆSð¢'Vâ6öÕ7V2fײgV÷C²ö2gV÷C²fײgV÷C¶V6ò'VæææröâFRgV÷C²fײb33c·W6W"fײgV÷C²66÷VçBb333²fwC´3¢b3#´G&fW'2b3#·fW&gçF×gV÷C²ÂgV÷C²gV÷C²Â5uôDR¢µDôDó¢6V6²f÷"W'&÷'2Föâb33·BfRFRVÇfÆRfÆ&VÂ6òG2âââࢲ&VÖVÖ&W"W6W"ÖvBæ÷BfR66W72Fò3¢b3#´G&fW'2b3#°¢bW'&÷"FVâ¢×6t&÷bÂgV÷C´U%$õ"â÷&gV÷C²ÂgV÷Cµ'Vââââ&WGW&æVBW'&÷'2gV÷C²¢&WGW&â¢VÇ6P¢&WGW&â¢VæDb¤VæDgVæ2 It's not so easy to understand what you realy want @daslick. Try to create small samples of hwat you need help with taht everybody is suposed to be able to run. Also try to search for +msgbox +return +runasset in the forums. It will give you plenty of ideas EDIT: Crap I'm not finished with this ... But my browser is living its own life at the moment. Now I'm done. Edited October 3, 2006 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
daslick Posted October 3, 2006 Author Posted October 3, 2006 ok thanks, I'll post the full code to my program soon.
daslick Posted October 4, 2006 Author Posted October 4, 2006 If someone can tell me how to fix this? [if $text not "empty" or "" then GUICtrlSetData($selectedfile, $file)] After I get that fixed with or without help I'll quickly post the au3 file.
Uten Posted October 4, 2006 Posted October 4, 2006 (edited) if NOT (($text = "empty") OR ($text = "")) then GUICtrlSetData($selectedfile, $file) Edited October 4, 2006 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
daslick Posted October 4, 2006 Author Posted October 4, 2006 I couldn't fix the browse button... maybe one of you can fix it and tell me how u did it. Thanks *file attached*Administrator_Tools2.au3
Uten Posted October 4, 2006 Posted October 4, 2006 I think your variable reference is wrong: $text = FileOpenDialog("Choose a program you want to run on the administrative account:", @DesktopDir, "Files (*.*)", 1 ) GUICtrlSetData($selectedfile, $file)oÝ÷ Ù«¢+Ø$$ÀÌØíÑáÐô¥±=Á¹¥±½ ÅÕ½Ðí ¡½½ÍÁɽɴå½ÔݹÐѼÉÕ¸½¸Ñ¡µ¥¹¥ÍÑÉÑ¥Ù½Õ¹ÐèÅÕ½Ðì°ÍѽÁ¥È°ÅÕ½Ðí¥±Ì ¨¸¨¤ÅÕ½Ðì°Ä¤($%U% ÑɱMÑÑ ÀÌØíͱѥ±°ÀÌØíÑáФ Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
daslick Posted October 4, 2006 Author Posted October 4, 2006 Yes! Got it. Thanks for all your help! Go ahead and download the attached file, replace the usernames/passwords with your admin info and test the program. Please let me know of any bugs/improvements/suggested features. Thanks!
daslick Posted October 4, 2006 Author Posted October 4, 2006 I'm trying to add a "create new admin" function. here is a sample code $username = InputBox("Add a new administrative account:", "Enter new user name:", "", "", .26*@DesktopWidth, .19*@DesktopHeight) $pass1 = InputBox("Add a new administrative account:", "Enter new password:", "", "*", .26*@DesktopWidth, .19*@DesktopHeight) $pass2 = InputBox("Add a new administrative account:", "Confirm new password:", "", "*", .26*@DesktopWidth, .19*@DesktopHeight) if $username = "" then Return if $username = "Administrator" then Return if $pass1 = "" then return if not $pass1 = $pass2 then Return _RunDos("net user" & $username $pass1 "/add") I would prefer not to use _RunDos... but either way, its not working because of the &s and "s... I don't know how (and read through the help). Could someone straighten up the _RunDos line for me? Thanks!
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