Phase 1

Here’s the info we found from Professor Varghese’s notepad:

NETSIFT CONFIDENTIAL

[email protected]

varghese

netsift 2005

From this, we can deduce that we need to connect to [email protected] with password varghese. The next step is to connect to host netsift port 2005.

# Get the IP address of netsift
$ dig netsift

# Solve phase
$ ./socket
> socket
> connect 3 10.0.124.247 2005
> send 3 GET /
> recv 3 2000
> close 3
> ^D

We get our response:

HTTP/1.0 200 OK
Content-Type: text/plain

NETSIFT INTERNAL DOCS
<REDACTED>
DATA LINK PROTOCOLS DISCUSSION:
FRAMING:
PAGE 20 OF LECTURE NOTES BIT STUFFING
<REDACTED>

Hint: Check Tuesday's lecture notes on Bit Stuffing (page 20). 
The next host you should connect to is a protocol that's 4 characters long.
The port is the year that this protocol was created. (Check Wikipedia.)

Phase 2

From the response, we know to check BruinLearn and Tuesday's lecture slides on Bit Stuffing. Check page 20. We see that the only 4 letter protocol is HDLC, and it was created in 1979—so, our host is hdlc and port is 1979.

$ dig hdlc

$ ./socket
> socket
> connect 3 10.0.78.200 1979
> send 3 GET /
> recv 3 2000
> ^D

We get our response:

HTTP/1.0 404 Not Found
Content-Type: text/plain

NETSIFT INTERVIEW PROBLEM (CONFIDENTIAL):
Here's a sequence of bits from a (modified) HDLC connection (beginning/end stripped):
00110011 001101110 00110011 001110000

From left to right, these bits form an ASCII string.

HDLC uses bit stuffing with a sentinel pattern 011110.
Any time it sees a sequence of 3 1s in a row, it inserts a 0.
Your job is to "unstuff" these bits.

Hint: If the answer is 2467, send GET /2467

Unfortunately, this is not as easy as phase 1—we have a problem to solve.

Solving the Problem

We know that anytime there’s a sequence of 3 1s, we should remove a 0. In our sequence of bits, we see that there are 2 triplets of 1s:

00110011 00110***111***0 00110011 00***111***0000

We can now remove the 0 right after:

00110011 00110***111*** 00110011 00***111***000

Converting to decimal, we get: