簡體   English   中英

scapy花費無限時間發送TCP SYN數據包而沒有回復。

[英]scapy takes infinite time sending TCP SYN packet with no reply.

我想向路由器發送一個簡單的SYN請求以獲取ACK響應,以嘗試使用python和scapy學習網絡(TCP / IP)。
但是,scapy需要很長時間才能得到任何答案。
腳本-

#!/usr/bin/env python

from scapy.all import *


pack=TCP(sport=22,dport=80,flags='S')/IP(src="192.168.0.13",dst="192.168.0.1")

# tried with retry and timeout options using both sr() and sr1()
# but it comes with no answer from the router. 
# ran this with sudo and iptables policy is default [ACCEPT] 

ans = sr1(pack)

解決辦法是什么 ?

因此,總結起來,您需要顛倒IPTCP順序。

人們所說的TCP / IP實際上是一個堆疊在IP層之上的TCP層。

例如,這是基本層的堆棧:

TCP / IP堆棧

每個堆棧都會添加新信息:以太網提供MAC地址,以便數據包到達路由器。 然后IP告訴數據應該發送到哪台計算機。 TCP最終宣布一些數據,擴展.....

它必須按此順序排列:在指定數據之前,您需要知道數據包需要到達的位置

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM