Beispiel #1
0
 def wait_for_availability(self, container):
     try:
         return requests.get(
             "http://localhost:%s" %
             get_host_port(container, "5984")).status_code == 200
     except Exception as e:
         return False
Beispiel #2
0
 def wait_for_availability(self, container):
     try:
         db = pymysql.connect("localhost",
                              "root",
                              "123456",
                              port=get_host_port(container, "3306"))
     except Exception as e:
         return False
     return True
Beispiel #3
0
    def init_victim(self, container, logger):
        port = get_host_port(container, "3306")
        try:
            db = pymysql.connect("localhost", "root", "123456", port=port)
            try:
                db.cursor().execute('create database ' + "textDB")
            except:
                pass

            self.db = pymysql.connect("localhost", "root", "123456", "textDB", port)
            sql = """CREATE TABLE `texts` (
                         `id` int(11) NOT NULL AUTO_INCREMENT, 
                         `text` varchar(255) COLLATE utf8_bin NOT NULL, 
                         PRIMARY KEY (`id`)
                     ) 
                     ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin 
                     AUTO_INCREMENT=1 ;"""
            self.db.cursor().execute(sql)
        except Exception as e:
            pass
Beispiel #4
0
 def init_victim(self, container, logger):
     init("localhost:%s" % get_host_port(container, "5984"), logger,
          full_chain)