How to Telnet. *Old School

So lets say that you want to get a 200 request from a website such as: Sports.yahoo.com. How would you go about accomplishing that? What about Sports.Yahoo.com/NFL

The structure of the telnet request is:

telnet urlthatyouwanttoaccess.com portnumber (press enter)

GET (space) HTTP/1.1

host: urlthatyouwanttoaccess.com

  • telnet is the command, this is separated by a single space.
  • Then the URL of the site that you are making the telnet request to.
  • Followed by the port number, in most cases a website would be port 80.
  • Once you press Enter, you will put the request type.
  • In this instance GET (note the caps) then the request protocol HTTP/1.0 or 1.1. Then press Enter.
  • To finish the request type | host: URLyouwanttoaccess.com and select Enter.

NOTE: If you want to output the request into a text file, you can use: telnet urlthatyouwanttoaccess.com 80 > telnetoutput.txt | This will place the output of the request into a text file in the current directory.

 

 

Advertisements
How to Telnet. *Old School

List grouped and sorted by count unique IPs (BASH)

There are two possible solutions to this. My attempt was as follows.

cat ./listofip |awk ‘{print $1}|sort|uniq -c|sort -n|more

This rendered an adequate result, but my output was in reverse order and still contained ports.

      1 10.0.2.31:11999
      1 127.0.0.1:32000
      1 127.0.0.1:47016
      1 127.0.0.1:47642
      1 127.0.0.1:47644
      1 127.0.0.1:47662
      1 127.0.0.1:47664
      1 127.0.0.1:47666
      1 127.0.0.1:47710
      1 127.0.0.1:47716
      1 127.0.0.1:47768
      1 127.0.0.1:47779
      1 127.0.0.1:49418
      1 ::ffff:10.0.2.18:61617
      1 ::ffff:10.0.2.19:52039
      1 ::ffff:10.0.2.27:35840
      1 ::ffff:10.0.3.19:35024
      1 ::ffff:10.0.3.22:51753
      1 ::ffff:10.0.3.25:55746
      1 ::ffff:10.0.3.25:56089
      1 ::ffff:10.0.3.28:51756
      1 ::ffff:10.0.4.26:45995
      1 ::ffff:127.0.0.1:3306
      1 ::ffff:127.0.0.1:42719
      1 ::ffff:52.0.22.114:55340
      2 127.0.0.1:8009
      8 10.0.2.31:3306
My second attempt was:
cat ./listofip | awk ‘ $0 ~ /^(::ffff:|[0-9|])/ { gsub(“::ffff:”,””,$0); print $0}’ | cut -d: -f1 | sort | uniq -c | sort -nr
This returned the result of:
    16 127.0.0.1
      9 10.0.2.31
      2 10.0.3.25
      1 52.0.22.114
      1 10.0.4.26
      1 10.0.3.28
      1 10.0.3.22
      1 10.0.3.19
      1 10.0.2.27
      1 10.0.2.19
      1 10.0.2.18
However, I could have written this in a shorter way.
awk -F: ‘{print $(NF-1)}’ /tmp/foo | sort | uniq -c | sort -rn
Which would have returned the same result, but required less functions.
List grouped and sorted by count unique IPs (BASH)