Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_myclass(self, proto_config):
self.conn.close()
self.server.protocol_config.update(proto_config)
self.conn = rpyc.connect("localhost", self.server.port)
return self.conn.root.MyClass()
def doListDupes(on_file):
print("Finding files similar to: '{}'".format(on_file))
remote = rpyc.connect("localhost", 12345)
commons = remote.root.listDupes(filePath=on_file)
print("result:")
print(commons)
print("Wut?")
def setUp(self):
self.cfg = {'allow_pickle': True}
self.server = rpyc.utils.server.ThreadedServer(MyService, port=0, protocol_config=self.cfg.copy())
self.server.logger.quiet = False
self.thd = self.server._start_in_thread()
self.conn = rpyc.connect("localhost", self.server.port, config=self.cfg)
self.conn2 = rpyc.connect("localhost", self.server.port, config=self.cfg)
# globals are made available to timeit, prepare them
cfg_tests.timeit['conn'] = self.conn
cfg_tests.timeit['conn2'] = self.conn2
cfg_tests.timeit['df'] = pd.DataFrame(np.random.rand(DF_ROWS, DF_COLS))
scanner.logSetup.initLogging()
if not os.path.exists(scanConf.sourcePath):
# print("ERROR: Source file does not exist!")
return
if not os.path.isfile(scanConf.sourcePath):
# print("ERROR: Source is not a file!")
return
if scanConf.noContext:
scanContext = None
else:
scanContext = [os.path.split(scanConf.sourcePath)]
remote = rpyc.connect("localhost", 12345)
status, bestMatch, intersections = remote.root.processDownload(
scanConf.sourcePath,
pathNegativeFilter=scanContext,
distance=6,
moveToPath=None,
locked=True)
# print("Processed archive. Return status '%s'", status)
if bestMatch:
print("Matching archive '%s'", bestMatch)
return status, bestMatch, intersections
def createConn(self):
"""Creates a rpyc connection."""
if self.username != None and self.password != None:
return rpyc.tlslite_connect(host=self.host, port=self.port, username=self.username, password=self.password)
else:
return rpyc.connect(host=self.host, port=self.port)
def createConn(self):
"""Creates a rpyc connection."""
if self.username != None and self.password != None:
return rpyc.tlslite_connect(host=self.host, port=self.port, username=self.username, password=self.password)
else:
return rpyc.connect(host=self.host, port=self.port)
def main(args):
con=rpyc.connect("localhost",port=2131)
master=con.root.Master()
if args[0] == "get":
get(master,args[1])
elif args[0] == "put":
put(master,args[1],args[2])
else:
LOG.error("try 'put srcFile destFile OR get file'")
def clear(self, index = None):
try:
c = rpyc.connect("localhost", 18861)
return c.root.clear(index)
except:
return 'Unable to connect'
def send_to_minion(block_uuid,data,minions):
LOG.info("sending: " + str(block_uuid) + str(minions))
minion=minions[0]
minions=minions[1:]
host,port=minion
con=rpyc.connect(host,port=port)
minion = con.root.Minion()
minion.put(block_uuid,data,minions)