Skip to main content


Unleashing the Power of "Swaks" for Ethical Hacking and Penetration Testing
In the realm of ethical hacking and penetration testing, having a versatile and reliable tool for email testing is crucial. One such tool that stands out is "swaks" a feature-rich SMTP transaction tester. In this article, we will explore how to harness the capabilities of swaks to conduct phishing email simulations, ensuring your organization's resilience to potential cyber threats.

Getting to Know Swaks:
Swaks, short for "Swiss Army Knife for SMTP" is a command-line tool designed for testing SMTP servers and diagnosing email sending issues. It provides a wide range of options to simulate various email scenarios, making it an invaluable asset for penetration testers and ethical hackers.

Crafting a Convincing Phishing Email:

To demonstrate swaks' capabilities, let's dive into a practical example where we send a phishing email. We'll customize the command, replacing specific details for a more realistic simulation:

sudo swaks -t -t \
--from \
--attach @malicious_payload.doc --server <ATTACKER IP> --body @phishing_body.txt \
--header "Subject: Urgent: Account Verification Required" --suppress-data -ap

In this example, we've substituted placeholder values to enhance the authenticity of the simulation. The crafted phishing email suggests urgency, a common tactic used by attackers, making it more convincing for testing purposes.

Understanding the Swaks Command:
Let's break down the modified command:
  • -t: Specifies the target email addresses.
  • --from: Sets the sender's email address.
  • --attach: Attaches a malicious payload (replace with your own file).
  • --server: Specifies the SMTP server (replace with your attacker machine's IP).
  • --body: Points to the file containing the email body.
  • --header: Defines the email subject.
  • --suppress-data: Prevents the display of email data in the console.
  • -ap: Auto-protocol mode for automatic protocol selection.
Enhancing Simulations and Customization:
Swaks offers a myriad of options for customization. Experiment with different flags, payload attachments, and email body content to create diverse scenarios that mimic real-world cyber threats.

Creating a Realistic Phishing Email:
For a more convincing simulation, let's draft a sample phishing email body in the phishing_body.txt file:

"Dear [Target Name], 
We recently detected unusual activity on your account. To ensure the security of your account, please click on the link below to verify your credentials immediately:
[Malicious Link] 
Failure to verify within 24 hours may result in account suspension. We appreciate your prompt attention to this matter. 
Your IT Support Team"

Ensure the link leads to a harmless destination during testing.

Swaks empowers ethical hackers and penetration testers with a powerful tool to simulate email-based attacks. By customizing commands and crafting realistic phishing emails, professionals can better assess an organization's preparedness against potential threats. Remember, ethical hacking is about enhancing security, and tools like swaks play a crucial role in achieving that goal.