Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Python by vpleshak ( 15 years ago )
import sys
from random import random
from pysmb import SmbURL
from pysmb.client import Smb1Client
from pysmb.client.utils import spawn, joinall, sleep
client = Smb1Client()
def thread(url):
pwd = ''
if url.password != None:
pwd=url.password
con = client.Connect(url.server, Pid = 1)
sess = con.Session(url.domain, url.user, pwd)
tree = sess.Tree(url.share)
#tree = client.Connect(url.server, Pid = 1).Session(url.domain, url.user, pwd).Tree(url.share)
sleep(10000);
#src = tree.File(url.path, access = 0x000001)
#dst = tree.File(str(random() * 1000000000))
#offset = 0; chunk_size = 0xfff
#chunk = src.read(chunk_size, offset)
#while chunk:
#print(chunk)
#dst.write(chunk, offset)
#offset += chunk_size
#chunk = src.read(chunk_size, offset)
if len(sys.argv)<2 :
print "Provide number of threads in arguments."
exit()
if len(sys.argv)>2:
url = SmbURL(sys.argv[2])
else:
#url = SmbURL('smb://Administrator:[email protected]/share/threading_demo.txt')
url = SmbURL('smb://administrator:[email protected]/share/threading_demo.txt')
#url = SmbURL('smb://admin:[email protected]/share/threading_demo.txt')
#url = SmbURL('smb://[email protected]/share/threading_demo.txt')
print url.server
print url.domain
print url.user
print url.password
print url.share
threads = []
for i in range(int(sys.argv[1])):
threads.append(spawn(thread, url))
joinall(threads)
client.close()
Revise this Paste