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

Repaste content from 0x0.st #61

Open
habnabit opened this issue Jul 5, 2020 · 2 comments · May be fixed by #63
Open

Repaste content from 0x0.st #61

habnabit opened this issue Jul 5, 2020 · 2 comments · May be fixed by #63

Comments

@habnabit
Copy link
Contributor

habnabit commented Jul 5, 2020

20:49:35 < ChrisWarrick> Could whoever maintains infobob these days put 0x0.st on the list of pastebins to repaste?
                         Firefox wants to download files from that site instead of showing them in the browser
20:51:14 < ChrisWarrick> redsh: 0x0.st uses a dumb text/x-python content type
20:53:23 < ChrisWarrick> re 0x0.st: https://i.imgur.com/yWAwLot.png
@cdunklau
Copy link
Contributor

I tested this a bit. It looks like normally the site sends plain text, but it allows you to specify the content type, e.g.: curl -F'file=@testnullpointer.py' http://0x0.st gave me text/plain, but curl -F'file=@testnullpointer2.py;type=text/x-python' http://0x0.st gave me the specified text/x-python. Now, that was with super simple files, just imports. I made another one:

import sqlite3

def main():
    with sqlite3.connect(':memory:') as conn:
        conn.execute('CREATE TABLE foo (name INTEGER PRIMARY KEY)')


if __name__ == '__main__':
    main()

...and still got plaintext, but adding #!/usr/bin/env python to the top make the site autodetect and gave me that x-python thing again.

This behavior and the possibility of arbitrary file types makes adding full support to infobob nontrivial, but I could imagine some kind of simplistic detection technique for a limited set of "file types" (the extension in the URL?). One idea could be:

  1. If the 0x0.st url ends in .py, download it, check the content type. Probably should limit downloads to something reasonable to avoid needless bandwidth (and memory) consumption, say, 16KiB? I think bpaste's limit is around there anyway.
  2. If the content type is text/plain, ignore the URL.
  3. Else assume it's python, and repaste.

However, based on my logs from this year to date, this site was only used ~27 times, 12 of which were .py URLs. That puts it rather low on my priorities. I'd certainly be willing to merge this feature though. @Kwpolska are you feeling up for it?

Kwpolska added a commit to Kwpolska/infobob that referenced this issue Jul 20, 2020
This resolves pound-python#61. Also adds retrieveUrlLazy that produces a Request
in unbuffered mode to avoid buffering pastes we might not be
interested in.
@Kwpolska Kwpolska linked a pull request Jul 20, 2020 that will close this issue
@Kwpolska
Copy link

@cdunklau I gave it a shot, PR #63.

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 a pull request may close this issue.

3 participants