def upload_file(self, host, src, dst):
dst = string.replace(dst,'/','\\')
dst = ntpath.normpath(dst)
dst = dst.split('\\')
share = dst[0]
dst = '\\'.join(dst[1:])
if os.path.exists(src):
color('[+] Starting upload: %s (%s bytes)' % (src, os.path.getsize(src)))
upFile = open(src, 'rb')
try:
self.smbconn[host].putFile(share, dst, upFile.read)
color('[+] Upload complete' )
except Exception as e:
color('[!]', e)
color('[!] Error uploading file, you need to include destination file name in the path')
upFile.close()
else:
color('[!] Invalid source. File does not exist')
sys.exit()
评论列表
文章目录