Currently we have some license issues. We are working on it.

Commit 80790127 authored by zauberstuhl's avatar zauberstuhl
Browse files

Move to nmap netcat and accept all connections

parent 2f36cf5a
Dummy Project
-------------
# Dummy Project
Related to [feneas.git.feneas.org/federation/testsuite](https://feneas.git.feneas.org/federation/testsuite/#testsuite)
## Dependencies
* postgresql-client
* nmap
* curl
* inotify-tools
......@@ -17,10 +17,14 @@ psqlCount="$psql -q -c 'select count(*) from testtable;'"
# create db schema
$psql -c 'create table if not exists testtable(id serial primary key);' || exit 1
while true; do
cnt=$(eval $psqlCount |head -3 |tail -n 1 |tr -d '[:space:]')
req=$(echo -e "HTTP/1.1 200 OK\n\n$cnt" |nc -l -p $PORT -q1)
remote=$(echo "$req" |grep GET |cut -d' ' -f2 |cut -d@ -f2)
tmplog=$(mktemp)
# listen and serve
ncat -l $PORT -o $tmplog -k -c 'echo -e "HTTP/1.1 200 OK\n\n$('\
'eval $psqlCount |head -3 |tail -n 1 |tr -d \"[:space:]\")"' &
while inotifywait -qq -e close_write $tmplog; do
req=$(grep GET $tmplog |tail -1)
remote=$(echo $req |cut -d' ' -f2 |cut -d@ -f2)
if [[ $req =~ '/add' ]]; then
if [[ "$remote" == "/add" ]]; then
eval $psqlAdd
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment