Update
This commit is contained in:
parent
9caca5a4fb
commit
f55aa94d84
10 changed files with 330 additions and 374 deletions
53
README.md
53
README.md
|
|
@ -1,4 +1,4 @@
|
|||
# **netbenixCMD**
|
||||
# netbenixCMD
|
||||
|
||||
A little project of mine to learn C.
|
||||
|
||||
|
|
@ -11,37 +11,56 @@ Used libs for Linux: *gtk+3.0, libmysqlclient*
|
|||
Version: *0.2.4*
|
||||
|
||||
## Features:
|
||||
|
||||
- A help page (OMG!!!)
|
||||
|
||||
- A little GTK Test
|
||||
- Can detect if you're using linux or not and tell the Architecture you're running on
|
||||
|
||||
- Can detect if you're using linux or not and tell the Architecture you're
|
||||
running on
|
||||
|
||||
- Can give you a bit of information about your CPU (but just a little bit)
|
||||
|
||||
- Checks your client version on start with the server
|
||||
|
||||
## Building:
|
||||
|
||||
Install packages:
|
||||
|
||||
- Ubuntu: ```sudo apt-get install make gcc git libgtk-3-dev libmysqlclient-dev```
|
||||
- Debian: ```sudo apt-get install make gcc git libgtk-3-dev libmariadbclient-dev libmariadb-dev-compat```
|
||||
- Arch: ```sudo pacman -S make gcc git gtk3 mariadb-libs pkgconf```
|
||||
- Ubuntu: `sudo apt-get install make gcc git libgtk-3-dev libmysqlclient-dev`
|
||||
|
||||
Clone repository: ```git clone https://github.com/netbenix/netbenixCMD.git```
|
||||
- Debian: `sudo apt-get install make gcc git libgtk-3-dev libmariadbclient-dev
|
||||
libmariadb-dev-compat`
|
||||
|
||||
Go into the cloned directory: ```cd netbenixCMD```
|
||||
- Arch: `sudo pacman -S make gcc git gtk3 mariadb-libs pkgconf`
|
||||
|
||||
Build program: ```make```
|
||||
Clone repository: `git clone https://github.com/netbenix/netbenixCMD.git`
|
||||
|
||||
Go into the cloned directory: `cd netbenixCMD`
|
||||
|
||||
Build program: `make`
|
||||
|
||||
## Usage
|
||||
After building use ```./netbenixCMD``` to start the program
|
||||
|
||||
If you want to use the testing arguments use ```./netbenixCMD <argument>```
|
||||
After building use `./netbenixCMD` to start the program
|
||||
|
||||
If you want to use the testing arguments use `./netbenixCMD <argument>`
|
||||
|
||||
## Arguments
|
||||
- ```--help``` => Displays all arguments
|
||||
- ```--gtk-test``` => Opens the GTK Test Window
|
||||
- ```--sql-test``` => Makes a test connection to a mysql server
|
||||
- ```--sys-info``` => Gives you information about your system
|
||||
- ```--no-version-check``` => Skips the client version check
|
||||
- ```--dev-mode``` => Starts the program in developer mode (right now it just skips version check)
|
||||
|
||||
- `--help` =\> Displays all arguments
|
||||
|
||||
- `--gtk-test` =\> Opens the GTK Test Window
|
||||
|
||||
- `--sql-test` =\> Makes a test connection to a mysql server
|
||||
|
||||
- `--sys-info` =\> Gives you information about your system
|
||||
|
||||
- `--no-version-check` =\> Skips the client version check
|
||||
|
||||
- `--dev-mode` =\> Starts the program in developer mode (right now it just
|
||||
skips version check)
|
||||
|
||||
## Known Bugs
|
||||
- ```sql-test``` sha-256 passwords not working on Debian
|
||||
|
||||
- `sql-test` sha-256 passwords not working on Debian
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ void showDirectory(char *arg[]){
|
|||
DIR *d;
|
||||
struct dirent *dir;
|
||||
char path[PATH_MAX];
|
||||
|
||||
;
|
||||
d = opendir(arg[1]); //Try to open directory
|
||||
if(d == NULL){ //Check if directory exists
|
||||
printf("Folder not found.\n");
|
||||
|
|
|
|||
49
etc/man.c
49
etc/man.c
|
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
@ -47,52 +46,4 @@ void showManEntry(char *arg[]){
|
|||
} else {
|
||||
printf("Entry not found.\n");
|
||||
}
|
||||
=======
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
// Color Codes:
|
||||
// Reset: \033[0m
|
||||
// Red: \033[0;31m
|
||||
// Green: \033[0;32m
|
||||
// Yellow: \033[0;33m
|
||||
// Blue: \033[0;34m
|
||||
// Magenta: \033[0;35m
|
||||
// Cyan: \033[0;36m
|
||||
// BoldRed: \033[1;31m
|
||||
// BoldGreen: \033[1;32m
|
||||
// BoldYellow: \033[1;33m
|
||||
// BoldBlue: \033[1;34m
|
||||
// BoldMagenta: \033[1;35m
|
||||
// BoldCyan: \033[1;36m
|
||||
|
||||
//Main function to start man is at the bottom
|
||||
|
||||
//MAN ENTRIES
|
||||
//LS
|
||||
void manEntry_ls(){
|
||||
printf("\033[0;33m##################\033[0m\n");
|
||||
printf("\033[0;33m# Manual of \033[0;36m'ls' \033[0;33m#\033[0m\n");
|
||||
printf("\033[0;33m##################\033[0m\n\n");
|
||||
printf("\033[0;33mNAME\033[0m\n");
|
||||
printf("\t\033[0;36mls - list directory contents\033[0m\n\n");
|
||||
printf("\033[0;33mUSAGE\033[0m\n");
|
||||
printf("\t\033[0;36mls \033[0;35m[DIRECTORY]\033[0m\n\n");
|
||||
printf("\033[0;33mDESCRIPTION\033[0m\n");
|
||||
printf("\t\033[0;36mList files and directorys in the given directory. Sorts entries alphabetically.\033[0m\n\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//MAIN FUNCTION
|
||||
void showManEntry(char *arg[]){
|
||||
if(!strcmp(arg[1], "man")){
|
||||
printf("Coming soon.\n");
|
||||
} else if(!strcmp(arg[1], "ls")){
|
||||
manEntry_ls();
|
||||
} else {
|
||||
printf("Entry not found.\n");
|
||||
}
|
||||
>>>>>>> f1cf6269f94065bfb8498dd7ef06bfbb61442b80
|
||||
}
|
||||
5
main.c
5
main.c
|
|
@ -15,10 +15,7 @@
|
|||
#include "utils/sql_test.h"
|
||||
#include "etc/logo.h"
|
||||
#include "etc/man.h"
|
||||
<<<<<<< HEAD
|
||||
#include "etc/math.h"
|
||||
=======
|
||||
>>>>>>> f1cf6269f94065bfb8498dd7ef06bfbb61442b80
|
||||
#include "etc/your-reality.h"
|
||||
#include "utils/logger.h"
|
||||
#include "utils/sys_info.h"
|
||||
|
|
@ -49,7 +46,6 @@ bool FUN_CONTENT = false;
|
|||
|
||||
//Handles the commands
|
||||
int commandHandler(char *cmd){
|
||||
|
||||
char *token = strtok(cmd, " ");
|
||||
int argc = 1;
|
||||
char *arg[10];
|
||||
|
|
@ -76,7 +72,6 @@ int commandHandler(char *cmd){
|
|||
printf("\033[1;34mexit\033[0m : exit the program\n");
|
||||
return 0;
|
||||
} else if(!strcmp(arg[0], "version")){
|
||||
|
||||
printf("netbenixCMD (Version: \033[1;34m%s\033[0m)\n", VERSION);
|
||||
printf("Author: \033[1;34m%s\033[0m\n", "netbenix");
|
||||
printf("Github: \033[1;34mhttps://github.com/netbenix/netbenixCMD\033[0m\n");
|
||||
|
|
|
|||
8
makefile
8
makefile
|
|
@ -2,12 +2,7 @@ CC= gcc
|
|||
ARGS= -export-dynamic -ansi -std=gnu99
|
||||
CFLAGS= $(shell pkg-config --cflags gtk+-3.0) -I/usr/include/mysql
|
||||
LDLIBS= $(shell pkg-config --libs gtk+-3.0) -L/usr/lib/mysql -lmysqlclient
|
||||
<<<<<<< HEAD
|
||||
OBJ= main.o logo.o logger.o help.o sys_info.o gtk_test.o sql_test.o show_dir.o change_dir.o update_check.o man.o your-reality.o math.o
|
||||
=======
|
||||
OBJ= main.o logo.o logger.o help.o sys_info.o gtk_test.o sql_test.o show_dir.o change_dir.o update_check.o man.o your-reality.o
|
||||
>>>>>>> f1cf6269f94065bfb8498dd7ef06bfbb61442b80
|
||||
|
||||
netbenixCMD: $(OBJ)
|
||||
$(CC) $(CFLAGS) $(ARGS) -o netbenixCMD $(OBJ) $(LDLIBS)
|
||||
main.o: main.c
|
||||
|
|
@ -32,10 +27,7 @@ update_check.o: utils/update_check.c
|
|||
$(CC) $(CFLAGS) -c utils/update_check.c
|
||||
man.o: etc/man.c
|
||||
$(CC) $(CFLAGS) -c etc/man.c
|
||||
<<<<<<< HEAD
|
||||
math.o: etc/math.c
|
||||
$(CC) $(CFLAGS) -c etc/math.c
|
||||
=======
|
||||
>>>>>>> f1cf6269f94065bfb8498dd7ef06bfbb61442b80
|
||||
your-reality.o: etc/your-reality.c
|
||||
$(CC) $(CFLAGS) -c etc/your-reality.c
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
#include "update_check.h"
|
||||
#include "logger.h"
|
||||
|
||||
#define SERVER_IP "127.0.0.1"
|
||||
#define DEFAULT_IP "192.168.0.32"
|
||||
|
||||
int checkForUpdate(char ver[10]){
|
||||
int sock;
|
||||
|
|
@ -19,7 +19,7 @@ int checkForUpdate(char ver[10]){
|
|||
logger("Error while creating socket");
|
||||
}
|
||||
|
||||
server.sin_addr.s_addr = inet_addr(SERVER_IP); //Set the IP address of the server
|
||||
server.sin_addr.s_addr = inet_addr(DEFAULT_IP); //Set the IP address of the server
|
||||
server.sin_family = AF_INET;
|
||||
server.sin_port = htons( 34000 ); //Set the server port
|
||||
|
||||
|
|
|
|||
|
|
@ -2,5 +2,4 @@
|
|||
#define _UPDATE_CHECK_H_
|
||||
|
||||
int checkForUpdate(char ver[10]);
|
||||
|
||||
#endif
|
||||
Reference in a new issue