{"id":19000735,"url":"https://github.com/fortra/no-consolation","last_synced_at":"2025-04-05T21:07:39.885Z","repository":{"id":205877600,"uuid":"715307226","full_name":"fortra/No-Consolation","owner":"fortra","description":" A BOF that runs unmanaged PEs inline ","archived":false,"fork":false,"pushed_at":"2024-05-21T02:13:57.000Z","size":275,"stargazers_count":373,"open_issues_count":0,"forks_count":37,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-05-21T03:29:23.032Z","etag":null,"topics":["bof","cna","cobalt-strike","pe-loader"],"latest_commit_sha":null,"homepage":"https://www.coresecurity.com/core-labs/articles/running-pes-inline-without-console","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fortra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-06T22:01:42.000Z","updated_at":"2024-05-29T21:46:47.125Z","dependencies_parsed_at":"2024-05-21T03:27:59.481Z","dependency_job_id":null,"html_url":"https://github.com/fortra/No-Consolation","commit_stats":null,"previous_names":["fortra/no-consolation"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortra%2FNo-Consolation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortra%2FNo-Consolation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortra%2FNo-Consolation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortra%2FNo-Consolation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fortra","download_url":"https://codeload.github.com/fortra/No-Consolation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399877,"owners_count":20932876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bof","cna","cobalt-strike","pe-loader"],"created_at":"2024-11-08T18:08:15.030Z","updated_at":"2025-04-05T21:07:39.861Z","avatar_url":"https://github.com/fortra.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# No-Consolation\n\nThis is a Beacon Object File (BOF) that executes unmanaged PEs inline and retrieves their output without allocating a console (i.e. spawning `conhost.exe`).  \n\n![screenshot](resources/demo.png)\n\n## Features\n- Supports 64 and 32 bits\n- Supports EXEs and DLLs\n- Does not create new processes\n- Does not create new threads\n- Links modules to the PEB\n- Saves binaries in memory\n- Supports C++ exceptions (x64 only)\n- Custom loads all dependencies\n\n## Usage\n```\nSummary: Run an unmanaged EXE/DLL inside Beacon's memory.\n\nUsage: noconsolation [--local] [--inthread] [--link-to-peb] [--dont-unload] [--timeout 60] [-k] [--method funcname] [-w] [--no-output] [--alloc-console] [--close-handles] [--free-libraries wininet.dll,winhttp.dll] [--dont-save] [--list-pes] [--unload-pe pename] [--load-all-dependencies] [--load-all-dependencies-but advapi32.dll] [--load-dependencies wininet.dll] [--search-paths C:\\Windows\\Temp\\] /path/to/binary.exe arg1 arg2\n    --local, -l                                    Optional. The binary should be loaded from the target Windows machine\n    --inthread, -it                                Optional. Run the PE with the main thread. This might hang your beacon depending on the PE and its arguments.\n    --link-to-peb, -ltp                            Optional. Load the PE into the PEB\n    --dont-unload, -du                             Optional. If set, the DLL won't be unloaded.\n    --timeout NUM_SECONDS, -t NUM_SECONDS          Optional. The number of seconds you wish to wait for the PE to complete running. Default 60 seconds. Set to 0 to disable\n    -k                                             Optional. Overwrite the PE headers\n    --method EXPORT_NAME, -m EXPORT_NAME           Optional. Method or function name to execute in case of DLL. If not provided, DllMain will be executed\n    -w                                             Optional. Command line is passed to unmanaged DLL function in UNICODE format. (default is ANSI)\n    --no-output, -no                               Optional. Do not try to obtain the output\n    --alloc-console, -ac                           Optional. Allocate a console. This will spawn a new process\n    --close-handles, -ch                           Optional. Close Pipe handles once finished. If PowerShell was already ran, this will break the output for PowerShell in the future\n    --free-libraries, -fl DLL_A,DLL_B              Optional. List of DLLs (previously loaded with --dont-unload) to be offloaded\n    --dont-save, -ds                               Optional. Do not save this binary in memory\n    --list-pes, -lpe                               Optional. List all PEs that have been loaded in memory\n    --unload-pe PE_NAME, -upe PE_NAME              Optional. Unload from memory a PE\n    --load-all-dependencies, -lad                  Optional. Custom load all the PE's dependencies\n    --load-all-dependencies-but, -ladb DLL_A,DLL_B Optional. Custom load all the PE's dependencies except these\n    --load-dependencies, -ld DLL_A,DLL_B           Optional. Custom load these PE's dependencies\n    --search-paths, -sp PATH_A,PATH_B              Optional. Look for DLLs on these paths (system32 is the default)\n\n    /path/to/binary.exe                   Required. Full path to the windows EXE/DLL you wish you run inside Beacon. If already loaded, you can simply specify the binary name.\n    ARG1 ARG2                             Optional. Parameters for the PE. Must be provided after the path\n\n    Example: noconsolation --local C:\\windows\\system32\\windowspowershell\\v1.0\\powershell.exe $ExecutionContext.SessionState.LanguageMode\n    Example: noconsolation /tmp/mimikatz.exe privilege::debug token::elevate exit\n    Example: noconsolation --local C:\\windows\\system32\\cmd.exe /c ipconfig\n    Example: noconsolation --list-pes\n    Example: noconsolation LoadedBinary.exe args\n```\n\n## Loading binaries into memory\nBinaries are automatically encrypted and stored in memory after they are ran the first time. This means that you do not need to constantly send the binary over the wire.  \nTo execute a binary that has already been saved in memory, simply specify its name instead of its entire path. So, instead of running:\n```\nbeacon\u003e noconsolation --local C:\\windows\\system32\\cmd.exe /c ipconfig\n```\nYou would run:\n```\nbeacon\u003e noconsolation cmd.exe /c ipconfig\n```\n\nTo list all binaries loaded in memory, run `--list-pes`.  \nIf you are done with some binary and wish to unload it, run `--unload-pe mimikatz.exe`.  \nFinally, if you want to run a binary without it being automatically loaded in memory, run it with `--dont-save`.  \n\n\n## Loading PE's dependencies\nYou can avoid all image load events by custom loading all the PE's depdendencies:\n```\nbeacon\u003e noconsolation --load-dependencies --link-to-peb /tmp/malware.exe\n```\nAfter execution is completed, the PE and its dependencies will be offloaded automatically.  \nDLLs that use Thread Local Storage are not supported.  \n\n\n## Credits\n- [Octoberfest7](https://twitter.com/octoberfest73) for [Inline-Execute-PE](https://github.com/Octoberfest7/Inline-Execute-PE) which was my inspiration for this project\n- [modexp](https://twitter.com/modexpblog) and [TheWover](https://twitter.com/TheRealWover) for the PE load logic from [donut](https://github.com/TheWover/donut)\n- [rad9800](https://twitter.com/rad9800) for his [HWBP engine](https://github.com/rad9800/hwbp4mw)\n- [batsec](https://twitter.com/_batsec_) for [DarkLoadLibrary](https://github.com/bats3c/DarkLoadLibrary)\n- [aidankhoury](https://twitter.com/aidankhoury) for [ApiSet](https://github.com/ajkhoury/ApiSet)\n- [bb107](https://github.com/bb107) for [MemoryModulePP](https://github.com/bb107/MemoryModulePP)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffortra%2Fno-consolation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffortra%2Fno-consolation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffortra%2Fno-consolation/lists"}