Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Latest commit

 

History

History

EthicalHacking

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Introduction

These scripts will guide you to create and setup an Azure Lab Services lab that is configured to run an ethical hacking class. Part 1 of these instructions will be to create the lab plan and lab resource in Azure. Part 2 of these instructions will be to prepare the template VM instance of the newly created lab to be used by your class.


Part 1 - Create Azure Lab Resources

This script will help create a lab plan and lab in your Azure subscription.

Prerequisites

To create a lab using the following instructions, you must have

  • Contributor permissions on the subscription in which the lab will be created

Directions

  1. Open a PowerShell window. Make sure that the window notes it is running under administrator privileges.

  2. Download the Create-EthicalHackingLabplanAndLab.ps1 PowerShell script onto your local machine:

    Invoke-WebRequest "https://raw.githubusercontent.com/Azure/LabServices/main/ClassTypes/PowerShell/EthicalHacking/Create-EthicalHackingLabplanAndLab.ps1" -OutFile Create-EthicalHackingLabplanAndLab.ps1
  3. Run Create-EthicalHackingLabplanAndLab.ps1 script.

         Install-Module 'Az' -Force
         Login-AzAccount 
         ./Create-EthicalHackingLabplanAndLab.ps1 -UserName "AdminUser" -Password $(ConvertTo-SecureString "<password>" -AsPlainText -Force) -Location "centralus"

Note

Run Get-help .\Create-EthicalHackingLabplanAndLab.ps1 -Detailed to see more information about script.

  1. Open the Azure Labs Services website and login with your Azure credentials to see the lab created by this script.

Part 2 - Prepare your template virtual machine

This script will help prepare your template virtual machine for a ethical hacking class. Script will:

  • Enable Hyper-V.
  • Install 7-Zip to extra Kali Linux Hyper-V disk.
  • Create a Hyper-V virtual machine with a Kali Linux. Kali is a Linux distribution that includes tools for penetration testing and security auditing.
  • Install Starwind V2V Converter to convert Metasploitable VMWare disk to Hyper-V disk.
  • Create a Hyper-V virtual machine with a Metasploitable image is created. The Rapid7 Metasploitable image is an image purposely configured with security vulnerabilities. You'll use this image to test and find issues.

Prerequisites

  • Lab with a template VM.
  • Template VM for lab has a Windows Server OS.

Directions

  1. Open the Azure Labs Services website and login with your Azure credentials to see the lab created by script in Part 1.

  2. Connect to template machine for your lab.

  3. Download the SetupForNestedVirtualization.ps1 and Setup-EthicalHacking.ps1 and PowerShell scripts onto the Template Virtual Machine:

    Invoke-WebRequest 'https://aka.ms/azlabs/scripts/hyperV-powershell' -Outfile SetupForNestedVirtualization.ps1
    Invoke-WebRequest ' https://aka.ms/azlabs/scripts/EthicalHacking-powershell' -Outfile Setup-EthicalHacking.ps1
  4. Open a PowerShell window. Make sure that the window notes it is running under administrator privileges.

  5. Run SetupForNestedVirtualization.ps1. This installs the necessary features to create HyperV virtual machines.

    .\SetupForNestedVirtualization.ps1

Note

The script may ask you to restart the machine and re-run it. A note that the script is completed will show in the PowerShell window when no further action is needed.

  1. Run Setup-EthicalHacking.ps1

    If you are using Windows 10 or Windows 11, the following command:

    .\Setup-EthicalHacking.ps1 -SwitchName 'Default Switch'

    If you are using Windows Server, the following command.

    .\Setup-EthicalHacking.ps1 

    Consider enabling Hyper-V DHCP guard and Router guard.

    Get-VMNetworkAdapter * | Set-VMNetworkAdapter -RouterGuard On -DhcpGuard On

Warning

Use Setup-EthicalHacking.ps1 -Force will cause any software to be installed silently. By using the Force switch you are automatically accepting the terms for the installed software.