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

shnake: TypeError: Can't convert 'NoneType' object to str implicitly #32

Open
sndx02d opened this issue Jan 8, 2016 · 1 comment
Open
Labels

Comments

@sndx02d
Copy link

sndx02d commented Jan 8, 2016

I've tried to add autocompletion mechanism to some file related plugins (the idea - after running "ls", the "cat" plugin, or any other plugin, will have autocompletion for the remote files and dirs):

\phpsploit\src\ui\interface.py:

    def complete_cat(self, text, *_):
        return [x for x in session.TargetFiles if x.startswith(text)]

\phpsploit\src\core\session__init__.py:

        self.File = None
        self.TargetFiles = []

    def _isattr(self, name):

\phpsploit\plugins\file_system\ls\plugin.py:

    rows = sorted(rows, key=(lambda elem: elem[-1]))

    for file in rows:
        file = file[3]
        if file != "." and file != "..":
            session.TargetFiles.append(target + file)

    rows.insert(0, rows_hdr)

When I'm testing it, it's never working as it supposed to work, and behaving very strange:

phpsploit(localhost) > cat D:\\
D:\xampp\FileZillaFTP           D:\xampp\contrib                D:\xampp\mailtodisk             D:\xampp\readme_de.txt          D:\xampp\webdav
D:\xampp\MercuryMail            D:\xampp\ctlscript.bat          D:\xampp\mercury_start.bat      D:\xampp\readme_en.txt          D:\xampp\xampp-control.exe
D:\xampp\anonymous              D:\xampp\filezilla_setup.bat    D:\xampp\mercury_stop.bat       D:\xampp\security               D:\xampp\xampp-control.ini
D:\xampp\apache                 D:\xampp\filezilla_start.bat    D:\xampp\mysql                  D:\xampp\service.exe            D:\xampp\xampp-control.log
D:\xampp\apache_start.bat       D:\xampp\filezilla_stop.bat     D:\xampp\mysql_start.bat        D:\xampp\setup_xampp.bat        D:\xampp\xampp_shell.bat
D:\xampp\apache_stop.bat        D:\xampp\htdocs                 D:\xampp\mysql_stop.bat         D:\xampp\src                    D:\xampp\xampp_start.exe
D:\xampp\catalina_service.bat   D:\xampp\img                    D:\xampp\passwords.txt          D:\xampp\test_php.bat           D:\xampp\xampp_stop.exe
D:\xampp\catalina_start.bat     D:\xampp\install                D:\xampp\perl                   D:\xampp\tmp
D:\xampp\catalina_stop.bat      D:\xampp\licenses               D:\xampp\php                    D:\xampp\tomcat
D:\xampp\cgi-bin                D:\xampp\locale                 D:\xampp\phpMyAdmin             D:\xampp\uninstall.dat
D:\xampp\changes.txt            D:\xampp\mailoutput             D:\xampp\properties.ini         D:\xampp\uninstall.exe
phpsploit(localhost) > cat D:\\D:\Temp\[!] Runtime Error: can't re-enter readline
Readline internal error
Traceback (most recent call last):
  File "C:\Python3\lib\site-packages\pyreadline\console\console.py", line 768, in hook_wrapper_23
    res = ensure_str(readline_hook(prompt))
  File "C:\Python3\lib\site-packages\pyreadline\rlmain.py", line 571, in readline
    self._readline_from_keyboard()
  File "C:\Python3\lib\site-packages\pyreadline\rlmain.py", line 536, in _readline_from_keyboard
    if self._readline_from_keyboard_poll():
  File "C:\Python3\lib\site-packages\pyreadline\rlmain.py", line 556, in _readline_from_keyboard_poll
    result = self.mode.process_keyevent(event.keyinfo)
  File "C:\Python3\lib\site-packages\pyreadline\modes\emacs.py", line 243, in process_keyevent
    r = self.process_keyevent_queue[-1](keyinfo)
  File "C:\Python3\lib\site-packages\pyreadline\modes\emacs.py", line 286, in _process_keyevent
    r = dispatch_func(keyinfo)
  File "C:\Python3\lib\site-packages\pyreadline\modes\basemode.py", line 257, in complete
    completions = self._get_completions()
  File "C:\Python3\lib\site-packages\pyreadline\modes\basemode.py", line 200, in _get_completions
    r = self.completer(ensure_unicode(text), i)
  File "D:\phpspolit\deps\shnake-0.4\shnake\shell.py", line 402, in complete
    compfunc = getattr(self, 'complete_'+name)
TypeError: Can't convert 'NoneType' object to str implicitly
@nil0x42
Copy link
Owner

nil0x42 commented Mar 13, 2016

maybe related to backslashes, need to see readline internals to be sure.
i d suggest to try on a Linux target server, or trying with normalized paths (phpsploit recognises windows paths even using normal slashes) to check if that's related to backslashes ''

@nil0x42 nil0x42 added the bug label Jan 15, 2019
@nil0x42 nil0x42 changed the title Shnake autocompletion's behaving strange shnake: TypeError: Can't convert 'NoneType' object to str implicitly Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants