PATH:
opt
/
bitninja-threat-hunting
/
node_modules
/
node-pty
/
deps
/
winpty
/
misc
# # Usage: powershell <path>\IdentifyConsoleWindow.ps1 # # This script determines whether the process has a console attached, whether # that console has a non-NULL window (e.g. HWND), and whether the window is on # the current window station. # $signature = @' [DllImport("kernel32.dll", SetLastError=true)] public static extern IntPtr GetConsoleWindow(); [DllImport("kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)] public static extern bool SetConsoleTitle(String title); [DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)] public static extern int GetWindowText(IntPtr hWnd, System.Text.StringBuilder lpString, int nMaxCount); '@ $WinAPI = Add-Type -MemberDefinition $signature ` -Name WinAPI -Namespace IdentifyConsoleWindow -PassThru if (!$WinAPI::SetConsoleTitle("ConsoleWindowScript")) { echo "error: could not change console title -- is a console attached?" exit 1 } else { echo "note: successfully set console title to ""ConsoleWindowScript""." } $hwnd = $WinAPI::GetConsoleWindow() if ($hwnd -eq 0) { echo "note: GetConsoleWindow returned NULL." } else { echo "note: GetConsoleWindow returned 0x$($hwnd.ToString("X"))." $sb = New-Object System.Text.StringBuilder -ArgumentList 4096 if ($WinAPI::GetWindowText($hwnd, $sb, $sb.Capacity)) { $title = $sb.ToString() echo "note: GetWindowText returned ""${title}""." if ($title -eq "ConsoleWindowScript") { echo "success!" } else { echo "error: expected to see ""ConsoleWindowScript""." echo " (Perhaps the console window is on a different window station?)" } } else { echo "error: GetWindowText could not read the window title." echo " (Perhaps the console window is on a different window station?)" } }
[-] DebugServer.py
[edit]
[+]
Font-Report-June2016
[-] Win32Echo1.cc
[edit]
[-] font-notes.txt
[edit]
[-] ShowArgv.cc
[edit]
[-] SetCursorPos.cc
[edit]
[-] UnicodeDoubleWidthTest.cc
[edit]
[-] SetBufferSize.cc
[edit]
[-] GetFont.cc
[edit]
[-] FreezePerfTest.cc
[edit]
[-] color-test.sh
[edit]
[+]
..
[-] ShowConsoleInput.cc
[edit]
[-] MouseInputNotes.txt
[edit]
[-] DebugClient.py
[edit]
[-] ScreenBufferTest2.cc
[edit]
[-] Win10WrapTest1.cc
[edit]
[-] VeryLargeRead.cc
[edit]
[-] FormatChar.h
[edit]
[-] ChangeScreenBuffer.cc
[edit]
[-] IdentifyConsoleWindow.ps1
[edit]
[-] DumpLines.py
[edit]
[-] EnableExtendedFlags.txt
[edit]
[-] TestUtil.cc
[edit]
[-] MoveConsoleWindow.cc
[edit]
[-] ClearConsole.cc
[edit]
[-] IsNewConsole.cc
[edit]
[-] ConoutMode.cc
[edit]
[-] SetWindowRect.cc
[edit]
[-] ConinMode.cc
[edit]
[-] WindowsBugCrashReader.cc
[edit]
[-] WriteConsole.cc
[edit]
[-] UnicodeWideTest1.cc
[edit]
[-] Notes.txt
[edit]
[-] Win32Test2.cc
[edit]
[-] ScreenBufferFreezeInactive.cc
[edit]
[-] GetConsolePos.cc
[edit]
[-] VkEscapeTest.cc
[edit]
[-] Win32Test1.cc
[edit]
[-] winbug-15048.cc
[edit]
[-] Win32Write1.cc
[edit]
[-] ScreenBufferTest.cc
[edit]
[-] OSVersion.cc
[edit]
[-] BufferResizeTests.cc
[edit]
[-] Spew.py
[edit]
[-] build32.sh
[edit]
[-] build64.sh
[edit]
[-] SetFont.cc
[edit]
[-] SelectAllTest.cc
[edit]
[-] UnixEcho.cc
[edit]
[-] ConinMode.ps1
[edit]
[-] Utf16Echo.cc
[edit]
[-] UnicodeWideTest2.cc
[edit]
[-] FontSurvey.cc
[edit]
[-] GetCh.cc
[edit]
[-] Win10WrapTest2.cc
[edit]
[-] Win32Echo2.cc
[edit]
[-] Win32Test3.cc
[edit]
[-] Win10ResizeWhileFrozen.cc
[edit]