惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

Black Hills Information Security, Inc.

Same Problem, Different Angles: When Red Team and Blue Team Actually Talk to Each Other How to Identify and Exploit New Vulnerabilities Swapper – A Pure Regex Match/Replace Burp Extension A Practical Guide to BloodHound Data Collection Network Engineering Basics Signed, Trusted, and Abused: Proxy Execution via WebView2 Getting Started In Pentesting – Advice From The BHIS Pentest Lead Cloud Security: Tips and Resources for Securing the Cloud Lessons From A Chatbot Incident How to Lead Effective Tabletops Understanding GRC: How to Navigate Risks and Compliance Standards The “P” in PAM is for Persistence: Linux Persistence Technique Malware Analysis: How to Analyze and Understand Malware OSINT: How to Find, Use, and Control Open-Source Intelligence What to Do with Your First Home Lab When the SOC Goes to Deadwood: A Night to Remember Social Engineering and Microsoft SSPR: The Road to Pwnage is Paved with Good Intentions Common Cyber Threats Finding the Right Penetration Testing Company Deceptive-Auditing: An Active Directory Honeypots Tool The Curious Case of the Comburglar How to Set Smart Goals (That Actually Work For You) Inside the BHIS SOC: A Conversation with Hayden Covington Abusing Delegation with Impacket (Part 3): Resource-Based Constrained Delegation Why You Got Hacked – 2025 Super Edition Abusing Delegation with Impacket (Part 2): Constrained Delegation Abusing Delegation with Impacket (Part 1): Unconstrained Delegation GoSpoof – Turning Attacks into Intel Model Context Protocol (MCP) Bypassing WAFs Using Oversized Requests Getting Started with AI Hacking Part 2: Prompt Injection Wrangling Windows Event Logs with Hayabusa & SOF-ELK (Part 2) DomCat: A Domain Categorization Tool Wrangling Windows Event Logs with Hayabusa & SOF-ELK (Part 1) Microsoft Store and WinGet: Security Risks for Corporate Environments Default Web Content MailFail Commonly Abused Administrative Utilities: A Hidden Risk to Enterprise Security Stop Spoofing Yourself! Disabling M365 Direct Send Bypassing CSP with JSONP: Introducing JSONPeek and CSP B Gone Offensive Tooling Cheatsheets: An Infosec Survival Guide Resource DNS Triage Cheatsheet GraphRunner Cheatsheet Burp Suite Cheatsheet Impacket Cheatsheet Wireshark Cheatsheet Hashcat Cheatsheet EyeWitness Cheatsheet Nmap Cheatsheet Netcat (nc) Cheatsheet Hunt for Weak Spots in Your Wireless Network with Airodump-ng from the Aircrack-ng Suite Detecting ADCS Privilege Escalation Vulnerability Scanning with Nmap Getting Started with NetExec: Streamlining Network Discovery and Access How to Use Dirsearch Augmenting Penetration Testing Methodology with Artificial Intelligence – Part 3: Arcanum Cyber Security Bot How to Design and Execute Effective Social Engineering Attacks by Phone Abusing S4U2Self for Active Directory Pivoting Why Use a Macro Pad? Espanso: Text Replacement, the Easy Way Caging Copilot: Lessons Learned in LLM Security Augmenting Penetration Testing Methodology with Artificial Intelligence – Part 2: Copilot Augmenting Penetration Testing Methodology with Artificial Intelligence – Part 1: Burpference Intercepting Traffic for Mobile Applications that Bypass the System Proxy How to Root Android Phones Communicating Security to the C-Suite: A Strategic Approach Offline Memory Forensics With Volatility Getting Started with AI Hacking: Part 1 Go-Spoof: A Tool for Cyber Deception How to Test Adversary-in-the-Middle Without Hacking Tools Canary in the Code: Alert()-ing on XSS Exploits How to Hack Wi-Fi with No Wi-Fi Why Your Org Needs a Penetration Test Program Burp Suite Extension: Copy For Light at the End of the Dark Web Wi-Fi Forge: Practice Wi-Fi Security Without Hardware Avoiding Dirty RAGs: Retrieval-Augmented Generation with Ollama and LangChain Gone Phishing: Installing GoPhish and Creating a Campaign 5 Things We Are Going to Continue to Ignore in 2025 John Strand’s 5 Phase Plan For Starting in Computer Security Questions From a Beginner Threat Hunter GRC for Security Managers: From Checklists to Influence AI Large Language Models and Supervised Fine Tuning Attack Tactics 9: Shadow Creds for PrivEsc w/ Kent & Jordan One Active Directory Account Can Be Your Best Early Warning Introduction to Zeek Log Analysis Indecent Exposure: Your Secrets are Showing Creating Burp Extensions: A Beginner’s Guide Pitting AI Against AI: Using PyRIT to Assess Large Language Models (LLMs) The Top Ten List of Why You Got Hacked This Year (2023/2024) ICS Hard Knocks: Mitigations to Scenarios Found in ICS/OT Backdoors & Breaches Intro to Data Analytics Using SQL Finding Access Control Vulnerabilities with Autorize The Detection Engineering Process Cyber Risk Lessons We Can Learn From Hurricane Preparedness Intro to Desktop Application Testing Methodology What Is Penetration Testing? Adversary in the Middle (AitM): Post-Exploitation Pentesting, Threat Hunting, and SOC: An Overview QEMU, MSYS2, and Emacs: Open-Source Solutions to Run Virtual Machines on Windows
Empire Bootstrapping v2 – How to Pre-Automate All the Things!
2017-04-19 · via Black Hills Information Security, Inc.

