So I wanted to make a C2 server that transfers methods and libraries to its clients but because of some reason it just dosen’t want to. I have checked the version and it’s 6.0.0 and there is no firewalls on pc. Code dosen’t spit out any erros 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 is right identations on the code above I just don’t know how to put it here(this is my first post ever)
I have tried transfering 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 dosen’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 gives me 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 begginer at this but I’m trying to learn so go easy on me if there is a big mistake somewhere
erik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.