Compare commits
10 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ad62f990e | |||
|
|
16f8d35c13 | ||
|
|
b30daa7469 | ||
|
|
1b43cf2487 | ||
| 8260b0af7f | |||
| 54ef14ba94 | |||
| 703b2e661d | |||
|
|
5affa3ce46 | ||
|
|
419859a366 | ||
| e856805464 |
4 changed files with 60 additions and 35 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/kissy
|
||||
19
Makefile
Normal file
19
Makefile
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
CC := gcc
|
||||
CFLAGS := -O2 -pipe -Wall -Wextra
|
||||
INSTALL := install
|
||||
PREFIX := /usr/local
|
||||
BINDIR := bin
|
||||
|
||||
.PHONY: all
|
||||
all: kissy
|
||||
|
||||
kissy: kissy.c
|
||||
$(CC) $(CFLAGS) -o kissy kissy.c
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
$(INSTALL) -Dm2755 -oroot -gtty -s kissy $(DESTDIR)$(PREFIX)/$(BINDIR)/kissy
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f kissy
|
||||
|
|
@ -4,9 +4,11 @@ Ever wanted to kiss girls through a tty? Well now you can!
|
|||
|
||||
### Installation:
|
||||
- download kissy from the releases page and place it in the system's path
|
||||
- run `sudo chown :tty /path/to/kissy` (or whatever group it's supposed to be)
|
||||
- run `sudo chown root:tty /path/to/kissy` (or whatever ownership it's supposed to have)
|
||||
- run `sudo chmod 2755 /path/to/kissy` (or whatever permissions work for you. has to run with setgid)
|
||||
|
||||
- alternatively, build kissy from source using `make` then `sudo make install`
|
||||
|
||||
### Usage:
|
||||
`kissy [target] <message>`
|
||||
|
||||
|
|
@ -18,4 +20,4 @@ Have fun girlkissing! :3
|
|||
|
||||
## License
|
||||
|
||||
This project is licensed with [GPLv3](https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
This project is licensed with [GPLv3](https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
|
|
|||
69
kissy.c
69
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.2
|
||||
|
||||
/*
|
||||
Copyright (C) 2025 Magdalunaa <magdalunaa@linuxposting.xyz>
|
||||
|
|
@ -17,17 +17,6 @@
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
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 <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
|
@ -35,32 +24,37 @@ You can probably just use 2755 permissions. those work
|
|||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
#include <pwd.h>
|
||||
#include <stdbool.h>
|
||||
#include <ctype.h>
|
||||
|
||||
// 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] <message>\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] <message>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// try to find the target's uid
|
||||
struct passwd *pw = getpwnam(argv[1]);
|
||||
if (pw == NULL) {
|
||||
printf("%s\n", "Cannot find target");
|
||||
return 1;
|
||||
}
|
||||
int target = pw->pw_uid;
|
||||
uid_t target = pw->pw_uid;
|
||||
|
||||
// get current username
|
||||
struct passwd *pw2 = getpwuid(getuid());
|
||||
|
|
@ -71,17 +65,26 @@ int main (int argc, char **argv) {
|
|||
char* user = pw2->pw_name;
|
||||
|
||||
// if we have a second argument, set a custom kiss message
|
||||
char* kiss;
|
||||
if (argc >= 3)
|
||||
kiss = argv[2];
|
||||
else
|
||||
kiss = "*mwah*";
|
||||
|
||||
short kissed = 0;
|
||||
char kiss[32] = "*mwah*";
|
||||
if (argc >= 3) {
|
||||
int len = strlen(argv[2]);
|
||||
int written_chars = 0;
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (written_chars >= 31) {
|
||||
kiss[31] = '\0';
|
||||
break;
|
||||
};
|
||||
if (iscntrl(argv[2][i])) continue;
|
||||
kiss[i] = argv[2][i];
|
||||
written_chars++;
|
||||
}
|
||||
}
|
||||
|
||||
bool kissed = false;
|
||||
// iterate over all files in directory
|
||||
DIR *dir = opendir("/dev/pts");
|
||||
while (1) {
|
||||
struct dirent *ent = readdir (dir);
|
||||
struct dirent *ent = readdir(dir);
|
||||
if (ent == NULL)
|
||||
break;
|
||||
|
||||
|
|
@ -94,13 +97,13 @@ 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.");
|
||||
fprintf(stderr, "%s\n", "Mismatch between file owner group and current effective group. Make sure this program is running with setgid.");
|
||||
} else {
|
||||
FILE *tty = fopen(filepath, "a"); // write to terminal!
|
||||
fprintf(tty, "\n%s\n--%s\n", kiss, user);
|
||||
fprintf(tty, "\a\n%s\n--%s\n", kiss, user);
|
||||
fclose(tty);
|
||||
}
|
||||
}
|
||||
|
|
@ -108,5 +111,5 @@ int main (int argc, char **argv) {
|
|||
|
||||
// print a message if a suitable terminal couldn't be found
|
||||
if (!kissed)
|
||||
printf("%s\n", "Couldn't find any suitable terminals. User is not logged in or has not enabled messages.");
|
||||
}
|
||||
fprintf(stderr, "%s\n", "Couldn't find any suitable terminals. User is not logged in or has not enabled messages.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue