/usr/share/doc/python-impacket/examples/smbcat.py is in python-impacket 0.9.10-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | import sys
sys.path.append('..')
from impacket import smb
if len(sys.argv) < 4:
print "Use: %s <host> <share> <file> [user] [password]" % sys.argv[0]
sys.exit(1)
host = sys.argv[1]
shre = sys.argv[2]
file = sys.argv[3]
user = ''
passwd = ''
try:
user = sys.argv[4]
passwd = sys.argv[5]
except:
pass
s = smb.SMB('*SMBSERVER',host)
s.login(user, passwd)
tid = s.tree_connect_andx(r"\\*SMBSERVER\%s" % shre)
fid = s.open_file(tid, file, smb.SMB_O_OPEN, smb.SMB_ACCESS_READ)[0]
offset = 0
while 1:
data = s.read_andx(tid, fid, offset, 40000)
sys.stdout.write(data)
if len(data) == 0: break
offset += len(data)
s.close_file(tid, fid)
|