Skip to content

Commit a0d4c87

Browse files
committed
conflict fixed
2 parents 90b986d + c513474 commit a0d4c87

File tree

3 files changed

+139
-1
lines changed

3 files changed

+139
-1
lines changed

Generate.py

+73-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/usr/bin/python
22
# -*- coding: UTF-8 -*-
3+
<<<<<<< HEAD
4+
=======
5+
import urllib
6+
import urllib2
7+
>>>>>>> dev
38

49
def change_to_list(filename):
510
content = open(filename,"r").read().strip()
@@ -17,16 +22,47 @@ def traceroute_to_dict(filename):
1722
line = content[i]
1823
if line[1].isdigit():
1924
if line[4] != "*" :
20-
latency=line.strip().split(" ")[2]
25+
<<<<<<< HEAD
26+
ip = line.strip().split(" ")[1]
2127
asn = line.strip().split(" ")[3]
28+
iptest = ip.strip().split(" ")[0]
29+
url = "http://ip-api.com/csv/" + iptest
30+
req = urllib2.Request(url)
31+
res_data = urllib2.urlopen(req)
32+
res = res_data.read()
33+
if res.strip().split(",")[0] == "success" :
34+
isp=res.strip().split(",")[11]
35+
asn=res.strip().split(",")[12]
36+
else:
37+
isp= "*"
38+
latency=line.strip().split(" ")[2]
2239
route = line.strip().split(" ")[4]
40+
=======
2341
ip = line.strip().split(" ")[1]
42+
asn = line.strip().split(" ")[3]
43+
iptest = ip.strip().split(" ")[0]
44+
url = "http://ip-api.com/csv/" + iptest
45+
req = urllib2.Request(url)
46+
res_data = urllib2.urlopen(req)
47+
res = res_data.read()
48+
if res.strip().split(",")[0] == "success" :
49+
isp=res.strip().split(",")[11]
50+
asn=res.strip().split(",")[12]
51+
else:
52+
isp= "*"
53+
latency=line.strip().split(" ")[2]
54+
route = line.strip().split(" ")[4]
55+
>>>>>>> dev
2456
step = line[0:2]
2557
else:
2658
latency="*"
2759
asn = "*"
2860
route = "*"
2961
ip = "*"
62+
<<<<<<< HEAD
63+
=======
64+
isp= "*"
65+
>>>>>>> dev
3066
step = line[0:2]
3167

3268
d[int(step)]=dict()
@@ -36,7 +72,11 @@ def traceroute_to_dict(filename):
3672
d[int(step)]["latency"]=latency
3773
d[int(step)]["asn"]=asn
3874
d[int(step)]["route"]=route
75+
<<<<<<< HEAD
3976

77+
=======
78+
d[int(step)]["isp"]=isp
79+
>>>>>>> dev
4080

4181
return dict(d)
4282

@@ -52,9 +92,16 @@ def traceroute_to_table(filename):
5292
<td>{}</td>
5393
<td>{}</td>
5494
<td>{}</td>
95+
<<<<<<< HEAD
5596
</tr>
5697
"""
5798
string = string + template.format(i,x["ip"],x["route"],x["asn"],x["latency"]) + "\n"
99+
=======
100+
<td>{}</td>
101+
</tr>
102+
"""
103+
string = string + template.format(i,x["ip"],x["route"],x["isp"],x["asn"],x["latency"]) + "\n"
104+
>>>>>>> dev
58105
59106
writefile = open(filename + "_table","w")
60107
writefile.write(string)
@@ -75,6 +122,10 @@ def dict_to_table(d,tab):
75122
<tr><th>跳数</th>
76123
<th>IP</th>
77124
<th>路由</th>
125+
<<<<<<< HEAD
126+
=======
127+
<th>ISP</th>
128+
>>>>>>> dev
78129
<th>AS Number</th>
79130
<th>延迟</th>
80131
</tr></thead>
@@ -90,9 +141,16 @@ def dict_to_table(d,tab):
90141
<td>{2}</td>
91142
<td>{3}</td>
92143
<td>{4}</td>
144+
<<<<<<< HEAD
93145
</tr>
94146

95147
""".format(step,d[step]["ip"],d[step]["route"],d[step]["asn"],d[step]["latency"])
148+
=======
149+
<td>{5}</td>
150+
</tr>
151+
152+
""".format(step,d[step]["ip"],d[step]["route"],d[step]["isp"],d[step]["asn"],d[step]["latency"])
153+
>>>>>>> dev
96154

97155
table_html = table_html + """
98156
</tbody>
@@ -479,6 +537,10 @@ def dict_to_table(d,tab):
479537
<a class="item" data-tab="fourth">广东移动</a>
480538
<a class="item" data-tab="fifth">广东电信</a>
481539
<a class="item" data-tab="sixth">广东联通</a>
540+
<<<<<<< HEAD
541+
=======
542+
<a class="item" data-tab="seventh">所在地IP</a>
543+
>>>>>>> dev
482544
</div>
483545
484546
"""
@@ -627,6 +689,12 @@ def dict_to_table(d,tab):
627689
traceroute_to_table("/tmp/gdu.txt")
628690
gdu_html = dict_to_table(gdu,"sixth")
629691

692+
<<<<<<< HEAD
693+
=======
694+
own = traceroute_to_dict("/tmp/own.txt")
695+
traceroute_to_table("/tmp/own.txt")
696+
own_html = dict_to_table(own,"seventh")
697+
>>>>>>> dev
630698

631699
html = html.format(info[0],info[1],info[2],info[3],info[4],info[5],info[6],info[7],info[8],info[9],info[10],info[11],info[12],info[13],info[14], \
632700

@@ -640,7 +708,11 @@ def dict_to_table(d,tab):
640708

641709
speed_cn[18],speed_cn[19],speed_cn[20],speed_cn[21],speed_cn[22],speed_cn[23])
642710

711+
<<<<<<< HEAD
643712
html = html + shm_html + sht_html + shu_html + gdm_html + gdt_html + gdu_html + footer
713+
=======
714+
html = html + shm_html + sht_html + shu_html + gdm_html + gdt_html + gdu_html + own_html + footer
715+
>>>>>>> dev
644716

645717
web = open("/root/report.html","w")
646718

ZBench-CN.sh

+33
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,30 @@ if [ ! -e '/usr/bin/wget' ]; then
88
fi
99
read -p "请输入你的服务器提供商: " Provider
1010

11+
<<<<<<< HEAD
12+
=======
13+
# Get IP
14+
OwnerIP=$(who am i | awk '{print $NF}' | sed -e 's/[()]//g')
15+
while :; do echo
16+
read -p "请确认你所在地的IP:${OwnerIP} [y/n]: " ifOwnerIP
17+
if [[ ! ${ifOwnerIP} =~ ^[y,n]$ ]]; then
18+
echo "输入错误! 请确保你输入的是 'y' 或者 'n'"
19+
else
20+
break
21+
fi
22+
done
23+
if [[ ${ifOwnerIP} == "n" ]]; then
24+
while :; do echo
25+
read -p "请输入你所在地的IP: " OwnerIP
26+
if [[ ! ${OwnerIP} ]]; then
27+
echo "输入错误!IP地址不能为空!"
28+
else
29+
break
30+
fi
31+
done
32+
fi
33+
34+
>>>>>>> dev
1135
# Check release
1236
if [ -f /etc/redhat-release ]; then
1337
release="centos"
@@ -123,6 +147,11 @@ chmod a+rx /tmp/ZPing-CN.py
123147
/tmp/besttrace 211.136.192.6 > /tmp/gdm.txt 2>&1 &
124148
#"TraceRoute to Guangdong Unicom"
125149
/tmp/besttrace 221.5.88.88 > /tmp/gdu.txt 2>&1 &
150+
<<<<<<< HEAD
151+
=======
152+
#"TraceRoute to Owner's Network"
153+
/tmp/besttrace ${OwnerIP} > /tmp/own.txt 2>&1 &
154+
>>>>>>> dev
126155

127156

128157

@@ -364,7 +393,11 @@ NetPiSM=$( sed -n "24p" /tmp/speed_cn.txt )
364393
NetUPCM=$( sed -n "25p" /tmp/speed_cn.txt )
365394
NetDWCM=$( sed -n "26p" /tmp/speed_cn.txt )
366395
NetPiCM=$( sed -n "27p" /tmp/speed_cn.txt )
396+
<<<<<<< HEAD
367397
wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/master/Generate.py >> /dev/null 2>&1
398+
=======
399+
wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/dev/Generate.py >> /dev/null 2>&1
400+
>>>>>>> dev
368401
python Generate.py && rm -rf Generate.py && cp /root/report.html /tmp/report/index.html
369402
TSM=$( cat /tmp/shm.txt_table )
370403
TST=$( cat /tmp/sht.txt_table )

ZBench.sh

+33
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,30 @@ if [ ! -e '/usr/bin/wget' ]; then
88
fi
99
read -p "Please Enter Your Host Provider: " Provider
1010

11+
<<<<<<< HEAD
12+
=======
13+
# Get IP
14+
OwnerIP=$(who am i | awk '{print $NF}' | sed -e 's/[()]//g')
15+
while :; do echo
16+
read -p "Please Confirm Your Client IP:${OwnerIP} [y/n]: " ifOwnerIP
17+
if [[ ! ${ifOwnerIP} =~ ^[y,n]$ ]]; then
18+
echo "Input error! Please only input 'y' or 'n'"
19+
else
20+
break
21+
fi
22+
done
23+
if [[ ${ifOwnerIP} == "n" ]]; then
24+
while :; do echo
25+
read -p "Please Enter Your Client IP: " OwnerIP
26+
if [[ ! ${OwnerIP} ]]; then
27+
echo "Input error! Cannot be void!"
28+
else
29+
break
30+
fi
31+
done
32+
fi
33+
34+
>>>>>>> dev
1135
# Check release
1236
if [ -f /etc/redhat-release ]; then
1337
release="centos"
@@ -123,6 +147,11 @@ chmod a+rx /tmp/ZPing.py
123147
/tmp/besttrace 211.136.192.6 > /tmp/gdm.txt 2>&1 &
124148
#"TraceRoute to Guangdong Unicom"
125149
/tmp/besttrace 221.5.88.88 > /tmp/gdu.txt 2>&1 &
150+
<<<<<<< HEAD
151+
=======
152+
#"TraceRoute to Owner's Network"
153+
/tmp/besttrace ${OwnerIP} > /tmp/own.txt 2>&1 &
154+
>>>>>>> dev
126155

127156

128157

@@ -372,7 +401,11 @@ NetUPCM=$( sed -n "25p" /tmp/speed_cn.txt )
372401
NetDWCM=$( sed -n "26p" /tmp/speed_cn.txt )
373402
NetPiCM=$( sed -n "27p" /tmp/speed_cn.txt )
374403
404+
<<<<<<< HEAD
375405
wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/master/Generate.py >> /dev/null 2>&1
406+
=======
407+
wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/dev/Generate.py >> /dev/null 2>&1
408+
>>>>>>> dev
376409
python Generate.py && rm -rf Generate.py && cp /root/report.html /tmp/report/index.html
377410
TSM=$( cat /tmp/shm.txt_table )
378411
TST=$( cat /tmp/sht.txt_table )

0 commit comments

Comments
 (0)