8000
Skip to content

Fix cyclic cli for 64 bit integers#1616

Merged
Arusekk merged 3 commits intoGallopsled:devfrom
tyilo:fix_cyclic_64bit
Jul 7, 2020
Merged

Fix cyclic cli for 64 bit integers#1616
Arusekk merged 3 commits intoGallopsled:devfrom
tyilo:fix_cyclic_64bit

Conversation

@tyilo
Copy link
Copy Markdown
Contributor
@tyilo tyilo commented Jun 28, 2020

Before this change, pwn cyclic -n 8 -l 0x6161616161616178 outputs:

Traceback (most recent call last):
  File "/home/tyilo/.local/bin/pwn", line 8, in <module>
    sys.exit(main())
  File "/home/tyilo/.local/lib/python3.8/site-packages/pwnlib/commandline/main.py", line 54, in main
    commands[args.command](args)
  File "/home/tyilo/.local/lib/python3.8/site-packages/pwnlib/commandline/cyclic.py", line 73, in main
    pat = flat(pat)
  File "/home/tyilo/.local/lib/python3.8/site-packages/pwnlib/context/__init__.py", line 1460, in setter
    return function(*a, **kw)
  File "/home/tyilo/.local/lib/python3.8/site-packages/pwnlib/util/packing.py", line 732, in flat
    out = _flat(args, preprocessor, make_packer(), filler)
  File "/home/tyilo/.local/lib/python3.8/site-packages/pwnlib/util/packing.py", line 560, in _flat
    val = packer(arg)
  File "/home/tyilo/.local/lib/python3.8/site-packages/pwnlib/util/packing.py", line 426, in <lambda>
    return lambda number: pack(number, word_size, endianness, sign)
  File "/home/tyilo/.local/lib/python3.8/site-packages/pwnlib/util/packing.py", line 145, in pack
    raise ValueError("pack(): number does not fit within word_size [%i, %r, %r]" % (0, number, limit))
ValueError: pack(): number does not fit within word_size [0, 7016996765293437304, 4294967296]

@tyilo tyilo changed the base branch from dev to stable June 28, 2020 06:56
@tyilo tyilo changed the base branch from stable to dev June 28, 2020 06:57
@Arusekk
Copy link
Copy Markdown
Member

Shouldn't this just use cyclic_find() function? It should handle stuff automatically already

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should set context.cyclic_size. instead of doing this here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't actually work:

AttributeError: cyclic pattern size cannot be larger than word size

but I can set context.bytes to args.length and it seems to work.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we at least do bytes= to avoid the unnecessary multiplication? Also this should be rebased since v4.2.0 was released and now this targets v4.4.0dev0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@heapcrash
Copy link
Copy Markdown
Collaborator

Mind rebasing this on dev? We just did a release today.

@tyilo tyilo force-pushed the fix_cyclic_64bit branch from a21b143 to 736f8d2 Compare July 5, 2020 22:30
@tyilo
Copy link
Copy Markdown
Contributor Author
tyilo commented Jul 5, 2020

Rebased.

@zachriggle
Copy link
Copy Markdown
Member

@heapcrash or @Arusekk can you merge this?

@Arus
7B72
ekk Arusekk merged commit 7e0e644 into Gallopsled:dev Jul 7, 2020
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

Successfully merging this pull request may close these issues.

4 participants

0