Version 1
This commit is contained in:
parent
935243d8b4
commit
d95043bd15
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
||||
build
|
||||
probotic
|
||||
config.h
|
||||
*/**.out
|
||||
.gdb_history
|
||||
*.sqlite
|
||||
build.sh
|
||||
|
11
CHANGELOG
Normal file
11
CHANGELOG
Normal file
@ -0,0 +1,11 @@
|
||||
Upgraded to just Make
|
||||
New entries in project_list.sql
|
||||
Deleted various irrelevant files
|
||||
Updated project goals
|
||||
Pruned pair parser
|
||||
Reduced creds struct
|
||||
|
||||
ADDED NVULN=1 build option to remove kill, raw and dump
|
||||
ADDED new -url option
|
||||
|
||||
Updated Version to 1
|
30
Makefile
30
Makefile
@ -1,11 +1,35 @@
|
||||
# note that this file does not properly handle options
|
||||
|
||||
PROGN:=probotic
|
||||
|
||||
CFLAGS:=-std=c99 -Wall -Wextra -Wpedantic -Wvla -Wshadow -Wundef
|
||||
CPPFLAGS:=-I/usr/include/libircclient/ -Iinclude -D_GNU_SOURCE -DPROGN=\"${PROGN}\" -D_FORTIFY_SOURCE=2
|
||||
|
||||
LDLIBS:=-lircclient -lsqlite3
|
||||
|
||||
SRC := api.c irc.c main.c parse.c unity.c
|
||||
HDR := api.h error.h irc.h irccolors.h parse.h stmt.h
|
||||
DEBUG := 1
|
||||
|
||||
probotic: $(SRC) $(HDR)
|
||||
DEBUG=$(DEBUG) ./build.sh
|
||||
ifeq (${DEBUG},1)
|
||||
CFLAGS += -Og -ggdb
|
||||
else
|
||||
CFLAGS += -O3 -flto=auto -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ifdef SAN
|
||||
CFLAGS += -fsanitize=${SAN}
|
||||
endif
|
||||
|
||||
ifeq (${NVULN},1)
|
||||
CPPFLAGS += -DNO_VULN_COMMANDS
|
||||
endif
|
||||
|
||||
${PROGN}: ${HDR} ${SRC}
|
||||
${LINK.c} src/unity.c -o $@ ${LDLIBS}
|
||||
|
||||
# do nothing but update them...
|
||||
$(SRC) $(HDR):
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-rm ${OBJ}
|
||||
|
@ -18,8 +18,7 @@ INSERT INTO tag VALUES('Tools');
|
||||
|
||||
INSERT INTO project (title, body) VALUES (
|
||||
'IRC Bot',
|
||||
'Build an IRC Bot using SQLite3 and libircclient\nhttps://www.sqlite.org/index.html\n
|
||||
http://www.ulduzsoft.com/libircclient/'
|
||||
'Contribute to Probotic'
|
||||
);
|
||||
|
||||
INSERT INTO assignment (who, project) VALUES (
|
||||
|
@ -1,7 +1,7 @@
|
||||
-- Starting off:
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Hello world', 1, 1);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Fizz Buzz', 1, 1);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Data Structures (Stacks, Heaps, Binary Trees, etc)', 2, 7);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Data Structures (Stack, List, Heap, Binary Tree, etc)', 2, 7);
|
||||
|
||||
-- AI:
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Neural Network', 2, 7);
|
||||
@ -46,7 +46,8 @@ INSERT INTO project (title, difficulty, span) VALUES ('BitTorrent Client', 2, 30
|
||||
INSERT INTO project (title, difficulty, span, body) VALUES ('Your own Operating system', 4, 30, 'wiki.osdev.org');
|
||||
|
||||
-- Rendering:
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('3D CAD Software', 4, 7);
|
||||
-- INSERT INTO project (title, difficulty, span) VALUES ('3D CAD Software', 4, 7);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('2D Vertex Editor', 3, 30);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('3D Vertex Editor', 3, 30);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Bitmap Raytracer', 3, 7);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Media Player (Think MPV & VLC)', 3, 30);
|
||||
@ -54,15 +55,97 @@ INSERT INTO project (title, difficulty, span) VALUES ('Music Player Daemon Imple
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Image to ASCII (BONUS: Use Unicode or Color)', 2, 7);
|
||||
|
||||
-- Simulation:
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Hydrodynamics', 2, 7);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Aerodynamics', 2, 7);
|
||||
-- INSERT INTO project (title, difficulty, span) VALUES ('Hydrodynamics', 2, 7);
|
||||
-- INSERT INTO project (title, difficulty, span) VALUES ('Aerodynamics', 2, 7);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Rigid Body Physics', 2, 7);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Voronoi Diagram (HARDMODE: hardware rendering)', 1, 7);
|
||||
|
||||
-- Tools (Usable and Applied Algorithms):
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Terminal Emulator', 3, 7);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Text Editor', 3, 7);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Text Editor (Autosave with dates, Configurable binds)', 3, 7);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Syntax Highlighter (preferably for your own editor)', 2, 30);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('General Compression Library (Think zlib)', 2, 30);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('General Compression Library', 2, 30);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Multi-Threaded GREP Implementation (BONUS: Highlighting and line numbers)(Hint: use pThread and AIO)', 2, 30);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Vector/Bitmap Image Manipulation Program', 2, 30);
|
||||
|
||||
-- V4, pruned and slightly revised
|
||||
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Download Manager', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Make an elastic producer/consumer task queue', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Markov Chain Sentence Generator', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('English Sentence Parser that points the Context of a Sentence', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('MIDI Player + Editor', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Stock Market Simulator Using Yahoo Spreadsheet Data', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Parametric/Graphic Equalizer for .wav files', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('To-Do List Application', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Verlet Integration', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('TCP/UDP Chat Server + Client (Bonus: No web browser needed)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Music Streaming', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Shazam', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Chatbot', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Curses Text Editor', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('paint.net Clone', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Image to ASCII Art', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Booru (Image Board) Image Downloader', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Image Converter (png -> jpeg -> avif)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('ID3 Reader', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Sound Synthesis (Sine, Square, Sawtooth, etc.) ("Fuck You" mode: Realtime MIDI Playback with Custom instruments)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('C++ IDE Plugin for your Text Editor', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Simple Version Control System supporting branches, commits with messages, unlocking, and per-file configuration of number of revisions and blame. ("Fuck You" mode: Do it all)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Imageboard (Think vichan)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Password Manager (think KeePassXC)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Torrent Client', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Booru Client', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Key Press Bot', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('IP/URL Obscurification (http://www.pc-help.org/obscure.htm)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Radix Base Converter (Give a radix base, convert it to a number, vice versa)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Chan aggregator (Lets users view multiple Chans)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Encrypt / Decrypt Tool (Using AES)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Create a HSV Color Representation', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Window Manager (Bonus: for Wayland)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Basic Relational Database Software (SQL Support Handle Relationships, Focus on Efficiency)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Pixel Editor', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Trivial File Transfer Protocol (TFTP): Allows a client to put a file onto a remote host and retrieve it', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Markdown (HTML/XML) Editor', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('IP Tracking Visualization', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Port Scanner', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Old School Demo Effect (Plasma Tunnel, Scrollers, Zoomers, etc...)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Fizzbuzz (Bonus: in Machine Code / Assembly)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('RPN Calculator', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Coreutils implementation of wc that supports printing numbers optionally in a human readible format (Bonus: for the rest of Coreutils)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Towers of Hanoi', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Music Visualizer', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Unicode Converter (Support for UTF-8, 16LE, 32LE, and 32BE)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Calculate nth digits of pi (Bonus: arbitrary precision, what is the 2^2082 digit of pi?)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Least Squares Fitting Algorithm', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Given an Array of Stocks values over time, find the period of time where the stocks could have made the most money', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Highest Prime Factor Calculator', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Hide and Extract Data in images (Basic Steganography)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Web Page Crawler', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Password Generator (Configurable)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Vigenère cipher', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Game Of Life (Bonus: Save load state / drop-in constructions)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Caesar Cipher Cracker', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Dijkstras Algorithm', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Caesar, ROT 13, ROT 47 ciphers (Bonus: In Assembly)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Program that displays MBR/GUID contents', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Random Name Picker (Bonus: Fetches data from the internet)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Youtube to MP3', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Text to Hexadecimal, Octal, and Binary', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Calculate the first 1,000 digits of pi iteratively', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Sierpinski Triangle', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Mandlebrot Set', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('OpenAI Gym Project', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('AI for Roguelikes', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Sudoku Solver (Using A* algorithm)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Connect-4 AI Player using Aplha-Beta Pruning', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Basic Neural Network - Simulate individual Neurons and their connections', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Real Neural Network - Implement a basic feed forward neural network using matrices for entire layers along with matrix operations for computation', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Convolutional Neural Network: For handwritten digit recognition, test on MNIST database (Use TensorFlow, Theano, etc)', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Convolutional Neural Network: Implement your own Convolutional N.N. for handwritten digit recognition.', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Virtual Machine with a script that writes "Hello, World!"', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Basic Bootloader', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Terminal Shell (Executable Binaries, Pipes, Redirection, History,) (Bonus 1: Supports VT100) (Bonus 2: Make it have its own Terminal Emulator', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('HTML + JavaScript Debugger', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('Write an Interpreted LISP-like Programming Language', 1000, 1000);
|
||||
INSERT INTO project (title, difficulty, span) VALUES ('make an application tha tis capable of mounting filesystems from othe OSes using the FUSE model', 1000, 1000);
|
||||
|
25
docs/api.md
25
docs/api.md
@ -1,14 +1,13 @@
|
||||
# Syntax
|
||||
<bot_name>: <command>
|
||||
|
||||
# Commands
|
||||
+ remind : dump current assignment
|
||||
## Admin
|
||||
+ reroll : terminate current assignment early and get a new
|
||||
+ set_repo <link> : set project repository link (to be dumped on remind)
|
||||
+ raw <sql> : execute raw sql, so add/delete is covered without retarded interfaces
|
||||
## PM
|
||||
So random users cant shit up the channel / add support for personal assignments.
|
||||
+ dump : list all possible projects
|
||||
+ request : request personal project
|
||||
+ remind : dump the users current personal assignment
|
||||
+ remind : dump current assignment
|
||||
## User
|
||||
+ magic : does a magical spell
|
||||
+ reroll : terminate current assignment early and get a new
|
||||
+ remind : dump the users current personal assignment
|
||||
## Dev
|
||||
+ dump : list all possible projects
|
||||
+ raw <sql> : execute raw sql, so add/delete is covered without retarded interfaces
|
||||
+ kill : kills the process
|
||||
## Undefined
|
||||
+ request : request personal project
|
||||
+ repo <link> : set project repository link (to be dumped on remind)
|
||||
|
@ -1,9 +0,0 @@
|
||||
-server SERVER - The desired server.
|
||||
-port PORT - Places port number.
|
||||
-username USERNAME - Specifies the username.
|
||||
-password PASSW0RD - Sets a password.
|
||||
-auth FILE - Uses an authorization file.
|
||||
-help - A message likewise.
|
||||
-version - Currently nothing.
|
||||
|
||||
options before are overwritten, and after take precedence.
|
@ -1 +0,0 @@
|
||||
./probotic irc.rizon.net 6667 '#/g/chad' probotic
|
@ -1,2 +0,0 @@
|
||||
/*--------------------------------------------------------------------------------*/
|
||||
/* Lines shouldn't be longer than 80 characters, which is this long ^ */
|
@ -1,51 +1,12 @@
|
||||
--- Probotic
|
||||
--- Goals
|
||||
|
||||
A IRC Bot that is able to recieve several commands and on a weekly
|
||||
(or daily, biweekly, monthly) basis will (privately?) declare an
|
||||
assignment for users to do.
|
||||
Provides users with commands to retrieve project ideas via a few simple
|
||||
commands. Possibly extended to where admins/users may prune/submit
|
||||
new ideas.
|
||||
|
||||
--- Speculations
|
||||
This project was created solely for a few people to learn to work together.
|
||||
|
||||
Internally this suggests that it must handle entries of these projects
|
||||
that could be preconceived or composed exactly for a given date (what
|
||||
we're doing.)
|
||||
--- Formatting
|
||||
|
||||
This may be done via a simplistic append-only database or a SQL-based
|
||||
database.
|
||||
|
||||
--- Requirements
|
||||
|
||||
The bot should support printing at a regular interval or at a given date.
|
||||
The bot should respect some commands, such as POST, for if someone wishes
|
||||
to post a project challenge.
|
||||
The bot should respect an administrator, such that he could POST, and
|
||||
REMOVE entered items.
|
||||
Command SEARCH, SINCE and LIST, for regexp searching, entries since a
|
||||
date (presumably a <from> <to> relationship), and a list all.
|
||||
|
||||
The tooling behind the bot should be accessible to do the same sort of
|
||||
interfacing to recieve a given task at the running of a command (to avoid
|
||||
having to deal with unix mail, this could be done through a daily check
|
||||
in a crontab file.)
|
||||
|
||||
--- Autism
|
||||
|
||||
Formatting is BSD spc2, always bracketed (unless the block is upon another
|
||||
keyword), overwrap functions and combinators.
|
||||
|
||||
--- Example
|
||||
|
||||
int /* what I meant by overwrap functions */
|
||||
main(int argc,
|
||||
argv * argv)
|
||||
{
|
||||
int * somevar = 0 + 1;
|
||||
if (1 || /* what I meant by overwrap combinators */
|
||||
*somevar)
|
||||
{ return 0; }
|
||||
else /* switch, if, do/while/for, would not be nested within */
|
||||
{
|
||||
puts("fruakk");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Formatting is BSD spc2, always bracketed (unless the block is upon
|
||||
another keyword), overwrap functions and combinators.
|
||||
|
@ -1,3 +0,0 @@
|
||||
server=irc.rizon.net
|
||||
username=probotic
|
||||
port=6667
|
@ -1,9 +0,0 @@
|
||||
2023-08-02 - Week 1 - The Challenge Bot
|
||||
|
||||
Contribute to the bot!
|
||||
|
||||
END
|
||||
|
||||
2023-08-09 - Week 2 - dunno...
|
||||
|
||||
\END or EOF
|
90
docs/v4.txt
Normal file
90
docs/v4.txt
Normal file
@ -0,0 +1,90 @@
|
||||
1 - Download Manager
|
||||
2 - Make an elastic producer/consumer task queue
|
||||
|
||||
4 - Markov Chain Sentence Generator
|
||||
5 - English Sentence Parser that points the Context of a Sentence
|
||||
6 - MIDI Player + Editor
|
||||
7 - Stock Market Simulator Using Yahoo Spreadsheet Data
|
||||
8 - Parametric/Graphic Equalizer for .wav files
|
||||
|
||||
10 - To-Do List Application
|
||||
11 - Verlet Integration
|
||||
12 - TCP/UDP Chat Server + Client (Bonus: No web browser needed)
|
||||
13 - Music Streaming
|
||||
14 - Shazam
|
||||
15 - Chatbot
|
||||
16 - Curses Text Editor
|
||||
17 - paint.net Clone
|
||||
18 - Image to ASCII Art
|
||||
19 - Booru (Image Board) Image Downloader
|
||||
20 - Image Converter (png -> jpeg -> avif)
|
||||
21 - ID3 Reader
|
||||
22 - Sound Synthesis (Sine, Square, Sawtooth, etc.) ("Fuck You" mode: Realtime MIDI Playback with Custom instruments)
|
||||
23 - C++ IDE Plugin for your Text Editor
|
||||
24 - Simple Version Control System supporting branches, commits with messages, unlocking, and per-file configuration of number of revisions and blame. ("Fuck You" mode: Do it all)
|
||||
25 - Imageboard (Think vichan)
|
||||
26 - Password Manager (think KeePassXC)
|
||||
27 - Torrent Client
|
||||
28 - Booru Client
|
||||
29 - Key Press Bot
|
||||
30 - IP/URL Obscurification (http://www.pc-help.org/obscure.htm)
|
||||
31 - Radix Base Converter (Give a radix base, convert it to a number, vice versa)
|
||||
32 - Chan aggregator (Lets users view multiple Chans)
|
||||
33 - Encrypt / Decrypt Tool (Using AES)
|
||||
|
||||
35 - Create a HSV Color Representation
|
||||
36 - Window Manager (Bonus: for Wayland)
|
||||
37 - Basic Relational Database Software (SQL Support Handle Relationships, Focus on Efficiency)
|
||||
38 - Pixel Editor
|
||||
39 - Trivial File Transfer Protocol (TFTP): Allows a client to put a file onto a remote host and retrieve it
|
||||
40 - Markdown (HTML/XML) Editor
|
||||
41 - IP Tracking Visualization
|
||||
42 - Port Scanner
|
||||
43 - Old School Demo Effect (Plasma Tunnel, Scrollers, Zoomers, etc...)
|
||||
44 - Fizzbuzz (Bonus: in Machine Code / Assembly)
|
||||
45 - RPN Calculator
|
||||
46 - Coreutils implementation of wc that supports printing numbers optionally in a human readible format (Bonus: for the rest of Coreutils)
|
||||
47 - Towers of Hanoi
|
||||
48 - Music Visualizer
|
||||
49 - Unicode Converter (Support for UTF-8, 16LE, 32LE, and 32BE)
|
||||
50 - Calculate nth digits of pi (Bonus: arbitrary precision, what is the 2^2082 digit of pi?)
|
||||
51 - Least Squares Fitting Algorithm
|
||||
52 - Given an Array of Stocks' values over time, find the period of time where the stocks could have made the most money
|
||||
53 - Highest Prime Factor Calculator
|
||||
54 - Hide and Extract Data in images (Basic Steganography)
|
||||
55 - Web Page Crawler
|
||||
56 - Password Generator (Configurable)
|
||||
57 - Vigenère cipher
|
||||
58 - Conway's Game Of Life (Bonus: Save load state / drop-in constructions)
|
||||
59 - Caesar Cipher Cracker
|
||||
60 - Dijkstra's Algorithm
|
||||
61 - Caesar, ROT 13, ROT 47 ciphers (Bonus: In Assembly)
|
||||
62 - Program that displays MBR/GUID partion's contents
|
||||
63 - Random Name Picker (Bonus: Fetches data from the internet)
|
||||
65 - Youtube to MP3
|
||||
66 - Text to Hexadecimal, Octal, and Binary
|
||||
67 - Calculate the first 1,000 digits of pi iteratively
|
||||
68 - Sierpinski Triangle
|
||||
69 - Mandlebrot Set
|
||||
70 - OpenAI Gym Project
|
||||
71 - AI for Roguelikes
|
||||
72 - Sudoku Solver (Using A* algorithm)
|
||||
73 - Connect-4 AI Player using Aplha-Beta Pruning
|
||||
74 - Basic Neural Network - Simulate individual Neurons and their connections
|
||||
75 - Real Neural Network - Implement a basic feed forward neural network using matrices for entire layers along with matrix operations for computation.
|
||||
76 - Convolutional Neural Network: For handwritten digit recognition, test on MNIST database (Use TensorFlow, Theano, etc)
|
||||
77 - Convolutional Neural Network: Implement your own Convolutional N.N. for handwritten digit recognition.
|
||||
78 - Virtual Machine with a script that writes "Hello, World!"
|
||||
79 - Basic Bootloader
|
||||
80 - Terminal Shell (Executable Binaries, Pipes, Redirection, History,) (Bonus 1: Supports VT100) (Bonus 2: Make it have it's own Terminal Emulator)
|
||||
81 - HTML + JavaScript Debugger
|
||||
82 - Write an Interpreted LISP-like Programming Language
|
||||
83 - make an application tha tis capable of mounting filesystems from othe OSes using the FUSE model
|
||||
|
||||
Already included
|
||||
3 - IRC Client
|
||||
9 - Graphing Calculator
|
||||
34 - Text Editor /w autosave
|
||||
|
||||
Broken Link
|
||||
64 - Encrypt/Decrypt Text: Implement at least one from http://rumkin.com/tools/cipher/collection
|
1
docs/v5-ext-2.txt
Normal file
1
docs/v5-ext-2.txt
Normal file
@ -0,0 +1 @@
|
||||
Write Your Own Custom Filesystem (Bonus: Supports Journaling)
|
@ -1,3 +1,5 @@
|
||||
An extension to v4
|
||||
|
||||
[easy] [medi] [hard] [fuck you] -- I'm not entirely sure about: [netlet] [mathlet]
|
||||
[-day] [-week] [-month] [-year] [-never] To completion
|
||||
|
2
docs/v5.txt
Normal file
2
docs/v5.txt
Normal file
@ -0,0 +1,2 @@
|
||||
TODO compile v4 and v5-ext* into this document, make sure it's in a format that
|
||||
can easily be converted into SQL code via Editor Macros.
|
@ -6,8 +6,7 @@ DECL int api_init(void);
|
||||
DECL void api_rope(void);
|
||||
DECL void rope(void);
|
||||
DECL char * remind(char * who);
|
||||
DECL char * raw(char const * const sql);
|
||||
DECL int is_no_assignment(char const * const who);
|
||||
/* DECL int is_no_assignment(char const * const who); */
|
||||
|
||||
#define API_H_
|
||||
#endif
|
||||
|
@ -1,9 +1,6 @@
|
||||
#ifndef HELP_H_
|
||||
|
||||
/* (((git))) */
|
||||
|
||||
VARDECL char const * help_msg;
|
||||
VARDECL char const * fmsg;
|
||||
|
||||
#define HELP_H_
|
||||
#endif
|
||||
|
@ -2,27 +2,23 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t admin_count;
|
||||
char * username;
|
||||
char * password;
|
||||
char * channel;
|
||||
char * server;
|
||||
char ** admins;
|
||||
int port;
|
||||
} creds_t;
|
||||
|
||||
VARDECL creds_t creds;
|
||||
|
||||
DECL char ** str_split(char const * s, char c);
|
||||
DECL void split_clean(char ** split);
|
||||
DECL char * dump(void);
|
||||
DECL char * raw(char const * const sql);
|
||||
/* DECL char ** str_split(char const * s, char c); */
|
||||
/* DECL void split_clean(char ** split); */
|
||||
/* DECL int is_admin(char const * user); */
|
||||
|
||||
/* DECL char * dump(void); */
|
||||
/* DECL char * raw(char const * const sql); */
|
||||
DECL char * remind(char * who);
|
||||
DECL char * slurp(char const * fn);
|
||||
DECL int is_admin(char const * user);
|
||||
DECL int parse_pair(char const * buf, size_t const len);
|
||||
DECL void creds_free_password(void);
|
||||
DECL void creds_free_rest(void);
|
||||
DECL void creds_free(void);
|
||||
DECL void parse_command(char const * const cmd);
|
||||
DECL void purge_assignments(char const * const who);
|
||||
DECL void random_assign(char const * const sql);
|
||||
|
31
src/api.c
31
src/api.c
@ -70,10 +70,12 @@ remind(char * who)
|
||||
if (desc) { desc = strdup(desc); } else { desc = ""; }
|
||||
repo = (char *) sqlite3_column_text(remind_stmt, 3);
|
||||
if (repo) { repo = strdup(repo); } else { repo = "<no link available>"; }
|
||||
asprintf(&r,
|
||||
IRC_RED "%s: " IRC_YELLOW "%s" IRC_GREEN
|
||||
" (@" IRC_BLUE "%s" IRC_GREEN ")" IRC_STOP,
|
||||
title, desc, repo);
|
||||
if (-1 == asprintf(&r,
|
||||
IRC_RED "%s: " IRC_YELLOW "%s" IRC_GREEN
|
||||
" (@" IRC_BLUE "%s" IRC_GREEN ")" IRC_STOP,
|
||||
title, desc, repo))
|
||||
{ /* this will probably never happen. But it implies a memory failure */
|
||||
r = strdup(IRC_RED "No memory!" IRC_STOP); }
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -92,12 +94,16 @@ set_repo(char const * const who,
|
||||
DBERR(sqlite3_step(set_repo_stmt));
|
||||
}
|
||||
|
||||
#ifndef NO_VULN_COMMANDS
|
||||
|
||||
/* Note that this function is may not be vuln,
|
||||
but is included as it's only used by vulns */
|
||||
DECL int
|
||||
rtos(void * data,
|
||||
int argc,
|
||||
char** argv,
|
||||
char** colname
|
||||
){
|
||||
int argc,
|
||||
char** argv,
|
||||
char** colname)
|
||||
{
|
||||
(void) colname;
|
||||
|
||||
char ** r = (char**)data;
|
||||
@ -162,6 +168,8 @@ raw(char const * const sql)
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif /* !NO_VULN_COMMANDS */
|
||||
|
||||
|
||||
DECL int
|
||||
get_project_count_callback(void* data, int argc, char** argv, char** colname)
|
||||
@ -220,11 +228,16 @@ purge_assignments(char const * const who)
|
||||
DBERR(sqlite3_step(purge_assignments_stmt));
|
||||
}
|
||||
|
||||
#ifdef INITIAL_ASSIGNMENT_MESSAGE
|
||||
|
||||
DECL int
|
||||
is_no_assignment(char const * const who){
|
||||
is_no_assignment(char const * const who)
|
||||
{
|
||||
DBERR(sqlite3_reset(is_no_assignment_stmt));
|
||||
DBERR(sqlite3_bind_text(is_no_assignment_stmt, 1, who, -1, SQLITE_STATIC));
|
||||
const int e = sqlite3_step(is_no_assignment_stmt);
|
||||
DBERR(e);
|
||||
return (e == SQLITE_DONE);
|
||||
}
|
||||
|
||||
#endif /* INITIAL_ASSIGNMENT_MESSAGE */
|
||||
|
68
src/irc.c
68
src/irc.c
@ -15,20 +15,15 @@
|
||||
*/
|
||||
|
||||
VARDECL char const * help_msg =
|
||||
IRC_GREEN "!help " IRC_STOP " : This message\n"
|
||||
/* IRC_GREEN "!help " IRC_STOP " : This message\n" */
|
||||
IRC_GREEN "!remind " IRC_STOP " : Dump current assignment\n"
|
||||
IRC_GREEN "!reroll " IRC_STOP " : Rerolls assignment\n"
|
||||
IRC_GREEN "!set_repo <link>" IRC_STOP " : Sets project repository link\n"
|
||||
IRC_GREEN "!raw <sql> " IRC_STOP " : Execute raw SQL\n"
|
||||
IRC_GREEN "!dump " IRC_STOP " : List all possible projects\n"
|
||||
/* IRC_GREEN "!repo <link>" IRC_STOP " : Sets project repository link\n" */
|
||||
/* IRC_GREEN "!raw <sql> " IRC_STOP " : Execute raw SQL\n" */
|
||||
/* IRC_GREEN "!dump " IRC_STOP " : List all possible projects\n" */
|
||||
IRC_GREEN "!request " IRC_STOP " : Request personal project\n"
|
||||
IRC_GREEN "!remind " IRC_STOP " : Prints your assignment\n";
|
||||
|
||||
VARDECL char const * fmsg =
|
||||
"%s\x2C\x20\x79\x6F\x75\x20\x61\x72\x65\x20\x66\x61\x67\x67"
|
||||
"\x6F\x74\x20\x66\x6F\x72\x20\x74\x68\x61\x74\x20\x6F\x70"
|
||||
"\x69\x6E\x69\x6F\x6E\x2E";
|
||||
|
||||
#define PREFIX_COMMAND_CHAR '!'
|
||||
#define PREFIX_CHANNEL_COMMAND_CHAR '%'
|
||||
|
||||
@ -36,8 +31,6 @@ VARDECL irc_session_t * session;
|
||||
VARDECL irc_callbacks_t callbacks;
|
||||
|
||||
VARDECL char * current_username = NULL;
|
||||
/* Do you have any idea how many things this breaks? */
|
||||
int stupid_shit = -1;
|
||||
|
||||
#define IRCMSG(msg) irc_cmd_msg(session, creds.channel, msg)
|
||||
|
||||
@ -50,8 +43,11 @@ get_username(const char * origin)
|
||||
while (origin[i] != USERNAME_TERMINATOR)
|
||||
{ i++; }
|
||||
r = (char *) malloc(i + 1);
|
||||
strncpy(r, origin, i);
|
||||
r[i] = '\00';
|
||||
if (r)
|
||||
{
|
||||
strncpy(r, origin, i);
|
||||
r[i] = '\00';
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -59,30 +55,33 @@ DECL void
|
||||
ircmsg(const char* fmt,
|
||||
...)
|
||||
{
|
||||
if(!strcmp(fmt, "") || fmt == NULL){ return; }
|
||||
va_list args;
|
||||
char * fmtdmsg;
|
||||
char * swp;
|
||||
const char * delim = "\n";
|
||||
char * data;
|
||||
if(!strcmp(fmt, "") || fmt == NULL)
|
||||
{ return; }
|
||||
|
||||
va_start(args, fmt);
|
||||
if(vasprintf(&fmtdmsg, fmt, args) == -1)
|
||||
{ exit(1); }
|
||||
|
||||
puts(fmtdmsg);
|
||||
const char* delim = "\n";
|
||||
char* data = strtok(fmtdmsg, delim);
|
||||
do{
|
||||
data = strtok(fmtdmsg, delim);
|
||||
do
|
||||
{
|
||||
swp = irc_color_convert_to_mirc(data);
|
||||
IRCMSG(swp);
|
||||
free(swp);
|
||||
}while((data = strtok(NULL, delim), data));
|
||||
free(swp);
|
||||
} while((data = strtok(NULL, delim), data));
|
||||
|
||||
free(fmtdmsg);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
DECL void
|
||||
event_connect(irc_session_t * session,
|
||||
event_connect(irc_session_t * lsession,
|
||||
const char * event,
|
||||
const char * origin,
|
||||
const char ** params,
|
||||
@ -93,16 +92,19 @@ event_connect(irc_session_t * session,
|
||||
(void) params;
|
||||
(void) count;
|
||||
/* msg ChanServ IDENTIFY? */
|
||||
irc_cmd_join(session, creds.channel, 0);
|
||||
if(is_no_assignment(creds.channel)){
|
||||
irc_cmd_join(lsession, creds.channel, 0);
|
||||
#ifdef INITIAL_ASSIGNMENT_MESSAGE
|
||||
if(is_no_assignment(creds.channel))
|
||||
{
|
||||
ircmsg(IRC_RED "No assignment for this channel. Finding a new..." IRC_STOP);
|
||||
random_assign(creds.channel);
|
||||
}
|
||||
ircmsg(remind(creds.channel));
|
||||
#endif /* INITIAL_ASSIGNMENT_MESSAGE */
|
||||
}
|
||||
|
||||
DECL void
|
||||
event_channel(irc_session_t * session,
|
||||
event_channel(irc_session_t * lsession,
|
||||
char const * event,
|
||||
char const * origin,
|
||||
char const ** params,
|
||||
@ -110,25 +112,25 @@ event_channel(irc_session_t * session,
|
||||
{
|
||||
/* char const * channel = params[0]; */
|
||||
char const * message = params[1];
|
||||
(void) session;
|
||||
(void) lsession;
|
||||
(void) event;
|
||||
(void) origin;
|
||||
/* (void) channel; */
|
||||
(void) message;
|
||||
(void) count;
|
||||
/* parses the command */
|
||||
switch(*message){
|
||||
switch(*message)
|
||||
{
|
||||
case PREFIX_CHANNEL_COMMAND_CHAR:
|
||||
current_username = strdup(creds.channel);
|
||||
current_username = strdup(creds.channel);
|
||||
break;
|
||||
case PREFIX_COMMAND_CHAR:
|
||||
current_username = get_username(origin);
|
||||
current_username = get_username(origin);
|
||||
break;
|
||||
}
|
||||
if(!current_username || *(message+1) == '\00'){ return; }
|
||||
--stupid_shit;
|
||||
if(stupid_shit == 0)
|
||||
{ ircmsg(fmsg, current_username); }
|
||||
if (!current_username ||
|
||||
message[1] == '\0')
|
||||
{ return; }
|
||||
parse_command(message+1);
|
||||
free(current_username);
|
||||
current_username = NULL;
|
||||
@ -154,11 +156,11 @@ init(void)
|
||||
irc_connect(session,
|
||||
creds.server, creds.port, creds.password,
|
||||
creds.username, creds.username, creds.username);
|
||||
creds_free_password();
|
||||
FULL_FREE(creds.password);
|
||||
atexit(rope);
|
||||
return 0;
|
||||
fail:
|
||||
creds_free_password();
|
||||
FULL_FREE(creds.password);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
60
src/main.c
60
src/main.c
@ -14,17 +14,15 @@
|
||||
|
||||
*/
|
||||
|
||||
#define VERSION_STRING "0.999"
|
||||
#define VERSION_STRING "1"
|
||||
|
||||
void
|
||||
help(void)
|
||||
{
|
||||
ERRMSG(PROGN ": usage\n"
|
||||
"-server SERVER - Sets server\n"
|
||||
"-port PORT - Sets port\n"
|
||||
"-username USERNAME - Sets username\n"
|
||||
"-password PASSW0RD - Sets password\n"
|
||||
"-auth FILE - Use auth file");
|
||||
"-channel CHANNEL - Sets the target channel\n"
|
||||
"-url URL - Sets the target URL\n"
|
||||
"Use format username[:password]@server[:port], port defaults to 6667.\n");
|
||||
}
|
||||
|
||||
void
|
||||
@ -37,11 +35,9 @@ int
|
||||
main (int argc,
|
||||
char ** argv)
|
||||
{
|
||||
char const * authfile = NULL;
|
||||
if (argc > 1)
|
||||
{
|
||||
char * arg;
|
||||
char * buf;
|
||||
while (++argv, --argc)
|
||||
{
|
||||
arg = *argv;
|
||||
@ -49,40 +45,28 @@ main (int argc,
|
||||
{
|
||||
++arg;
|
||||
if (strcmp(arg, "version") == 0)
|
||||
{ return 0; }
|
||||
{ ERR(1, PROGN ": Version " VERSION_STRING); }
|
||||
else if (strcmp(arg, "help") == 0)
|
||||
{ goto help; }
|
||||
if (argc < 2)
|
||||
{ goto nop; }
|
||||
if (strcmp(arg, "db") == 0)
|
||||
{ db = argv[1]; }
|
||||
else if (strcmp(arg, "server") == 0)
|
||||
{ free(creds.server); creds.server = strdup(argv[1]); }
|
||||
else if (strcmp(arg, "port") == 0)
|
||||
{ creds.port = atoi(argv[1]); }
|
||||
else if (strcmp(arg, "url") == 0)
|
||||
{ parse_url(argv[1]); }
|
||||
/* else if (strcmp(arg, "server") == 0) */
|
||||
/* { free(creds.server); creds.server = strdup(argv[1]); } */
|
||||
/* else if (strcmp(arg, "port") == 0) */
|
||||
/* { creds.port = atoi(argv[1]); } */
|
||||
else if (strcmp(arg, "channel") == 0)
|
||||
{ free(creds.channel); creds.channel = strdup(argv[1]); }
|
||||
else if (strcmp(arg, "username") == 0)
|
||||
{ free(creds.username); creds.username = strdup(argv[1]); }
|
||||
else if (strcmp(arg, "password") == 0)
|
||||
{ free(creds.password); creds.password = strdup(argv[1]); }
|
||||
else if (strcmp(arg, "auth") == 0)
|
||||
/* else if (strcmp(arg, "username") == 0) */
|
||||
/* { free(creds.username); creds.username = strdup(argv[1]); } */
|
||||
/* else if (strcmp(arg, "password") == 0) */
|
||||
/* { free(creds.password); creds.password = strdup(argv[1]); } */
|
||||
else
|
||||
{
|
||||
authfile = argv[1];
|
||||
buf = slurp(authfile);
|
||||
if (!buf)
|
||||
{
|
||||
fprintf(stderr, "file: %s\n", authfile);
|
||||
PERROR(1);
|
||||
}
|
||||
if (parse_pair(buf, strlen(buf)))
|
||||
{
|
||||
free(buf);
|
||||
creds_free_rest();
|
||||
ERR(CREDS_ERROR, "Cannot parse creds");
|
||||
}
|
||||
free(buf);
|
||||
atexit(creds_free_rest);
|
||||
ERR(1,"Unknown command provided");
|
||||
}
|
||||
++argv; --argc;
|
||||
}
|
||||
@ -90,11 +74,11 @@ main (int argc,
|
||||
{ nop: ERRFMT(1, "Oprand without option '%s'", arg); }
|
||||
}
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
fprintf(stderr, "-- server:'%s:%d' channel:'%s' username:'%s' pass:%s --\n",
|
||||
creds.server, creds.port, creds.channel, creds.username,
|
||||
creds.password);
|
||||
#endif /* NDEBUG */
|
||||
atexit(creds_free);
|
||||
|
||||
fprintf(stderr, "Connecting to %s:%s@%s:%d\nChannel: %s\n",
|
||||
creds.username, creds.password,
|
||||
creds.server, creds.port, creds.channel);
|
||||
|
||||
if (init())
|
||||
{ return 1; }
|
||||
|
209
src/parse.c
209
src/parse.c
@ -16,38 +16,22 @@
|
||||
|
||||
#define PARAMS_COUNT 6
|
||||
|
||||
enum cred_names_map
|
||||
VARDECL creds_t creds =
|
||||
{
|
||||
DATABASE,
|
||||
USERNAME,
|
||||
PASSWORD,
|
||||
CHANNEL,
|
||||
SERVER,
|
||||
PORT
|
||||
.username = NULL,
|
||||
.password = NULL,
|
||||
.channel = NULL,
|
||||
.server = NULL, /* localhost? */
|
||||
#ifndef IRC_SSL_SUPPORT
|
||||
.port = 6667
|
||||
#else
|
||||
.port = 6669
|
||||
#endif /* IRC_SSL_SUPPORT */
|
||||
};
|
||||
|
||||
VARDECL char const * cred_names[] =
|
||||
{
|
||||
"database",
|
||||
"username",
|
||||
"password",
|
||||
"channel",
|
||||
"server",
|
||||
"port"
|
||||
};
|
||||
|
||||
VARDECL size_t const cred_names_len[] =
|
||||
{
|
||||
8,
|
||||
8,
|
||||
8,
|
||||
7,
|
||||
6,
|
||||
4,
|
||||
6
|
||||
};
|
||||
|
||||
VARDECL creds_t creds = {0};
|
||||
#if 0
|
||||
|
||||
DECL char **
|
||||
str_split(char const * s, char c)
|
||||
@ -110,30 +94,7 @@ split_clean(char ** split)
|
||||
free(split);
|
||||
}
|
||||
|
||||
DECL char *
|
||||
slurp(char const * fn)
|
||||
{
|
||||
size_t len;
|
||||
char * b;
|
||||
FILE * fp = fopen(fn, "r");
|
||||
if (fp)
|
||||
{
|
||||
fseek(fp, 0, SEEK_END);
|
||||
len = ftell(fp);
|
||||
rewind(fp);
|
||||
b = malloc(len+2);
|
||||
if (b)
|
||||
{
|
||||
fread(b, 1, len, fp);
|
||||
b[len+1] = '\0';
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
return b;
|
||||
}
|
||||
else
|
||||
{ return NULL; }
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
DECL void
|
||||
parse_command(char const * cmd)
|
||||
@ -149,32 +110,35 @@ parse_command(char const * cmd)
|
||||
if (cmd[i] == '\0')
|
||||
{
|
||||
/* no arguments */
|
||||
#ifndef NO_VULN_COMMANDS
|
||||
if (strcmp(cmd, "kill") == 0)
|
||||
{ exit(1); }
|
||||
#endif /* !NO_VULN_COMMANDS */
|
||||
if (strcmp(cmd, "remind") == 0)
|
||||
{
|
||||
msgswp = remind(current_username);
|
||||
ircmsg("%s: %s", current_username, msgswp);
|
||||
}
|
||||
/* XXX: maybe no? */
|
||||
/*else if (strcmp(cmd, "next") == 0) | TODO: implement */
|
||||
/* { ircmsg("%s: No future assignments", current_username); } */
|
||||
else if (strcmp(cmd, "help") == 0)
|
||||
{ ircmsg(help_msg); }
|
||||
else if (strcmp(cmd, "magic") == 0)
|
||||
{ stupid_shit = 8 + (rand() % 100); }
|
||||
{ ircmsg("%s: " IRC_YELLOW "%d" IRC_STOP, current_username, (rand() % 100) + 1); }
|
||||
else if (strcmp(cmd, "dump") == 0)
|
||||
{
|
||||
#ifndef NO_VULN_COMMANDS
|
||||
ircmsg("%s: All projects:", current_username);
|
||||
msgswp = dump();
|
||||
ircmsg(msgswp);
|
||||
#else
|
||||
ircmsg("%s: dump disabled", current_username);
|
||||
#endif /* !NO_VULN_COMMANDS */
|
||||
}
|
||||
else if (strcmp(cmd, "reroll") == 0)
|
||||
{
|
||||
ircmsg("%s: Rerolling...", current_username);
|
||||
/* ircmsg("%s: Rerolling...", current_username); */
|
||||
purge_assignments(current_username);
|
||||
random_assign(current_username);
|
||||
ircmsg(remind(current_username));
|
||||
ircmsg("%s: %s", current_username, remind(current_username));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -183,96 +147,77 @@ parse_command(char const * cmd)
|
||||
char const * const arg = cmd + i + 1;
|
||||
if (strncmp(cmd, "raw", i) == 0)
|
||||
{
|
||||
ircmsg("%s: Executing SQL `%s'.", current_username, arg);
|
||||
msgswp = raw(arg);
|
||||
ircmsg(msgswp);
|
||||
}
|
||||
else if (strncmp(cmd, "set_repo", i) == 0)
|
||||
#ifndef NO_VULN_COMMANDS
|
||||
/* ircmsg("%s: Executing SQL `%s'.", current_username, arg); */
|
||||
msgswp = raw(arg);
|
||||
ircmsg(msgswp);
|
||||
#else
|
||||
ircmsg("%s: raw disabled", current_username);
|
||||
#endif /* !NO_VULN_COMMANDS */
|
||||
}
|
||||
else if (strncmp(cmd, "repo", i) == 0)
|
||||
{
|
||||
ircmsg("%s: Setting project repository...", current_username);
|
||||
/* ircmsg("%s: Setting project repository...", current_username); */
|
||||
set_repo(creds.channel, arg);
|
||||
msgswp = remind(creds.channel);
|
||||
ircmsg("%s: %s", current_username, msgswp);
|
||||
}
|
||||
/* XXX: what is this suppose to do? */
|
||||
else if (strncmp(cmd, "submit", i) == 0) /* TODO: implement */
|
||||
{
|
||||
ircmsg("%s: Submitting project link '%s' to <random janny>",
|
||||
current_username, arg);
|
||||
}
|
||||
msgswp = remind(creds.channel);
|
||||
ircmsg("%s: %s", current_username, msgswp);
|
||||
}
|
||||
}
|
||||
free(msgswp);
|
||||
}
|
||||
|
||||
/* Parses the format username[:password]@server[:port] */
|
||||
|
||||
#define GENCOPY(dst,src,l) \
|
||||
do \
|
||||
{ \
|
||||
dst = malloc(sep + 1); \
|
||||
if (dst) \
|
||||
{ \
|
||||
strncpy(dst,src,l); \
|
||||
dst[len] = '\0'; \
|
||||
} \
|
||||
else \
|
||||
{ return 1; } \
|
||||
} while (0)
|
||||
|
||||
DECL int
|
||||
parse_pair(char const * buf, size_t len)
|
||||
parse_url(char const * url)
|
||||
{
|
||||
size_t i, f, x;
|
||||
/* fprintf(stderr, "ENT len:%ld buf:%sEOF\n", len, buf); */
|
||||
for (i = 0; buf[i] &&
|
||||
i < len; ++i)
|
||||
size_t len = strlen(url);
|
||||
size_t sep = 0, ls = 0, rs;
|
||||
while (++sep < len && url[sep] != '@');
|
||||
while (++ls < len && url[ls] != ':')
|
||||
{
|
||||
if (buf[i] == '=')
|
||||
{
|
||||
++i;
|
||||
for (f = 0, x = 0; f < PARAMS_COUNT; ++f)
|
||||
{
|
||||
/* fprintf(stderr, "x%ld, i%ld, %s\n", x, i, buf); */
|
||||
/* X macro for handling this data may be better */
|
||||
if (strncmp(buf, cred_names[f], cred_names_len[f]) == 0)
|
||||
{
|
||||
/* fprintf(stderr, "f%ld:len%ld:%s\n", f, cred_names_len[f], */
|
||||
/* cred_names[f]); fflush(stderr); */
|
||||
buf += i;
|
||||
while (buf[x] != '\0')
|
||||
{
|
||||
if (buf[x] == '\n')
|
||||
{
|
||||
len -= i; i = 0; break;
|
||||
}
|
||||
++x;
|
||||
}
|
||||
switch (f)
|
||||
{
|
||||
case DATABASE: db = strndup(buf,x); break;
|
||||
case USERNAME: creds.username = strndup(buf,x); break;
|
||||
case PASSWORD: creds.password = strndup(buf,x); break;
|
||||
case CHANNEL: creds.channel = strndup(buf,x); break;
|
||||
case SERVER: creds.server = strndup(buf,x); break;
|
||||
case PORT: creds.port = atoi(buf); break;
|
||||
}
|
||||
if (x + 2 < len)
|
||||
{ buf += x + 1; }
|
||||
else
|
||||
{ return 1; }
|
||||
goto next;
|
||||
}
|
||||
}
|
||||
}
|
||||
next:;
|
||||
if (ls >= sep)
|
||||
{ ls = 0; break; }
|
||||
}
|
||||
rs = sep;
|
||||
while (++rs < len && url[rs] != ':');
|
||||
if (rs == len)
|
||||
{ rs = 0; }
|
||||
GENCOPY(creds.username, url, ls ? ls : sep);
|
||||
if (ls)
|
||||
{
|
||||
GENCOPY(creds.password, url + ls + 1, sep - ls - 1);
|
||||
}
|
||||
if (rs)
|
||||
{
|
||||
GENCOPY(creds.server, url + sep + 1, rs - sep - 1);
|
||||
creds.port = atoi(url + rs + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
GENCOPY(creds.server, url + sep + 1, len - sep - 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECL int
|
||||
is_admin(char const * user)
|
||||
{
|
||||
/* No Gods or Kings, Only size_t */
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
creds_free_password(void)
|
||||
{
|
||||
FULL_FREE(creds.password);
|
||||
}
|
||||
|
||||
void
|
||||
creds_free_rest(void)
|
||||
DECL void
|
||||
creds_free(void)
|
||||
{
|
||||
FULL_FREE(creds.username);
|
||||
/* FULL_FREE(creds.password); */
|
||||
FULL_FREE(creds.password);
|
||||
FULL_FREE(creds.channel);
|
||||
FULL_FREE(creds.server);
|
||||
FREE(creds.admins);
|
||||
}
|
||||
|
Reference in New Issue
Block a user