Input sanitizing; Heartbeat integration

This commit is contained in:
DarkFeather 2017-02-08 19:26:13 -06:00
parent 327d9d33ee
commit b78da4c77c
2 changed files with 12 additions and 10 deletions

View File

@ -1,8 +1,12 @@
CONFDIR = /usr/local/etc/TheRaven
INSTALLER != bash -c `curl -s https://aninix.net/foundation/installer-test.bash`
compile: clean /usr/bin/mcs /usr/bin/mono clean /bin/bash /usr/bin/mail /usr/bin/wget /usr/local/bin/djinni ./chatbot-support.bash
compile: clean ./chatbot-support.bash ./math-support.bash
if [ ! -x /usr/bin/mcs ] || [ ! -x /usr/bin/mono ] || [ ! -x /usr/bin/lynx ] || [ ! -x /usr/bin/bash ] || [ ! -x /usr/bin/wget ]; then ${INSTALLER} mono wget lynx bash; fi
# Hook to use Djinni for notification
if [ ! -d ../Djinni ]; then git clone -C '..' https://aninix.net/foundation/Djinni; fi
git -C ../Djinni pull
cd /usr/local/src/Djinni; make install
if [ ! -d ../SharedLibraries ]; then git clone -C '..' https://aninix.net/foundation/SharedLibraries; fi
git -C ../SharedLibraries pull
mcs -out:raven.mono ../SharedLibraries/CSharp/*.csharp *.csharp Raven.csharp
@ -10,20 +14,18 @@ compile: clean /usr/bin/mcs /usr/bin/mono clean /bin/bash /usr/bin/mail /usr/bin
clean:
for i in raven.mono; do if [ -f $$i ]; then rm $$i; fi; done
edit:
emacs -nw raven.csharp
test: compile
script -c "mono ./raven.mono -c raven-test.conf -v" /tmp/raven-test.log
check-for-verbosity:
grep Console.WriteLine *.csharp | egrep -v 'verbosity|raven.csharp'; echo
install: compile
cp raven.mono /opt/raven.mono
if [ ! -d ${CONFDIR} ]; then (mkdir -p /usr/local/etc/TheRaven; cp ./sample-conf/* ${CONFDIR}); fi
if [ ! -d ${CONFDIR} ]; then mkdir -p /usr/local/etc/TheRaven; cp ./sample-conf/* ${CONFDIR}; fi
# Hook to deprivilege bot
if ! getent passwd raven; then useradd -M -G git,ircd,api -d ${CONFDIR} raven; fi
make checkperm
# Hook for Heartbeat
if [ -f /usr/local/etc/Heartbeat/services.list ] && [ `grep -c TheRaven /usr/local/etc/Heartbeat/services.list` -eq 0 ]; then echo "" >> /usr/local/etc/Heartbeat/services.list; fi
# Hook for Systemd
cp ./raven.service /usr/lib/systemd/system/raven.service
systemctl daemon-reload
systemctl enable raven

View File

@ -70,7 +70,7 @@ namespace AniNIX.TheRaven {
send.PrivMsg(theRaven.helpText,incoming.user);
} else {
try {
send.PrivMsg(ExecuteCommand.Run(String.Format("wget -q -O - \"http://tiny-url.info/api/v1/create?format=text&apikey=\"$(api-keys tinyurl)\"&provider=x_co&url={0}\"",bySpace[1])),(incoming.target.Equals(theRaven.Nick))?incoming.user:incoming.target);
send.PrivMsg(ExecuteCommand.Run(String.Format("wget -q -O - \"http://tiny-url.info/api/v1/create?format=text&apikey=\"$(api-keys tinyurl)\"&provider=tinyurl_com&url={0}\"",bySpace[1].Replace("\"",""))),(incoming.target.Equals(theRaven.Nick))?incoming.user:incoming.target);
} catch (Exception e) {
ReportMessage.Log(Verbosity.Error,e.ToString());
send.PrivMsg("TinyURL error. Could not get link.",(incoming.target.Equals(theRaven.Nick))?incoming.user:incoming.target);
@ -82,7 +82,7 @@ namespace AniNIX.TheRaven {
if (bySpace.Length < 2) {
} else {
send.PrivMsg(ExecuteCommand.Run(String.Format("/bin/bash /usr/local/src/TheRaven/math-support.bash \"{0}\"",incoming.message.Replace("r.math ","").Replace("'",""))),(incoming.target.Equals(theRaven.Nick))?incoming.user:incoming.target);
send.PrivMsg(ExecuteCommand.Run(String.Format("/bin/bash /usr/local/src/TheRaven/math-support.bash \"{0}\"",incoming.message.Replace("r.math ","").Replace("'","").Replace("\"",""))),(incoming.target.Equals(theRaven.Nick))?incoming.user:incoming.target);
}
connection.Write(send);
return;