Search code examples
eclipserobotframeworkrobotframework-sshlibrary

RobotFrameWork with Eclipse - SSHLibrary doesn't seem to do anything. (based on book: Practical Security Automation and Testing)


I am studying in the book: Practical Security Autmation and testing. on page [124] there is a script which uses RIDE with the SSHLibrary.

But I'm using Eclipse, so I tried to install it.

pip install wheel

pip install --upgrade robotframework-sshlibrary

did the trick, now you can start editting the .robot script.

I made it till the point: (so it is different from the book, but this works for Eclipse)

*** Settings ***
Library  SSHLibrary
*** Variables ***
${HOST_URL}  http://demo.testfire.net
${output}=  Execute Command  python sqlmap.py -u ${HOST_URL} --batch --banner

*** Test Cases ***
SQL Injection Testing
  Should Not Contain  ${output}  vulnerable

Now the problem is: it says 'passed' but when I alter the host_url in something I'm sure of it should fail it also says 'passed'. in other words: it doesn't seem to check or do anything.

I don't know what I am doing wrong here. need help.


Solution

  • You are not executing the command at all - keywords cannot be called in the Variables section. This line here

    *** Variables ***
    ${HOST_URL}  http://demo.testfire.net
    ${output}=  Execute Command  python sqlmap.py -u ${HOST_URL} --batch --banner
    

    will just create a string variable with that content. Move it inside the case (or in a keyword of its own)

    *** Test Cases ***
    SQL Injection Testing
        ${output}=  Execute Command  python sqlmap.py -u ${HOST_URL} --batch --banner
        Should Not Contain  ${output}  vulnerable