Public/Invoke-Phase06Reconnaissance.ps1

function Invoke-Phase06Reconnaissance {

    ################################################################################
    ##### #####
    ##### Run the Attack Phase - Brute Force Account #####
    ##### #####
    ################################################################################
    
    Param (  
        [switch]$UnAttended,
        [switch]$Continue,
        [Switch]$EnableLogging,
        [switch]$SkipImages,
        [switch]$SkipClearHost,
        [switch]$AS2GoDemo
    )

    $CurrentFunction = Get-FunctionName
    Write-Log -Message "### Start Function $CurrentFunction ###"
    $StartRunTime = (Get-Date).ToString($Script:DateFormatLog)
    #################### main code | out- host #####################
    
    If (-not $AS2GoDemo) { Set-NewColorSchema -NewStage $Script:InitialStart }
    If (-not $SkipClearHost) { Clear-Host }

    Update-WindowTitle -NewTitle $Script:Phase06
    #Set-KeyValue -key "LastStage" -NewValue $Script:Phase06
    If (-not $SkipImages) { Show-Phases -Phase "phase_006.html" }
    Do {
        # If ($skipstep) { break }
        If (-not $SkipClearHost) { Clear-Host }
        
        Invoke-Output -T Header -M "Attack Phase - RECONNAISSANCE"

        Write-Host " try to collect reconnaissance and configuration data "

        If ($AS2GoDemo) {
            If ($UnAttended) {
                $answer = $yes
            }
            else {
                $question = "Would you like to run this step - Y or N? Default "
                $answer = Get-Answer -question $question -defaultValue $Yes
            }
        }
        else {
            $answer = $yes
        }

        If ($answer -eq $yes) {
            Start-Reconnaissance
            $reconnaissance = $no

            If ($UnAttended) {
                $answer = $reconnaissance
            }
            else {
                $question = "Further reconnaissance tasks - Y or N? Default "
                $answer = Get-Answer -question $question -defaultValue $reconnaissance
            }

            If ($answer -eq $yes) {
                Start-ReconnaissanceExtended
            }
        }
        elseIf ($answer -eq $exit) {
            Stop-AS2GoDemo
        }
        else {
        }

        If (-not $AS2GoDemo) { break }
        If (-not $SkipClearHost) { Clear-Host }

        Invoke-Output -T Header -M "??? REPEAT | Attack Phase - RECONNAISSANCE ???"


        If ($UnAttended) {
            $repeat = $no
        }
        else {
            $question = "Would you like to repeat this attack phase? Please enter Y or N. Default "
            $repeat = Get-Answer -question $question -defaultValue $no
        }

   
    } Until ($repeat -eq $no)  

    ######################## main code ############################
    $runtime = Get-RunTime -StartRunTime $StartRunTime
    Write-Log -Message " Run Time: $runtime [h] ###"
    Write-Log -Message "### End Function $CurrentFunction ###"
}