SHARE
TWEET

Untitled

a guest Jan 18th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. https://carbon.now.sh/?bg=rgba(171%2C%20184%2C%20195%2C%201)&t=blackboard&wt=none&l=python&ds=true&dsyoff=20px&dsblur=68px&wc=true&wa=true&pv=56px&ph=56px&ln=false&fm=Hack&fs=14px&lh=133%25&si=false&code=%2523%2520Python%25203%250A%2523%2520Linux%250A%250Aimport%2520netifaces%2520%2523%25200.10.5%250Aimport%2520subprocess%250Aimport%2520pyspeedtest%2520%2523%2520https%253A%252F%252Fgithub.com%252Ffopina%252Fpyspeedtest%250Afrom%2520time%2520import%2520sleep%250Aimport%2520os%250A%250A%250A%2523%2520kolorowanie%2520konsoli%250Aclass%2520clr%253A%250A%2520%2520%2520%2520OKGREEN%2520%253D%2520%2522%255C033%255B92m%2522%250A%2520%2520%2520%2520GREEN%2520%253D%2520%2522%255C033%255B1%253B32m%2522%250A%2520%2520%2520%2520GREENUNDER%2520%2520%253D%2520%2520%2520%2522%255C033%255B4%253B32m%2522%250A%2520%2520%2520%2520%2523RED2%2520%253D%2520%2522%255C033%255B91m%2522%2520%2523%2520not%2520bold%250A%2520%2520%2520%2520WARNING%2520%253D%2520%2522%255C033%255B93m%2522%250A%2520%2520%2520%2520BASICY%2520%253D%2520%2522%255C033%255B0%253B33m%2522%250A%2520%2520%2520%2520YELLOW%2520%253D%2520%2522%255C033%255B1%253B33m%2522%250A%2520%2520%2520%2520BRED%2520%253D%2520%2522%255C033%255B0%253B31m%2522%250A%2520%2520%2520%2520RED%2520%253D%2520%2522%255C033%255B1%253B31m%2522%2520%2523%2520bold%250A%2520%2520%2520%2520UNDERLINE%2520%253D%2520%2522%255C033%255B4m%2522%250A%2520%2520%2520%2520ENDC%2520%253D%2520%2522%255C033%255B0m%2522%250A%250Adef%2520logo()%253A%250A%2509print(%2522%2520%2520%2520_____%2520_%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520_%2520%2520%2520%2520%2520%2520_%2520%2520%2520_%2520%2520%2520%2520%2520%2520_%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520_%2520%2520%2520%2520%2522)%250A%2509print(%2522%2520%2520%252F%2520____%257C%2520%257C%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257C%2520%257C%2520%2520%2520%2520%257C%2520%255C%2520%257C%2520%257C%2520%2520%2520%2520%257C%2520%257C%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257C%2520%257C%2520%2520%2520%2522)%250A%2509print(%2522%2520%257C%2520%257C%2520%2520%2520%2520%257C%2520%257C__%2520%2520%2520___%2520%2520___%257C%2520%257C%2520__%2520%257C%2520%2520%255C%257C%2520%257C%2520___%257C%2520%257C___%2520%2520%2520%2520%2520%2520_____%2520%2520_%2520__%257C%2520%257C%2520__%2522)%250A%2509print(%2522%2520%257C%2520%257C%2520%2520%2520%2520%257C%2520%27_%2520%255C%2520%252F%2520_%2520%255C%252F%2520__%257C%2520%257C%252F%2520%252F%2520%257C%2520.%2520%2560%2520%257C%252F%2520_%2520%255C%2520__%255C%2520%255C%2520%252F%255C%2520%252F%2520%252F%2520_%2520%255C%257C%2520%27__%257C%2520%257C%252F%2520%252F%2522)%250A%2509print(%2522%2520%257C%2520%257C____%257C%2520%257C%2520%257C%2520%257C%2520%2520__%252F%2520(__%257C%2520%2520%2520%253C%2520%2520%257C%2520%257C%255C%2520%2520%257C%2520%2520__%252F%2520%257C_%2520%255C%2520V%2520%2520V%2520%252F%2520(_)%2520%257C%2520%257C%2520%2520%257C%2520%2520%2520%253C%2520%2522)%250A%2509print(%2522%2520%2520%255C_____%257C_%257C%2520%257C_%257C%255C___%257C%255C___%257C_%257C%255C_%255C%2520%257C_%257C%2520%255C_%257C%255C___%257C%255C__%257C%2520%255C_%252F%255C_%252F%2520%255C___%252F%257C_%257C%2520%2520%257C_%257C%255C_%255C%2520%2522)%250A%2509print(%2522Krzysztof%2520%25C5%2581uczak%255Cn%255Cn%2522)%250A%2509sleep(1)%250A%250Adef%2520interfaces()%253A%250A%2509print(%2522%255Cn%255Ct%2522%252Bclr.RED%252B%2522List%2520interfaces%2522%252Bclr.ENDC)%250A%2509for%2520iface%2520in%2520netifaces.interfaces()%253A%250A%2509%2509mac_addr%2520%253D%2520netifaces.ifaddresses(iface)%255Bnetifaces.AF_LINK%255D%255B0%255D%255B%27addr%27%255D%250A%2509%2509try%253A%250A%2509%2509%2509ip_addr%2520%253D%2520netifaces.ifaddresses(iface)%255Bnetifaces.AF_INET%255D%255B0%255D%255B%27addr%27%255D%250A%2509%2509%2509netmask%2520%253D%2520netifaces.ifaddresses(iface)%255Bnetifaces.AF_INET%255D%255B0%255D%255B%27netmask%27%255D%250A%2509%2509except%253A%250A%2509%2509%2509ip_addr%2520%253D%2520%2522%2522%250A%2509%2509%2509netmask%2520%253D%2520%2522%2522%250A%2509%2509print(%27%257B%257D%253A%255Cn%255CtMAC%253A%255Ct%257B%257D%255Cn%255CtIPv4%253A%255Ct%257B%257D%255Cn%255CtMask%253A%255Ct%257B%257D%27.format(iface%252C%2520mac_addr%252C%2520clr.GREEN%252Bip_addr%252Bclr.ENDC%252C%2520netmask))%250A%250A%250A%250Adef%2520ping()%253A%250A%2509print(%2522%255Cn%255Ct%2522%252Bclr.RED%252B%2522Check%2520DNS%2522%252Bclr.ENDC)%250A%2509%2523%2520ping%2520domain%250A%2509try%253A%250A%2509%2509print(%2522%255Cn%2522%252Bclr.YELLOW%252B%2522PING%253A%2520google.com%2522%252Bclr.ENDC)%250A%2509%2509domain%2520%253D%2520subprocess.Popen(%255B%2522ping%2522%252C%2520%2522-c%25202%2522%252C%2520%2522google.com%2522%255D%252C%2520stdout%253Dsubprocess.PIPE).communicate()%255B0%255D%250A%2509%2509domain%2520%253D%2520domain.decode(%27UTF-8%27).split(%2522%255Cn%2522)%250A%2509%2509print(%27%2520%27.join(domain%255B1%255D.replace(%2522(%2522%252C%2522%2522).replace(%2522)%2522%252C%2522%2522).split(%2522%2520%2522)%255B4%253A%255D))%2520%2520%2523%2520take%2520first%2520line%250A%2509%2509print(%27%2520%27.join(domain%255B2%255D.replace(%2522(%2522%252C%2522%2522).replace(%2522)%2522%252C%2522%2522).split(%2522%2520%2522)%255B4%253A%255D))%2520%2520%2523%2520take%2520second%2520line%250A%2509except%253A%250A%2509%2509print(%2522Domain%2520error%2520!%2522)%250A%250A%2509%2523%2520ping%2520IPv4%2520address%250A%2509try%253A%250A%2509%2509print(clr.YELLOW%252B%2522PING%253A%252046.238.98.154%2520(google.com)%2522%252Bclr.ENDC)%250A%2509%2509domain_ip%2520%253D%2520subprocess.Popen(%255B%2522ping%2522%252C%2520%2522-c%25202%2522%252C%2520%252246.238.98.154%2522%255D%252C%2520stdout%253Dsubprocess.PIPE).communicate()%255B0%255D%250A%2509%2509if%2520%27ttl%27%2520not%2520in%2520domain_ip.decode(%27UTF-8%27)%253A%2520%2520%2523%2520%2520ping%2520lose%2520%253D%2520ttl%2520not%2520in%2520return%250A%2509%2509%2509raise%250A%2509%2509domain_ip%2520%253D%2520domain_ip.decode(%27UTF-8%27).split(%2522%255Cn%2522)%250A%2509%2509print(%27%2520%27.join(domain_ip%255B1%255D.split(%2522%2520%2522)%255B3%253A%255D))%250A%2509%2509print(%27%2520%27.join(domain_ip%255B2%255D.split(%2522%2520%2522)%255B3%253A%255D))%250A%2509except%253A%250A%2509%2509print(%2522Domain%2520IPv4%2520error%2520!%2522)%250A%250A%2509%2523%2520ping%2520IPv4%2520address%2520of%2520DNS%250A%2509try%253A%250A%2509%2509print(clr.YELLOW%252B%2522PING%253A%25208.8.8.8%2520(google%2520DNS)%2522%252Bclr.ENDC)%250A%2509%2509domain_ip%2520%253D%2520subprocess.Popen(%255B%2522ping%2522%252C%2520%2522-c%25202%2522%252C%2520%25228.8.8.8%2522%255D%252C%2520stdout%253Dsubprocess.PIPE).communicate()%255B0%255D%250A%2509%2509if%2520%27ttl%27%2520not%2520in%2520domain_ip.decode(%27UTF-8%27)%253A%250A%2509%2509%2509raise%250A%2509%2509domain_ip%2520%253D%2520domain_ip.decode(%27UTF-8%27).split(%2522%255Cn%2522)%250A%2509%2509print(%27%2520%27.join(domain_ip%255B1%255D.split(%2522%2520%2522)%255B3%253A%255D))%250A%2509%2509print(%27%2520%27.join(domain_ip%255B2%255D.split(%2522%2520%2522)%255B3%253A%255D))%250A%2509except%253A%250A%2509%2509print(%2522Google%2520DNS%2520error%2520!%2522)%250A%250A%2509%2523%2520ping%2520IPv4%2520address%2520of%2520DNS%250A%2509try%253A%250A%2509%2509print(clr.YELLOW%252B%2522PING%253A%2520217.30.129.149%2520(netia%2520DNS)%2522%252Bclr.ENDC)%250A%2509%2509domain_ip%2520%253D%2520subprocess.Popen(%255B%2522ping%2522%252C%2520%2522-c%25202%2522%252C%2520%2522217.30.129.149%2522%255D%252C%2520stdout%253Dsubprocess.PIPE).communicate()%255B0%255D%250A%2509%2509if%2520%27ttl%27%2520not%2520in%2520domain_ip.decode(%27UTF-8%27)%253A%250A%2509%2509%2509raise%250A%2509%2509domain_ip%2520%253D%2520domain_ip.decode(%27UTF-8%27).split(%2522%255Cn%2522)%250A%2509%2509print(%27%2520%27.join(domain_ip%255B1%255D.split(%2522%2520%2522)%255B3%253A%255D))%250A%2509%2509print(%27%2520%27.join(domain_ip%255B2%255D.split(%2522%2520%2522)%255B3%253A%255D))%250A%2509except%253A%250A%2509%2509print(%2522Netia%2520DNS%2520error%2520!%2522)%250A%250A%2509%2523%2520ping%2520IPv4%2520address%2520of%2520default%2520gateway%2520(Access%2520Point%252C%2520router%252C%2520DHCP%2520server%252C...)%250A%2509try%253A%250A%2509%2509response%2520%253D%2520subprocess.Popen(%255B%2522ip%2522%252C%2520%2522route%2522%252C%2520%2522show%2522%252C%2520%2522default%2522%255D%252C%2520stdout%253Dsubprocess.PIPE).communicate()%255B0%255D%250A%2509%2509default_route%2520%253D%2520response.decode(%27utf-8%27).split(%2522%255Cn%2522)%255B0%255D.split(%2522%2520%2522)%255B2%255D%250A%2509%2509default_iface%2520%253D%2520response.decode(%27utf-8%27).split(%2522%255Cn%2522)%255B0%255D.split(%2522%2520%2522)%255B4%255D%250A%2509%2509print(clr.YELLOW%252B%2522PING%253A%2520%2522%252Bdefault_route%252B%2522%2520(%2522%252Bdefault_iface%252B%2522)%2522%252Bclr.ENDC)%250A%2509%2509gateway%2520%253D%2520subprocess.Popen(%255B%2522ping%2522%252C%2520%2522-c%25202%2522%252C%2520default_route%255D%252C%2520stdout%253Dsubprocess.PIPE).communicate()%255B0%255D%250A%2509%2509if%2520%27ttl%27%2520not%2520in%2520gateway.decode(%27UTF-8%27)%253A%250A%2509%2509%2509raise%250A%2509%2509gateway%2520%253D%2520gateway.decode(%27UTF-8%27).split(%2522%255Cn%2522)%250A%2509%2509print(%27%2520%27.join(gateway%255B1%255D.split(%2522%2520%2522)%255B3%253A%255D))%250A%2509%2509print(%27%2520%27.join(gateway%255B2%255D.split(%2522%2520%2522)%255B3%253A%255D))%250A%2509except%253A%250A%2509%2509print(%2522Gateway%2520error%2520!%2522)%250A%250A%250Adef%2520speedtest()%253A%250A%2509print(%2522%255Cn%255Ct%2522%252Bclr.RED%252B%2522SpeedTest%2522%252Bclr.ENDC)%250A%2509st%2520%253D%2520pyspeedtest.SpeedTest()%250A%2509%250A%2509print(clr.YELLOW%252B%2522Ping%253A%255Ct%255Ct%2522%252Bclr.ENDC%252Cend%253D%2522%2522)%250A%2509ping_ms%2520%253D%2520st.ping()%250A%2509print(clr.GREEN%252B%27%257B%253A.2f%257D%2520ms%27.format(ping_ms)%252Bclr.ENDC)%250A%250A%2509print(clr.YELLOW%252B%2522Download%2520speed%253A%255Ct%2522%252Bclr.ENDC%252C%2520end%253D%2522%2522)%250A%2509down%2520%253D%2520st.download()%250A%2509print(clr.GREEN%252B%27%257B%253A.2f%257D%2520Mbps%27.format(down%252F1000000)%252Bclr.ENDC)%250A%250A%2509print(clr.YELLOW%252B%2522Upload%2520speed%253A%255Ct%2522%252Bclr.ENDC%252Cend%253D%2522%2522)%250A%2509upl%2520%253D%2520st.upload()%250A%2509print(clr.GREEN%252B%27%257B%253A.2f%257D%2520Mbps%27.format(upl%252F1000000)%252Bclr.ENDC)%250A%250Adef%2520traceroute()%253A%250A%2509print(%2522%255Cn%255Ct%2522%252Bclr.RED%252B%2522Traceroute%2520(google.com)%2522%252Bclr.ENDC)%250A%2509os.system(%2522sudo%2520traceroute%2520-I%2520google.com%2522)%250A%2509print()%250A%250A%250Adef%2520main()%253A%250A%2509logo()%250A%2509try%253A%250A%2509%2509interfaces()%250A%2509%2509input(clr.UNDERLINE%252B%2522%255CnPress%2520enter%2520for%2520continue%2520or%2520Ctrl%252BC%2520for%2520exit%2522%252Bclr.ENDC)%250A%2509%2509ping()%250A%2509%2509input(clr.UNDERLINE%252B%2522%255CnPress%2520enter%2520for%2520continue%2520or%2520Ctrl%252BC%2520for%2520exit%2522%252Bclr.ENDC)%250A%2509%2509speedtest()%250A%2509%2509input(clr.UNDERLINE%252B%2522%255CnPress%2520enter%2520for%2520continue%2520or%2520Ctrl%252BC%2520for%2520exit%2522%252Bclr.ENDC)%250A%2509%2509traceroute()%250A%2509except%2520KeyboardInterrupt%253A%250A%2509%2509print()%250A%2509%2509return%250A%250Aif%2520__name__%2520%253D%253D%2520%27__main__%27%253A%250A%2509main()&es=2x&wm=false
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top