hugsy / gef-extras

Extra goodies for GEF to (try to) make GDB suck even less
https://hugsy.github.io/gef-extras
MIT License
149 stars 50 forks source link

some error in ubuntu20.04:AttributeError: type object 'ABCMeta' has no attribute '_cmdline_' #48

Closed maru7777 closed 2 years ago

maru7777 commented 2 years ago
Reading symbols from start...
(No debugging symbols found in start)
GEF for linux ready, type `gef' to start, `gef config' to configure
93 commands loaded for GDB 9.2 using Python engine 3.8
[*] 3 commands could not be loaded, run `gef missing` to know why.
[+] Configuration from '/home/k/.gef.rc' restored
Traceback (most recent call last):
  File "/home/k/git/dev/gef-extras/scripts/error.py", line 8, in <module>
    class ErrorCommand(GenericCommand):
  File "~/git/dev/gef/gef.py", line 4552, in register_external_command
  File "~/git/dev/gef/gef.py", line 10584, in load
  File "~/git/dev/gef/gef.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/k/git/dev/gef-extras/scripts/xref-telescope.py", line 3, in <module>
    class XRefTelescopeCommand(SearchPatternCommand):
  File "~/git/dev/gef/gef.py", line 4552, in register_external_command
  File "~/git/dev/gef/gef.py", line 10584, in load
  File "~/git/dev/gef/gef.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/k/git/dev/gef-extras/scripts/stack.py", line 6, in <module>
    class CurrentFrameStack(GenericCommand):
  File "~/git/dev/gef/gef.py", line 4552, in register_external_command
  File "~/git/dev/gef/gef.py", line 10584, in load
  File "~/git/dev/gef/gef.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/k/git/dev/gef-extras/scripts/ida_interact.py", line 364, in <module>
    register_external_command(cmd)
  File "~/git/dev/gef/gef.py", line 4552, in register_external_command
  File "~/git/dev/gef/gef.py", line 10584, in load
  File "~/git/dev/gef/gef.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/k/git/dev/gef-extras/scripts/peekpointers.py", line 2, in <module>
    class PeekPointers(GenericCommand):
  File "~/git/dev/gef/gef.py", line 4552, in register_external_command
  File "~/git/dev/gef/gef.py", line 10584, in load
  File "~/git/dev/gef/gef.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/k/git/dev/gef-extras/scripts/ftrace.py", line 57, in <module>
    class FtraceCommand(GenericCommand):
  File "~/git/dev/gef/gef.py", line 4552, in register_external_command
  File "~/git/dev/gef/gef.py", line 10584, in load
  File "~/git/dev/gef/gef.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/k/git/dev/gef-extras/scripts/skel.py", line 48, in <module>
    class ExploitTemplateCommand(GenericCommand):
  File "~/git/dev/gef/gef.py", line 4552, in register_external_command
  File "~/git/dev/gef/gef.py", line 10584, in load
  File "~/git/dev/gef/gef.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/k/git/dev/gef-extras/scripts/v8-dereference.py", line 40, in <module>
    class V8DereferenceCommand(GenericCommand):
  File "~/git/dev/gef/gef.py", line 4552, in register_external_command
  File "~/git/dev/gef/gef.py", line 10584, in load
  File "~/git/dev/gef/gef.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/k/git/dev/gef-extras/scripts/bincompare.py", line 19, in <module>
    class BincompareCommand(GenericCommand):
  File "~/git/dev/gef/gef.py", line 4552, in register_external_command
  File "~/git/dev/gef/gef.py", line 10584, in load
  File "~/git/dev/gef/gef.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/k/git/dev/gef-extras/scripts/visualize_heap.py", line 92, in <module>
    class VisualizeHeapChunksCommand(GenericCommand):
  File "~/git/dev/gef/gef.py", line 4552, in register_external_command
  File "~/git/dev/gef/gef.py", line 10584, in load
  File "~/git/dev/gef/gef.py", line 10584, in <listcomp>
hugsy commented 2 years ago

Hi,

There was a slight branch confusion which I believe is the root of your problem, but it's fixed now. If you use gef-extras from the dev branch, make sure you also use gef from the dev.

Thanks

maru7777 commented 2 years ago

Hi,

There was a slight branch confusion which I believe is the root of your problem, but it's fixed now. If you use gef-extras from the dev branch, make sure you also use gef from the dev.

Thanks

Thx for your reply in the path name "~/git/dev/.. ",dev is not the name of a branch ,but just a folder name. My gef has already been checkout to dev branch,and as your indication,I chekout gef-extra into 'dev' branch.like:

k@k:~/git/dev/gef$ git branch 
* dev
k@k:~/git/dev/gef$ cd ..
k@k:~/git/dev$ cd gef-extras/
k@k:~/git/dev/gef-extras$ git branch 
* dev

and now both of gef and gef-extra are in dev branch .after that I try it again,but it still report the same error. and i tried to switch both gef and gef-extra into master branch, it also doesn't work and report the same issue as before

hugsy commented 2 years ago

I think I mispoke: the changes I was referring to has not being merged to dev yet. It's still being reviewed in PR (see https://github.com/hugsy/gef/pull/813) So you have 3 options:

  1. keep using dev and wait a bit for the PR to be merged
  2. use the branch better_tests of gef
  3. or use gef and gef-extras in their master branch
maru7777 commented 2 years ago

thanks for your reply~ I tried both gef and gef-extra with master branch,and I also tried gef in better_tests,gef-extra in dev ,but these still did not work.I guess maybe there is some issue in my setup precedure? Now I am very excited to wait a bit for the coming official support.

hugsy commented 2 years ago

813 is merged to dev so it will be easier to try to get to the bottom of this problem.

hugsy commented 2 years ago

Can you try again with the latest commit of gef-extras from the dev branch and also gef ?

hugsy commented 2 years ago

If that doesn't work, provide us an exact step by step of how you get the errors so we can try to reproduce

jalvarezit commented 2 years ago

I had the same issue 🥵

Steps to reproduce it:

Install gdb:

bash -c "$(curl -fsSL http://gef.blah.cat/sh)"

Install gef-extras:

wget -q -O- https://github.com/hugsy/gef/raw/master/scripts/gef-extras.sh | sh

Also tried the manual setup from the docs:

Download from dev branch

git clone --branch dev https://github.com/hugsy/gef-extras ~/.config/gef-extras

Also tried master branch

Setup config:

gef➤  gef config gef.extra_plugins_dir ~/.config/gef-extras/scripts
gef➤  gef config pcustom.struct_path ~/.config/gef-extras/structs
gef➤  gef config syscall-args.path ~/.config/gef-extras/syscall-tables
gef➤  gef config context.libc_args True
gef➤  gef config context.libc_args_path~/.config/gef-extras/glibc-function-args
gef➤ gef save

Here is the full traceback:

Traceback (most recent call last):
  File "/home/itasahobby/.config/gef-extras/scripts/bincompare.py", line 19, in <module>
    class BincompareCommand(GenericCommand):
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 4552, in register_external_command
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in load
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/itasahobby/.config/gef-extras/scripts/error.py", line 8, in <module>
    class ErrorCommand(GenericCommand):
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 4552, in register_external_command
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in load
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/itasahobby/.config/gef-extras/scripts/bytearray.py", line 19, in <module>
    class BytearrayCommand(GenericCommand):
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 4552, in register_external_command
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in load
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/itasahobby/.config/gef-extras/scripts/retdec.py", line 15, in <module>
    class RetDecCommand(GenericCommand):
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 4552, in register_external_command
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in load
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/itasahobby/.config/gef-extras/scripts/stack.py", line 6, in <module>
    class CurrentFrameStack(GenericCommand):
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 4552, in register_external_command
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in load
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/itasahobby/.config/gef-extras/scripts/windbg.py", line 418, in <module>
    register_external_command(_)
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 4552, in register_external_command
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in load
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/itasahobby/.config/gef-extras/scripts/peekpointers.py", line 2, in <module>
    class PeekPointers(GenericCommand):
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 4552, in register_external_command
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in load
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/itasahobby/.config/gef-extras/scripts/remote.py", line 46, in <module>
    class GefRemoteCommand(GenericCommand):
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 4552, in register_external_command
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in load
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/itasahobby/.config/gef-extras/scripts/xref-telescope.py", line 3, in <module>
    class XRefTelescopeCommand(SearchPatternCommand):
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 4552, in register_external_command
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in load
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/itasahobby/.config/gef-extras/scripts/ftrace.py", line 57, in <module>
    class FtraceCommand(GenericCommand):
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 4552, in register_external_command
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in load
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/itasahobby/.config/gef-extras/scripts/visualize_heap.py", line 92, in <module>
    class VisualizeHeapChunksCommand(GenericCommand):
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 4552, in register_external_command
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in load
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/itasahobby/.config/gef-extras/scripts/ida_interact.py", line 364, in <module>
    register_external_command(cmd)
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 4552, in register_external_command
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in load
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/itasahobby/.config/gef-extras/scripts/skel.py", line 48, in <module>
    class ExploitTemplateCommand(GenericCommand):
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 4552, in register_external_command
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in load
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'
Traceback (most recent call last):
  File "/home/itasahobby/.config/gef-extras/scripts/v8-dereference.py", line 40, in <module>
    class V8DereferenceCommand(GenericCommand):
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 4552, in register_external_command
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in load
  File "~/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py", line 10584, in <listcomp>
AttributeError: type object 'ABCMeta' has no attribute '_cmdline_'

Versions:

gef➤  version
GEF: (Standalone)
Blob Hash(/home/itasahobby/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py): 83861546049c4c1130503dd0acb802fc8383aa45
SHA256(/home/itasahobby/.gef-283690ae9bfcecbb3deb80cd275d327c46b276b5.py): a6b9698cdb06eefeb0a2b6ce9d31e706e75e151b4006be8d90cdcaf7f9afa1f1
GDB: 10.1.90.20210103-git
GDB-Python: 3.9
ebubekirtrkr commented 2 years ago

@itasahobby

You should also install dev version of the gef using

wget https://gef.blah.cat/sh -O gef.sh
chmod +x gef.sh
./gef.sh dev

or using wget

wget -O ~/.gdbinit-gef.py -q https://gef.blah.cat/dev
echo source ~/.gdbinit-gef.py >> ~/.gdbinit

or manually cloning

git clone --branch dev https://github.com/hugsy/gef ~/gef
echo "source ~/gef/gef.py > ~/.gdbinit
jalvarezit commented 2 years ago

That made the job 🙂

hugsy commented 2 years ago

Fixed