• 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

Instructions for receiving 3 months of Shopee VIP from Vinaphone for 0 VND
Tips

Instructions for receiving 3 months of Shopee VIP from Vinaphone for 0 VND

October 3, 2026
How to use Stylish to change the interface of Facebook and Youtube to be extremely beautiful
Tips

How to use Stylish to change the interface of Facebook and Youtube to be extremely beautiful

October 3, 2026
Instructions on how to receive 1 billion Muse AI tokens
Tips

Instructions on how to receive 1 billion Muse AI tokens

October 1, 2026
Instructions for getting 12 months of Google AI Plus for free (Indian students)
Tips

Instructions for getting 12 months of Google AI Plus for free (Indian students)

October 1, 2026
Instructions for creating job card photos using AI
Tips

Instructions for creating job card photos using AI

October 1, 2026
Free course to bypass antivirus and EDR software
Tips

Free course to bypass antivirus and EDR software

October 1, 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

Instructions for receiving 3 months of Shopee VIP from Vinaphone for 0 VND

Instructions for receiving 3 months of Shopee VIP from Vinaphone for 0 VND

October 3, 2026
How to create Safari extension on iOS 27 and macOS 27

How to create Safari extension on iOS 27 and macOS 27

October 3, 2026
How to use Stylish to change the interface of Facebook and Youtube to be extremely beautiful

How to use Stylish to change the interface of Facebook and Youtube to be extremely beautiful

October 3, 2026
How to write the word Hoa Ki on Casio calculator

How to write the word Hoa Ki on Casio calculator

October 3, 2026
Instructions for receiving 3 months of Shopee VIP from Vinaphone for 0 VND

Instructions for receiving 3 months of Shopee VIP from Vinaphone for 0 VND

October 3, 2026
How to create Safari extension on iOS 27 and macOS 27

How to create Safari extension on iOS 27 and macOS 27

October 3, 2026
How to use Stylish to change the interface of Facebook and Youtube to be extremely beautiful

How to use Stylish to change the interface of Facebook and Youtube to be extremely beautiful

October 3, 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

Instructions for receiving 3 months of Shopee VIP from Vinaphone for 0 VND

Instructions for receiving 3 months of Shopee VIP from Vinaphone for 0 VND

October 3, 2026
How to create Safari extension on iOS 27 and macOS 27

How to create Safari extension on iOS 27 and macOS 27

October 3, 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