1

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

DangerAnt
  • 11
  • 2
  • 1
    You're fine to link to GitHub, but it would be easiest if you were able to put a real code example. Since your question is about a specific piece of code behaviour, it's hard to answer without a specific example :) But I think the short answer to your question is "when it's called" – Tim Jun 21 '20 at 00:15
  • Welcome to SO. Please read [mre]. It might be best to make a minimal toy example that illustrates the problem you are having. Something you can include here that can be copied then pasted into an editor. Also please take the time to read [ask]. – wwii Jun 21 '20 at 00:18

0 Answers0