Leaderboard
Popular Content
Showing content with the highest reputation on 02/10/2025 in all areas
-
Another bitmap brute-forcing thread
argumentum reacted to Hashim for a topic
Yeah, the tough part was trying to find the right pixel in such a small space but knowing that I only needed to find the right Y axis helped massively and I managed to get this working shortly after. I can confirm it works perfectly, is much faster than expected and even slightly more accurate than Werty's solution: 000000,34.7907 elapsed 000001,33.5822 elapsed 000002,21.6923 elapsed 000003,22.1064 elapsed 000004,22.1113 elapsed 000005,36.8183 elapsed 000006,23.241 elapsed 000007,40.3301 elapsed 000008,35.89 elapsed 000009,37.0641 elapsed 000010,21.9951 elapsed 000011,21.4196 elapsed 000012,38.3739 elapsed 000013,37.8921 elapsed 000014,38.5466 elapsed 000015,36.1872 elapsed 000016,21.8126 elapsed 000017,36.5059 elapsed 000018,21.8542 elapsed 000019,21.7613 elapsed 000020,37.61 elapsed 000021,22.2271 elapsed 000022,36.4784 elapsed 000023,24.7719 elapsed 000024,35.9157 elapsed 000025,36.2146 elapsed 000026,37.1957 elapsed 000027,20.4105 elapsed 000028,20.3534 elapsed 000029,22.0913 elapsed 000030,22.3388 elapsed Thanks so much! Once again the absolute genius of this solution - how fast it is and how concise, with only marginally less accuracy than other solutions - never fails to blow my mind. Just the startup times are double the speed of the screen-scraping method's average run, and after that it gets ridiculously fast: 000000,17.3893 elapsed 000001,19.3955 elapsed 000002,4.952 elapsed 000003,5.7421 elapsed 000004,4.4015 elapsed 000005,4.6038 elapsed 000006,4.3785 elapsed 000007,4.8244 elapsed 000008,4.9788 elapsed 000009,5.0533 elapsed 000010,4.2012 elapsed 000011,4.3916 elapsed 000012,5.0254 elapsed 000013,5.2419 elapsed 000014,4.2951 elapsed 000015,4.4227 elapsed 000016,4.804 elapsed 000017,4.9286 elapsed 000018,3.9473 elapsed 000019,4.7 elapsed 000020,5.8118 elapsed 000021,19.3781 elapsed 000022,4.6165 elapsed 000023,4.7874 elapsed 000024,5.0672 elapsed 000025,4.9123 elapsed 000026,4.8596 elapsed 000027,5.0079 elapsed 000028,4.6646 elapsed 000029,5.0613 elapsed 000030,4.5557 elapsed I did have to fix a similar memory/performance bug as the one I came across in ioa747's script, but once I cleaned up all remaining resources it works perfectly on the entire input range. Thank you, I appreciate yours and Argumentum's explanations and comments a lot. I don't have the time to read through and absorb them right now but if and when I ever do I'm sure I'll find them very useful. @Werty @Nine @junkew@argumentum Thanks to all of you, please send me your PayPal/BMAC links so I can send you those drinks you deserve.1 point -
GUI forms with background images not showing when run from compiled EXE
SOLVE-SMART reacted to Nine for a topic
Your GUI create is wrong. Try this : Global $Form_Intro = GUICreate("Intro form", 463, 266, -1, -1, $WS_POPUP, $WS_EX_TOOLWINDOW)1 point -
Hi all, I just wanted to write about the current WIP release and future extension plans. For the 1.8 release: For anyone interested in the new DocBlock format, I've implemented support for @link tags, both as a stand alone tag and inline tag. I also plan to implement syntax highlighting for both DockBlock format and the legacy UDF format. I've been busy working on issues with the parser and auto-generated typescript types. This is, and my AutoIt3 parser in AutoIt3 project are the reason for the slow release of 1.8. When i resolve the last issues with type generation, i will finish and release 1.8! 🙂 For future releases: The function signature helper for parameters in functions is currently too flaky for me, and i will spend time to try and improve the experience. I will look into partial code AST object updates with the parser. I am not 100% sure how well i will be able to implement it, but i hope to improve performance when working in big script files. I want to add a static typing to functions and variables. Type hinting or casting will be supported via a new comment syntax. Built-in functions and variables will be supported right away, when typing resolution is released. This should help with general development and allow warnings with for example, when doing implicit variable type casting via operators. I also want to implement a formatter/linter. For now, the plan is to add it to this extension, but may end up being it's own thing, depending on configuration complexity and performance overhead. Also, completion suggestions for DllStruct object members. DllStruct's (and maybe some COM objects) will be analyzed and allow completion suggestions and errors for use of non existing members. This MAY also include Map and Array objects, but it is unclear how easy it will be to infer size and members of those. And finally for now, syntax highlighting and attempted analysis of strings given to Eval, Execute and Assign. I cannot guarantee all will be implemented. Most will be exploratory implementations when the time comes, but hopefully it will result in the best editor experience i can offer!1 point
-
I am not in any rush here as I have already published a new Beta for SciTE4AutoIt3 containing all stuff I mentioned here. After a short period in which people can comment on that Beta, I will release it and then go into hiding for a month. 😅 The reason for starting a discussion here is to see whether there is anything I could do in the current packages used by the extensions in VSCode, and was curious about people's opinions what the "best" extension is to use. Couple of things I have been wondering since using VSCode & the Damien version for the AutoIt3 extension are: Is there a reason not having shortcuts for Tidy / Au3Stripper? $VARIABLES & @MACROs aren't shown with a different color. Any reason for that or did I miss something? Is there any logic in the extension to fix some of the auto indent quirks, or is everybody just livening with it? (I know all about them having messed with the LUA code for that and still not have it perfect) Jos1 point
-
Verify Username and Email Address
SOLVE-SMART reacted to seadoggie01 for a topic
My final code looks something like this: Get-MgUser -Filter "UserPrincipalName eq '<UserName>@<DN>.net'" -Property "proxyAddresses" | Select-Object -ExpandProperty ProxyAddresses This returns a list of (mostly) email addresses. The one prefixed with a capitalized SMTP is the primary email and others with lowercased smtp are proxy emails. My results have other protocols that I'll ignore (prefixed with things other than SMTP). The proxyAddresses and other user properties are documented here: user resource type - Microsoft Graph v1.0 | Microsoft Learn Thank you Solve-Smart and Subz for pointing me in the right direction!1 point -
WebDriver UDF - Send keyboard command (CTRL+V) through _WD_Action
Nine reacted to SOLVE-SMART for a topic
Okay. It would be interesting what was not working exactly, but I see @Nines approach was helpful enough, so all good. Nines answer was exactly what you was looking for "sending" ctrl+v by the WebDriver protocol ... I understood this now 😅 . My approach was looking for simply pasting the formated string to the element which is probably not feasable (that's why I wrote "not tested") in this way. I will test it - just to learn about it. Best regards Sven1 point -
AutoIt parser in AutoIt
SOLVE-SMART reacted to genius257 for a topic
Just an update regarding performance. This parser is slower than i want, but from my own testing, it seems the biggest problem is how AutoIt works with Arrays and Maps. It seems AutoIt always copies arrays and maps when re-assigning to another variable and/or returning from a function. I have compared my parser to the one hand made by @Mat (https://github.com/MattDiesel/Ault) and my parser seems at least is 100x slower. Due to how the expected behavior of pegjs/peggy grammars work, i cannot use the same trick of defining one big array that never copied (unless number of branches reaches the array limit, and it will then redim +100 elements) and passed via ByRef. I have plans on making an executor, with som JIT asm creation, that MIGHT help me solve this the long way around at some point, but for now it seems the performance is stuck with the current implementation. I still plan on continuing with my current implementation, simply to allow both JS and au3 parsing to work identically. Edit: When testing big, i parse the parser itself. On my machine it takes ~11minutes and takes up ~2.6GB of ram 😵 So just to be clear, 11minutes is not acceptable to me, but as stated above I'll stick with this approach anyway.1 point -
AutoIt parser in AutoIt
SOLVE-SMART reacted to genius257 for a topic
Hi @IronFine , It's for debugging: I use execute for dynamic function calls. When an syntax error occurs, no error information is given. Calling Execute within an Execute execution, allows AutoIt3 to report errors again. During my testing it seems to have no tangible performance impact, so I've left it in for now1 point -
OK, thanks for looking at this. It turns out there are several issues that somewhat masked what was happening... First, the original script exhibiting the issue is quite a lot larger than the test script I posted, and it obtains the path (either a directory or a single file) from the clipboard. Next, it turns out that the path names with the special characters exhibit different character codes when the path goes through the clipboard from when they are obtained using _FileListToArrayRec(). This was confusing. In order to simplify the script for posting here, I used InputBox but then I was having to use the "Copy as path" and paste it into the InputBox, but that was encapsulating the path in quote marks which were being passed into the rename() function and then FileExists() said it didn't exist. Finally, as I mentioned earlier, I thought that FileMove() was returning 0 (failure) even when the renaming worked. It was my error, I was looking at @error instead of the return value. So I while I was monitoring @error it appeared to be failing but actually it was doing the rename. I was checking file attributes and permissions, all which turned out to be irrelevant, but while doing that I found that FileSetAttribute() was failing, but it wasn't the issue anyway. So, the edited original script is now working (now that I understand what is going on). And AutoIt3 is handling the path names correctly. I just wish people wouldn't use all the fancy characters and encodings! Thanks again for your help. You know what its like when stuff that worked on an old machine fails on a new machine and you think its a real problem, but when you start discussing it with others, you end up fixing your own problem.1 point
-
AutoIt parser in AutoIt
ValentinM reacted to SOLVE-SMART for a topic
Please don't. Please do not apologize for your great work. Yes it does not work in the first place, but to me it does not matter that much. What matters, and this is the point what I appriciate the most, your answers, your code and your explanations (here or on GitHub) makes me a better programmer and lead me to learn new things. I will test the new parser example tomorrow (or in the next days) and will let you know about possible questions etc 🤝 . Best regards Sven1 point -
Some demo maybe that helps in understanding. you need 1-9.png in downloads\examples or modify script It will show all the numbers on your screen It will snapshot each digit as binary and present it as string (one character per pixel) in a matrix layout A binary snapshot will just be a sequence of bytes in memory (its actually not a matrix with an x,y position like humans recognize) So once you have a sequence for each digit 0-9 you have to teach the system what differentiates a 0 from a 1 and others. When a binarystring is converted to a regular string it doubles in size and has 0x as a prefix in the string. After its a string you can do any stringmanipulation you like PixelGetColor seems just not fast enough to recognise PixelCheckSum I would have expected to work but seems to be miscalculating or more pixels in checksum then needed. Its not recognizing but as you can see the matrix for each digit it should be relatively easy to know why a 5 and 7 look similar on certain lines. #include <GDIPlus.au3> #include <WinAPI.au3> #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <ScreenCapture.au3> dim $bmpData, $w, $h, $s dim $pic[10],$BitmapFilename, $hImage, $Bmp ; Initialize GDI+ library _GDIPlus_Startup() #Region ### START Koda GUI section ### Form= $frmCompare = GUICreate("Another bitmap brute-forcing thread", 1024, 768, 193, 125) for $picId=0 to 9 $BitmapFilename = @UserProfileDir & "\downloads\examples\" & string($picId) & ".png" $pBitmap = _GDIPlus_BitmapCreateFromFile($BitmapFilename) $hImage=_GDIPlus_ImageLoadFromFile($BitmapFilename) $Bmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) ;~ $hBitmap = _GDIPlus_ImageLoadFromFile($BMPFile) ;~ ConsoleWrite("Bitmap Width: " & _GDIPlus_ImageGetWidth($pBitmap) & @CRLF ) ;~ ConsoleWrite("Bitmap Height: " & _GDIPlus_ImageGetHeight($pBitmap) & @CRLF) $Pic[$picId] = GUICtrlCreatePic("", 32, 24+($picId*60), 100, 100, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) _WinAPI_DeleteObject(GUICtrlSendMsg($Pic[$picId], $STM_SETIMAGE, $iMAGE_BITMAP, $Bmp)) Next $editBox = GuiCtrlCreateEdit("Analytics box", 250,14,700,750) GUICtrlSetFont($editBox, 8, 100, 0, "Courier New") $Button1 = GUICtrlCreateButton("Analyse", 104, 700, 75, 25, 0) $Button2 = GUICtrlCreateButton("Button2", 104, 730, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $picIdWidth=100 $picIdHeight=100 $picIdX=0 $picIdY=0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _GDIPlus_Shutdown() Exit Case $Button1 analyse() Case $Button2 EndSwitch WEnd func analyse() WinActivate($frmCompare) Local $wPos = WinGetPos($frmCompare) ;~ $aArray[0] = X position $aArray[1] = Y position $aArray[2] = Width $aArray[3] = Height Local $aClientSize = WinGetClientSize($frmCompare) ;~ $aArray[0] = Width of window's client area $aArray[1] = Height of window's client area Local $cLeft= ($wpos[2]-$aClientSize[0])/2 Local $cTop= ($wPos[3]-$aClientSize[1])-2 Local $bytesPerDigit = 1 ;~ could be 1 or 2 or 3 bytes for $picId=0 to 9 Local $cPos = ControlGetPos ( $frmCompare, "", $pic[$picId] ) ;~ $aArray[0] = X position ;~ $aArray[1] = Y position ;~ $aArray[2] = Width ;~ $aArray[3] = Height ;~ ;~ $tLeft, $tRight, $tTop, $tBottom, $color = 0xFF, $PenWidth = 1 ;~ _Screen_DrawRect($wpos[0]+$cLeft+$cPos[0],$wPos[0]+$cPos[0] + $cPos[2], $wPos[1] + $cTop +$cPos[1], $wPos[1] + $cTop + $cPos[1] + $cPos[3]) ;~ for $charId=1 to 1 for $charId=0 to 5 local $charWidth=29 local $leftMatrix=($charId*$charWidth)+$wpos[0]+$cLeft+$cPos[0] local $rightMatrix=$charWidth+($charId*$charWidth)+$wPos[0]+$cLeft+$cPos[0] local $topMatrix= $wPos[1] + $cTop +$cPos[1] + 10 local $bottomMatrix=$wPos[1] + $cTop + $cPos[1] + $cPos[3] -2 -11 local $x, $y Local $bytesForDigit="", $widthMatrix=0, $heightMatrix=0, $stride=0 ;~ Func GetImageDataFromScreen($left, $right, $top, $bottom, byref $BMPDataStart, byref $Width, byRef $Height, byref $Stride, $picIdmgBytes=3) GetImageDataFromScreen($leftMatrix, $topMatrix, $rightMatrix, $bottomMatrix, $bytesForDigit, $widthMatrix, $heightMatrix, $stride, $bytesPerDigit) ;~ consolewrite(BinaryLen($bytesForDigit) & " " & stringlen($bytesForDigit) & " " & $widthMatrix & "-" & $heightMatrix & "-" & $stride &@CRLF) local $textoutput= " 0 1 2 3 4 5 6 7 8 " & @CRLF $textoutput&=" 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" & @CRLF ;~ strip 0x ;~ consolewrite(stringleft(string($bytesForDigit),20)) local $stringForDigit=stringmid(string($bytesForDigit),4) ;~ consolewrite(binarylen($bytesforDigit) & "-" & stringlen($stringforDigit)) ;~ consolewrite($bytesForDigit & @crlf) ;~ consolewrite($stringForDigit & @CRLF) local $stringLine1=stringRegExpReplace($stringForDigit,"((0+2A)|(22))","") local $count1=@extended $stringline1=stringreplace($stringLine1,"0","") local $checksum=@extended-$count1 $stringline1=stringreplace($stringLine1,"222222","") $checksum+=@extended $checksum=$checksum+stringlen($stringline1) local $num=" " if ($checksum=636) or ($checksum=653) then $num=0 if ($checksum=719) then $num=1 if ($checksum=674) then $num=2 if ($checksum=661) then $num=3 if ($checksum=666) then $num=4 if ($checksum=650) then $num=5 if ($checksum=699) or ($checksum=716) then $num=6 if ($checksum=732) or ($checksum=734) then $num=7 if ($checksum=655) then $num=8 if ($checksum=659) or ($checksum=676) then $num=9 consolewrite($num) ;~ consolewrite("-" & $checksum & "-" & $stringLine1 & @CRLF) ;~ $stringLine1=StringRegExpReplace($stringLine1,"[1-9A-Za-z]+","1") ;~ For $picIdLine = 0 To $heightMatrix-1 step 2 For $picIdLine = 0 To $heightMatrix-1 ;~ From the screenshots we can ignore the first 16 bytes (remember in text its 2 characters ;~ $binaryLine=BinaryMid($bmp1Data,($picId*$BMP1LineWidth)+16,$BMP1LineWidth) ;~ and we only need 4 digits which takes about 28 characters and 1 character separator = local $stringLine=stringMid($stringForDigit,($picIdLine * ($stride * 2))+1,($stride*2)-3) ;~ Lets make it readable $stringLine=StringReplace($stringLine,"0",".") ;~ $stringLine=StringRegExpReplace($stringLine,"[0]+",".") ;~ $stringLine=StringRegExpReplace($stringLine,"[1-9A-Za-z]+","1") ;~ $stringLine=StringRegExpReplace($stringLine,"1+","x") $textoutput&=stringformat("%02i",$picIdLine) & " : " & $stringLine & @CRLF next ControlSetText("","",$editBox,$textOutput) ;~ Not working propertly? ;~ local $checkSum=PixelChecksum($leftMatrix, $rightMatrix , $topMatrix, $bottomMatrix, 1, 0 ,1) ;~ consolewrite($checksum & " - ") ;~ Minus two just as it influences the next screenshot _Screen_DrawRect( $leftMatrix, $rightMatrix-4 , $topMatrix, $bottomMatrix) ;~ if ($charId=1) then ;~ MsgBox($MB_SYSTEMMODAL, "Title", "This message box will timeout after 10 seconds or select the OK button.", 10) ;~ EndIf SLEEP (100) Next consolewrite(@crlf) Next EndFunc Func GetImageDataFromScreen($left, $top, $right, $bottom, byref $BMPDataStart, byref $Width, byRef $Height, byref $Stride, $picIdmgBytes=3) local $Scan0, $pixelData, $hbScreen, $pBitmap, $pBitmapCap, $handle, $bitMapdata, $pixelFormat ; Capture screen to load the bitmap to search in ;~ _ScreenCapture_Capture(@UserProfileDir & "\downloads\examples\test.png",$left, $top, $right, $bottom,False) ;~ _ScreenCapture_Capture("",$left, $top, $right, $bottom,False) $hbScreen=_ScreenCapture_Capture("",$left, $top, $right, $bottom,False) local $pBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hbScreen); returns memory bitmap _WinAPI_DeleteObject($hbScreen) ;release GDI bitmap resource because not needed anymore ;~ Local $pBitmap= _GDIPlus_ImageResize($hBitmap, 16, 16) ;resize image ;~ Local $pBitmap= _GDIPlus_ImageScale($hBitmap, 0.5, 0.5) ;resize image ;Get $tagGDIPBITMAPDATA structure ;~ ConsoleWrite("Bitmap Width: " & _GDIPlus_ImageGetWidth($pBitmap) & @CRLF ) ;~ ConsoleWrite("Bitmap Height: " & _GDIPlus_ImageGetHeight($pBitmap) & @CRLF) ;~ 24 bits (3 bytes) or 16 bits (2 bytes) comparison if ($picIdmgBytes=1) then $BitmapData= _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $GDIP_PXF04INDEXED) Endif if ($picIdmgBytes=2) then $BitmapData= _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $GDIP_PXF16RGB555) ;~ $BitmapData= _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $GDIP_PXF32ARGB) EndIf if ($picIdmgBytes=3) then $BitmapData= _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $GDIP_PXF24RGB) ;~ $BitmapData= _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $GDIP_PXF32ARGB) endIf If @ERROR Then MsgBox(0,"","Error locking region " & @error) $Stride = DllStructGetData($BitmapData, "Stride");Stride - Offset, in bytes, between consecutive scan lines of the bitmap. If the stride is positive, the bitmap is top-down. If the stride is negative, the bitmap is bottom-up. $Width = DllStructGetData($BitmapData, "Width");Image width - Number of pixels in one scan line of the bitmap. $Height = DllStructGetData($BitmapData, "Height");Image height - Number of scan lines in the bitmap. $PixelFormat = DllStructGetData($BitmapData, "PixelFormat");Pixel format - Integer that specifies the pixel format of the bitmap $Scan0 = DllStructGetData($BitmapData, "Scan0");Scan0 - Pointer to the first (index 0) scan line of the bitmap. $pixelData = DllStructCreate("ubyte lData[" & (abs($Stride) * $Height-1) & "]", $Scan0) $BMPDataStart = $BMPDataStart & DllStructGetData($pixeldata,"lData") _GDIPlus_BitmapUnlockBits($pBitmap, $BitmapData) _GDIPlus_ImageDispose ($pBitmap) _WinAPI_DeleteObject ($pBitmap) _WinAPI_DeleteObject ($hbScreen) EndFunc;==>GetImage ; Draw rectangle on screen. Func _Screen_DrawRect($tLeft, $tRight, $tTop, $tBottom, $color = 0xFF, $PenWidth = 1) Local $hDC, $hPen, $obj_orig, $x1, $x2, $y1, $y2 $x1 = $tLeft $x2 = $tRight $y1 = $tTop $y2 = $tBottom $hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop) $hPen = _WinAPI_CreatePen($PS_SOLID, $PenWidth, $color) $obj_orig = _WinAPI_SelectObject($hDC, $hPen) _WinAPI_DrawLine($hDC, $x1, $y1, $x2, $y1) ; horizontal to right _WinAPI_DrawLine($hDC, $x2, $y1, $x2, $y2) ; vertical down on right _WinAPI_DrawLine($hDC, $x2, $y2, $x1, $y2) ; horizontal to left right _WinAPI_DrawLine($hDC, $x1, $y2, $x1, $y1) ; vertical up on left ; clear resources _WinAPI_SelectObject($hDC, $obj_orig) _WinAPI_DeleteObject($hPen) _WinAPI_ReleaseDC(0, $hDC) EndFunc ;==>_UIA_DrawRect1 point
-
@Hashim Some try to give you more understanding ChatGpt was not a misunderstanding just a different approach: https://dorik.com/blog/how-to-use-chatgpt-api but lets assume nobody has done this from AutoIt. There are different approaches to "read" from a screen Have access to the sourcecode or internals of the program (probably Delphi) and based on that you can define your strategy Intercept Win32 API calls like drawtext (win 32 hooks) Check the default functions like ControlGetText see Faq 31,34,40 and helpfile. Take the more difficult route pixelmanipulation (with GDI32 functions) @Nine has made a nice library for that which he used on above answer Use OCR and AI tools like ChatGPT API: https://dorik.com/blog/how-to-use-chatgpt-api ..... Looking at the thread(s) and screenshots approach 4 looks the most realistic one 😉 The theory around this you can learn here (and google offcourse) bitblt: https://en.wikipedia.org/wiki/Bit_blit bitmap: https://en.wikipedia.org/wiki/Bitmap You should start with: https://www.autoitscript.com/autoit3/docs/functions/PixelGetColor.htm https://www.autoitscript.com/autoit3/docs/functions/PixelChecksum.htm your constants misunderstanding That was for a 3 digit approach to identify the matrix where your digits are. You shared pictures of 176 width and 56 height and we have to guess where they are on the screen. How did you make the screenshots of the numbers? by hand? automated? In your previous thread with 3 digits it was TTabsheet1 Share a full screenshot of the application that can help Share information when you hover over the application with au3inf or other spy tools. Based on what you shared before it looks like a delphi application The matrix The bitblt function takes an x,y and height, width to create a matrix of pixels. Based on that height and width you get the magic constants like 680. We can only assume with 4 digits of 176 width and 56 height that 4*176=704 width in pixels total matrix and if a pixel takes 2 bytes you come to 1 line of 2816. Then this can be hard to read but basically says look at the (First) line 7 times and do a calculation For $loop = 1 To 2816 Step 440 $code[0] += DllStructGetData($pixels, 1, $loop ) > 4278190080 ? $value:0 $code[1] += DllStructGetData($pixels, 1, $loop+29) > 4278190080 ? $value:0 $code[2] += DllStructGetData($pixels, 1, $loop+58) > 4278190080 ? $value:0 $code[3] += DllStructGetData($pixels, 1, $loop+87) > 4278190080 ? $value:0 $value /= 2 Next So look at these pixels (the algorithm that was determined to be enough to discriminate numbers from each other): [1 30 59 88], [441 470 499 528],[881 910 939 968],[1321 1350 1379 1408],[1761 1790 1819 1848],[2201 2230 2259 2288],[2641 2670 2699 2728] 1 pixel can be described in multiple bits (black/white/monochrome, grey, colour, 16 bits color, 24 bits color, ....) so far we take the approach 16 bits per pixelcolor. The algorithm Maybe this helps from long ago when I started to learn bitblt and pixelmanipulation. If you merge all 10 numbers in this thread you will know which (minimum number of) pixels you need to check to discriminate 0-9 and the other examples given above are alternative algorithms.1 point
-
Well, appears it would be as simple a loop as the first one... Func Getnumber($result) Local $code[4] = [0,0,0,0], $value = 64, $pixels = DllStructCreate('dword[2816]') DllCall('gdi32.dll', 'dword', 'GetBitmapBits', 'ptr', $capture, 'dword', DllStructGetSize($pixels), 'ptr', DllStructGetPtr($pixels)) For $loop = 1 To 2816 Step 440 $code[0] += DllStructGetData($pixels, 1, $loop ) > 4278190080 ? $value:0 $code[1] += DllStructGetData($pixels, 1, $loop+29) > 4278190080 ? $value:0 $code[2] += DllStructGetData($pixels, 1, $loop+58) > 4278190080 ? $value:0 $code[3] += DllStructGetData($pixels, 1, $loop+87) > 4278190080 ? $value:0 $value /= 2 Next Return String($digit[$code[0]]) & String($digit[$code[1]]) & String($digit[$code[2]]) & String($digit[$code[3]]) EndFunc Runable example (requires the images from above)... #include <GDIPlus.au3> #include <WinAPI.au3> HotKeySet("{ESC}", "_exit") ;Be sure $posx and $posy is pointing at the correct spot! Global $posx = 1715, $posy = 705, $result = "", $code[4], $capture ;Lookup table to avoid searching Global $digit[115] = [1,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,6,0,0,0,3,2,0,0,0,0, _ 0,0,0,0,0,0,0,0,9,0,0,0,0,0,8,0,0,0,0,0, _ 0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,5] ;Test section ;-------------------------------------------------------------- $gui = GUICreate("Getnumber", 640, 480, -1, -1) GUISetState() WinWaitActive($gui); <--- necessary or screencapture fails _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND($gui) $image = _GDIPlus_BitmapCreateFromFile("9.png") _GDIPlus_GraphicsDrawImageRect($graphics, $image, 280, 200, 176, 56) Sleep(10); <------- necessary because drawimagerect() is too slow, script occasionally fails without ;-------------------------------------------------------------- ;/Test section $hDDC = _WinAPI_GetDC(0) $hCDC = _WinAPI_CreateCompatibleDC($hDDC) $capture = _WinAPI_CreateCompatibleBitmap($hDDC, 88, 32) _WinAPI_SelectObject($hCDC, $capture) _WinAPI_BitBlt($hCDC, 0, 0, 88, 32, $hDDC, $posx, $posy, 0x00CC0020) _WinAPI_DeleteDC($hCDC) $result = Getnumber($result) Consolewrite("Result: " & $result & @crlf) While 1 Sleep(10) WEnd Func Getnumber($result) Local $code[4] = [0,0,0,0], $value = 64, $pixels = DllStructCreate('dword[2816]') DllCall('gdi32.dll', 'dword', 'GetBitmapBits', 'ptr', $capture, 'dword', DllStructGetSize($pixels), 'ptr', DllStructGetPtr($pixels)) For $loop = 1 To 2816 Step 440 $code[0] += DllStructGetData($pixels, 1, $loop ) > 4278190080 ? $value:0 $code[1] += DllStructGetData($pixels, 1, $loop+29) > 4278190080 ? $value:0 $code[2] += DllStructGetData($pixels, 1, $loop+58) > 4278190080 ? $value:0 $code[3] += DllStructGetData($pixels, 1, $loop+87) > 4278190080 ? $value:0 $value /= 2 Next Return String($digit[$code[0]]) & String($digit[$code[1]]) & String($digit[$code[2]]) & String($digit[$code[3]]) EndFunc Func _exit() _GDIPlus_Shutdown() Exit EndFunc And as in the previous thread and as Nine posted above, the $Posx and $Posy must point at the correct spot, which in this case is here (red spot)...1 point
-
Another bitmap brute-forcing thread
Hashim reacted to argumentum for a topic
I butcher the heck out of it and I hope that by doing so, it makes more sense. Maybe.1 point -
Verify Username and Email Address
seadoggie01 reacted to Subz for a topic
You should use UPN (User Principal Name), as Azure/Entra doesn't recognise samAccountName attribute. if using Get-Mailbox you can request PrimarySmtpAddress or as mentioned use Get-MgUser -UserId 'UPN' | Select-Object DisplayName, Mail which should also show the PrimarySmtpAddress.1 point -
I get perfect match with the new files you gave us. The problem you have to solve is "where those images are located in your real world". You need to help yourself. Ok maybe my explaination was not good enough : $LINE must be the first line (top most) where the bright green color appears (the Y value) $COLUMN can be located somewhere before the digits (the X value) $ENDX can be anywhere right after the 4 digits (...) $ENDY can be anywhere below under the 4 digits (...) ps. only important value is $LINE, rest does not need to be precise : $COLUMN can be 0, $ENDX can be @DESKTOPwIDTH, $ENDY can be @desktopHEIGHT Here a picture of the pixel you want : $LINE is the Y and $COLUMN is the X (in absolute screen coordinates)1 point
-
Verify Username and Email Address
seadoggie01 reacted to SOLVE-SMART for a topic
Hi @seadoggie01 👋 , does your company uses MS 365? In case yes, you could use the Microsoft Graph API to combine Exchange and AD. A quick research puts out such Powershell code snippet/commandlet. $headers = @{ Authorization = "Bearer $accessToken" } Invoke-RestMethod -Uri "https://graph.microsoft.com/v1.0/users?$filter=mail eq 'FullName@Company.com'" -Headers $headers Another way could be using LDAP (if set up and access is granted). Something like: $ldap = [ADSI]"LDAP://your.domain.com" $searcher = New-Object DirectoryServices.DirectorySearcher($ldap) $searcher.Filter = "(&(objectClass=user)(mail=FullName@Company.com))" $result = $searcher.FindOne() if ($result) { "User found" } else { "Not found" } ⚠ These are just ideas, not fully developed solutions. Best regards Sven1 point