In order to monitor the boss, I made a fishing artifact in Python

What fish do ordinary people touch? Chat, microblog, wechat circle of friends, games, novels, stock funds, etc.

What is the biggest obstacle to fishing? Of course, it's the contractor (boss). They want workers to work 24 hours a day.

However, people's energy is limited. They can only concentrate on working for a few hours a day. Other times need to be adjusted by fishing. Therefore, as long as we don't get caught by the contractor, it's a very pleasant thing.

To this end, I wrote a small tool in Python - BOSS, to monitor the BOSS and reduce the probability of fishing being found.


We know that every computer or mobile phone and other terminals have a fixed Mac address, while there are several APS in our company's office area. Everyone's mobile phones are connected to the nearest AP, so theoretically, if I know the Mac address of the boss's mobile phone, and then scan all Mac addresses of the LAN, if the Mac address of the boss's mobile phone appears, The boss is probably near me. It's dangerous to fish at this time; If the Mac address of the boss doesn't appear, the boss may be far away from me. It's safer to fish at this time.

Based on the above ideas, all I have to do is get the Mac address of the boss's mobile phone, and then constantly poll all Mac addresses on the LAN. Once I find the Mac address of the boss's mobile phone, I will work honestly. Once the boss's Mac address disappears, I can fish.


Get the boss's mobile Mac address

How do you get the boss's mobile Mac address?

Many people may feel hopeless when they hear this! You can't steal the boss's mobile phone and find it in the settings.

There's no way out of heaven. As long as you're willing to use your brain, there are many ways!

My method is like this. When other colleagues don't walk around, when the boss comes, save the Mac address information of the LAN once. When the boss leaves, save it again, and then compare it to find out the Mac address of the boss's mobile phone. In order to ensure accuracy, you can try several times.

Get all Mac addresses

First, use the ipconfig/all command to find the current network segment:

The second step is to use the polling command to ping the IP in the network segment one by one. This step is to establish the ARP table. The command is as follows:

for /L %i IN (1,1,254) DO ping -w 1 -n 1 192.168.1.%i

Of which, 192.168.1% I is the network segment to query.

Step 3: use the arp command to query all Mac addresses. The command is:

arp -a

After running, you will see results similar to the following:

code implementation

The idea has been verified and the preparations have been made. The next step is the code implementation.

First, according to the above idea, we first write a method to obtain all Mac addresses in the LAN.

def get_macs():
    # Run the cmd control window, enter "arp -a" and pass the content to res
    res = os.popen("arp -a")
    # Read res data and convert it into readable data
    arps =

    # Divide and slice the data in the obtained counts according to the "newline character"
    result = arps.split('\n')

    # Set an empty list to install ip
    ips = []
    # Set an empty list to install mac
    macs = []

    # ergodic
    for i in range(1, len(result)):
        # Get the idx data in the list
        line = result[i]
        if ('Internet' in line) | ('' == line) | ('Interface' in line):
        # Slice according to ""
        line_split = line.split(" ")
        index = 0
        for l in line_split:
            if l != '':
                index += 1
                if index == 1:
                elif index == 2:

    return ips, macs

Then, write a timed poll.

# Mac address of the boss
bossMac = "01-00-5e-0b-14-01"
sleep_time = 5
while 1 == 1:
    ips, macs = get_macs()
    is_come = 0
    for mac in macs:
        if mac == bossMac:
            is_come = 2
            # If the boss comes, scan every five minutes
            sleep_time = 300
            # Prompt alarm
            choice = g.msgbox(msg="There's an insider, close the deal!", title="OMG")
    if is_come == 0:
        # If the boss is gone, scan every five seconds
        sleep_time = 5
        g.msgbox(msg="business as usual!", title="OMG")

What I set here is: if the boss appears, poll every five minutes, because if the boss is there, you should concentrate on your work and don't think about fishing too often. If the boss is gone, poll every five seconds. It's better to give frequent early warning when fishing!

Run the program. When the boss comes, the warning pop-up window looks like this:

When the boss disappears, the content of the pop-up window is as follows:


Of course, if the boss doesn't turn on WiFi, this method will fail. Or if the boss comes over, but the mobile phone responds slowly and does not switch to the AP here, it will also be dangerous. So don't rely entirely on this gadget. When fishing, you should occasionally observe the surrounding environment.

Finally, I still have to remind you: small touch is pleasant, big touch hurts your body!

Recommended reading

My cousin said that this Python regular task can earn 5000. Do you believe me?

Keywords: Python Back-end

Added by andy666 on Sat, 26 Feb 2022 14:06:38 +0200