Code Monkey home page Code Monkey logo

yiffy's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

mertguitarra

yiffy's Issues

new formatting system for config and credentials file

configuration file:

IS_NSFW=NO
IMG_DISPLAY_COMMAND=ascii-image-converter

credentials file:

API_KEY=
USERNAME=

NOTE:
Since the updates on formatting, the config-credential reading/modifying files should be written from scratch.

Add plog system to files.

Add plog system to files, make it work if only plog is on in the configuration file.

Default on.

Works in search.c and fetch.

Security checks and tests needed after application development

The whole code security will be checked after the development and poor security code blocks will be rewritten to ensure security.

1: Check vulnerable functions like gets, strcpy, etc...
2: Static code analysis with cppcheck and flawfinder.
3: Memory analysis with Valgrind.

check possible bugs for --ivcommand

The --ivcommand added to system as a new feature, plog will be discontinued.

Check the potential bugs/errors in the code related to the --ivcommand feature.

Fix the /src/msg/file_open_error_msg.c bug.

/src/msg/file_open_error_msg.c needs bugfix.

If the file pointer is NULL, you shouldn't do fclose on it. It will cause undefined behavior.

It might crash or harm current loaded memory on old systems.

/**
 * @file file_open_error_msg.c
 * 
 * @brief This file is used to show some information about file permissions when yiffy is not able to read file.  
 * 
 * @author Mehmet Mert Gunduz ([email protected])
 * 
 * @date 05/08/2023
*/

#include "yiffy_messages.h"

/**
 * @brief Shows some information about file permissions when yiffy is not able to read file.  
 * 
 * @param file This is used to close the file. 
*/
void file_open_error_msg(FILE *file)
{ 
    fprintf(stderr, "yiffy: error opening the file.\n");
    fprintf(stderr, "yiffy: please check the file read-write permissions.\n");

    fclose(file);
}

The FILE *file parameter and fclose function should be removed from the code.

After removing the code files using this function should be fixed.

Add secure compilation options to cmake script

Enable stack protection to help prevent stack buffer overflow attacks

-fstack-protector-all

Enable additional checks for some standard library functions to detect buffer overflows

-D_FORTIFY_SOURCE=2

Generate position-independent code (PIC) suitable for use in a shared library

-fPIE

Create a position-independent executable (PIE)

-pie

Enable read-only relocations (RELRO) for more secure memory handling

-Wl,-z,relro

When enabled, the dynamic linker will resolve symbols when the application is started, reducing the risk of certain types of attacks

-Wl,-z,now

Implement a dependency check system to /src/app/yiffy.c file before accessing e621/e926.

yiffy uses these additional packages and programs:

  • gcc
  • build-essential
  • ascii-image-converter
  • aria2
  • cmake
  • make
  • libncurses-dev

Before creating the requests and using the program, it should do a dependency check in the https://github.com/MertGunduz/yiffy/blob/main/src/app/yiffy.c file.

The main reason doing this is missing dependencies can create problems like undefined behaviour etc... in some systems.

So we need to implement this feature to yiffy.

Implement changeable image output/show system to yiffy.

Implement a new changeable image output/show system to yiffy.

The system will read it ~/.yiffy/yiffy-config.txt

For example: wgen:nsfw:ascii-image-converter

And system will read it then start the process.

It can use these image output/show applications:

  • ascii-image-converter (default dependency)
  • tiv
  • timg
  • jp2a
  • img2sixel

Command system: yiffy --image-app ascii-image-converter

search.c, fetch.c, dfetch.c can't be used without the api and username access.

search.c, fetch.c, dfetch.c can't be used without the credentials because api doesn't provide some posts when they aren't provided to api as a get method.

The wanted api request for search function:

https://e621.net/posts.json?login=USERNAME&api_key=API_KEY&limit=POST_LIMIT&page=PAGE_INDEX&tags=SELECTED_TAGS
https://e926.net/posts.json?login=USERNAME&api_key=API_KEY&limit=POST_LIMIT&page=PAGE_INDEX&tags=SELECTED_TAGS

if the credentials aren't provided to the application, it'll give an error message that indicates no credentials were provided to the program.

Change the for loops counter type to size_t

For loops are using this in the current codebase:

for (int i = 0; i < NUM; i++)
{
      // code
}

We want to make it like this for better readability and optimisation:

for (size_t i = 0; i < NUM; i++)
{
      // code
}

Implement a ping check in /src/app/yiffy.c file before accessing e621/e926.

In some countries e621/e926 is banned.

Implement a ping check before to https://github.com/MertGunduz/yiffy/blob/main/src/app/yiffy.c file, if you can't send ping. Then you are in prohibited access zone to e621/e926 like Middle East and some African countries.

If it happens then give users a message that says it might be banned in your country or you can't access e621/e926 (whatever is used in client side), please use a vpn or proxy to access.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.