Windows防火墙在javascript中启用或禁用 [英] Windows Firewall enable or disable in javascript
本文介绍了Windows防火墙在javascript中启用或禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我试图通过单击浏览器中的按钮来使用javascript启用或禁用Windows防火墙.如果启用了防火墙,则单击应禁用防火墙;如果禁用了防火墙,则单击应启用防火墙(简单的if语句)
我的代码在下面列出
Hi im trying to enable or disable windows firewall using javascript by click on a button in a browser. If the firewall is enabled the click should disable the firewall and if it is disabled the click should enable the firewall (simple if statement)
My code is listed below
<html>
<head>
<title>Firewall</title>
</head>
<body>
<script type="text/javascript">
Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
function fwall()
{
if (objPolicy.FirewallEnabled = TRUE)
{
objPolicy.FirewallEnabled = FALSE
}
else
{
objPolicy.FirewallEnabled = TRUE
}
}
</script>
<button onclick="fwall();">Enable / Disable</button>
</body>
</html>
推荐答案
这是其他系统上的违规机制.根据您要尝试执行的操作,只需单击几下即可禁用防火墙,这听起来像是迈向了木马/病毒输入的一步.
错误的论坛和错误的人,您正在问这个问题.我们不支持或鼓励任何人创建病毒活动.
It''s a breach mechanism on others system. Based on what you are trying to do, disabling a firewall on some click just sounds like a step towards a trojan/virus entry.
Wrong forum and wrong people you are asking this. We do not support or encourage anyone in creating virus kind of activity.
这篇关于Windows防火墙在javascript中启用或禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文