Skip to content

Commit 0a6cec8

Browse files
committed
Initial commit
0 parents  commit 0a6cec8

File tree

5 files changed

+16835
-0
lines changed

5 files changed

+16835
-0
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# CS latencies
2+
3+
Scripts to measure the latency to several Counter-Strike 1.6 servers.

cs-latency.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
mapfile -t server_ips < output.txt
4+
#server_ips=( '80.72.41.211' '185.113.141.45' '147.135.199.82' )
5+
6+
hops=30
7+
8+
for server_ip in "${server_ips[@]}"; do
9+
latency=$(traceroute -n -f $hops -m $hops -q 10 -w 0.4 "$server_ip" | grep -oP "(?<=$hops $server_ip ).*" | grep -Eo '[0-9]+\.[0-9]+' | python -c '
10+
import sys
11+
12+
nums=[float(l) for l in sys.stdin]
13+
14+
if nums:
15+
print(sum(nums) / len(nums))
16+
else:
17+
1000000
18+
')
19+
latency=${latency:-1000000}
20+
echo $server_ip $latency
21+
done

myspider.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import scrapy
2+
3+
class BlogSpider(scrapy.Spider):
4+
name = 'gametracker'
5+
start_urls = [f'https://www.gametracker.com/search/cs/?&searchipp=50&searchpge={page}#search' for page in range(1, 221)]
6+
7+
def parse(self, response):
8+
for ip_class in response.css('.ip'):
9+
yield {"ip": ip_class.css('::text').get()} # .text().split(":")[0]

0 commit comments

Comments
 (0)