Skip to content

Instantly share code, notes, and snippets.

@khafatech
Created November 23, 2010 01:45
Show Gist options
  • Select an option

  • Save khafatech/711095 to your computer and use it in GitHub Desktop.

Select an option

Save khafatech/711095 to your computer and use it in GitHub Desktop.
#!/bin/bash
# The "Arc" challenge done in a horrible way with netcat and bash. :P
# http://arclanguage.org/item?id=722
#
# Point the browser to http://localhost:9000 after running the script.
http200="HTTP/1.0 200 OK
Content-Type: text/html
"
# output submit page
echo "$http200
<form><input type=text name=foo><input type=submit>" | nc -l 9000
# output "click here" and get response
foo=$(echo "$http200
<a href=\"\">click here</a>" | nc -l 9000 | grep -oe "?foo=\(.*\)HTTP" | sed -ne 's/\(^?foo=\|HTTP$\)//gp' | sed -e 's/+/ /g')
echo "$http200
You said: $foo" | nc -l 9000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment