Esempio n. 1
0
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
Esempio n. 2
0
 def load_folder(self, path):
     self.base_path = path
     self.path_md = ''
     self.path_dba = ''
     self.db_server, self.db_name, self.db_user, self.db_password = '', '', '', ''
     if os.path.isdir(self.base_path):
         mylog.debug(' init from folder: %s' % self.base_path)
         self.path_md  = os.path.join(self.base_path, '1Cv7.MD')
         self.path_dba = os.path.join(self.base_path, '1Cv7.DBA')
         if os.path.exists(self.path_md):
             self.load_1cv7_md(self.path_md)
         if os.path.exists(self.path_dba):
             from v7 import dba
             self.db_server, self.db_name, self.db_user, self.db_password = dba.read_dba(self.path_dba)
             self.init_db_engine()
Esempio n. 3
0
File: core.py Progetto: yarmol/v7py
 def load_folder(self, path):
     self.base_path = path
     self.path_md = ''
     self.path_dba = ''
     self.db_server, self.db_name, self.db_user, self.db_password = '', '', '', ''
     if os.path.isdir(self.base_path):
         mylog.debug(' init from folder: %s' % self.base_path)
         self.path_md = os.path.join(self.base_path, '1Cv7.MD')
         self.path_dba = os.path.join(self.base_path, '1Cv7.DBA')
         if os.path.exists(self.path_md):
             self.load_1cv7_md(self.path_md)
         if os.path.exists(self.path_dba):
             from v7 import dba
             self.db_server, self.db_name, self.db_user, self.db_password = dba.read_dba(
                 self.path_dba)
             self.init_db_engine()
Esempio n. 4
0
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
Esempio n. 5
0
        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)
Esempio n. 6
0
    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)
Esempio n. 7
0
 def __init__(self, base_path=None):
     mylog.debug('init Application')
     self.metadata = None
     self.md = None
     self.db = None
     self.load_folder(base_path)
Esempio n. 8
0
 def load_1cv7_md(self,filename):
     mylog.debug(' load: %s' % filename)
     self.md = md_reader.parse_md(filename)
     self.metadata = md_reader.extract_metadata(self.md)
Esempio n. 9
0
 def disconect(self):
     if self.db:
         mylog.debug('disconect db')
         self.db.close()
Esempio n. 10
0
 def connect(self):
     if self.db:
         mylog.debug('connect db')
         self.db.connect()
Esempio n. 11
0
 def init_db_engine(self):
     if self.db_server:
         mylog.debug('init MSSQL connection proxy')
         from v7 import MS_Proxy
         self.db = MS_Proxy(self.db_name, self.db_server, self.db_user, self.db_password)
Esempio n. 12
0
File: core.py Progetto: yarmol/v7py
 def load_1cv7_md(self, filename):
     mylog.debug(' load: %s' % filename)
     self.md = md_reader.parse_md(filename)
     self.metadata = md_reader.extract_metadata(self.md)
Esempio n. 13
0
File: core.py Progetto: yarmol/v7py
 def disconect(self):
     if self.db:
         mylog.debug('disconect db')
         self.db.close()
Esempio n. 14
0
File: core.py Progetto: yarmol/v7py
 def connect(self):
     if self.db:
         mylog.debug('connect db')
         self.db.connect()
Esempio n. 15
0
File: core.py Progetto: yarmol/v7py
 def init_db_engine(self):
     if self.db_server:
         mylog.debug('init MSSQL connection proxy')
         from v7 import MS_Proxy
         self.db = MS_Proxy(self.db_name, self.db_server, self.db_user,
                            self.db_password)
Esempio n. 16
0
File: core.py Progetto: yarmol/v7py
 def __init__(self, base_path=None):
     mylog.debug('init Application')
     self.metadata = None
     self.md = None
     self.db = None
     self.load_folder(base_path)