<s> from impacket import tds <EOL> from impacket . tds import SQLErrorException , TDS_LOGINACK_TOKEN , TDS_ERROR_TOKEN , TDS_ENVCHANGE_TOKEN , TDS_INFO_TOKEN , TDS_ENVCHANGE_VARCHAR , TDS_ENVCHANGE_DATABASE , TDS_ENVCHANGE_LANGUAGE , TDS_ENVCHANGE_CHARSET , TDS_ENVCHANGE_PACKETSIZE <EOL> def printRowsCME ( self ) : <EOL> if self . lastError is True : <EOL> return <EOL> out = '<STR_LIT>' <EOL> self . processColMeta ( ) <EOL> for row in self . rows : <EOL> for col in self . colMeta : <EOL> if row [ col [ '<STR_LIT:Name>' ] ] != '<STR_LIT>' : <EOL> out += col [ '<STR_LIT>' ] % row [ col [ '<STR_LIT:Name>' ] ] + self . COL_SEPARATOR + '<STR_LIT:\n>' <EOL> return out <EOL> def printRepliesCME ( self ) : <EOL> for keys in self . replies . keys ( ) : <EOL> for i , key in enumerate ( self . replies [ keys ] ) : <EOL> if key [ '<STR_LIT>' ] == TDS_ERROR_TOKEN : <EOL> error = "<STR_LIT>" % ( key [ '<STR_LIT>' ] . decode ( '<STR_LIT>' ) , key [ '<STR_LIT>' ] , key [ '<STR_LIT>' ] . decode ( '<STR_LIT>' ) ) <EOL> self . lastError = SQLErrorException ( "<STR_LIT>" % ( key [ '<STR_LIT>' ] , key [ '<STR_LIT>' ] . decode ( '<STR_LIT>' ) ) ) <EOL> self . _MSSQL__rowsPrinter . error ( error ) <EOL> elif key [ '<STR_LIT>' ] == TDS_INFO_TOKEN : <EOL> self . _MSSQL__rowsPrinter . info ( "<STR_LIT>" % ( key [ '<STR_LIT>' ] . decode ( '<STR_LIT>' ) , key [ '<STR_LIT>' ] , key [ '<STR_LIT>' ] . decode ( '<STR_LIT>' ) ) ) <EOL> elif key [ '<STR_LIT>' ] == TDS_LOGINACK_TOKEN : <EOL> self . _MSSQL__rowsPrinter . info ( "<STR_LIT>" % ( key [ '<STR_LIT>' ] , key [ '<STR_LIT>' ] . decode ( '<STR_LIT>' ) , key [ '<STR_LIT>' ] , key [ '<STR_LIT>' ] , key [ '<STR_LIT>' ] , key [ '<STR_LIT>' ] ) ) <EOL> elif key [ '<STR_LIT>' ] == TDS_ENVCHANGE_TOKEN : <EOL> if key [ '<STR_LIT>' ] in ( TDS_ENVCHANGE_DATABASE , TDS_ENVCHANGE_LANGUAGE , TDS_ENVCHANGE_CHARSET , TDS_ENVCHANGE_PACKETSIZE ) : <EOL> record = TDS_ENVCHANGE_VARCHAR ( key [ '<STR_LIT>' ] ) <EOL> if record [ '<STR_LIT>' ] == '<STR_LIT>' : <EOL> record [ '<STR_LIT>' ] = '<STR_LIT:None>' . encode ( '<STR_LIT>' ) <EOL> elif record [ '<STR_LIT>' ] == '<STR_LIT>' : <EOL> record [ '<STR_LIT>' ] = '<STR_LIT:None>' . encode ( '<STR_LIT>' ) <EOL> if key [ '<STR_LIT>' ] == TDS_ENVCHANGE_DATABASE : <EOL> _type = '<STR_LIT>' <EOL> elif key [ '<STR_LIT>' ] == TDS_ENVCHANGE_LANGUAGE : <EOL> _type = '<STR_LIT>' <EOL> elif key [ '<STR_LIT>' ] == TDS_ENVCHANGE_CHARSET : <EOL> _type = '<STR_LIT>' <EOL> elif key [ '<STR_LIT>' ] == TDS_ENVCHANGE_PACKETSIZE : <EOL> _type = '<STR_LIT>' <EOL> else : <EOL> _type = "<STR_LIT>" % key [ '<STR_LIT>' ] <EOL> self . _MSSQL__rowsPrinter . info ( "<STR_LIT>" % ( _type , record [ '<STR_LIT>' ] . decode ( '<STR_LIT>' ) , record [ '<STR_LIT>' ] . decode ( '<STR_LIT>' ) ) ) <EOL> tds . MSSQL . printReplies = printRepliesCME <EOL> tds . MSSQL . printRows = printRowsCME </s>
