I have read many similar question on the Stack Exchange community but none of them address a 'clean' binary dump. I have used: xxd and sed combinations to try to obtain a clean binary dump from any given file.
Let me explain what I'm talking about. You have probably seen the output of `xxd -p', it looks something like this: f4d37fd532171a4a3445be1bb03e7d6b75f3871ffee937aebc9eb2c9417f f4e2fc8516e0a60a2c7e83c6a14c1a5e1b1e3f2ab9e12904cbd18aa2a4b9 f493d317c7a3ce71b7ab99fad4b6ced4d1f3e3f9 fd1c8f7230d8b07936c4c0c29d2d12b138cdb2c544be9cc9fa 0e79d66faf375737966b67e7c7bf7efcf17193d9aaafd63215 cf09a6e3e152bd01e9696b79f5faa5edd9f9b05628fdd9f77ee0dae1c5e8 dc2351d59693d84abac088cc4cd830e4482e214bda0892f38c 60e9856fa122a7905e20b3c272a5b25c6fec9fbe386bb7f6cf There are no line numbers, no corresponding ASCII, nothing.
Mac malware expert Patrick Wardle examined the bug and named it “OSX.Dummy” as reported by ars Technica, where he broke it down to all its dumb aspects: the infection method is dumb the massive size of the binary is dumb the persistence mechanism is lame (and thus also dumb) the capabilities are rather limited (and thus rather dumb).
Just plain old collection of bytes. That is the thing I'm after, except that I need the binary.
There are two options: I could first obtain a plain xxd hex dump like the one shown above and convert that to binary, OR may be there's some tool or utility in bash that I don't know about that could do this. This is what I want: A binary dump looks like this: 011000 001000 Any of the above is fine to me, as long as I obtain a clean plain binary dump from any file. So, my question is how do I obtain it-without any linebreaks or spaces or line numbers or nothing?
Hi Paramiko developers! In 2013 I published pip-accel and it wasn't long before came in that the python setup.py bdistdumb command was broken for the package on Mac OS X.
After some analysis I realized that the ssh package included a distutils monkey patch ( setuphelper.py) which had become incompatible with newer versions of distutils. To the person who reported the bug was to switch to Paramiko because ssh was a fork of Paramiko, ssh seemed abandoned and Paramiko didn't include the distutils monkey patch. Imagine my surprise when the same bug report was reopened in 2015 because the distutils hack had found its way from ssh to Paramiko:-).
Multiple users have now complained about it. I can't reasonably fix this from the side of pip-accel because the distutils monkey patch is simply broken against new versions of distutils on Mac OS X. The only other option was a pull request against the Paramiko project to get the real bug fixed, so here I am:-). VENV=/tmp/paramiko-pull-request-works virtualenv $VENV && (source $VENV/bin/activate && pip install pip-accel && pip-accel install && python -c 'import paramiko ') && echo 'Successfully installed Paramiko on Mac OS X:-) ' echo 'Failed to install Paramiko on Mac OS X:-( ' On my test system the above shell snippet outputs a 'Successfully installed Paramiko' message.
The Dumb Binary For Mac Download
I hope I've clearly explained why I think my pull request would be an improvement. If you have any questions I would be happy to answer them. Disclaimer: I don't know why setuphelper.py was originally added and I couldn't determine this based on a git blame of the file and looking up the old revisions; I couldn't find a public issue or discussion arguing about why the monkey patch is necessary in the first place. My pull request assumes the monkey patch is there for a good reason and just makes it work again. To the best of my knowledge my changes should be backwards compatible with both older and newer versions of distutils.
Thanks for your time! Thanks for this! Yea, that file dates from 2006 and lacks granularity in its commit message, so I have as little clue as you do re: its necessity.
Interestingly, I'd never seen this myself (and it appears to pop up even in python setup.py sdist - which is what we use for releases) because it only happens on Python 2.7 and up, and I run my development virtualenv under 2.6 as it's the oldest we support. I just checked after noting you were on 2.7, and sure enough, TypeError. I confirm your fix works under 2.7 for sdist, and that the result is installable. Unfortunately, the bdist (granted, I'm not usually dealing with these, so not sure if it's ever worked) explodes on install, having some problem unpacking things or whatnot, e.g.: IOError: Errno 2 No such file or directory: '/var/folders/yb/d3l0hbhn5jvgv2fxb7mlj7cr0000gn/T/pip-9XWn0I-build/setup.py' (where that temp dir is the one it's trying to unpack into). Furthermore, your fix doesn't work under 2.6 even on the build step, since tar.add doesn't seem to have a filter kwarg in that version. Hi Jeff and thanks for the fast feedback!
Unfortunately, the bdist (granted, I'm not usually dealing with these, so not sure if it's ever worked) explodes on install, having some problem unpacking things or whatnot. Pip doesn't support installation from 'dumb binary distributions' and so expects to find a setup.py script, this is why it raises the error you reported. Pip-accel is basically pip plus caching via 'dumb binary distributions' which are installed by pip-accel itself (because pip can't do it, although it can do binary wheels nowadays, but I digress). So this error is expected. Furthermore, your fix doesn't work under 2.6 even on the build step, since tar.add doesn't seem to have a filter kwarg in that version. Ouch, sorry about that, I missed that!
I don't have more time to dig into this but I'm assuming there are further contortions you could do to handle 2.6 compatibility within your additions? It's not actually that bad:-). I just committed, pushed and tested which uses try. Except TypeError logic to first try the tar.add(.) call with the filter parameter and fall back to a call without the filter parameter if TypeError is raised. I wrote a new test script and used that script to confirm Python 2.6, 2.7 and 3.4 compatibility.
These are the Python versions I have available on a Mac OS X system I can (ab)use to test this:-). Here's the output of the script: Testing branch 'master' of repository '. Python2.6 sdist works /tmp/paramiko-pull-request-582/python2.6-miXWQx/output.log python2.7 sdist fails /tmp/paramiko-pull-request-582/python2.7-pTXM8T/output.log python3.4 sdist fails /tmp/paramiko-pull-request-582/python3.4-Z2pghq/output.log python2.6 bdist works /tmp/paramiko-pull-request-582/python2.6-Lcp5Xh/output.log python2.7 bdist fails /tmp/paramiko-pull-request-582/python2.7-QOwSue/output.log python3.4 bdist fails /tmp/paramiko-pull-request-582/python3.4-qrt4c5/output.log Testing branch 'fix-bdist-dumb-mac-os-x' of repository '. Python2.6 sdist works /tmp/paramiko-pull-request-582/python2.6-V1z4xe/output.log python2.7 sdist works /tmp/paramiko-pull-request-582/python2.7-xQdjNc/output.log python3.4 sdist works /tmp/paramiko-pull-request-582/python3.4-RHMTCI/output.log python2.6 bdist works /tmp/paramiko-pull-request-582/python2.6-JcqbIn/output.log python2.7 bdist works /tmp/paramiko-pull-request-582/python2.7-EPuzU6/output.log python3.4 bdist works /tmp/paramiko-pull-request-582/python3.4-rx0KME/output.log Here is the shell script used to perform the test. Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit.
The Dumb Binary For Mac Free
Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews.