Skip to content

Instantly share code, notes, and snippets.

@gogocurtis
Last active May 24, 2018 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gogocurtis/ac9039af9b61cd8bff14aff0caf5342d to your computer and use it in GitHub Desktop.
Save gogocurtis/ac9039af9b61cd8bff14aff0caf5342d to your computer and use it in GitHub Desktop.
High Level Reference:
https://en.wikipedia.org/wiki/Ident_protocol
For Lols:
http://www.clock.org/~fair/opinion/identd.html ( about how useless this protocol is)
Ident-D is an old protocol that runs on TCP port 113 traditionally - It’s hilariously easy to spoof.
This assignment creates a IDENTD (TCP) Plaintext Server for the IDENTD protocol that implements a spoof on the protocol.
Feel free to choose any language. Ruby*[1], Go, Rust, Clojure, Python, Java, Etc
*[1] Ruby api reference (bottom of file)
We are going to write a IDENTD spoofing server.
Part 1 Essentially:
Listen on port 10113.
Read input format
__REMOTE_PORT__, __LOCAL_PORT__
Example:
6999, 23
Write back to socket in output format
__REMOTE_PORT__, __LOCAL_PORT__ : USERID : UNIX : yourname
Return "no" on invalid input
Example:
test:
echo -n "6999, 23" | nc localhost 10113
result:
6999, 23 : USERID : UNIX : curtis
test:
echo -n "" | nc localhost 10113
result:
no
test:
echo -n "1234" | nc localhost 10113
result:
no
test:
echo -n "1234," | nc localhost 10113
result:
no
Part 2 (Docker)
Create a Dockerfile and run with appropriate port mapping such that the following returns right details:
test:
echo -n "6999, 23" | nc localhost 113
result:
6999, 23 : USERID : UNIX : yourname
Part 3
Read in configuration (json or yaml or anything you like)
Example (YAML):
---
23 : johnb
1236 : stacyw
-- Testing With Above Config
test:
echo -n "6999, 23" | nc localhost 113
result:
6999, 23 : USERID : UNIX : johnb
test:
echo -n "6999, 1236" | nc localhost 113
result:
6999, 1236 : USERID : UNIX : stacyw
test:
echo -n "6999, 9999" | nc localhost 113
result:
6999, 9999 : USERID : ERROR : NO-USER
As before invalid input should respond with "no"
test:
echo -n "hi" | nc localhost 113
result:
no
Part 4 (optional)
Extensions
Adds config to Docker
Part 5 (optional)
Instead of adding config to docker
mount volume with config.
Changing values in config should change docker at runtime.
Discussion Points:
Ephemerality (12 Factor)
Running Databases in dockers?
( Tradeoffs, support requirements, OS Disk, Vs Hypervisor Disk, Vs VM disk, Network disk vs Local Disk, Network Cluster vs Disk Log )
Reference Ruby*[1]
---
If one uses ruby based approach these can help with 90% of the work.
https://ruby-doc.org/stdlib-2.3.0/libdoc/socket/rdoc/TCPServer.html
https://ruby-doc.org/core-2.3.1/IO.html
http://ruby-doc.org/stdlib-2.5.0/libdoc/yaml/rdoc/YAML.html
http://ruby-doc.org/stdlib-1.8.6/libdoc/yaml/rdoc/YAML.html ( this actually has yaml docs )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment