Skip to content
49 changes: 49 additions & 0 deletions collection/screenshot/capture-screenshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ rule:
- [email protected]
- "@_re_fox"
- [email protected]
- "Abhyuday K Hegde"
scopes:
static: function
dynamic: span of calls
Expand All @@ -17,7 +18,10 @@ rule:
- BFB9B5391A13D0AFD787E87AB90F14F5:0x1314610A
- 7204e3efc2434012e13ca939db0d0b02:0x414070
- 50D5EE1CE2CA5E30C6B1019EE64EEEC2:0x406E07
- 333cf4a403f2dbd56e2509eb2f1d8922:0x140002180
- de5f2dd641b3e75eea6e4575b0ba4a48:0x140002180
features:
# Classic GDI Capture
- or:
- and:
- or:
Expand All @@ -43,3 +47,48 @@ rule:
- and:
- api: BitBlt
- api: System.Drawing.Graphics::CopyFromScreen

- and:
- or:
- api: "GetDC"
- and:
- api: "CreateDC"
- optional:
- string: "DISPLAY"
- or:
- and:
- api: "SelectObject"
- api: "DrawText"
- and:
- api: "CreateCompatibleDC"
- api: "CreateCompatibleBitmap"
- or:
- api: "BitBlt"
- api: "StretchBlt"
- api: "PrintWindow"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some of this seems to be duplicated from above, right? would you please merge the logic where reasonable?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @williballenthin ,

I've tried to remove the duplicated parts of the code and committed the changes. Please let me know if further improvements are required.


# GDI+ Graphics API chain
- and:
- api: "GdipCreateBitmapFromScan0"
- api: "GdipGetImageGraphicsContext"
- api: "GdipGetDC"

# Direct GDI+ screen copy

- and:
- api: "Gdiplus::Graphics::FromHDC"
- api: "Gdiplus::Graphics::CopyFromScreen"
Comment on lines +63 to +64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be api or function-name features?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @mike-hunhoff !
According to my understanding, Gdiplus is not from a statically linked library right?


# DirectX method of screen capture
- and:
- or:
- api: "PrintWindow"
- api: "StretchBlt"
- and:
- api: "DwmGetDxSharedSurface"
- optional:
- string: "DXGI"
- or:
- api: "Direct3DCreate9"
- api: "IDirect3DDevice9::GetFrontBufferData"
Comment on lines +75 to +76
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be api or function-name features?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Over here too, Direct3DCreate 9 is a direct import of a dll file right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Furthermore, changing these features to function-name would require me to change the static scope of the rule to file. Would it not increase the number of false positives?

- string: "IDirect3DSurface9::GetDC"