我使用脚本:#!/usr/bin/python
from uuid import getnode as get_mac
import socket
import requests
import datetime
import os
def main():
print('start')
i = datetime.datetime.now()
#print ("Current date & time = %s" % i)
headers = {"Content-Type": "text/html; charset=UTF-8"}
r = requests.post("http://michulabs.pl", data={'name' : 'CI17nH', 'ip' : getIp(), 'mac' : getMac(), 'source' : 'so', 'join_date' : i})
print(r.status_code, r.reason)
print(r.text) # TEXT/HTML
print(r.status_code, r.reason) # HTTP
os.system('zenity --warning --text="It is part of master thesis. \nThis script is safe but you should never open files from untrusted source. \nThanks for help!"')
"""
method to read ip from computer
it will be saved in database
"""
def getIp():
ip = socket.gethostbyname(socket.gethostname())
print 'ip: ' + str(ip)
return ip
"""
method to read mac from computer
it will be saved in database
"""
def getMac():
mac = get_mac()
print 'mac: ' + str(mac)
return mac
if __name__ == "__main__":
main()
它在Linux(Kali-Linux)上运行良好,但是当我在Windows上使用它时(在py2exe创建了.exe文件之后),消息框会弹出,然后立即消失,而不需要等待单击“确定”。如何强制它等待单击的按钮?在