, , , , , , , ,

Kent Ickler //

ADVISORY: The techniques and tools referenced within this blog post may be outdated and do not apply to current situations. However, there is still potential for this blog entry to be used as an opportunity to learn and to possibly update or integrate into modern tools and techniques.

A robot wearing boots… with straps….

Have you been tasked with automation in the Command and Control (C2) world? If so your goal is to shorten the overhead time on repetitive tasks related to procuring a valid control channel. This wasn’t my first rodeo in mundane automation and finding creative shorthand. Automating automated tools usually comes without too many headaches. It’s amazing how a little time in a script can potentially save staff HOURS and even WEEKS of work.  

I’m still surprised though, Powershell Empire does not directly accept command line arguments to launch a predefined listener (albeit it includes an API).  The challenge to automate attended Powershell Empire configuration was already presented by Carrie in this blog post.  The previous work used Screen to create a new shell session “window” and cast in the appropriate commands.  With a couple of small changes to Carrie’s work, a Powershell Empire bootstrap is created for unattended deployment and teardown.

Review of Screen:

Screen allows for multiple retained sessions within a Linux system. Casting the Powershell Empire directly into a new Screen without attaching the screen causes Empire to be actively loaded in the background of the current session. Screen’s feature allows passing commands into the new session from the existing session, allowing a shell script to mimic an attended session with input.

Unattended Powershell Empire bootstrap:

The following script casts a Powershell Empire instance into a new Screen session, sends the necessary commands to that Session to clear all existing listeners and the commands to create a new listener. The last command (commented out for unattended utility) attaches the user to the new Empire session. Attaching to the new session is optional, however, since Empire could now be interactively controlled via scripting from other sources/scripts. The syntax to send commands to the Empire instance are pretty apparent here and modifying to fit your needs for automation or unattended needs should be pretty easy.

#You’ll need sudo for Empire:

sudo -s

#Don’t forget your +x flag!

chmod +x Empire_Listener_443.sh

.\Empire_Listener_443.sh

Carrie had set most of this work in motion last year, with a couple of small updates it becomes unattended and automated.  Thanks Carrie!

Empire_Listener_443.sh

#Clear any Existing empire Screen sessions

screen -X -S Empire Quit

# Launch Empire and wait a few seconds while it starts and brings user to prompt.

cd /directory/to/Empire

screen -S Empire -d -m /directory/to/Empire/empire

sleep 5

#Send unattended commands to the Empire instance

screen -S Empire -X stuff ‘listeners\r’

screen -S Empire -X stuff ‘kill all\r’

screen -S Empire -X stuff ‘y\r’

screen -S Empire -X stuff ‘set Name OurListener\r’

screen -S Empire -X stuff ‘set Port 443\r’

screen -S Empire -X stuff ‘execute\r’

screen -S Empire -X stuff ‘back\r’

screen -S Empire -X stuff ‘listeners\r’

Echo “***Connect to this Empire session with ‘screen -S Empire -R’”

This leaves the Empire listener running in the background session and the appropriate command to connect to the listener control menu.

Attended Powershell Empire bootstrap

Now, to take it one more step, this short script can be turned into a bootstrap that will launch Empire and Attach you into a session with the command line argument(s) you provide.

#You’ll need sudo for Empire:

sudo -s

#Don’t forget your +x flag!

chmod +x EmpListener.sh

./EmpListener.sh [listener-name] [port number]

/.EmpListener.sh OurListener 443

EmpListener.SH:

#Clear any Existing empire screen sessions

screen -X -S Empire Quit

# Launch Empire and wait a few seconds while it starts and brings user to prompt.

cd /directory/to/Empire

screen -S Empire -d -m /directory/to/Empire/empire

sleep 5

#Send unattended commands to the Empire instance

screen -S Empire -X stuff ‘listeners\r’

screen -S Empire -X stuff ‘kill all\r’

screen -S Empire -X stuff ‘y\r’

screen -S Empire -X stuff ‘set Name ‘$1’\r’

screen -S Empire -X stuff ‘set Port ‘$2’\r’

screen -S Empire -X stuff ‘execute\r’

screen -S Empire -X stuff ‘back\r’

screen -S Empire -X stuff ‘listeners\r’

#Attach to the new screen session (optional)

screen -S Empire -R

Note that if you now attach to the newly created Screen session “EMPIRE” and exit out of the Powershell Empire instance, the Screen session is destroyed as the Empire instance is destroyed, leaving you back at your original shell.

Screenshot_2017-03-28_12-44-05.png

Want to learn more mad skills from the person who wrote this blog?

Check out these classes from Jordan and Kent: