• XSS.stack #1 – первый литературный журнал от юзеров форума

[C3] Implementing a C2 in C

el84

(L2) cache
Пользователь
Регистрация
10.01.2023
Сообщения
326
Реакции
143
Депозит
0.00
Hello this is a new project, I started to implement a C2 in C. It still buggy and just have Raw TCP channel. It can keep simultaneous sessions and for now have just two commands which are spawning a shell and terminate the session. The code is not well organized, I need to split it in proper files so it become more clear and manageable. Any kind of tips are welcome, suggestion on changes of code are welcome too.

I will try to improve this code in my free time, hope you all enjoy. I know that there is a lot of already ready made C2, but the point here is to learn and make the code nice to extend.


Project: http://52rh4ydtapqtl36quxz6uedcmcygkef5fedb534dvgzqyufoj5xml7id.onion/el84/c3
 
Code looks clean. I have only taken a *quick* look at your server.c

It's made for Linux, so I recommend considering a different architecture:

1. epoll() functions vs using pthread

Take a look at how libevent works, it's less resource-intensive.
pthreads are cool, but they don't scale very well, unless ofcourse, you have
a very powerful server.

good luck.
 
Code looks clean. I have only taken a *quick* look at your server.c

It's made for Linux, so I recommend considering a different architecture:

1. epoll() functions vs using pthread

Take a look at how libevent works, it's less resource-intensive.
pthreads are cool, but they don't scale very well, unless ofcourse, you have
a very powerful server.

good luck.
Thanks for tips, I used to use more select API to multiplex fd/socket IO, but some friends also have told me about poll/epoll APIs. I should give it a try. as you can see I use select() to handle IO during the shell session (both client and server). I just used pthread in this case because it was the less complex way I thinked when writing this code.

I will first split the code in more files, it dont even use headers yet, just created one for the Queue implementation. Thanks again for the input.
 


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх