From 419859a3660b17e4a5345fc7456f1d1b2f3fe6ee Mon Sep 17 00:00:00 2001 From: "Luna Magdalena :3" <3"@girlkissing.tips> Date: Mon, 17 Nov 2025 15:22:46 -0300 Subject: [PATCH] You can now do --help and -h. also they work better yay --- kissy.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/kissy.c b/kissy.c index 9d67a1e..5167a5b 100644 --- a/kissy.c +++ b/kissy.c @@ -1,4 +1,4 @@ -// KISSY (Kissing Interface for Sapphic Smooching over ttY) v1.0 +// KISSY (Kissing Interface for Sapphic Smooching over ttY) v1.1 /* Copyright (C) 2025 Magdalunaa @@ -17,17 +17,6 @@ along with this program. If not, see . */ -/* -This file needs to: -- be owned by the tty group (or whatever group owns the terminal devices in your system) -- have setgid set -- be group executable -- not be world writeable - -You can probably just use 2755 permissions. those work - -*/ - #include #include #include @@ -35,25 +24,29 @@ You can probably just use 2755 permissions. those work #include #include #include +#include // mreowww meow nya :3 int main (int argc, char **argv) { + + // print help + if (argc < 2 || strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0) { + printf("%s\n", "Usage: kissy [target] \n\n" + "Kissy is a utility that allows you to kiss currently logged in users who allow messages.\n" + "It works by writing to files in /dev/pts. It needs to run as the group who owns said files (usually tty), using setgid (2755 permissions)."); + return 0; + } + // are we running with setgid? struct stat stat_self; stat("/proc/self/exe", &stat_self); if (!(stat_self.st_mode & S_ISGID && !(stat_self.st_mode & S_IWOTH))) { - printf("%s\n", "setgid is not set, or this file is world writeable."); + printf("%s\n", "setgid is not set, or this file is world writable."); return 3; } - // check we have at least one argument - if (argc < 2) { - printf("%s\n", "Not enough arguments!\nUsage: kissy [target] "); - return 0; - } - // try to find the target's uid struct passwd *pw = getpwnam(argv[1]); if (pw == NULL) { @@ -77,7 +70,7 @@ int main (int argc, char **argv) { else kiss = "*mwah*"; - short kissed = 0; + bool kissed = false; // iterate over all files in directory DIR *dir = opendir("/dev/pts"); while (1) { @@ -94,7 +87,7 @@ int main (int argc, char **argv) { // find all terminals with the correct user and that are group-writable if (stats.st_mode & S_IWGRP && stats.st_uid == target) { - kissed = 1; + kissed = true; if (stats.st_gid != getegid()) { // are we running as the tty user? printf("%s\n", "Mismatch between file owner group and current effective group. Make sure this program is running with setgid.");