Rpyc dosen't transfer any methods or libraries to client
15:56 19 Jun 2024

I want to create a C2 server that transfers methods and libraries to its clients but because of some reason it just doesn't want to. I have checked the version and it's 6.0.0 and there is no firewalls on PC. Code doesn't spit out any errors except;

AttributeError: 'SlaveService' object has no attribute exposed_add,

So I assume it's some kind of bug in my code.

Here is my C2:

import rpyc
conn = rpyc.classic.connect("localhost", 18812)
while True:
   class MyService(rpyc.Service):
        def on_connect(self, conn):
            print("connection made")
        def on_disconnect(self, conn):
            print("connection closed")
        def exposed_add(self, x, y):
            resukt = x + y
            print(resukt)
            print("jesus")
if __name__ == "__main__":
    from rpyc.utils.server import ThreadedServer
    server = ThreadedServer(Myservice, port=18812,protocol_config = {"allow_public_attrs" : True} )
    server.start()

There are correct identations in the code shown above, I just don't know how to put it here (this is my first post ever).

I have tried transferring the libraries to the client but either it spits out the error I mentioned above or it just says welcome and goodbye. When client asks for an import it doesn't work but when I do the conn.execute('for loop') it works perfectly and even gives me the result back. I tried importing the libraries through the conn.execute method but it still throws the same error from above

Here is my client:

import rpyc

conn = rpyc.connect("localhost", 18812)
rez = conn.root.exposed_add(5, 6)
print(rez)

I'm a beginner at this but I'm trying to learn so go easy on me if there is a big mistake somewhere

python multithreading server service rpyc