Пример #1
0
    def privmsg(self, user, channel, msg):
        user = user.split('!', 1)[0]
        print("<%s> %s" % (user, msg))

        out = ''
        if user == 'rmarko' and ':' in msg:
            tokens = map(lambda x: x.strip(), msg.split(':'))
            print('tok: %s' % tokens)
            if 'ticho' in tokens:
                self.ticho = cfg.TICHO
                out = "%s: :-x" % user

            if 'zmizni' in tokens:
                reactor.stop()
        elif (user == 'rmarko' or user == 'hexo') and ':' in msg:
            tokens = map(lambda x: x.strip(), msg.split(':'))
            ts = tokens[1].split(' ')
            if ts[0] == 'wolinfo' and ts[1] == cfg.WOL_PWD:
                out = str(WOL_HOSTS)
            if ts[0] == 'wol' and ts[2] == cfg.WOL_PWD
                and cfg.WOL_PWD.has_key(ts[1]):
                out = 'waking %s (%s)' % (cfg.WOL_HOSTS[ts[1]], ts[1])
                wol.wake_on_lan(cfg.WOL_HOStS[ts[1]], cfg.WOL_BROADCAST)

        if out:
            self.msg(channel, out)
Пример #2
0
def startCluster():

    print("starting lenovo")

    wol.wake_on_lan("lenovo")

    print("starting horus")

    wol.wake_on_lan("horus")
Пример #3
0
def btn_action(id):
    global quit_after_wol_var

    host = btn[id].cget("text")
    mac = mac_labels[id].cget("text")
    ip_nr = ip_labels[id].cget("text")
    bc_ip = general_ip_entry.get()

    if(validate_ip(bc_ip)):
        if (wake_on_lan(host, macaddress=mac, broadcast_ip=bc_ip)):
            print(f"magic packet sent to {host}")
            label.config(bg="#5d5", text=host)
            ip_labels[id].config(fg="#22d")

        else:
            print(f"Failed to send packet to\nHost: {host} \nMAC: {mac}")
            label.config(bg="red", text=host)

    repeat_number=repeat_ping_entry.get()
    if(validate_ip(ip_nr) and len(repeat_number) and not repeat_number == "0"):
        try:
            pf.ping_threading(ip_nr, host, int(repeat_number))
            repeat_ping_entry.config(fg="black")
        except ValueError:
            repeat_ping_entry.config(fg="red")


    if quit_after_wol_var.get():
        quit_func()
Пример #4
0
def _do_click_V3001_WAKEUP(server, fromUser, toUser, doc):
    import wol
    ret = False
    reply_msg = '广播失败'
    try:
        ret = wol.wake_on_lan('00:00:00:00:00:00')
    except Exception, e:
        #print e
        pass
Пример #5
0
def _do_click_V3001_WAKEUP(server, fromUser, toUser, doc):
    import wol
    ret = False
    reply_msg = '广播失败'
    try:
        ret = wol.wake_on_lan('00:00:00:00:00:00')
    except Exception, e:
        #print e
        pass
Пример #6
0
def btn5_action():
    ip_addr=text_entry_ip.get()
    bc_ip = general_ip_entry.get()
    mac_addr=check_mac(text_entry_mac.get())
    host_n=text_entry_host.get()

    if (mac_addr):
        text_entry_mac.config(fg="black")
        text_entry_mac.delete(0, END)
        text_entry_mac.insert(0, mac_addr)
        wake_on_lan(host=host_n, broadcast_ip=bc_ip, macaddress=mac_addr)
    else:
        text_entry_mac.config(fg="red")

    if validate_ip(ip_addr):
        text_entry_ip.config(fg="black")
        pf.ping_threading(ip_address=ip_addr, host_name=host_n)
        print ("yoyoyo!!")
    else:
        text_entry_ip.config(fg="red")
Пример #7
0
def start(request, id):
    device = Device.objects.get(pk=id)
    broadcast = Broadcast.objects.get(pk=1)
    context = {}
    try:
        if wake_on_lan(device.mac, broadcast.ip):
            context['message'] = "Magic package is on the way!"
    except ValueError as e:
        context['message'] = "Error: Incorrect address format."
        return render(request, 'core/index.html', {'context': context})
    except Exception as e:  #TODO: Correct exceptionhandling
        context['message'] = "Error: Network unreachable."
        return render(request, 'core/index.html', {'context': context})

    return render(request, 'core/index.html', {'context': context})
Пример #8
0
def startNode(node):

    print("starting %s" % node)

    wol.wake_on_lan(node)
Пример #9
0
 def wol(self):
     wol.wake_on_lan(self.ip, self.mac)
Пример #10
0
def wake():
    wol.wake_on_lan()
    return 'WOL packet sent.'