Skip to content
This repository was archived by the owner on Mar 30, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions techniques/ConnectedPrinter/c/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# *Connected printers*

## Authorship information
* Nickname: *Sems*
* Github: *https://github.com/SemsYapar*

## Technique Information
* Technique Title: **U1309 - Connected Printer**
* Technique category: **Sandbox Evasion**
* Technique description: Same as the already existing description

## Additional resources

## Detection rules
20 changes: 20 additions & 0 deletions techniques/ConnectedPrinter/c/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <windows.h>
#include <stdio.h>

int main() {
DWORD pcbNeeded;
DWORD pcReturned;

if (!EnumPrinters(PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &pcbNeeded, &pcReturned)) {
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
PRINTER_INFO_2* pPrinterEnum = (PRINTER_INFO_2*)malloc(pcbNeeded);
if (EnumPrinters(PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)pPrinterEnum, pcbNeeded, &pcbNeeded, &pcReturned)) {
printf("Printer number: %d\n", pcReturned);
for (int i = 0; i < pcReturned; i++) {
printf("printerName %ls\n", pPrinterEnum[i].pPrinterName);
}
}
free(pPrinterEnum);
}
}
}