I'm having this really strange problem I can't figure out in Python. I'm essentially checking your computer's arp table, and trying to send a "Magic Packet" from a specific IP. my problem is that when I create a function to list the content of that arp table, then make a list of MAC addresses'. long story short here I'm using Tkinter for an interface. I'm creating a list of buttons and use lambda to pass an index variable as an argument to the function call associated with the button.
pseudo code
def arp_window:
create tk window
check arp table and make a list of it MAC address'
loop threw the list in order to populate the window
macs.append(mac)
populate the window with tk.Label for each mac address
populate the window with tk.Button for each mac address and when its pressed run wake(macs[index])
def wake(x):
send Magic Packet to x
so what is happening is that my function runs and always send a Magic Packet to the last mac. I have tried everything i can think of but always get the same result of having the very last mac on the list being sent the command.
Github project https://github.com/shifty189/Puter-waker/blob/shifty189-Arp-Wake-patch/Main.py