Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.
usage: mount_smbfs [-Nh] [-d mode] [-f mode] //[domain;][user[:password]@]server[/share] path Traceback (most recent call last): File "./mnt-queue.py", line 22, in <module> with mounted(remote_dir,local_dir): File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/contextlib.py", line 16, in __enter__ File "./mnt-queue.py", line 12, in mounted raise OSError("Mount operation failed") OSError: Mount operation failed
#!/usr/bin/python from contextlib import contextmanager import os import shutil import subprocess @contextmanager def mounted(remote_dir,local_dir): local_dir = os.path.abspath(local_dir) retcode = subprocess.call(["/sbin/mount", "-t","smbfs",remote_dir,local_dir]) if retcode != 0: raise OSError("Mount operation failed") try: yield finally: retcode = subprocess.call(["/sbin/umount",local_dir]) if retcode != 0: raise OSError ("Umount Operation Failed!") remote_dir = "\\server\process" local_dir = "/tmp/process" with mounted(remote_dir,local_dir): print "Processing: " , os.walk(local_dir).next()
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
21 Experts available now in Live!