with open(filename, 'rb') as f: buff = f.read() mylog.debug('buff [%s]' % buff) key = "19465912879oiuxc ensdfaiuo3i73798kjl".encode("US-ASCII") mylog.debug(key) ##decode[i] = ((byte)(buf[i] ^ SQLKeyCode[(i % 36)])); decode = [] s = '' for i in xrange(0, len(buff)): b = ord(buff[i]) ^ ord(key[(i % 36)]) decode.append(b) s += chr(b) mylog.debug(s) s = s.replace('","', '":"').replace('{{', '{').replace('}}', '}').replace('},{', ',') #mylog.debug(s) v = eval(s) #mylog.debug(repr(v)) if dict_ret: return v Server, DB, Login, Password = v["Server"], v["DB"], v["UID"], v["PWD"] mylog.debug(repr([Server, DB, Login, Password])) return Server, DB, Login, Password #{{"Server","192.168.1.30"},{"DB","work"},{"UID","sa"},{"PWD","xxxeral!"},{"Checksum","bf062f4f"}} if __name__ == '__main__': from v7 import getDataPath server, db, user, pwd = read_dba(getDataPath('1Cv7.DBA')) mylog.debug("Server: %s" % server)
def read_dba(filename, dict_ret=False): buff = '' with open(filename, 'rb') as f: buff = f.read() mylog.debug('buff [%s]' % buff) key = "19465912879oiuxc ensdfaiuo3i73798kjl".encode("US-ASCII") mylog.debug(key) ##decode[i] = ((byte)(buf[i] ^ SQLKeyCode[(i % 36)])); decode = [] s = '' for i in xrange(0, len(buff)): b = ord(buff[i]) ^ ord(key[(i%36)]) decode.append( b ) s += chr(b) mylog.debug(s) s = s.replace('","','":"').replace('{{','{').replace('}}','}').replace('},{',',') #mylog.debug(s) v = eval(s) #mylog.debug(repr(v)) if dict_ret: return v Server, DB, Login, Password = v["Server"], v["DB"], v["UID"], v["PWD"] mylog.debug(repr([Server, DB, Login, Password])) return Server, DB, Login, Password #{{"Server","192.168.1.30"},{"DB","work"},{"UID","sa"},{"PWD","xxxeral!"},{"Checksum","bf062f4f"}} if __name__ == '__main__': from v7 import getDataPath server, db, user, pwd = read_dba(getDataPath('1Cv7.DBA')) mylog.debug("Server: %s" % server)
def pprint(self): myprint.pprint(self) def as_div(self): r = u'<div class="%s">%s</div>' % div_class tr = [] for tgroup, tbls in self.items(): t = '<div>%s</div>' % tgroup #for tbl in t return r # пытаюсь загрузить файл описания в папке со скриптом from v7 import getDataPath dds_filename = getDataPath('1Cv7.DDS') dds = None class DdsFileNotFoundException(RuntimeError): pass def read_dds(): global dds if dds is None: if os.path.exists(dds_filename): dds = DDS(dds_filename) if dds is None: raise DdsFileNotFoundException(dds_filename)
raise RuntimeError(u"errors prepare sql:%s" % sqlres) return sqlres def pprint(self): myprint.pprint(self) def as_div(self): r = u'<div class="%s">%s</div>' % div_class tr = [] for tgroup,tbls in self.items(): t = '<div>%s</div>' % tgroup #for tbl in t return r # пытаюсь загрузить файл описания в папке со скриптом from v7 import getDataPath dds_filename = getDataPath('1Cv7.DDS') dds = None class DdsFileNotFoundException(RuntimeError): pass def read_dds(): global dds if dds is None: if os.path.exists(dds_filename): dds = DDS(dds_filename) if dds is None: raise DdsFileNotFoundException(dds_filename) def parse(query, debug=False): ''' собственно говоря преобразует запрос к нужному виду ''' read_dds()