• 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 that the user has changed is correct

AnonyViet by AnonyViet
February 2, 2023
in Tips
0

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

Join the channel Telegram of the AnonyViet 👉 Link 👈

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

Get the result of the ifconfig . command

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

[PyHack]  Lesson 2: Check if the MAC that the user has changed is correct 14
It’s a bit bad, you guys can check it out 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 that the user has changed is correct 15[PyHack]  Lesson 2: Check if the MAC that the user has changed is correct 16

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

FIND MAC

In programming, there is an algorithm called Regular Expression aka 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 them for your expressions to work. .

You guys come in Pythex so you can test this algorithm online. Click on the word Regular expression cheatsheet to learn more expressions included 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 the 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 that the user has changed is correct 17

Ta da! We have found the location of the MAC already, easy?

Using RegEx in python

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

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

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

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

When the program cannot read the MAC of the interface.

[PyHack]  Lesson 2: Check the MAC that the user has changed to see if it is correct 20

Compact code

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

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

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 the 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.

check mac address python[PyHack]  Lesson 2: Check if the MAC that the user has changed is correct 23

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

Remember the error of not changing the MAC when the first pair of numbers was odd? There was an error last time, but this time it’s gone.[PyHack]  Lesson 2: Check if the MAC that the user has changed is correct 25

The article achieved: 5/5 – (100 votes)

Tags: changedcheckcorrectLessonMacPyHackUser
Previous Post

[Giveaway] VideoProc – High Quality 4K Video Editing Software

Next Post

Instructions for creating a disconect hack tool LoL

AnonyViet

AnonyViet

Related Posts

4 ways to fix bluetooth connectivity on Windows 11
Tips

4 ways to fix bluetooth connectivity on Windows 11

August 8, 2025
How to know the computer is tracked and processed by Keylogger
Tips

How to know the computer is tracked and processed by Keylogger

August 7, 2025
Opal: Create applications who do not need to write code
Tips

Opal: Create applications who do not need to write code

August 3, 2025
How to activate a new Start menu on Windows 11
Tips

How to activate a new Start menu on Windows 11

July 29, 2025
Intellgpt: AI tool for osint and data science
Tips

Intellgpt: AI tool for osint and data science

July 28, 2025
How to create Google Ai Pro 12 months free with Indian student account
Tips

How to create Google Ai Pro 12 months free with Indian student account

July 27, 2025
Next Post
Instructions for creating a disconect hack tool LoL

Instructions for creating a disconect hack tool LoL

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Recent News

How to add application to your favorite bar

How to add application to your favorite bar

August 14, 2025
Wowhay.com – The door opens the world of modern knowledge and network culture

Wowhay.com – The door opens the world of modern knowledge and network culture

August 13, 2025
Instructions on how to fix Screen Time Limited Reached on RoBlox

Instructions on how to fix Screen Time Limited Reached on RoBlox

August 13, 2025
How to install GPT-suns on who do not need the Internet

How to install GPT-suns on who do not need the Internet

August 12, 2025
How to add application to your favorite bar

How to add application to your favorite bar

August 14, 2025
Wowhay.com – The door opens the world of modern knowledge and network culture

Wowhay.com – The door opens the world of modern knowledge and network culture

August 13, 2025
Instructions on how to fix Screen Time Limited Reached on RoBlox

Instructions on how to fix Screen Time Limited Reached on RoBlox

August 13, 2025
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

How to add application to your favorite bar

How to add application to your favorite bar

August 14, 2025
Wowhay.com – The door opens the world of modern knowledge and network culture

Wowhay.com – The door opens the world of modern knowledge and network culture

August 13, 2025
  • Home
  • Home 2
  • Home 3
  • Home 4
  • Home 5
  • Home 6
  • Next Dest Page
  • Sample Page

©2024 AnonyVietFor Knowledge kqxs hôm nay xem phim miễn phí mm88 8XBET mm88 trang chủ new88

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

©2024 AnonyVietFor Knowledge kqxs hôm nay xem phim miễn phí mm88 8XBET mm88 trang chủ new88

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