1
0
Fork 0

Add section "background"

master
Ambrose Chua 2018-03-21 21:59:15 +08:00
parent fe884c5152
commit 897f297de8
8 changed files with 168 additions and 13 deletions

3
.gitignore vendored
View File

@ -1 +1,4 @@
**/.DS_Store
scan*.bin
scan*.json

View File

@ -23,10 +23,36 @@ masscan -c scan.conf
This produces the output file `scan.bin`.
## Counting latency
I need to reduce the data for the five ports per host into a single latency reading for each host.
But first, I had to convert the scan binary into JSON:
```
masscan --readscan scan.bin -oJ scan.json
go run latency.go -in scan.json -out latency.json
```
## Categorising readings by country
To associate an IP address with a country, a geolocation lookup database must be used. I used two sources of geolocation databases; Maxmind's GeoLite2, and Webnet77's IPToCountry; to test the accuracy of either database.
```
Next, I wrote and used a Go script to group the scans by country:
```
go run country.go -in latency.json -db geolite -out country.json
```
## Plotting the latency from Singapore by country
> Not implemented
I will start with a simple plot of latency to every country from Singapore.
```
go run json2csv.go -in country.json -out country.csv
```
##

9
compare.go Normal file
View File

@ -0,0 +1,9 @@
package main
import (
"log"
)
func main() {
log.Print("comp")
}

10
country.go Normal file
View File

@ -0,0 +1,10 @@
package main
import (
"log"
"os"
)
func main() {
log.Print(os.Args[1])
}

9
json2csv.go Normal file
View File

@ -0,0 +1,9 @@
package main
import (
"log"
)
func main() {
log.Print("comp")
}

9
latency.go Normal file
View File

@ -0,0 +1,9 @@
package main
import (
"log"
)
func main() {
log.Print("comp")
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 KiB

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@ -247,17 +247,17 @@
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="0.24748737"
inkscape:cx="1167.064"
inkscape:cy="2972.0832"
inkscape:zoom="0.64"
inkscape:cx="1853.3374"
inkscape:cy="3388.8728"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1440"
inkscape:window-height="856"
inkscape:window-x="0"
inkscape:window-width="1432"
inkscape:window-height="855"
inkscape:window-x="4"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:window-maximized="0"
showguides="true"
inkscape:guide-bbox="true">
<sodipodi:guide
@ -333,7 +333,7 @@
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:120.00000763px;line-height:120.00000477%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI Bold';text-align:start;text-anchor:start;fill:url(#linearGradient4208);fill-opacity:1">A quick analysis of Internet latency from Singapore to the rest of the world</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot4214"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:100%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:100%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
transform="translate(0,-3160.6301)"><flowRegion
id="flowRegion4216"><rect
id="rect4218"
@ -341,9 +341,85 @@
height="3359.6287"
x="148.81891"
y="630.13507"
style="text-anchor:start;text-align:start;" /></flowRegion><flowPara
id="flowPara4220"
style="-inkscape-font-specification:'Inter UI';font-family:'Inter UI';font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:50.00000447px;text-anchor:start;text-align:start">Lorem ipsum</flowPara></flowRoot> <g
style="text-align:start;text-anchor:start" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6548">Latency is a crucial metric to measure network performance, especially in real-time systems. On the Internet, latency can affect user experience as pages and assets only start loading after one round-trip. With latency data, we can better understand the physical aspects of the Internet, make better decisions on server locations, and gamers can choose a better server closer to Singapore.</flowPara><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6566" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6576">To measure latency, I scanned the entire Internet with the tool &quot;masscan&quot;. More details can be found at <flowSpan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:Monaco;-inkscape-font-specification:Monaco;fill:#800066"
id="flowSpan6574">https://github.com/serverwentdown/sgp-internet-ping</flowSpan>, together with the data collected.</flowPara><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6588" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6590">A good overview of the data is the following chart of the top 5 countries with the lowest latency:</flowPara><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6592" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6594" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6596" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6598" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6600" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6602" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6604" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6606" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6608" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6610" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6612" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6614" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6616" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6618">From that data, we can perform a 2-sample t-test on the latency data to USA and the UK. </flowPara><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6620" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6626" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6632" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6634" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6636" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6638" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6640" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6642" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6644" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6646" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6648" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6656" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6664" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6666" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6668" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6670" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6674" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6676" /><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
id="flowPara6672">We can generalise this to any two countries, by applying the same 2-sample t-test to the data. </flowPara></flowRoot> <g
id="g4422"
transform="matrix(4.8345795,0,0,4.8345795,-10978.401,-3987.9826)">
<path
@ -416,5 +492,18 @@
id="path4322"
inkscape:connector-curvature="0" />
</g>
</g>
<flowRoot
transform="translate(1379.7141,-3160.6301)"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:100%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="flowRoot6678"
xml:space="preserve"><flowRegion
id="flowRegion6680"><rect
style="text-align:start;text-anchor:start"
y="630.13507"
x="148.81891"
height="3359.6287"
width="1302.6096"
id="rect6682" /></flowRegion><flowPara
id="flowPara6760"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start">Lorem ipsum</flowPara></flowRoot> </g>
</svg>

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 32 KiB