calebstewart / pwncat

Fancy reverse and bind shell handler
https://pwncat.readthedocs.io
MIT License
2.58k stars 250 forks source link

run enumerate.user error #248

Closed aels closed 2 years ago

aels commented 2 years ago
(local) pwncat$ run enumerate.user
╭─────────────────────────────── Traceback (most recent call last) ───────────────────────────────╮
│                                                                                                 │
│ /tmp/pwncat/pwncat/commands/__init__.py:591 in run                                              │
│                                                                                                 │
│    588 │   │   │   │   if line == "":                                                           │
│    589 │   │   │   │   │   continue                                                             │
│    590 │   │   │   │                                                                            │
│ ❱  591 │   │   │   │   self.dispatch_line(line)                                                 │
│    592 │   │   │   # We used to catch only KeyboardException, but this prevents a               │
│    593 │   │   │   # badly written command from completely killing our remote                   │
│    594 │   │   │   # connection.                                                                │
│ /tmp/pwncat/pwncat/commands/__init__.py:667 in dispatch_line                                    │
│                                                                                                 │
│    664 │   │   │                                                                                │
│    665 │   │   │   # Parse the arguments                                                        │
│    666 │   │   │   if command.parser:                                                           │
│ ❱  667 │   │   │   │   args = command.parser.parse_args(args)                                   │
│    668 │   │   │   else:                                                                        │
│    669 │   │   │   │   args = line                                                              │
│    670                                                                                          │
│                                                                                                 │
│ /usr/lib/python3.8/argparse.py:1780 in parse_args                                               │
│                                                                                                 │
│   1777 │   # Command line argument parsing methods                                              │
│   1778 │   # =====================================                                              │
│   1779 │   def parse_args(self, args=None, namespace=None):                                     │
│ ❱ 1780 │   │   args, argv = self.parse_known_args(args, namespace)                              │
│   1781 │   │   if argv:                                                                         │
│   1782 │   │   │   msg = _('unrecognized arguments: %s')                                        │
│   1783 │   │   │   self.error(msg % ' '.join(argv))                                             │
│                                                                                                 │
│ /usr/lib/python3.8/argparse.py:1812 in parse_known_args                                         │
│                                                                                                 │
│   1809 │   │                                                                                    │
│   1810 │   │   # parse the arguments and exit if there are any errors                           │
│   1811 │   │   try:                                                                             │
│ ❱ 1812 │   │   │   namespace, args = self._parse_known_args(args, namespace)                    │
│   1813 │   │   │   if hasattr(namespace, _UNRECOGNIZED_ARGS_ATTR):                              │
│   1814 │   │   │   │   args.extend(getattr(namespace, _UNRECOGNIZED_ARGS_ATTR))                 │
│   1815 │   │   │   │   delattr(namespace, _UNRECOGNIZED_ARGS_ATTR)                              │
│                                                                                                 │
│ /usr/lib/python3.8/argparse.py:2021 in _parse_known_args                                        │
│                                                                                                 │
│   2018 │   │   │   start_index = consume_optional(start_index)                                  │
│   2019 │   │                                                                                    │
│   2020 │   │   # consume any positionals following the last Optional                            │
│ ❱ 2021 │   │   stop_index = consume_positionals(start_index)                                    │
│   2022 │   │                                                                                    │
│   2023 │   │   # if we didn't consume all the argument strings, there were extras               │
│   2024 │   │   extras.extend(arg_strings[stop_index:])                                          │
│                                                                                                 │
│ /usr/lib/python3.8/argparse.py:1977 in consume_positionals                                      │
│                                                                                                 │
│   1974 │   │   │   for action, arg_count in zip(positionals, arg_counts):                       │
│   1975 │   │   │   │   args = arg_strings[start_index: start_index + arg_count]                 │
│   1976 │   │   │   │   start_index += arg_count                                                 │
│ ❱ 1977 │   │   │   │   take_action(action, args)                                                │
│   1978 │   │   │                                                                                │
│   1979 │   │   │   # slice off the Positionals that we just parsed and return the               │
│   1980 │   │   │   # index at which the Positionals' string args stopped                        │
│                                                                                                 │
│ /usr/lib/python3.8/argparse.py:1870 in take_action                                              │
│                                                                                                 │
│   1867 │   │                                                                                    │
│   1868 │   │   def take_action(action, argument_strings, option_string=None):                   │
│   1869 │   │   │   seen_actions.add(action)                                                     │
│ ❱ 1870 │   │   │   argument_values = self._get_values(action, argument_strings)                 │
│   1871 │   │   │                                                                                │
│   1872 │   │   │   # error if this argument is not allowed with other previously                │
│   1873 │   │   │   # seen arguments, assuming that actions that use the default                 │
│                                                                                                 │
│ /usr/lib/python3.8/argparse.py:2402 in _get_values                                              │
│                                                                                                 │
│   2399 │   │   elif len(arg_strings) == 1 and action.nargs in [None, OPTIONAL]:                 │
│   2400 │   │   │   arg_string, = arg_strings                                                    │
│   2401 │   │   │   value = self._get_value(action, arg_string)                                  │
│ ❱ 2402 │   │   │   self._check_value(action, value)                                             │
│   2403 │   │                                                                                    │
│   2404 │   │   # REMAINDER arguments convert all values, checking none                          │
│   2405 │   │   elif action.nargs == REMAINDER:                                                  │
│                                                                                                 │
│ /usr/lib/python3.8/argparse.py:2454 in _check_value                                             │
│                                                                                                 │
│   2451 │                                                                                        │
│   2452 │   def _check_value(self, action, value):                                               │
│   2453 │   │   # converted value must be one of the choices (if specified)                      │
│ ❱ 2454 │   │   if action.choices is not None and value not in action.choices:                   │
│   2455 │   │   │   args = {'value': value,                                                      │
│   2456 │   │   │   │   │   'choices': ', '.join(map(repr, action.choices))}                     │
│   2457 │   │   │   msg = _('invalid choice: %(value)r (choose from %(choices)s)')               │
│                                                                                                 │
│ /tmp/pwncat/pwncat/commands/__init__.py:325 in __iter__                                         │
│                                                                                                 │
│    322 │   │   │   │   │   │   wself.method = method                                            │
│    323 │   │   │   │   │                                                                        │
│    324 │   │   │   │   │   def __iter__(wself):                                                 │
│ ❱  325 │   │   │   │   │   │   yield from wself.method(self)                                    │
│    326 │   │   │   │                                                                            │
│    327 │   │   │   │   param.kwargs["choices"] = wrapper(method)                                │
│    328                                                                                          │
│                                                                                                 │
│ /tmp/pwncat/pwncat/commands/__init__.py:163 in get_module_choices                               │
│                                                                                                 │
│    160 │   if command.manager.target is None:                                                   │
│    161 │   │   return                                                                           │
│    162 │                                                                                        │
│ ❱  163 │   yield from [                                                                         │
│    164 │   │   module.name.removeprefix("agnostic.").removeprefix(                              │
│    165 │   │   │   command.manager.target.platform.name + "."                                   │
│    166 │   │   )                                                                                │
│                                                                                                 │
│ /tmp/pwncat/pwncat/commands/__init__.py:164 in <listcomp>                                       │
│                                                                                                 │
│    161 │   │   return                                                                           │
│    162 │                                                                                        │
│    163 │   yield from [                                                                         │
│ ❱  164 │   │   module.name.removeprefix("agnostic.").removeprefix(                              │
│    165 │   │   │   command.manager.target.platform.name + "."                                   │
│    166 │   │   )                                                                                │
│    167 │   │   for module in command.manager.target.find_module("*")                            │
╰─────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'str' object has no attribute 'removeprefix'

got this error on old linux machine =\ any suggestions?

aels commented 2 years ago

also, same kind of error

(local) pwncat$ run id
╭─────────────────────────────── Traceback (most recent call last) ───────────────────────────────╮
│                                                                                                 │
│ /tmp/pwncat/pwncat/commands/__init__.py:591 in run                                              │
│                                                                                                 │
│    588 │   │   │   │   if line == "":                                                           │
│    589 │   │   │   │   │   continue                                                             │
│    590 │   │   │   │                                                                            │
│ ❱  591 │   │   │   │   self.dispatch_line(line)                                                 │
│    592 │   │   │   # We used to catch only KeyboardException, but this prevents a               │
│    593 │   │   │   # badly written command from completely killing our remote                   │
│    594 │   │   │   # connection.                                                                │
│ /tmp/pwncat/pwncat/commands/__init__.py:667 in dispatch_line                                    │
│                                                                                                 │
│    664 │   │   │                                                                                │
│    665 │   │   │   # Parse the arguments                                                        │
│    666 │   │   │   if command.parser:                                                           │
│ ❱  667 │   │   │   │   args = command.parser.parse_args(args)                                   │
│    668 │   │   │   else:                                                                        │
│    669 │   │   │   │   args = line                                                              │
│    670                                                                                          │
│                                                                                                 │
│ /usr/lib/python3.8/argparse.py:1780 in parse_args                                               │
│                                                                                                 │
│   1777 │   # Command line argument parsing methods                                              │
│   1778 │   # =====================================                                              │
│   1779 │   def parse_args(self, args=None, namespace=None):                                     │
│ ❱ 1780 │   │   args, argv = self.parse_known_args(args, namespace)                              │
│   1781 │   │   if argv:                                                                         │
│   1782 │   │   │   msg = _('unrecognized arguments: %s')                                        │
│   1783 │   │   │   self.error(msg % ' '.join(argv))                                             │
│                                                                                                 │
│ /usr/lib/python3.8/argparse.py:1812 in parse_known_args                                         │
│                                                                                                 │
│   1809 │   │                                                                                    │
│   1810 │   │   # parse the arguments and exit if there are any errors                           │
│   1811 │   │   try:                                                                             │
│ ❱ 1812 │   │   │   namespace, args = self._parse_known_args(args, namespace)                    │
│   1813 │   │   │   if hasattr(namespace, _UNRECOGNIZED_ARGS_ATTR):                              │
│   1814 │   │   │   │   args.extend(getattr(namespace, _UNRECOGNIZED_ARGS_ATTR))                 │
│   1815 │   │   │   │   delattr(namespace, _UNRECOGNIZED_ARGS_ATTR)                              │
│                                                                                                 │
│ /usr/lib/python3.8/argparse.py:2021 in _parse_known_args                                        │
│                                                                                                 │
│   2018 │   │   │   start_index = consume_optional(start_index)                                  │
│   2019 │   │                                                                                    │
│   2020 │   │   # consume any positionals following the last Optional                            │
│ ❱ 2021 │   │   stop_index = consume_positionals(start_index)                                    │
│   2022 │   │                                                                                    │
│   2023 │   │   # if we didn't consume all the argument strings, there were extras               │
│   2024 │   │   extras.extend(arg_strings[stop_index:])                                          │
│                                                                                                 │
│ /usr/lib/python3.8/argparse.py:1977 in consume_positionals                                      │
│                                                                                                 │
│   1974 │   │   │   for action, arg_count in zip(positionals, arg_counts):                       │
│   1975 │   │   │   │   args = arg_strings[start_index: start_index + arg_count]                 │
│   1976 │   │   │   │   start_index += arg_count                                                 │
│ ❱ 1977 │   │   │   │   take_action(action, args)                                                │
│   1978 │   │   │                                                                                │
│   1979 │   │   │   # slice off the Positionals that we just parsed and return the               │
│   1980 │   │   │   # index at which the Positionals' string args stopped                        │
│                                                                                                 │
│ /usr/lib/python3.8/argparse.py:1870 in take_action                                              │
│                                                                                                 │
│   1867 │   │                                                                                    │
│   1868 │   │   def take_action(action, argument_strings, option_string=None):                   │
│   1869 │   │   │   seen_actions.add(action)                                                     │
│ ❱ 1870 │   │   │   argument_values = self._get_values(action, argument_strings)                 │
│   1871 │   │   │                                                                                │
│   1872 │   │   │   # error if this argument is not allowed with other previously                │
│   1873 │   │   │   # seen arguments, assuming that actions that use the default                 │
│                                                                                                 │
│ /usr/lib/python3.8/argparse.py:2402 in _get_values                                              │
│                                                                                                 │
│   2399 │   │   elif len(arg_strings) == 1 and action.nargs in [None, OPTIONAL]:                 │
│   2400 │   │   │   arg_string, = arg_strings                                                    │
│   2401 │   │   │   value = self._get_value(action, arg_string)                                  │
│ ❱ 2402 │   │   │   self._check_value(action, value)                                             │
│   2403 │   │                                                                                    │
│   2404 │   │   # REMAINDER arguments convert all values, checking none                          │
│   2405 │   │   elif action.nargs == REMAINDER:                                                  │
│                                                                                                 │
│ /usr/lib/python3.8/argparse.py:2454 in _check_value                                             │
│                                                                                                 │
│   2451 │                                                                                        │
│   2452 │   def _check_value(self, action, value):                                               │
│   2453 │   │   # converted value must be one of the choices (if specified)                      │
│ ❱ 2454 │   │   if action.choices is not None and value not in action.choices:                   │
│   2455 │   │   │   args = {'value': value,                                                      │
│   2456 │   │   │   │   │   'choices': ', '.join(map(repr, action.choices))}                     │
│   2457 │   │   │   msg = _('invalid choice: %(value)r (choose from %(choices)s)')               │
│                                                                                                 │
│ /tmp/pwncat/pwncat/commands/__init__.py:325 in __iter__                                         │
│                                                                                                 │
│    322 │   │   │   │   │   │   wself.method = method                                            │
│    323 │   │   │   │   │                                                                        │
│    324 │   │   │   │   │   def __iter__(wself):                                                 │
│ ❱  325 │   │   │   │   │   │   yield from wself.method(self)                                    │
│    326 │   │   │   │                                                                            │
│    327 │   │   │   │   param.kwargs["choices"] = wrapper(method)                                │
│    328                                                                                          │
│                                                                                                 │
│ /tmp/pwncat/pwncat/commands/__init__.py:163 in get_module_choices                               │
│                                                                                                 │
│    160 │   if command.manager.target is None:                                                   │
│    161 │   │   return                                                                           │
│    162 │                                                                                        │
│ ❱  163 │   yield from [                                                                         │
│    164 │   │   module.name.removeprefix("agnostic.").removeprefix(                              │
│    165 │   │   │   command.manager.target.platform.name + "."                                   │
│    166 │   │   )                                                                                │
│                                                                                                 │
│ /tmp/pwncat/pwncat/commands/__init__.py:164 in <listcomp>                                       │
│                                                                                                 │
│    161 │   │   return                                                                           │
│    162 │                                                                                        │
│    163 │   yield from [                                                                         │
│ ❱  164 │   │   module.name.removeprefix("agnostic.").removeprefix(                              │
│    165 │   │   │   command.manager.target.platform.name + "."                                   │
│    166 │   │   )                                                                                │
│    167 │   │   for module in command.manager.target.find_module("*")                            │
╰─────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'str' object has no attribute 'removeprefix'

I bet it's platform specific?

sh-3.2$ uname -a
Linux zavot.nmrfam.wisc.edu 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Mitul16 commented 2 years ago

@aels Your error logs show that you are using Python3.8, use Python3.9 as mentioned in README.md

pwncat requires Python 3.9+ on Linux

aels commented 2 years ago

God, thank you! Let it be left there for google.