Пример #1
0
def netstat_b_o():
    #print "\n*****************************************************************************************"
    checkPrivilege()
    # subprocess.call("netstat -b -o")
    try:
        x = "kooko"
        print x
        x = subprocess.Popen("netstat -b -o", stdout=subprocess.PIPE)
        # print x.stdout.read()
        text = x.stdout.read()
    # x = subprocess.check_output("cmd -command \"netstat -e -o\"")
    except:
        print "============>>> ", x
    # print "+++++++++++++++",x," .. ",text
    return text
Пример #2
0
def Block(process):
    # checkPrivilege()
    print "==========================>>>>", process
    checkPrivilege()
    try:
        x = subprocess.call(
            "netsh advfirewall firewall set rule name=\"Block" + process +
            "\" new enable=yes")
        print x
        if x == 1:
            print "Adding new rule: -------->", process
            AddRule(process, getProcessPathByName(process))
            Block(process)
    except:
        ad = getProcessPathByName(process)
        print '--->', ad
        AddRule(process, ad)
        Block(process)
Пример #3
0
import admin
from admin import checkPrivilege
import main
from main import Block, Unblock
import processList
from processList import getProcessTable
import get_process_path
from get_process_path import getProcessPathByPID, getProcessPathByName

# import urllib
# import json
#
# import pandas as pd
# import numpy as np

checkPrivilege()

LARGE_FONT = ("Verdana", 12)
SMALL_FONT = ("Verdana", 10)
style.use("ggplot")

f = Figure()
a = f.add_subplot(111)
f.set_figheight(240)

dList = []
uList = []
index = []

for i in range(1, 100):
    index.append(i)
Пример #4
0
def AddRule(process, address):
    checkPrivilege()
    print subprocess.check_call(
        "netsh advfirewall firewall add rule name=\"Block" + process +
        "\" dir=out action=block program=\"" + address + "\"  enable=yes")