1234567891011121314 |
- def upload_s3(filename, md5, sha256, filetype):
- try:
- # Connect and upload to S3 bucket
- conn = boto.connect_s3()
- bucket = conn.create_bucket(unique_string.lower() + '_malware')
- k = Key(bucket)
- # Set unique_id
- k.key = sha256
- k.set_metadata('md5_hash', md5)
- k.set_metadata('file_type', filetype)
- k.set_contents_from_filename(filename)
- return 'success'
- except:
- return 'upload to s3 failed, make sure your aws keys are set in ~/.boto'
|