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

ASCII codec can't encode characters #526

Closed
mubix opened this issue May 7, 2020 · 14 comments
Closed

ASCII codec can't encode characters #526

mubix opened this issue May 7, 2020 · 14 comments

Comments

@mubix
Copy link
Contributor

mubix commented May 7, 2020

On Debian 9 I'm getting an odd error when trying to start PTF

root@pentestframework:~/ptf# ./ptf 
[*] You can always type ./ptf --no-network-connection to skip the Internet check..
[*] Checking for an Internet connection...
[*] Trying to update myself first.. Then starting framework.
Already up-to-date.
[!] [!] DANGER WILL ROBINSON. DANGER WILL ROBINSON. Error has occurred.
[!] [!] It's not possible its due to my coding skillz, it must be you? :-)
[!] [!] Printing that error. Get that error. You get it: ['ascii' codec can't encode characters in position 36-47: ordinal not in range(128)]
@mubix
Copy link
Contributor Author

mubix commented May 7, 2020

Using build 3d1f5cf

@mubix
Copy link
Contributor Author

mubix commented May 7, 2020

Checking out the prior version solves this issue: 371a67e

@mubix
Copy link
Contributor Author

mubix commented May 7, 2020

Also passing -nb works as well

root@pentestframework:~/ptf# ./ptf -nb
[*] You can always type ./ptf --no-network-connection to skip the Internet check..
[*] Checking for an Internet connection...
[*] Trying to update myself first.. Then starting framework.
Already up-to-date.
[*] Operating system detected as: DEBIAN
[*] Welcome to PTF - where everything just works...Because..Aliens

For a list of available commands type ? or help

ptf> exit

@mubix
Copy link
Contributor Author

mubix commented May 7, 2020

@mubix
Copy link
Contributor Author

mubix commented May 7, 2020

Also getting it with search

root@pentestframework:~/ptf# ./ptf -nb
[*] You can always type ./ptf --no-network-connection to skip the Internet check..
[*] Checking for an Internet connection...
[*] Trying to update myself first.. Then starting framework.
Already up-to-date.
[*] Operating system detected as: DEBIAN
[*] Welcome to PTF - where everything just works...Because..Aliens

For a list of available commands type ? or help

ptf> search unicorn
[!] [!] DANGER WILL ROBINSON. DANGER WILL ROBINSON. Error has occurred.
[!] [!] It's not possible its due to my coding skillz, it must be you? :-)
[!] [!] Printing that error. Get that error. You get it: ['ascii' codec can't decode byte 0xc5 in position 169: ordinal not in range(128)]

@mubix
Copy link
Contributor Author

mubix commented May 7, 2020

Tried with the following:

  • Python 2.7.13 (default, Sep 26 2018, 18:42:22)
  • Python 3.5.3 (default, Sep 27 2018, 17:25:39)

@HackingDave
Copy link
Contributor

Thanks, we just updated the banner today... will revert it back

@HackingDave
Copy link
Contributor

just pushed an update, can you give it a shot

@mubix
Copy link
Contributor Author

mubix commented May 7, 2020

Works again. Thanks @HackingDave

@mubix
Copy link
Contributor Author

mubix commented May 7, 2020

Oddly enough I still run into this with the search unicorn command:

root@pentestframework:~/ptf# ./ptf
[*] You can always type ./ptf --no-network-connection to skip the Internet check..
[*] Checking for an Internet connection...
[*] Trying to update myself first.. Then starting framework.
Already up-to-date.

 _____ _           ______        _____         _                 ______                                           _    
|_   _| |          | ___ \      |_   _|       | |                |  ___|                                         | |   
  | | | |__   ___  | |_/ /__ _ __ | | ___  ___| |_ ___ _ __ ___  | |_ _ __ __ _ _ __ ___   _____      _____  _ __| | __
  | | | '_ \ / _ \ |  __/ _ \ '_ \| |/ _ \/ __| __/ _ \ '__/ __| |  _| '__/ _` | '_ ` _ \ / _ \ \ /\ / / _ \| '__| |/ /
  | | | | | |  __/ | | |  __/ | | | |  __/\__ \ ||  __/ |  \__ \ | | | | | (_| | | | | | |  __/\ V  V / (_) | |  |   < 
  \_/ |_| |_|\___| \_|  \___|_| |_\_/\___||___/\__\___|_|  |___/ \_| |_|  \__,_|_| |_| |_|\___| \_/\_/ \___/|_|  |_|\_\


                     The PenTesters Framework

                           Version: 2.4.3
                        Codename: Toolsmith
                         Red Team Approved
                      A project by TrustedSec
                 Written by: Dave Kennedy (ReL1K)
                Twitter: @HackingDave, @TrustedSec

                    https://www.trustedsec.com
        
              The easy way to get the new and shiny.

             Total module/tool count within PTF: 308

All tools are downloaded directly from the developers websites as-is.  PTF 
doesn't perform any type of source code analysis or verification on the tools.
You should run these after performing your own analysis of the tools and ensure 
you trust the parties. PTF only adds tools that are well-known typically in the 
security industry but that does not negate the risk. This is no different than 
any other tool distribution platform, operating system, or anything you would 
download from the Internet.

[*] Operating system detected as: DEBIAN
[*] Welcome to PTF - where everything just works...Because..Aliens

For a list of available commands type ? or help

ptf> search unicorn
[!] [!] DANGER WILL ROBINSON. DANGER WILL ROBINSON. Error has occurred.
[!] [!] It's not possible its due to my coding skillz, it must be you? :-)
[!] [!] Printing that error. Get that error. You get it: ['ascii' codec can't decode byte 0xc5 in position 169: ordinal not in range(128)]
root@pentestframework:~/ptf# 

@HackingDave
Copy link
Contributor

weird, let me investigate, can't replicate on Ubuntu, let me check with Debian 9

@mubix
Copy link
Contributor Author

mubix commented May 7, 2020

Added trace output:

ptf> search unicorn
[!] [!] DANGER WILL ROBINSON. DANGER WILL ROBINSON. Error has occurred.
[!] [!] It's not possible its due to my coding skillz, it must be you? :-)
[!] [!] Printing that error. Get that error. You get it: ['ascii' codec can't decode byte 0xc5 in position 169: ordinal not in range(128)]
Traceback (most recent call last):
  File "./ptf", line 95, in <module>
    src.framework.mainloop()
  File "/root/ptf/src/framework.py", line 781, in mainloop
    handle_prompt(prompt)
  File "/root/ptf/src/framework.py", line 595, in handle_prompt
    search(prompt)
  File "/root/ptf/src/core.py", line 397, in search
    data = open(path, "r").readlines()
  File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 169: ordinal not in range(128)

@mubix
Copy link
Contributor Author

mubix commented May 7, 2020

In

ptf/src/core.py

Line 397 in 976e48b

data = open(path, "r").readlines()

changing the line to data = open(path, "r", encoding="utf-8").readlines() fixed search

@HackingDave
Copy link
Contributor

Thank you kind sir for troubleshooting that and cut a new release. Closing this out.

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

2 participants