---
- name: NSP Playbook
hosts: nsp
gather_facts: no
connection: local
tasks:
- expect:
command: /usr/bin/ssh -tt killeruser@{{ inventory_hostname }}
responses:
^.*[p|P]assword:\s*$: "somepassword"
^.*\>\s*$:
- "show malwareenginestats\r\nexit\r\n"
register: shell
- debug: msg="{{ shell.stdout_lines }}"
The stdout_lines shows the results from the show command but it shows as having an error with Return Code of 1. Any clues would be nice. I just need to parse the data once it's not in error.
Sincerely,
Scott
**Output:**
PLAY [NSP Playbook] *******************************************************************************************************************************************************
TASK [expect] *************************************************************************************************************************************************************
fatal: [192.168.193.6]: FAILED! => {"changed": true, "cmd": "/usr/bin/ssh -tt killeruser@192.168.193.6", "delta": "0:00:00.431237", "end": "2017-05-08 15:16:13.300577", "failed": true, "rc": 1, "start": "2017-05-08 15:16:12.869340", "stdout": "* * *\r\n\r\nAuthorized users only. Unauthorized users will be prosecuted\r\nto the full extent of the law.\r\n\r\n* * *\r\nkilleruser@192.168.193.6's password: \r\nLast login: Mon May 8 15:07:05 2017 from 192.168.195.205\r\r\nTrying 127.0.0.1...\r\nConnected to 127.0.0.1.\r\nEscape character is 'off'.\r\n\r\nHello, this is zebra (version 0.92a).\r\nCopyright 1996-2001 Kunihiro Ishiguro.\r\n\r\nintruShell@VIPS01> \r\n\r\nMALWARE STATISTICS FOR NSP Analysis(pdf) Engine:\r\n--------------------------------------------------\r\n Files Submitted: 0 \r\n Files Processed: 0 \r\n\r\n Clean Files: 0 \r\n Very High Malware Confidence Matches: 0 \r\n High Malware Confidence Matches: 0 \r\n Medium Malware Confidence Matches: 0 \r\n Low Malware Confidence Matches: 0 \r\n Very Low Malware Confidence Matches: 0 \r\n Unknown Malware Confidence Matches: 0 \r\n\r\n Alert Generated: 0 \r\n Files Blocked: 0 \r\n Connection Reset: 0 \r\n \r\nMALWARE STATISTICS FOR NSP Analysis(flash) Engine:\r\n--------------------------------------------------\r\n Files Submitted: 0 \r\n Files Processed: 0 \r\n\r\n Clean Files: 0 \r\n Very High Malware Confidence Matches: 0 \r\n High Malware Confidence Matches: 0 \r\n Medium Malware Confidence Matches: 0 \r\n Low Malware Confidence Matches: 0 \r\n Very Low Malware Confidence Matches: 0 \r\n Unknown Malware Confidence Matches: 0 \r\n\r\n Alert Generated: 0 \r\n Files Blocked: 0 \r\n Connection Reset: 0 \r\n \r\nMALWARE STATISTICS FOR NSP Analysis(office) Engine:\r\n--------------------------------------------------\r\n Files Submitted: 0 \r\n Files Processed: 0 \r\n\r\n Clean Files: 0 \r\n Very High Malware Confidence Matches: 0 \r\n High Malware Confidence Matches: 0 \r\n Medium Malware Confidence Matches: 0 \r\n Low Malware Confidence Matches: 0 \r\n Very Low Malware Confidence Matches: 0 \r\n Unknown Malware Confidence Matches: 0 \r\n\r\n Alert Generated: 0 \r\n Files Blocked: 0 \r\n Connection Reset: 0 \r\n \r\nMALWARE STATISTICS FOR Mobile Cloud ENGINE:\r\n--------------------------------------------------\r\n Files Submitted: 0 \r\n Files Processed: 0 \r\n\r\n Clean Files: 0 \r\n Very High Malware Confidence Matches: 0 \r\n High Malware Confidence Matches: 0 \r\n Medium Malware Confidence Matches: 0 \r\n Low Malware Confidence Matches: 0 \r\n Very Low Malware Confidence Matches: 0 \r\n Unknown Malware Confidence Matches: 0 \r\n\r\n Alert Generated: 0 \r\n Files Blocked: 0 \r\n Connection Reset: 0 \r\n \r\nMALWARE STATISTICS FOR Gateway Anti-Malware ENGINE:\r\n--------------------------------------------------\r\n Files Submitted: 0 \r\n Files Processed: 0 \r\n\r\n Clean Files: 0 \r\n Very High Malware Confidence Matches: 0 \r\n High Malware Confidence Matches: 0 \r\n Medium Malware Confidence Matches: 0 \r\n Low Malware Confidence Matches: 0 \r\n Very Low Malware Confidence Matches: 0 \r\n Unknown Malware Confidence Matches: 0 \r\n\r\n Alert Generated: 0 \r\n Files Blocked: 0 \r\n Connection Reset: 0 \r\n \r\nMALWARE STATISTICS FOR GTI FILE Reputation ENGINE:\r\n--------------------------------------------------\r\n Files Submitted: 0 \r\n Files Processed: 0 \r\n\r\n Clean Files: 0 \r\n Very High Malware Confidence Matches: 0 \r\n High Malware Confidence Matches: 0 \r\n Medium Malware Confidence Matches: 0 \r\n Low Malware Confidence Matches: 0 \r\n Very Low Malware Confidence Matches: 0 \r\n Unknown Malware Confidence Matches: 0 \r\n\r\n Alert Generated: 0 \r\n Files Blocked: 0 \r\n Connection Reset: 0 \r\n \r\nMALWARE STATISTICS FOR FILE SAVE ENGINE:\r\n--------------------------------------------------\r\n Files Submitted: 0 \r\n Files Processed: 0 \r\n \r\nMALWARE STATISTICS FOR BLACKLIST ENGINE:\r\n--------------------------------------------------\r\n Files Submitted: 0 \r\n Files Processed: 0 \r\n\r\n Very High Malware Confidence Matches: 0 \r\n\r\n Alert Generated: 0 \r\n Files Blocked: 0 \r\n Connection Reset: 0 \r\n \r\n\r\nMALWARE STATISTICS FOR Advanced Threat Detection ENGINE:\r\n--------------------------------------------------\r\n Files Submitted: 0 \r\n Files Processed: 0 \r\n\r\n Number of files dropped by MATD under load/error: 0 \r\n Clean Files: 0 \r\n Very High Malware Confidence Matches: 0 \r\n High Malware Confidence Matches: 0 \r\n Medium Malware Confidence Matches: 0 \r\n Low Malware Confidence Matches: 0 \r\n Very Low Malware Confidence Matches: 0 \r\n Unknown Malware Confidence Matches: 0 \r\n\r\n Alert Generated: 0 \r\n Files Blocked: 0 \r\n Connection Reset: 0 \r\n \r\nintruShell@VIPS01> \r\nshow malwareenginestatsexitConnection closed by foreign host.\r\nConnection to 192.168.193.6 closed.", "stdout_lines": ["* * *", "", "Authorized users only. Unauthorized users will be prosecuted", "to the full extent of the law.", "", "* * *", "killeruser@192.168.193.6's password: ", "Last login: Mon May 8 15:07:05 2017 from 192.168.195.205", "", "Trying 127.0.0.1...", "Connected to 127.0.0.1.", "Escape character is 'off'.", "", "Hello, this is zebra (version 0.92a).", "Copyright 1996-2001 Kunihiro Ishiguro.", "", "intruShell@VIPS01> ", "", "MALWARE STATISTICS FOR NSP Analysis(pdf) Engine:", "--------------------------------------------------", " Files Submitted: 0 ", " Files Processed: 0 ", "", " Clean Files: 0 ", " Very High Malware Confidence Matches: 0 ", " High Malware Confidence Matches: 0 ", " Medium Malware Confidence Matches: 0 ", " Low Malware Confidence Matches: 0 ", " Very Low Malware Confidence Matches: 0 ", " Unknown Malware Confidence Matches: 0 ", "", " Alert Generated: 0 ", " Files Blocked: 0 ", " Connection Reset: 0 ", " ", "MALWARE STATISTICS FOR NSP Analysis(flash) Engine:", "--------------------------------------------------", " Files Submitted: 0 ", " Files Processed: 0 ", "", " Clean Files: 0 ", " Very High Malware Confidence Matches: 0 ", " High Malware Confidence Matches: 0 ", " Medium Malware Confidence Matches: 0 ", " Low Malware Confidence Matches: 0 ", " Very Low Malware Confidence Matches: 0 ", " Unknown Malware Confidence Matches: 0 ", "", " Alert Generated: 0 ", " Files Blocked: 0 ", " Connection Reset: 0 ", " ", "MALWARE STATISTICS FOR NSP Analysis(office) Engine:", "--------------------------------------------------", " Files Submitted: 0 ", " Files Processed: 0 ", "", " Clean Files: 0 ", " Very High Malware Confidence Matches: 0 ", " High Malware Confidence Matches: 0 ", " Medium Malware Confidence Matches: 0 ", " Low Malware Confidence Matches: 0 ", " Very Low Malware Confidence Matches: 0 ", " Unknown Malware Confidence Matches: 0 ", "", " Alert Generated: 0 ", " Files Blocked: 0 ", " Connection Reset: 0 ", " ", "MALWARE STATISTICS FOR Mobile Cloud ENGINE:", "--------------------------------------------------", " Files Submitted: 0 ", " Files Processed: 0 ", "", " Clean Files: 0 ", " Very High Malware Confidence Matches: 0 ", " High Malware Confidence Matches: 0 ", " Medium Malware Confidence Matches: 0 ", " Low Malware Confidence Matches: 0 ", " Very Low Malware Confidence Matches: 0 ", " Unknown Malware Confidence Matches: 0 ", "", " Alert Generated: 0 ", " Files Blocked: 0 ", " Connection Reset: 0 ", " ", "MALWARE STATISTICS FOR Gateway Anti-Malware ENGINE:", "--------------------------------------------------", " Files Submitted: 0 ", " Files Processed: 0 ", "", " Clean Files: 0 ", " Very High Malware Confidence Matches: 0 ", " High Malware Confidence Matches: 0 ", " Medium Malware Confidence Matches: 0 ", " Low Malware Confidence Matches: 0 ", " Very Low Malware Confidence Matches: 0 ", " Unknown Malware Confidence Matches: 0 ", "", " Alert Generated: 0 ", " Files Blocked: 0 ", " Connection Reset: 0 ", " ", "MALWARE STATISTICS FOR GTI FILE Reputation ENGINE:", "--------------------------------------------------", " Files Submitted: 0 ", " Files Processed: 0 ", "", " Clean Files: 0 ", " Very High Malware Confidence Matches: 0 ", " High Malware Confidence Matches: 0 ", " Medium Malware Confidence Matches: 0 ", " Low Malware Confidence Matches: 0 ", " Very Low Malware Confidence Matches: 0 ", " Unknown Malware Confidence Matches: 0 ", "", " Alert Generated: 0 ", " Files Blocked: 0 ", " Connection Reset: 0 ", " ", "MALWARE STATISTICS FOR FILE SAVE ENGINE:", "--------------------------------------------------", " Files Submitted: 0 ", " Files Processed: 0 ", " ", "MALWARE STATISTICS FOR BLACKLIST ENGINE:", "--------------------------------------------------", " Files Submitted: 0 ", " Files Processed: 0 ", "", " Very High Malware Confidence Matches: 0 ", "", " Alert Generated: 0 ", " Files Blocked: 0 ", " Connection Reset: 0 ", " ", "", "MALWARE STATISTICS FOR Advanced Threat Detection ENGINE:", "--------------------------------------------------", " Files Submitted: 0 ", " Files Processed: 0 ", "", " Number of files dropped by MATD under load/error: 0 ", " Clean Files: 0 ", " Very High Malware Confidence Matches: 0 ", " High Malware Confidence Matches: 0 ", " Medium Malware Confidence Matches: 0 ", " Low Malware Confidence Matches: 0 ", " Very Low Malware Confidence Matches: 0 ", " Unknown Malware Confidence Matches: 0 ", "", " Alert Generated: 0 ", " Files Blocked: 0 ", " Connection Reset: 0 ", " ", "intruShell@VIPS01> ", "show malwareenginestatsexitConnection closed by foreign host.", "Connection to 192.168.193.6 closed."]}
to retry, use: --limit @/vagrant/ansible/nsp.retry
PLAY RECAP ****************************************************************************************************************************************************************
192.168.193.6 : ok=0 changed=0 unreachable=0 failed=1