91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

計算機網絡-自頂向下方法第七版配套資源(包括ppt,課后答案,勘誤,wireshark實驗等)

資源截圖

代碼片段和文件信息

from?socket?import?*
import?os
import?sys
import?struct
import?time
import?select
import?binascii??

ICMP_ECHO_REQUEST?=?8

def?checksum(string):?
csum?=?0
countTo?=?(len(string)?//?2)?*?2??
count?=?0

while?count? thisVal?=?ord(string[count+1])?*?256?+?ord(string[count])?
csum?=?csum?+?thisVal?
csum?=?csum?&?0xffffffff??
count?=?count?+?2

if?countTo? csum?=?csum?+?ord(string[len(string)?-?1])
csum?=?csum?&?0xffffffff?

csum?=?(csum?>>?16)?+?(csum?&?0xffff)
csum?=?csum?+?(csum?>>?16)
answer?=?~csum?
answer?=?answer?&?0xffff?
answer?=?answer?>>?8?|?(answer?< return?answer?

def?receiveOnePing(mySocket?ID?timeout?destAddr):
timeLeft?=?timeout

while?1:?
startedSelect?=?time.time()
whatReady?=?select.select([mySocket]?[]?[]?timeLeft)
howLongInSelect?=?(time.time()?-?startedSelect)
if?whatReady[0]?==?[]:?#?Timeout
return?“Request?timed?out.“

timeReceived?=?time.time()?
recPacket?addr?=?mySocket.recvfrom(1024)

#?Fetch?the?ICMPHeader?from?the?IP
icmpHeader?=?recPacket[20:28]

rawTTL?=?struct.unpack(“s“?bytes([recPacket[8]]))[0]??

#?binascii?--?Convert?between?binary?and?ASCII??
TTL?=?int(binascii.hexlify(rawTTL)?16)?

icmpType?code?checksum?packetID?sequence?=?struct.unpack(“bbHHh“?icmpHeader)

if?packetID?==?ID:
byte?=?struct.calcsize(“d“)?
timeSent?=?struct.unpack(“d“?recPacket[28:28?+?byte])[0]
return?“Reply?from?%s:?bytes=%d?time=%f5ms?TTL=%d“?%?(destAddr?len(recPacket)?(timeReceived?-?timeSent)*1000?TTL)

timeLeft?=?timeLeft?-?howLongInSelect
if?timeLeft?<=?0:
return?“Request?timed?out.“


def?sendOnePing(mySocket?destAddr?ID):
#?Header?is?type?(8)?code?(8)?checksum?(16)?id?(16)?sequence?(16)

myChecksum?=?0
#?Make?a?dummy?header?with?a?0?checksum
#?struct?--?Interpret?strings?as?packed?binary?data
header?=?struct.pack(“bbHHh“?ICMP_ECHO_REQUEST?0?myChecksum?ID?1)
data?=?struct.pack(“d“?time.time())
#?Calculate?the?checksum?on?the?data?and?the?dummy?header.

myChecksum?=?checksum(str(header?+?data))?

#?Get?the?right?checksum?and?put?in?the?header
if?sys.platform?==?‘darwin‘:
#?Convert?16-bit?integers?from?host?to?network?byte?order
myChecksum?=?htons(myChecksum)?&?0xffff
else:
myChecksum?=?htons(myChecksum)

header?=?struct.pack(“bbHHh“?ICMP_ECHO_REQUEST?0?myChecksum?ID?1)
packet?=?header?+?data

mySocket.sendto(packet?(destAddr?1))?#?AF_INET?address?must?be?tuple?not?str
#?Both?LISTS?and?TUPLES?consist?of?a?number?of?objects
#?which?can?be?referenced?by?their?position?number?within?the?object.

def?doOnePing(destAddr?timeout):?
icmp?=?getprotobyname(“icmp“)

#?SOCK_RAW?is?a?powerful?socket?type.?For?more?details:???http://sock-raw.org/papers/sock_raw
mySocket?=?socket(AF_INET?SOCK_RAW?icmp)

myID?=?os.getpid()?&?0xFFFF??#?Return?the?current?process?i

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-11-29?22:31??resources\599710134312805_Pythonsol-260138\
?????目錄???????????0??2018-11-29?22:31??resources\599710134312805_Pythonsol-260138\__MACOSX\
?????文件?????????222??2016-05-26?16:27??resources\599710134312805_Pythonsol-260138\__MACOSX\._Solutions
?????目錄???????????0??2018-11-29?22:31??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\
?????文件?????????120??2016-05-26?16:27??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\._.DS_Store
?????文件?????????222??2015-03-09?12:07??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\._IcmpPing
?????文件?????????222??2015-03-09?12:07??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\._ProxyServer
?????文件?????????222??2015-03-09?12:07??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\._SMTPClient
?????文件?????????222??2015-03-09?12:07??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\._StreamingVideo
?????文件?????????222??2015-03-16?09:56??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\._Traceroute
?????文件?????????222??2015-03-09?12:07??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\._UDPPinger
?????文件?????????222??2015-03-09?12:07??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\._Webserver
?????目錄???????????0??2018-11-29?22:31??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\IcmpPing\
?????文件?????????222??2015-03-08?16:31??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\IcmpPing\._IcmpPing.py
?????目錄???????????0??2018-11-29?22:31??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\ProxyServer\
?????文件?????????222??2015-03-07?19:24??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\ProxyServer\._ProxyServer.py
?????目錄???????????0??2018-11-29?22:31??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\SMTPClient\
?????文件?????????222??2015-03-07?20:24??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\SMTPClient\._SMTPClient.py
?????目錄???????????0??2018-11-29?22:31??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\StreamingVideo\
?????文件?????????222??2015-03-09?11:39??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\StreamingVideo\._Client.py
?????文件?????????222??2015-03-08?09:39??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\StreamingVideo\._RtpPacket.py
?????目錄???????????0??2018-11-29?22:31??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\Traceroute\
?????文件?????????222??2015-03-16?09:56??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\Traceroute\._Traceroute.py
?????目錄???????????0??2018-11-29?22:31??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\UDPPinger\
?????文件?????????222??2015-03-08?17:08??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\UDPPinger\._UDP_Pinger_Client.py
?????目錄???????????0??2018-11-29?22:31??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\Webserver\
?????文件?????????222??2015-03-06?17:00??resources\599710134312805_Pythonsol-260138\__MACOSX\Solutions\Webserver\._Websever.py
?????目錄???????????0??2018-11-29?22:31??resources\599710134312805_Pythonsol-260138\Solutions\
?????文件????????6148??2016-05-26?16:27??resources\599710134312805_Pythonsol-260138\Solutions\.DS_Store
?????目錄???????????0??2018-11-29?22:31??resources\599710134312805_Pythonsol-260138\Solutions\IcmpPing\
?????文件????????3625??2015-03-08?16:31??resources\599710134312805_Pythonsol-260138\Solutions\IcmpPing\IcmpPing.py
............此處省略47個文件信息

評論

共有 條評論