def move_to(mon, x, y, absolute=True): if absolute: # Reset to top-left mon_cmd("mouse_move -2000 -2000\n", mon) time.sleep(1) mon_cmd("mouse_move {0} {1}\n".format(x, y), mon) time.sleep(.5)
def click(mon): mon_cmd("mouse_button 1\n", mon) # Button 1 down time.sleep(.1) mon_cmd("mouse_button 0\n", mon) # Button 1 up
os.unlink(rr_file) # 需要远程访问https://222.20.79.157 事先填入用户名和密码(手动模拟环境) print("Please visit the forum website and type in the username and password!") tmp = raw_input("Being ready to record? Enter any key: ") # 开启攻击(按框架图这里的攻击应该由bro控制,这里只是方便测试) attack_args = ["python", attack_wrap_script] attack = subprocess.Popen(attack_args, stdin=subprocess.PIPE, stdout=None, stderr=None) # 开启记录 print("Begining the record") mon_cmd("begin_record " + rr_name + "\n", mon) time.sleep(2) ## 按下登录按钮 #print("Please click on the Login button!") #time.sleep(2) # 等待记录 print("Recording...") time.sleep(record_time) ## 关闭攻击 attack.kill() # 结束记录 print("Ending the record")
break except socket.error: time.sleep(1) if not mon: logging.error("Couldn't connect to monitor on port {0}".format(monitor_port)) sys.exit(1) else: logging.info("Successfully connected to monitor on port {0}".format(monitor_port)) # Wait for prompt mon.read_until("(qemu)") # Mount the CD logging.info('Mounting CD image') mon_cmd('change ide1-cd0 {0}\n'.format(iso_file), mon) # Get rid of the CD dialog logging.info('Getting rid of CD autoplay dialog') time.sleep(1) mon_cmd('sendkey esc\n', mon) # Refresh network logging.info("Renewing DHCP lease") guest_type(r"ipconfig /renew" + '\n', mon) time.sleep(1) # Copy the file to the desktop logging.info("Copying file to desktop.") guest_type(r"copy D:\{0} C:\Users\qemu\Desktop".format(sample_name) + '\n', mon)