Skip to content

Commit

Permalink
conflict fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
beststarry committed Jul 31, 2018
2 parents 90b986d + c513474 commit a0d4c87
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 1 deletion.
74 changes: 73 additions & 1 deletion Generate.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
<<<<<<< HEAD
=======
import urllib
import urllib2
>>>>>>> dev

def change_to_list(filename):
content = open(filename,"r").read().strip()
Expand All @@ -17,16 +22,47 @@ def traceroute_to_dict(filename):
line = content[i]
if line[1].isdigit():
if line[4] != "*" :
latency=line.strip().split(" ")[2]
<<<<<<< HEAD
ip = line.strip().split(" ")[1]
asn = line.strip().split(" ")[3]
iptest = ip.strip().split(" ")[0]
url = "http://ip-api.com/csv/" + iptest
req = urllib2.Request(url)
res_data = urllib2.urlopen(req)
res = res_data.read()
if res.strip().split(",")[0] == "success" :
isp=res.strip().split(",")[11]
asn=res.strip().split(",")[12]
else:
isp= "*"
latency=line.strip().split(" ")[2]
route = line.strip().split(" ")[4]
=======
ip = line.strip().split(" ")[1]
asn = line.strip().split(" ")[3]
iptest = ip.strip().split(" ")[0]
url = "http://ip-api.com/csv/" + iptest
req = urllib2.Request(url)
res_data = urllib2.urlopen(req)
res = res_data.read()
if res.strip().split(",")[0] == "success" :
isp=res.strip().split(",")[11]
asn=res.strip().split(",")[12]
else:
isp= "*"
latency=line.strip().split(" ")[2]
route = line.strip().split(" ")[4]
>>>>>>> dev
step = line[0:2]
else:
latency="*"
asn = "*"
route = "*"
ip = "*"
<<<<<<< HEAD
=======
isp= "*"
>>>>>>> dev
step = line[0:2]

d[int(step)]=dict()
Expand All @@ -36,7 +72,11 @@ def traceroute_to_dict(filename):
d[int(step)]["latency"]=latency
d[int(step)]["asn"]=asn
d[int(step)]["route"]=route
<<<<<<< HEAD

=======
d[int(step)]["isp"]=isp
>>>>>>> dev

return dict(d)

Expand All @@ -52,9 +92,16 @@ def traceroute_to_table(filename):
<td>{}</td>
<td>{}</td>
<td>{}</td>
<<<<<<< HEAD
</tr>
"""
string = string + template.format(i,x["ip"],x["route"],x["asn"],x["latency"]) + "\n"
=======
<td>{}</td>
</tr>
"""
string = string + template.format(i,x["ip"],x["route"],x["isp"],x["asn"],x["latency"]) + "\n"
>>>>>>> dev
writefile = open(filename + "_table","w")
writefile.write(string)
Expand All @@ -75,6 +122,10 @@ def dict_to_table(d,tab):
<tr><th>跳数</th>
<th>IP</th>
<th>路由</th>
<<<<<<< HEAD
=======
<th>ISP</th>
>>>>>>> dev
<th>AS Number</th>
<th>延迟</th>
</tr></thead>
Expand All @@ -90,9 +141,16 @@ def dict_to_table(d,tab):
<td>{2}</td>
<td>{3}</td>
<td>{4}</td>
<<<<<<< HEAD
</tr>

""".format(step,d[step]["ip"],d[step]["route"],d[step]["asn"],d[step]["latency"])
=======
<td>{5}</td>
</tr>
""".format(step,d[step]["ip"],d[step]["route"],d[step]["isp"],d[step]["asn"],d[step]["latency"])
>>>>>>> dev

table_html = table_html + """
</tbody>
Expand Down Expand Up @@ -479,6 +537,10 @@ def dict_to_table(d,tab):
<a class="item" data-tab="fourth">广东移动</a>
<a class="item" data-tab="fifth">广东电信</a>
<a class="item" data-tab="sixth">广东联通</a>
<<<<<<< HEAD
=======
<a class="item" data-tab="seventh">所在地IP</a>
>>>>>>> dev
</div>
"""
Expand Down Expand Up @@ -627,6 +689,12 @@ def dict_to_table(d,tab):
traceroute_to_table("/tmp/gdu.txt")
gdu_html = dict_to_table(gdu,"sixth")

