Created
November 23, 2010 01:45
-
-
Save khafatech/711095 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment