summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--atom.xml14
-rw-r--r--log-211006-1.gmi19
-rwxr-xr-xtak16
3 files changed, 27 insertions, 22 deletions
diff --git a/atom.xml b/atom.xml
index 950589b..50671c3 100644
--- a/atom.xml
+++ b/atom.xml
@@ -2,7 +2,7 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<id>gemini://l-3.space/</id>
<title>l-3.space</title>
- <updated>2021-10-06T03:03:30.476000+00:00</updated>
+ <updated>2021-10-06T13:16:38.103000+00:00</updated>
<author>
<name>tslil</name>
<email>hello@l-3.space</email>
@@ -10,12 +10,6 @@
<link href="gemini://l-3.space/atom.xml" rel="self"/>
<link href="gemini://l-3.space/" rel="alternate"/>
<entry>
- <id>gemini://l-3.space/log-201116-1.gmi</id>
- <title>Plausible authorship deniability</title>
- <updated>2020-11-16T15:55:26.889000+00:00</updated>
- <link href="gemini://l-3.space/log-201116-1.gmi" rel="alternate"/>
- </entry>
- <entry>
<id>gemini://l-3.space/log-201204-1.gmi</id>
<title>Experiencing a classic for the first time: DOOM (1993)</title>
<updated>2020-12-04T17:35:50.643000+00:00</updated>
@@ -69,4 +63,10 @@
<updated>2021-10-06T03:03:30.476000+00:00</updated>
<link href="gemini://l-3.space/log-211004-1.gmi" rel="alternate"/>
</entry>
+ <entry>
+ <id>gemini://l-3.space/log-211006-1.gmi</id>
+ <title>Play Tak against a bot over Gemini!</title>
+ <updated>2021-10-06T13:16:38.103000+00:00</updated>
+ <link href="gemini://l-3.space/log-211006-1.gmi" rel="alternate"/>
+ </entry>
</feed>
diff --git a/log-211006-1.gmi b/log-211006-1.gmi
index 5849d6f..81daed1 100644
--- a/log-211006-1.gmi
+++ b/log-211006-1.gmi
@@ -1,4 +1,4 @@
-Time-stamp: <2021-10-06 02h58 UTC>
+Time-stamp: <2021-10-06 13h16 UTC>
# Play Tak against a bot over Gemini!
@@ -6,30 +6,33 @@ The title says it all! I had all the pieces lying about and so finally decided t
=> gemini://l-3.space/tak.gmi The Tak portal
-At present i've attempted to limit the server to running 10 instances of the bot at once, but i'm not sure that that will work correctly. I'm also not sure i've defeated shell escapes here---please let me know⁰ how to improve on this! Here's the entire CGI script, all 24 lines of it.
+At present i've attempted to limit the server to running 10 instances of the bot at once, but i'm not sure that that will work correctly. I'm also not sure i've defeated shell escapes here---please let me know⁰ how to improve on this! Here's the entire CGI script, all 27 lines of it.
```CGI script for Tak
#!/bin/bash
META="text/gemini; charset=utf-8"
-input="${QUERY_STRING//[^abcde12345CFW]/}"
+input="${QUERY_STRING//[^abcde12345CFW+\-><]/}"
if [ -n "$input" ]; then
- new_ptn="${PATH_INFO//[^abcde12345CFW.]/}"
+ new_ptn="${PATH_INFO//[^abcde12345CFW.+\-LR]/}"
+ new_ptn="$(echo ${new_ptn} | tr 'LR' '<>')"
printf '20 %s\r\n' "$META"
printf '```\n'
while [ "$(pgrep geminict | wc -l)" > "10" ]; do
- sleep 0.25s;
+ sleep 0.5s;
done
- output="$(geminict "$new_ptn$input.")"
+ attempt_ptn="$new_ptn$input."
+ output=$(geminict ${attempt_ptn@Q})
if [ "$?" == "0" ]; then
ct1986=$(echo "$output" | awk '/ct1986 says:/ {print $3}')
- new_ptn="$new_ptn$input.$ct1986."
+ new_ptn="$attempt_ptn$ct1986."
fi;
+ new_ptn=${new_ptn//>/R}; new_ptn=${new_ptn//</L};
printf '%s\n' "$output"
printf '```\n'
echo 'Please be patient, ct1986 is a slow bot and no more than 10 instances are allowed concurrently on the server.'
echo "=> gemini://l-3.space/tak/$new_ptn/ Enter ply"
- echo 'Note: all input is stripped to match only [abcde12345CFW].'
+ echo 'Note: all input is stripped to match only [abcde12345CFW+-<>].'
else
printf "10 Enter ply:\r\n"
fi;
diff --git a/tak b/tak
index 62ff252..9121cdb 100755
--- a/tak
+++ b/tak
@@ -1,24 +1,26 @@
#!/bin/bash
META="text/gemini; charset=utf-8"
-input="${QUERY_STRING//[^abcde12345CFW]/}"
+input="${QUERY_STRING//[^abcde12345CFW+-><]/}"
if [ -n "$input" ]; then
- new_ptn="${PATH_INFO//[^abcde12345CFW.]/}"
+ new_ptn="${PATH_INFO//[^abcde12345CFW.+-LR]/}"
+ new_ptn=$(echo ${new_ptn@Q} | tr 'LR' '<>')
printf '20 %s\r\n' "$META"
printf '```\n'
while [ "$(pgrep geminict | wc -l)" > "10" ]; do
- sleep 0.25s;
+ sleep 0.5s;
done
- output="$(geminict "$new_ptn$input.")"
+ attempt_ptn="$new_ptn$input."
+ output=$(geminict ${attempt_ptn@Q})
if [ "$?" == "0" ]; then
ct1986=$(echo "$output" | awk '/ct1986 says:/ {print $3}')
- new_ptn="$new_ptn$input.$ct1986."
+ new_ptn="$attempt_ptn.$ct1986."
fi;
printf '%s\n' "$output"
printf '```\n'
echo 'Please be patient, ct1986 is a slow bot and no more than 10 instances are allowed concurrently on the server.'
- echo "=> gemini://l-3.space/tak/$new_ptn/ Enter ply"
- echo 'Note: all input is stripped to match only [abcde12345CFW].'
+ echo "=> gemini://l-3.space/tak/$(echo ${new_ptn@Q} | tr '<>' 'LR')/ Enter ply"
+ echo 'Note: all input is stripped to match only [abcde12345CFW+-<>].'
else
printf "10 Enter ply:\r\n"
fi;