<<<<<<< HEAD
=======
own = traceroute_to_dict("/tmp/own.txt")
traceroute_to_table("/tmp/own.txt")
own_html = dict_to_table(own,"seventh")
>>>>>>> dev

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], \

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

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

<<<<<<< HEAD
html = html + shm_html + sht_html + shu_html + gdm_html + gdt_html + gdu_html + footer
=======
html = html + shm_html + sht_html + shu_html + gdm_html + gdt_html + gdu_html + own_html + footer
>>>>>>> dev

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

Expand Down
33 changes: 33 additions & 0 deletions ZBench-CN.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@ if [ ! -e '/usr/bin/wget' ]; then
fi
read -p "请输入你的服务器提供商: " Provider

<<<<<<< HEAD
=======
# Get IP
OwnerIP=$(who am i | awk '{print $NF}' | sed -e 's/[()]//g')
while :; do echo
read -p "请确认你所在地的IP:${OwnerIP} [y/n]: " ifOwnerIP
if [[ ! ${ifOwnerIP} =~ ^[y,n]$ ]]; then
echo "输入错误! 请确保你输入的是 'y' 或者 'n'"
else
break
fi
done
if [[ ${ifOwnerIP} == "n" ]]; then
while :; do echo
read -p "请输入你所在地的IP: " OwnerIP
if [[ ! ${OwnerIP} ]]; then
echo "输入错误!IP地址不能为空!"
else
break
fi
done
fi

>>>>>>> dev
# Check release
if [ -f /etc/redhat-release ]; then
release="centos"
Expand Down Expand Up @@ -123,6 +147,11 @@ chmod a+rx /tmp/ZPing-CN.py
/tmp/besttrace 211.136.192.6 > /tmp/gdm.txt 2>&1 &
#"TraceRoute to Guangdong Unicom"
/tmp/besttrace 221.5.88.88 > /tmp/gdu.txt 2>&1 &
<<<<<<< HEAD
=======
#"TraceRoute to Owner's Network"
/tmp/besttrace ${OwnerIP} > /tmp/own.txt 2>&1 &
>>>>>>> dev



Expand Down Expand Up @@ -364,7 +393,11 @@ NetPiSM=$( sed -n "24p" /tmp/speed_cn.txt )
NetUPCM=$( sed -n "25p" /tmp/speed_cn.txt )
NetDWCM=$( sed -n "26p" /tmp/speed_cn.txt )
NetPiCM=$( sed -n "27p" /tmp/speed_cn.txt )
<<<<<<< HEAD
wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/master/Generate.py >> /dev/null 2>&1
=======
wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/dev/Generate.py >> /dev/null 2>&1
>>>>>>> dev
python Generate.py && rm -rf Generate.py && cp /root/report.html /tmp/report/index.html
TSM=$( cat /tmp/shm.txt_table )
TST=$( cat /tmp/sht.txt_table )
Expand Down
33 changes: 33 additions & 0 deletions ZBench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@ if [ ! -e '/usr/bin/wget' ]; then
fi
read -p "Please Enter Your Host Provider: " Provider

<<<<<<< HEAD
=======
# Get IP
OwnerIP=$(who am i | awk '{print $NF}' | sed -e 's/[()]//g')
while :; do echo
read -p "Please Confirm Your Client IP:${OwnerIP} [y/n]: " ifOwnerIP
if [[ ! ${ifOwnerIP} =~ ^[y,n]$ ]]; then
echo "Input error! Please only input 'y' or 'n'"
else
break
fi
done
if [[ ${ifOwnerIP} == "n" ]]; then
while :; do echo
read -p "Please Enter Your Client IP: " OwnerIP
if [[ ! ${OwnerIP} ]]; then
echo "Input error! Cannot be void!"
else
break
fi
done
fi

>>>>>>> dev
# Check release
if [ -f /etc/redhat-release ]; then
release="centos"
Expand Down Expand Up @@ -123,6 +147,11 @@ chmod a+rx /tmp/ZPing.py
/tmp/besttrace 211.136.192.6 > /tmp/gdm.txt 2>&1 &
#"TraceRoute to Guangdong Unicom"
/tmp/besttrace 221.5.88.88 > /tmp/gdu.txt 2>&1 &
<<<<<<< HEAD
=======
#"TraceRoute to Owner's Network"
/tmp/besttrace ${OwnerIP} > /tmp/own.txt 2>&1 &
>>>>>>> dev



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

0 comments on commit a0d4c87

Please sign in to comment.