Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 support #5

Open
nikhildr22 opened this issue Sep 28, 2020 · 6 comments
Open

Python 3 support #5

nikhildr22 opened this issue Sep 28, 2020 · 6 comments

Comments

@nikhildr22
Copy link

I can contribute in converting these to python 3

@red-rhett
Copy link

red-rhett commented Sep 28, 2020

I can contribute in converting these to python 3

Hi, I need some help with regex in python3 - in python2 I'm getting the right result from code input (e.g. line 53 https://github.com/Loganinit/python-zaid/blob/master/1%20mac_changer/macchanger-9.py)

current_mac = re.search(r"\w\w:\w\w:\w\w:\w\w:\w\w:\w\w",ifconfig_result)

but I cannot find the correct input for python3. Can you help? I've tried flags options etc

The error includes

TypeError: cannot use a string pattern on a bytes-like object"

Thanks!

@nikhildr22
Copy link
Author

Hey,
subprocess.check_output(["ifconfig",interface]) returns raw data in bytes. You can use a byte method called decode( ) to convert the byte to string before using regex.
i've made the changes for you in my forked repo.. https://github.com/nikhildr22/python-zaid/blob/master/1%20mac_changer/macchanger-9.py

@red-rhett
Copy link

Hey,
subprocess.check_output(["ifconfig",interface]) returns raw data in bytes. You can use a byte method called decode( ) to convert the byte to string before using regex.
i've made the changes for you in my forked repo.. https://github.com/nikhildr22/python-zaid/blob/master/1%20mac_changer/macchanger-9.py

That's amazing, and such a simple solution. Thank you!

@nikhildr22
Copy link
Author

im rewriting every one of these files for python 3 support, feel free to ping me if something comes up

@red-rhett
Copy link

im rewriting every one of these files for python 3 support, feel free to ping me if something comes up

Hello nikhildr22, and thanks again for updating the Ch1 sections.
Zaid's videos (Udemy and O'Reilly) and code are really an EXCELLENT source, but the course's reliance on Python 2.7 is no longer relevant, since 2.7 entered end of life this year. It appears that at each step I am encountering issues in conversion. I have an email on which you can contact me (see profile), and that way I can be more specific.

Thanks!

@ChongChink
Copy link

ChongChink commented Sep 30, 2021

use python pip module 2to3 to convert python2 files to python3 files
example: suppose the keylogger works with python2 so u run 2to3 -w keylogger.py (this will convert the existing file to python3 and will create a backup file - keylogger.bak)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants