Tuesday, July 16, 2013

Human readable sharing links for files in Google Drive

If you follow the instructions for sharing links to google drive files, you end up with horrible links that are mostly just long random strings, which violate Google's own advice about URLs, but are necessary to avoid namespace conflicts.

To get a more human readable link, right click on a file in drive, click Details, then use the link under 'Hosting'. It still has a random string, but the string is the same for all files within each Drive folder and the end of the URL is the same as the name of the file in Drive, which is a significant improvement.

Friday, July 12, 2013

How not to do incident response

The OIG has a great write-up of an incident response at the Economic Development Administration that cost them $2.7m and included them physically destroying $170k of computer equipment: right down to keyboards and mice because they believed malware had firmware persistence capabilities. There were huge mis-communications with the Department Of Commerce CIRT, and a series of bad assumptions that led to this scenario. Great case study.

Thursday, July 11, 2013

Python: skip a unittest with unittest.skipTest

There's a neat way to skip python tests built into unittest. You can use decorators for the test or whole class of tests that will skip a test unconditionally or based on a condition.

In my case there was significant setup to do before I knew whether or not this test should be skipped, in which case you can call unittest.TestCase.skipTest, which just raises a unittest.SkipTest exception that is handled by the test runner. It looks like this:
In [40]: runner = unittest.TextTestRunner()

In [41]: class testing(unittest.TestCase):
    def testblah(self):
    def setUp(self):
    def runTest(self):

In [42]: thistestclass=testing()

In [43]: runner.run(thistestclass)
Ran 1 test in 0.000s  

OK (skipped=1)