• Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
AnonyViet - English Version
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
AnonyViet - English Version
No Result
View All Result

[PyHack] Lesson 2: Check if the MAC the user has changed is correct

AnonyViet by AnonyViet
December 29, 2024
in Tips
0

Continue lesson 1after we have written the function to change the MAC address on the terminal. We need to check whether the current MAC matches the MAC address specified by the user or not.

Join the channel Telegram belong to AnonyViet 👉 Link 👈

To do that, first, we must get the result of the “ifconfig” command and assign it to a string variable. Then, we will find the MAC in that pile of data.Check the MAC that the user has changed to see if it is correct

Get the results of the ifconfig command

In module subprocess there is a function called check_outputthis function will test your command and possibly assign the result to another variable.test mac with pyhack

[PyHack]  Lesson 2: Check if the MAC the user has changed is correct
It's a bit poorly printed, please help me take a look and see where the MAC is located (hihi). We fix this problem by adding the command decode('utf-8')[PyHack]  Lesson 2: Check if the MAC the user has changed is correct[PyHack]  Lesson 2: Check if the MAC the user has changed is correct

After successfully getting the results of the ifconfig command, we will find the MAC in this pile of data.

FIND MAC

In programming, there is an algorithm called Regular Expressions also known as RegEx for short. RegEX is a regular expression used for advanced string processing through its own expressions. These expressions will have their own rules and you must follow those rules for your expression to work. .

You guys come in Pythex So you can test this algorithm online. Click on the text Regular expressions cheatsheet to learn more about the expressions available in Pythex.Find mac address using Regular Expression

You copy the text that the ifconfig command returns and paste it in place Your test string. On section Your regular expression then enter \w\w:\w\w:\w\w:\w\w:\w\w:\w\w[PyHack]  Lesson 2: Check if the MAC the user has changed is correct

Ta da! We have found MAC's location, isn't it easy?

Using RegEx in python

The RegEx algorithm is included in the module re of python. We use functions re.search("cú pháp", biến)Using RegEx in python

[PyHack]  Lesson 2: Check if the MAC the user has changed is correct

Now we add an if statement to check whether the interface's MAC can be read or not.

[PyHack]  Lesson 2: Check if the MAC the user has changed is correct

When the program cannot read the MAC of the interface.

[PyHack]  Lesson 2: Check if the MAC the user has changed is correct

Compact code

We will put in the code from before hàm get_current_mac()and return the result to the current_mac variable, then print it out. Because curret_mac is a Non-type, I just forced it to a string.[PyHack]  Lesson 2: Check if the MAC the user has changed is correct

[PyHack]  Lesson 2: Check if the MAC the user has changed is correct

Check MAC

After getting the current MAC address, we will compare it with the new MAC address specified by the user. To see if when changing MAC, the current MAC address is the same as the MAC address the user entered. If they are the same, they will succeed, if they are different, they will fail.

[PyHack] Lesson 2: Check if the MAC the user has changed is correct[PyHack]  Lesson 2: Check if the MAC the user has changed is correct

And this is when you enter the wrong interface.[PyHack]  Lesson 2: Check if the MAC the user has changed is correct

Remember the error of not being able to change MAC when the first pair of numbers is an odd number? Last time the error still appeared, but this time it's gone.[PyHack]  Lesson 2: Check if the MAC the user has changed is correct

Previous Post

How to use ChatGPT on WhatsApp: Did you know?

Next Post

How to use Deepseek V3: Chinese AI for free

AnonyViet

AnonyViet

Related Posts

SynthID Detector: Genuine AI checking tool from Google
Tips

SynthID Detector: Genuine AI checking tool from Google

October 11, 2026
Microsoft is preparing to launch Windows 11
Tips

Microsoft is preparing to launch Windows 11

October 9, 2026
How to download all photos from Google Photos to transfer to another service
Tips

How to download all photos from Google Photos to transfer to another service

October 8, 2026
How to use newly updated utilities on Windows 10
Tips

How to use newly updated utilities on Windows 10

October 7, 2026
Stealth Reader – Web story reader with Excel interface without being detected by the boss
Tips

Stealth Reader – Web story reader with Excel interface without being detected by the boss

October 7, 2026
Tips for handling when JPG images cannot be saved in Photoshop
Tips

Tips for handling when JPG images cannot be saved in Photoshop

October 6, 2026
Next Post
How to use Deepseek V3: Chinese AI for free

How to use Deepseek V3: Chinese AI for free

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted

Recent News

SynthID Detector: Genuine AI checking tool from Google

SynthID Detector: Genuine AI checking tool from Google

October 11, 2026
NoteCute – Extension to create super cute sticky notes

NoteCute – Extension to create super cute sticky notes

October 10, 2026
Super virtual way to change the photography angle using AI on iPhone

Super virtual way to change the photography angle using AI on iPhone

October 9, 2026
Instructions for detecting network vulnerabilities: How to check the system for data leaks (IP/DNS)

Instructions for detecting network vulnerabilities: How to check the system for data leaks (IP/DNS)

October 9, 2026
SynthID Detector: Genuine AI checking tool from Google

SynthID Detector: Genuine AI checking tool from Google

October 11, 2026
NoteCute – Extension to create super cute sticky notes

NoteCute – Extension to create super cute sticky notes

October 10, 2026
Super virtual way to change the photography angle using AI on iPhone

Super virtual way to change the photography angle using AI on iPhone

October 9, 2026
AnonyViet - English Version

AnonyViet

AnonyViet is a website share knowledge that you have never learned in school!

We are ready to welcome your comments, as well as your articles sent to AnonyViet.

Follow Us

Contact:

Email: anonyviet.com[@]gmail.com

Main Website: https://anonyviet.com

Recent News

SynthID Detector: Genuine AI checking tool from Google

SynthID Detector: Genuine AI checking tool from Google

October 11, 2026
NoteCute – Extension to create super cute sticky notes

NoteCute – Extension to create super cute sticky notes

October 10, 2026
  • Home
  • Home 2
  • Home 3
  • Home 4
  • Home 5
  • Home 6
  • Next Dest Page
  • Sample Page

say88 tỷ lệ kèo nhà cái kèo nhà cái 5 febet

No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

say88 tỷ lệ kèo nhà cái kèo nhà cái 5 febet

wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
| Reply