最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

python - Why sr1 return None when TCP flags are FPU - Stack Overflow

matteradmin5PV0评论

from scapy.all import IP, ICMP, TCP, sr1
import sys

def probe_scan(ip):
    probe_packet = IP(dst=ip) / ICMP()
    return sr1(probe_packet, timeout=10) != None

def tryXMas(ip, port):
    xMas_packet = IP(dst=ip) / TCP(dport=int(port), flags="FPU")
    Xmas_resp = sr1(xMas_packet, timeout=5)
    return Xmas_resp


if __name__ == "__main__":
    ip = "127.0.0.1" # sys.argv[1]
    port = 21 # sys.argv[2]
    if probe_scan(ip):
        xMas_packet = tryXMas(ip, port)
       """This line calls error due to sr1 return None type!! """
        xMas_packet.summary()
    else:
        print("Prove Scan Failed")`

Hi, I wanna create XMas scanning using Scapy. When I set flags="SA" all is fine(I get TCP result), but when I change flags I get None type from sr1 in tryXMas() method

It doesn't make difference what ip or port I'll choose. However, in my example I use metasploitable machine on my VirtualBox

Post a comment

comment list (0)

  1. No comments so far