'This method will discard the output the shell sends, it will read it
from the xml where it expects it to be present.
NOTE: if \'debug\' is true then it is being run from a test case and the
output being sent is valid.'

def parseOutputString(self, output, debug=False):

    try:
        conn = psycopg2.connect(dbname=self.getSetting('Database'), user=self.getSetting('User'), password=self.getSetting('Password'), host=self.getSetting('Server'), port=self.getSetting('Port'))
        cur = conn.cursor()
    except Exception as e:
        print e
        print 'Error    Connecting    to    the    database\n'
        return
    cur = self._doSql(cur, (("select    *    from    hosts    inner    join    workspaces    ON    (hosts.workspace_id=workspaces.id)    where    workspaces.name    like    '" + self.getSetting('Wordspace')) + "';"))
    if (cur is None):
        print 'Error    getting    database    data\n'
        return
    self.path = (((self.data_path + '/') + api.getActiveWorkspace().name) + '_metasploit_last')
    if os.path.isfile(self.path):
        f = open(self.path, 'r')
        self._sdate = f.readline()
        f.close
    for h in cur.fetchall():
        h_id = self.createAndAddHost(str(h[2]), str(h[7]))
        if self._isIPV4(str(h[2])):
            i_id = self.createAndAddInterface(h_id, str(h[2]), mac=str(h[3]), ipv4_address=str(h[2]), hostname_resolution=str(h[5]))
        else:
            i_id = self.createAndAddInterface(h_id, str(h[2]), mac=str(h[3]), ipv6_address=str(h[2]), hostname_resolution=str(h[5]))
        self._checkDate(str(h[13]))
        cur = self._doSql(cur, (((('select    *    from    vulns    where    host_id=' + str(h[0])) + '    and    service_id    is    null') + self._mwhere) + ';'))
        if (cur is None):
            return
        for v in cur.fetchall():
            self._checkDate(str(v[5]))
            cur = self._doSql(cur, (('select    *    from    vulns_refs    inner    join    refs    ON    (vulns_refs.id=refs.id)    where    vulns_refs.vuln_id=' + str(v[0])) + ';'))
            if (cur is None):
                return
            refs = []
            for r in cur.fetchall():
                self._checkDate(str(r[5]))
                refs.append(r[6])
            self.createAndAddVulnToHost(h_id, str(v[4]), str(v[6]), refs)
        cur = self._doSql(cur, (((('select    *    from    notes    where    host_id=' + str(h[0])) + '    and    service_id    is    null') + self._mwhere) + ';'))
        if (cur is None):
            return
        for n in cur.fetchall():
            self._checkDate(str(n[6]))
            self.createAndAddNoteToHost(h_id, str(n[2]), str(n[9]))
        cur = self._doSql(cur, ('select    *    from    services    where    host_id=' + str(h[0])))
        if (cur is None):
            return
        for s in cur.fetchall():
            self._checkDate(str(s[7]))
            s_id = self.createAndAddServiceToInterface(h_id, i_id, name=str(s[6]), ports=[str(s[3])], protocol=str(s[4]), status=str(s[5]), description=str(s[8]), version=str(s[8]))
            cur = self._doSql(cur, ((('select    *    from    creds    where    service_id=' + str(s[0])) + self._mwhere) + ';'))
            if (cur is None):
                return
            for c in cur.fetchall():
                self._checkDate(str(c[3]))
                self.createAndAddCredToService(h_id, s_id, c[4], c[5])
                self.createAndAddVulnToService(h_id, s_id, 'Weak    Credentials', ('[metasploit    found    the    following    credentials]\nuser:%s\npass:%s' % (c[4], c[5])), severity='high')
            cur = self._doSql(cur, ((((('select    *    from    vulns    where    host_id=' + str(h[0])) + '    and    service_id=') + str(s[0])) + self._mwhere) + ';'))
            if (cur is None):
                return
            for v in cur.fetchall():
                self._checkDate(str(v[5]))
                cur = self._doSql(cur, (('select    *    from    vulns_refs    inner    join    refs    ON    (vulns_refs.id=refs.id)    where    vulns_refs.vuln_id=' + str(v[0])) + ';'))
                if (cur is None):
                    return
                refs = []
                for r in cur.fetchall():
                    self._checkDate(str(r[5]))
                    refs.append(r[6])
                self.createAndAddVulnToService(h_id, s_id, name=str(v[4]), desc=str(v[6]), ref=refs)
            mwhere = re.sub('updated_at', 'web_vulns.updated_at', self._mwhere)
            cur = self._doSql(cur, ((('select    *    from    web_vulns    INNER    JOIN    web_sites    ON    (web_vulns.web_site_id=web_sites.id)    where    web_sites.service_id=' + str(s[0])) + mwhere) + ';'))
            if (cur is None):
                return
            for v in cur.fetchall():
                self._checkDate(str(v[3]))
                website = (str(v[23]) + str(v[4]))
                self.createAndAddVulnWebToService(h_id, s_id, name=str(v[9]), desc=str(v[13]), website=website, path=str(v[5]), request=str(v[16]), method=str(v[6]), pname=str(v[8]), params=str(v[7]), query=str(v[11]))
            cur = self._doSql(cur, (((('select    *    from    notes    where    host_id=' + str(h[0])) + '    and    service_id=') + str(s[0])) + self._mwhere))
            if (cur is None):
                return
            for n in cur.fetchall():
                self._checkDate(str(n[6]))
                self.createAndAddNoteToService(h_id, s_id, str(n[2]), str(n[9]))
            cur = self._doSql(cur, (('select    *    from    web_sites    where    service_id=' + str(s[0])) + self._mwhere))
            for w in cur.fetchall():
                self._checkDate(str(w[3]))
                n_id = self.createAndAddNoteToService(h_id, s_id, 'website', '')
                n2_id = self.createAndAddNoteToNote(h_id, s_id, n_id, str(w[4]), '')
    cur.close()
    conn.close()
