Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FIN scan with scapy
#1
I'm trying to make a FIN scan with python3.5 using scapy, I send a FIN packet and in case the port is closed I should get a RST packet back, in case it is opened the server should ignore my request. The problem is I'm not getting anything at all, nothing in resp part of the sending function. The same thing happens when I try to do a xmas scan (FPU). I've already tried with several hosts but none seems to work. What am I doing wrong ? Here's the code :

...
def TCP_Fin():
    ip_p = IP(dst=host_ip)
    tcp_p = TCP(dport=(1,100),flags='F')
    packets = ip_p/tcp_p
    resp, non_resp = sr(packets,timeout=0.5)
    for item in non_resp :
        print('[-]Port:',item.sport,'closed)
    for sent,recv in resp: # I DO NOt get any recv packets
        if recv[1].flags == 4 : # 4 == RST packet
            print('[+]Port:',sent[1].dport,'closed, but !port service on!')
        if recv[1].flags != 4 :
            print('[+]Port:',sent[1].dport,'opened')
            print(recv[1].flags) 
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Scapy Basics Shivi 0 940 Sep-25-2023, 07:37 AM
Last Post: Shivi
  How to send a HTTP response packet using scapy JeffreyStoner 0 2,659 Apr-18-2022, 05:23 AM
Last Post: JeffreyStoner
  How to get every IP found by a Scapy traceroute? jao 0 2,454 Feb-06-2022, 01:00 AM
Last Post: jao
  scapy wifi scan to get payload \ data korenron 0 2,144 Nov-16-2021, 01:47 PM
Last Post: korenron
  can I set scan interval for scapy? korenron 0 2,327 Dec-31-2020, 01:43 PM
Last Post: korenron
  scapy trazom 1 2,628 Aug-30-2020, 04:17 PM
Last Post: micseydel
  network and scapy trazom 0 2,066 Aug-16-2020, 03:54 PM
Last Post: trazom
  Need Help with creating an IP packet with timestamp field using Scapy RTD 0 3,475 Jun-15-2019, 08:21 PM
Last Post: RTD
  Scapy, creating response for GET request. SyRex1013 4 5,112 Dec-11-2018, 07:39 AM
Last Post: SyRex1013
  sniffing real time with pyshark or scapy jeanapala 2 7,450 Nov-16-2017, 09:07 PM
Last Post: jeanapala

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020