init
This commit is contained in:
commit
4066382ce5
10
Makefile
Normal file
10
Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
include config.mk
|
||||
|
||||
all:
|
||||
$(CC) src/ecrypt.c $(CFLAGS) $(LDFLAGS) -lecrypt -o src/ecrypt
|
||||
|
||||
install:
|
||||
install src/ecrypt $(PREFIX)/bin
|
||||
|
||||
clean:
|
||||
rm src/ecrypt
|
26
README
Normal file
26
README
Normal file
@ -0,0 +1,26 @@
|
||||
+ ecrypt - a simple password and key generator
|
||||
|
||||
ecrypt is an extremely simple and basic encryption tool. It does not aim to provide
|
||||
advanced encryption features that tools such as OpenSSL may offer, it simply acts as
|
||||
a random string generator and comparison tool.
|
||||
|
||||
+ Dependencies
|
||||
|
||||
- libecrypt 2.2.0
|
||||
|
||||
+ Installation
|
||||
|
||||
Clone this repository:
|
||||
(user)$ git clone https://git.everestlinux.org/EverestLinux/ecrypt
|
||||
|
||||
Review src/config.h:
|
||||
(user)$ $EDITOR src/config.h
|
||||
|
||||
Review config.mk:
|
||||
(user)$ $EDITOR config.mk
|
||||
|
||||
Run make:
|
||||
(user)$ make
|
||||
|
||||
Install:
|
||||
(root)# make install
|
5
config.mk
Normal file
5
config.mk
Normal file
@ -0,0 +1,5 @@
|
||||
# config.mk
|
||||
|
||||
CC = cc
|
||||
CFLAGS = -O3 -fstack-protector-strong -static -pie
|
||||
LDFLAGS =
|
11
src/config.h
Normal file
11
src/config.h
Normal file
@ -0,0 +1,11 @@
|
||||
/* config.h - define configuration values */
|
||||
|
||||
#ifndef CONFIG_H_
|
||||
#define CONFIG_H_
|
||||
|
||||
/* Length of string to be outputted */
|
||||
#define ECRYPT_STR_LEN 30
|
||||
|
||||
#define ECRYPT_VERSION "3.0.0"
|
||||
|
||||
#endif
|
110
src/ecrypt.c
Normal file
110
src/ecrypt.c
Normal file
@ -0,0 +1,110 @@
|
||||
/*
|
||||
ecrypt.c - string generation and comparison tool
|
||||
|
||||
This file is part of ecrypt.
|
||||
|
||||
ecrypt is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
ecrypt is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with ecrypt. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <color.h>
|
||||
#include <ecrypt.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
static void
|
||||
usage(char *argv[])
|
||||
{
|
||||
printf("%s - string generator and checker\n", argv[0]);
|
||||
printf("usage: %s [-h] [-v] [-s] [-g] [-c]\n", argv[0]);
|
||||
printf("\n");
|
||||
printf("%s {-h} Show this message\n", argv[0]);
|
||||
printf("%s {-v} Show the current version\n", argv[0]);
|
||||
printf("%s {-s} View compile-time settings\n", argv[0]);
|
||||
printf("%s {-g} Generate a string\n", argv[0]);
|
||||
printf("%s {-c} Compare 2 files\n", argv[0]);
|
||||
printf("\n");
|
||||
printf("Ecrypt is free software.\n");
|
||||
printf("See the GNU GPL version 3 for details.\n");
|
||||
}
|
||||
|
||||
static void
|
||||
usage_small(char *argv[])
|
||||
{
|
||||
printf("usage: %s [-h] [-v] [-s] [-g] [-c]\n", argv[0]);
|
||||
}
|
||||
|
||||
static void
|
||||
view_compile_time_settings(char *argv[])
|
||||
{
|
||||
printf("Compile-time settings for %s\n", argv[0]);
|
||||
printf("String length: %i\n", ECRYPT_STR_LEN);
|
||||
}
|
||||
|
||||
static void
|
||||
view_version(char *argv[])
|
||||
{
|
||||
printf("%s\n", argv[0]);
|
||||
printf(ECRYPT_VERSION);
|
||||
printf("\n");
|
||||
printf("Compiled against libecrypt\n");
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
if (argc < 2) {
|
||||
usage_small(argv);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int opt;
|
||||
|
||||
while ((opt = getopt(argc, argv, ":if:hvsgc")) != -1) {
|
||||
switch(opt) {
|
||||
case 'h':
|
||||
usage(argv);
|
||||
exit(0);
|
||||
break;
|
||||
case 'v':
|
||||
view_version(argv);
|
||||
exit(0);
|
||||
break;
|
||||
case 's':
|
||||
view_compile_time_settings(argv);
|
||||
exit(0);
|
||||
break;
|
||||
case 'g':
|
||||
ecrypt_gen(ECRYPT_STR_LEN);
|
||||
printf("\n");
|
||||
exit(0);
|
||||
break;
|
||||
case 'c':
|
||||
if (argc < 4) {
|
||||
printf("not enough arguments\n");
|
||||
exit(1);
|
||||
}
|
||||
ecrypt_check(argv[2], argv[3]);
|
||||
break;
|
||||
case '?':
|
||||
usage_small(argv);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user