Jump to content

DarkGUNMAN

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by DarkGUNMAN

  1. I got around this problem using ControlSend: ControlSend($WindowTitle,"","[CLASS:WindowsForms10.STATIC.app.0.2004eee; INSTANCE:40]","{ENTER}")
  2. I've attempted to port a vbs script to AutoIT which decodes files using Scripting.Encoder http://www.interclasse.com/scripts/decovbe.php Here is the derived version that works: option explicit Dim F1 F1= "c:\program files\decrypt\target.vbe" Dim fso Set fso=WScript.CreateObject("Scripting.FileSystemObject") If fso.FileExists(F1) Then Dim fic,contenu Set fic = fso.OpenTextFile(F1, 1) Contenu=fic.readAll fic.close Set fic=Nothing Const TagInit="#@~^" '#@~^awQAAA== Const TagFin="==^#~@" '& chr(0) Dim DebutCode, FinCode Do FinCode=0 DebutCode=Instr(Contenu,TagInit) If DebutCode>0 Then If (Instr(DebutCode,Contenu,"==")-DebutCode)=10 Then 'If "==" follows the tag FinCode=Instr(DebutCode,Contenu,TagFin) If FinCode>0 Then Contenu=Left(Contenu,DebutCode-1) & _ Decode(Mid(Contenu,DebutCode+12,FinCode-DebutCode-12-6)) & _ Mid(Contenu,FinCode+6) End If End If End If Loop Until FinCode=0 WScript.Echo Contenu End If Set fso=Nothing Function Decode(Chaine) Dim se,i,c,j,index,ChaineTemp Dim tDecode(127) Const Combinaison="1231232332321323132311233213233211323231311231321323112331123132" Set se=WSCript.CreateObject("Scripting.Encoder") If IsObject(se) then For i=9 to 127 tDecode(i)="JLA" Next For i=9 to 127 ChaineTemp=Mid(se.EncodeScriptFile(".vbs",string(3,i),0,""),13,3) For j=1 to 3 c=Asc(Mid(ChaineTemp,j,1)) tDecode(c)=Left(tDecode(c),j-1) & chr(i) & Mid(tDecode(c),j+1) Next Next tDecode(42)=Left(tDecode(42),1) & ")" & Right(tDecode(42),1) Set se=Nothing Chaine=Replace(Replace(Chaine,"@&",chr(10)),"@#",chr(13)) Chaine=Replace(Replace(Chaine,"@*",">"),"@!","<") Chaine=Replace(Chaine,"@$","@") index=-1 For i=1 to Len(Chaine) c=asc(Mid(Chaine,i,1)) If c<128 Then index=index+1 If (c=9) or ((c>31) and (c<128)) Then If (c<>60) and (c<>62) and (c<>64) Then Chaine=Left(Chaine,i-1) & Mid(tDecode(c),Mid(Combinaison,(index mod 64)+1,1),1) & Mid(Chaine,i+1) End If End If Next Decode=Chaine End If End Function I converted the variables and functions to AutoIT comparable format: #Include <string.au3> $F1= "C:\Program Files\decrypt\target.vbe" DIM $Contenu Dim $fso $fso=ObjCreate("Scripting.FileSystemObject") If $fso.FileExists($F1) Then Dim $fic, $contenu $fic = $fso.OpenTextFile($F1, 1) $Contenu = $fic.ReadAll $fic.close $fic="" Const $TagInit="#@~^" ;'#@~^awQAAA== Const $TagFin="==^#~@" ;'& chr(0) Dim $DebutCode, $FinCode Do $FinCode=0 $DebutCode=StringInstr($Contenu,$TagInit) If $DebutCode > 0 Then If (StringInstr($Contenu,"==",0,1,$DebutCode)-$DebutCode)=10 Then ;If "==" follows the tag $FinCode=StringInstr($Contenu,$TagFin,0,1,$DebutCode) If $FinCode>0 Then $Contenu=StringLeft($Contenu,$DebutCode-1) & _ _Decode(StringMid($Contenu,$DebutCode+12,$FinCode-$DebutCode-12-6)) & _ StringMid($Contenu,$FinCode+6) EndIf EndIf EndIf Until $FinCode=0 ConsoleWrite("Contenu: "&$Contenu&@CRLF) EndIf $fso="" Func _Decode($Chaine) Dim $se,$i,$c,$j,$index,$ChaineTemp Dim $tDecode[128];~ Dim $tDecode(127) Const $Combinaison="1231232332321323132311233213233211323231311231321323112331123132" $se=ObjCreate("Scripting.Encoder") If IsObj($se) then For $i=9 to 127 $tDecode[$i]="JLA" Next For $i=9 to 127 $ChaineTemp=StringMid($se.EncodeScriptFile(".vbs", _StringRepeat(3,$i),0,""),13,3) For $j=1 to 3 $c=Asc(StringMid($ChaineTemp,$j,1)) $tDecode[$c]=StringLeft($tDecode[$c],$j-1) & chr($i) & StringMid($tDecode[$c],$j+1) Next Next $tDecode[42]=StringLeft($tDecode[42],1) & ")" & StringRight($tDecode[42],1) $se="" $Chaine=StringReplace(StringReplace($Chaine,"@&",chr(10)),"@#",chr(13)) $Chaine=StringReplace(StringReplace($Chaine,"@*",">"),"@!","<") $Chaine=StringReplace($Chaine,"@$","@") $index=-1 For $i=1 to StringLen($Chaine) $c=asc(StringMid($Chaine,$i,1)) If $c<128 Then $index=$index+1 If ($c=9) or (($c>31) and ($c<128)) Then If ($c<>60) and ($c<>62) and ($c<>64) Then $Chaine=StringLeft($Chaine,$i-1) & StringMid($tDecode[$c], StringMid($Combinaison, Mod($index,64)+1,1), 1) & StringMid($Chaine,$i+1) EndIf EndIf Next Return $Chaine Endif EndFunc Obviously I cannot show the decoded text from the vbs version, but for some reason I don't understand, the output of the AutoIT version comes out as JLA throughout, replacing all the text. It does match the number of characters per line though. Could anyone help shed light on where it it going wrong?
  3. This is on old post but I thought i'd add my take on this - the attached .zip contains 2 .properties files (vb.properties and vb.keywords.properties), and an updated .api file (vb.api). The colour scheme is as close to AutoIt as I could get without having a new lexer written. vb.zip
  4. I needed a reliable way of getting information (RAM, DiskSize, FreeSpace) from a Remote machine without WMI installed, and I've enjoyed the challenge of finding out how to get the majority of information I need the old fashioned way >_<
  5. I know this post is ancient, but I've been trying to get this value for a while Here's what I came up with after a great deal of research/internet trawling... ;Use REG command because RegRead cannot handle REG_RESOURCE_LIST values ;Grab last 8 characters, strip spaces from end of string $Memory = StringRight(StringStripWS(_RunCommand("REG QUERY ""HKLM\HARDWARE\RESOURCEMAP\System Resources\Physical Memory"" /v .Translated"),2),8) ;Convert to Decimal( Trim to Hex value ) *Multiply Dim $RAM[5] $RAM[0] = Dec(StringTrimLeft ($Memory,6)) *16777216 $RAM[1] = Dec(StringTrimRight(StringTrimLeft($Memory,4),2)) *65536 $RAM[2] = Dec(StringTrimRight(StringTrimLeft($Memory,2),4)) *256 $RAM[3] = Dec(StringTrimRight ($Memory,6)) $RAM[4] = $RAM[0]+$RAM[1]+$RAM[2]+$RAM[3] ;Added values = RAM in BYTES MsgBox(0,"",$RAM[0]&" "&$RAM[1]&" "&$RAM[2]&" "&$RAM[3]& @CRLF&@CRLF&_StringConvertBytes($RAM[4])) ;Run DOS command, Output to StdOut Func _RunCommand($Command, $Username1="",$Password1="") Local $CommandRun, $CommandOutput ConsoleWrite("---------------"&@CRLF&"Command:"&@CRLF&$Command&@CRLF) If $Username1 <> "" And $Password1 <> "" Then $CommandRun = RunAs($Username1,"AD",$Password1,0,@ComSpec&" /c "&$Command, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Else $CommandRun = Run(@ComSpec&" /c "&$Command, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) EndIf $CommandOutput = '' While 1 $line = StdoutRead($CommandRun) If $Line = "" Then $line = StderrRead($CommandRun) If @error Then ExitLoop If $line <> '' Then $CommandOutput &= $line Wend ConsoleWrite("Returned:"&@CRLF&$CommandOutput&@CRLF&"----------------") Return $CommandOutput EndFunc ;Convert String value to kb, mb, gb etc Func _StringConvertBytes($bytes,$rounding = 2, $outputstring = True) Local $array[3] Select Case $bytes < 2^10 ;bytes $array[0] = $bytes $array[1] = "bytes" $array[2] = "bytes" Case $bytes >= 2^10 and $bytes < 2^20 ;kilobytes $array[0] = Round($bytes/2^10,$rounding) $array[1] = "kilobytes" $array[2] = "Kb" Case $bytes >= 2^20 and $bytes < 2^30 ;megabytes $array[0] = Round($bytes/2^20,$rounding) $array[1] = "megabytes" $array[2] = "Mb" Case $bytes >= 2^30 and $bytes < 2^40 ;gigabytes $array[0] = Round($bytes/2^30,$rounding) $array[1] = "gigabytes" $array[2] = "Gb" Case $bytes >= 2^40 and $bytes < 2^50 ;terabytes $array[0] = Round($bytes/2^40,$rounding) $array[1] = "terabytes" $array[2] = "Tb" Case $bytes >= 2^50 and $bytes < 2^60 ;petabytes $array[0] = Round($bytes/2^50,$rounding) $array[1] = "petabytes" $array[2] = "Pb" Case $bytes >= 2^60 and $bytes < 2^70 ;exabytes $array[0] = Round($bytes/2^60,$rounding) $array[1] = "exabytes" $array[2] = "Eb" Case $bytes >= 2^70 and $bytes < 2^80 ;zettabytes $array[0] = Round($bytes/ 2^70,$rounding) $array[1] = "zettabytes" $array[2] = "Zb" Case $bytes >= 2^80 ;yottabytes $array[0] = Round($bytes/ 2^80,$rounding) $array[1] = "yottabytes" $array[2] = "Yb" EndSelect If $outputstring then Return $array[0] & " " & $array[2] Else Return $array EndIf EndFunc ;==>_StringConvertBytes
  6. Ok.. took some relentless tweaking and testing but I think i got it. Here's a copy of the code with a test preview window.(This is what i came up with before I had a chance to read your replies ) #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 1349, 996, 193, 115) $Label1 = GUICtrlCreateLabel("Label1", 10, 10, 1341, 1002) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch $Text = ControlGetText("Outlook","","RichEdit20W7") ;Get content of Preview Pane when viewing Text or RTF $TextCheck = StringRegExp($Text,'\(\d\d/\d\d/\d\d') ;Look for old text mail separator (Sender name (Date)) If $TextCheck = 1 Then $Type = "Text" $TestSearch = StringRegExp($Text,'((.*\n){1,25}).*\(\d\d/\d\d/\d\d',1) If $TestSearch <> 0 Then $Type = "Text RegEx" $Text = $TestSearch[0] EndIf ;Display message as is, or RegEx to find RTF mail separator (_) ElseIf $Text <> "" Then $Type = "RTF/Text" $TestSearch = StringRegExp($Text,'((.*\n){1,25})_',1) If $TestSearch <> 0 Then $Text = $TestSearch[0] $Type = "RTF RegEx" EndIf EndIf ;Get content of Preview Pane when viewing HTML message $HTMLControlHandle = ControlGetHandle("Outlook","","Internet Explorer_Server1") If $HTMLControlHandle <> "" Then $HTML = __IEControlGetObjFromHWND($HTMLControlHandle) $Text = _IEBodyReadText($HTML) $Type = "HTML" ;Display message as is, or RegEx to find HTML mail separator (From:) $TestSearch = StringRegExp($Text,'((.*\n){1,25})From:',1) If $TestSearch <> 0 Then $Type = "HTML RegEx" $Text = $TestSearch[0] EndIf EndIf ;Update Test window with message content GUICtrlSetData($Label1, $Type &@CRLF&@CRLF&$Text) Sleep(1000) WEnd The Outlook Preview Pane changes the name of the control when viewing RTF/Text or HTML dependant on the content. Once the HTML is viewable from _IEBodyReadText, the normal mail separator (_) doesn't appear through so I had to find another (From:) The expression was working, ((.*\n){1,25}) but I realised I needed to limit how far into the message it should go, between 1-25 lines is typical of a reply. afterwards to was a case of tweaking the detection of the mail separators. @GEOSoft, Tried the code you supplied - works a charm except on Text mails. Changed it to use \(\d\d/\d\d/\d\d and it's now working.. Thanks! Reading it as i see it, you use (?i)(?s) as modifiers to ignore case and include all characters before using (.*) to capture all characters (?:[\r\n] tells the expression to look for but not include return\new line, [[:punct:]{5,}]) means not to include any letters or digits, which can means a range of separators are covered. Don't know why > is not one of them @SmOke_N, I'm doing my best to get my head around RegEx but it's a long way off before i'm fluent.. don't know my way around COM objects in any respect yet, so if there's a more elegant solution i'm interested in learning how it's done
  7. Thats correct. Just need to extract the last reply just down the mail separator, and ignore the rest of the mail. CODEText of the last reply -------------------------------------------------------------------------------- From:whoever This expression ((.*\n)*)_) will work most of the time I can adapt the expression using | (or) to detect different mail separators, it's just getting the initial text in it's own that it proving difficult... Adapting it to ((.*\n)*)>) so that it is supposed to capture only to the separator > didn't work - it included the entire mail. Neither did ((.*\n)*\n\n\n) working, as it isn't stopping when there is a 3 blank line separator.
  8. Thanks for the reply. Gave it a try - it strips out the extra lines and spaces, but the body of the previous messages remain. Curious to see your previous e-mail utility - hopefully it can do the job! I need to create a RegEx which will read the text down to the separator ( _ , > , [3 blank lines] From:) and ignore/strip the rest. Not sure where i'm going wrong on what i have done so far... SmOke_N anywhere to be found?
  9. I'm writing a small script to read e-mails from the reading pane in Outlook 2003. So far I've got it to read the standard rtf messages, asciii text messages, and capture the text from html messages using _IEBodyReadText. Now comes the tricky part... I'm trying to use RegEx to read only the current reply and not include the previous mail history. So far my expression looks like this: ((Look for all characters and new lines)Repeat. Look for _ mail separator) ((.*/n)*_) In most cases it will skip the previous reply and include the mail previous to it. When I've modified ti to search for > separators in ascii text mails, it includes the entire mail. As for html mesaages - after it has been imported the _ separators are stripped out. The only separator i can see is 3 new lines then From: Am in on the right track here or am i barking up the wrong tree?
  10. Hi Stefan, thanks for the reply. Didn't know about that particular WMI command, but thanks for posting it as it might be useful later - can't use it here as it requires credentials. The NBTStat command is useful in returning the information i need without using credentials, it's not something i can use in an AutoIt script to return a domain value. [Edit: The wonders of searching the forum showed me a way to do this - thanks for the clue] That said - having read about it but not knowing the command sent to the dll, is there any way to do this in a similar way to _TCPIpToName through dll calls?
  11. I've made a little front-end for VNC which has input for credentials and the domain and the IP/Hostname. However, since we are migrating from several domains to one AD, I can't be sure which domain the PC is in it fi try and connect. Looking at the way you can browse a network manually through explorer and find PC in a domain without inputting any credentials, is there any way to do this through functions in AutoIT by entering a hostname or IP, and returning the domain the it is attached to? I'm guessing it is possible through the WinNet functions, but I don't know my way around them. Any help would be greatly appreciated!
  12. Hi! I'm happy to admit I'm a newbie when it comes to handling menus.. following this simple code is hard enough but I'm trying to get my head around it.. with little success so far. Is there anyone who knows more about this who is willing to break it down a bit so I can see how the menu is created, and how executables are called? How would I go about modifying this to run a set of functions instead of .exe lines. I'm also trying to figure out how to create submenus to group these functions. Cut a long story short, I've a lot of functions for controlling a program running from a third party popup menu utility, and I'd like to bring them all into one script. which i can customize myself, the main stumbling block is learning how to code the popup menu and hotkey. Any help with this would be greatly appreciated!
  13. AHA! Thank you for your help > take the date, add 7 days then remove the ISO day number = works out the monday date. One of those things where you can't see the forest for the trees. Thanks again!
  14. Hi! This is my first post in this forum. I've been learining AutoIT gradually for the past 4 months writing automation scripts, one with a GUI for remote suppot. Now I've hit my first problem which i can't work out from the help files.... Our helpdesk system is a bit of a pain in the jacksee, so to make the job a bit easier when suspending a call I automated part of it in a script. Now I want to make it a bit more dynamic by getting the date of Monday on the following week. I'm guessing it's along the lines of working out the week number based on the current date/time then getting the following Monday's date by advancing the week number, but the date functions are still giving me headaches. Anyone with a greater knowledge of the date functions able to help me out here? Thank you in advance.
×
×
  • Create New...