|
|
@@ -47,6 +47,11 @@ int read_msg(struct vcc_request *buf);
|
|
|
int get_msgs(void);
|
|
|
int vcc_login(char *, char *);
|
|
|
|
|
|
+int show_algo_info(void);
|
|
|
+int crypt_init(void *key);
|
|
|
+char *encrypt(char *);
|
|
|
+int decrypt(char *);
|
|
|
+
|
|
|
int do_cmd(char *s);
|
|
|
int do_bh(struct vcc_request *);
|
|
|
|
|
|
@@ -141,7 +146,9 @@ int main(int argc, char **argv) {
|
|
|
struct pollfd fds[2];
|
|
|
struct vcc_request *req;
|
|
|
char *buf, *msg, *ip = "124.223.105.230";
|
|
|
+ char key[64];
|
|
|
int n, size, port = VCC_PORT, got_usrname;
|
|
|
+
|
|
|
(void) argc;
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
@@ -156,10 +163,17 @@ int main(int argc, char **argv) {
|
|
|
init_socket(ip, port);
|
|
|
|
|
|
printf("Connected to server. \n");
|
|
|
- printf("%s@%s%d\n", usrname, ip, port);
|
|
|
-
|
|
|
login(got_usrname);
|
|
|
|
|
|
+ show_algo_info();
|
|
|
+
|
|
|
+ memset(key, 0, 64);
|
|
|
+
|
|
|
+ fprintf(stderr, "Key: ");
|
|
|
+ read(0, key, 64);
|
|
|
+
|
|
|
+ crypt_init(key);
|
|
|
+
|
|
|
fds[0].fd = 0;
|
|
|
fds[0].events = POLLIN;
|
|
|
fds[0].revents = 0;
|
|
|
@@ -217,7 +231,11 @@ int main(int argc, char **argv) {
|
|
|
do_cmd(buf);
|
|
|
|
|
|
else if (*buf != '\n') {
|
|
|
+ if (unlikely(!encrypt(buf)))
|
|
|
+ continue;
|
|
|
+
|
|
|
send_msg(buf, usrname);
|
|
|
+ decrypt(buf);
|
|
|
|
|
|
pretty_new_msg(usrname, buf, current_sid);
|
|
|
}
|
|
|
@@ -242,8 +260,8 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
msg = req->msg;
|
|
|
|
|
|
- if (!*msg || *(unsigned char *) msg == 0xffu)
|
|
|
- continue;
|
|
|
+ if (strcmp(req->usrname, "system"))
|
|
|
+ decrypt(msg);
|
|
|
|
|
|
pretty_new_msg(req->usrname, msg, ntohl(req->session));
|
|
|
pretty_prompt(usrname);
|