pablocorbalann / trj Goto Github PK
View Code? Open in Web Editor NEWExecute any command in other's computer using a trojan horse coded and compiled in C. Just for educational purpose.
License: Boost Software License 1.0
Execute any command in other's computer using a trojan horse coded and compiled in C. Just for educational purpose.
License: Boost Software License 1.0
The makefile of the client looks like:
TARGET = client
LIBS = -pthread
CC = gcc
CFLAGS = -g
FILES = # The files to be compiled
client: $(FILES)
gcc -o $(TARGET) $(LIBS) $(FILES) $(CFLAGS)
The problem with this is that we have to change the FILES
variable every time we have to add a new file, so it would be great if this could be automated in the makefile.
Remember that the trojan is in a different directory from the client itself and it also has to be compiled.
/trj
| ...
| /client
|| ...
||/trojan
||| ...
The README.md
file has grown as the project grew and improved, and I think it is time to divide it into smaller files, so this file could be divided into more, such as INSTALL.md
, advanced.md
etc etc. These files must go inside the doc folder
Remember to read the contributions guidelines before contributing!
If you are looking for a good project to start contributing to the world of open source, this issue is for you.
You can translate the README.md
file of this project into your language, and put it in the doc/
folder after making a pull request.
The name of the new file must be: README-lang.md
, for example README-es.md
.
Good luck!
I've been working on trj for a couple of weeks now, and right now it works quite well when only one client is connected.
However, when you try to connect more than one client simultaneously to the server, it begins to generate small bugs such as eliminating the option "choose what you want to do" disappears suddenly although you can still type the number related to the option you want.
See the example in the photo below
It is quite a complex issue, since the server uses a fairly large thread system so the bug could be anywhere. Good luck!
One of the things that would be nice to be implemented would be a timeout to close and completely expel the clients when they take more than X seconds to respond, for example, 10 seconds.
I have tried to implement a small timeout on the server before receiving the messages. When the server sends a command to be executed on the client, the client sends a response message to the server, something like command "command" has been received on the client
. My idea is to implement the timeout before the server receives this confirmation from the client, something like:
# When declaring the server inside the server/server.Server class
self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.server.settimeout(10) # 10 seconds timeout
self.server.bind(addr)
# The rest of the code...
# In the while loop that receives messages from the clients:
try:
# ... The code that goes before receiving the confirmation from the server
client_confirmation = client.recv(self.MAX_BITES).decode(self.DCF) # DCF stands for DeCode Format
cdr.append(client_confirmation) # cdr stands for client data register
print(f"{client.__repr__()}: {client_confirmation}")
# ... The code after receiving the configuration
except socket.timeout as _:
# The code that should remove the client from the server
pass
The fault is that when I try to implement the timeout, it is also activated when a new client does not connect for more than 10 seconds. This makes the timeout to be raised every 10 seconds:
Some pieces of code from the actual state
Trj is a project with which I am learning C, so before implementing a new function I try to create a small "test", especially if I don't know where to start with this new feature.
When I was working on this little test to read a json file from the client (later this feature will be used) I can't compile the test file correctly using the @json-c library.
You can check out the branch here.
The purpose of the test is to be able to load a json file very easily, the file is this one
{
"name": "Pablo",
"age": 15,
"friends": ["steve", "alex", "susan"]
}
If you can modify the file so that it is able to read this json document and compile it using gcc, it would be amazing!
good luck, and remember to create your pr to the feat branch
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.