You can use Python with XUL with the help of a http server
which execute plain Python Scripts sent by the client.
Like the following :
CPython Server
<?xml version="1।0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="example-window" title="Example 7.2.1"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script language="javascript">
var wmi=" \n\
import wmi \n\
c = wmi.WMI('Python') \n\
for os in c.Win32_OperatingSystem(): \n\
caption = os.Caption \n\
response = caption \n\
filename = 'foo'"
function WebMethod(url,request,callback)
{
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
} catch (e) {
alert("Permission UniversalBrowserRead denied.");
}
var http = new XMLHttpRequest();
var mode = request?"POST":"GET";
http.open(mode,url,true);
if(mode=="POST"){http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');}
http.onreadystatechange=function(){if(http.readyState==4){callback(http.responseText);}};
http.send(request);
}
function CallBack(r)
{
alert(r);
}
</script>
<box id="aBox" width="200">
<button label="GetOsName" oncommand="WebMethod('http://127.0.0.1:9981',wmi,CallBack);"/>
</box>
</window>
ca m'a l'air tres dangereux !
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteTu as entièrement raison, à exécuter dans un environnement sécurisé uniquement
ReplyDelete