How Do I: Display open port results from nmap scan in a pop-up dialog with Robot Framework

I am a novice trying to write a Python/robot that will let the user choose which type of nmap scan they want to run in a drop down box (which is working). After the nmap scan is done, I would like the ports that are open results to display in a pop up wind/dialog box.

This is what I have so far, but I do not get any results:

*** Settings ***
    Library     BuiltIn
    Library     Process
    Library     OperatingSystem
    Library     RPA.Assistant
    Library     RPA.Desktop
    Library     RPA.RobotLogListener


    *** Variables ***
    ${router_ip}    192.168.254.254
    ${nmap_path}    /usr/local/bin/nmap


    *** Test Cases ***
    Scan For Open Ports on Router
    [Documentation]    Test for open ports on the router using nmap
    [Tags]    smoke test

    ${test_type}=    Choose The Pill

    ${output}=    Set Variable    ${EMPTY}
        IF    '${test_type}' == 'TCP'
            ${output}=    TCP Command    ${router_ip}
        ELSE IF    '${test_type}' == 'UDP'
            ${output}=    UDP Command    ${router_ip}
        END

    Display Results In Dialog    $output
    Success dialog


    *** Keywords ***
    Choose The Pill
        Add heading    Select Test
        Spinner
        Add drop-down    name=test_type    options=TCP,UDP    default=TCP    label=Test type
        Add submit buttons    buttons=OK,Cancel    default=OK
        ${result}=    Run dialog    height=300    location=Center
        RETURN    ${result.test_type}

    TCP command
         [Arguments]    ${ip}
        ${output}=    Run    nmap -p 1-5819 -T4 -A -v 192.168.254.254

        Log    ${output}
        Display Output In Dialog    ${output}

    UDP command
        [Arguments]    ${ip}
        ${output}=    Run    sudo nmap -max-retries 0 -sU -p 1-65535 -T4 -v 192.168.254.254

        Log    ${output}
    
        Display Output In Dialog    ${output}

    Spinner
        Add Loading Spinner
        ...    Please wait...
        ...    width=15
        ...    height=15
        ...    stroke_width=3
        ...    color=amber100
        ...    tooltip=Waiting...

    Display Results In Dialog
        [Arguments]    ${output}
        Add Text Input    name=output    label=Output    default=${output}
        ${response}=    Run Dialog    title=Results    height=250    width=600    location=Center          on_top=True
        Log    ${response.output}

    Success dialog
        Add Image    /Users/mbpro-2/Documents/Python/thumbs.png
        Add heading    The test is complete!
        Run dialog    title=Success    height=250    location=Center    on_top=True
        Add submit buttons    buttons=OK    default=OK
Display Output In Dialog
    [Arguments]    ${output}
    Add Text Input    name=output    label=Output    default=${output}
    ${response}=    Run Dialog    title=Results    height=250    width=600    location=Center    on_top=True
    Log    ${response.output}

Run Python Script
    ${result}=    Run Process    python    /Users/glen/Documents/Python2/Nmap/Extract.py
    Log    ${result.stdout}


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.