summaryrefslogtreecommitdiff
path: root/scapy/scan_tcp.py
diff options
context:
space:
mode:
Diffstat (limited to 'scapy/scan_tcp.py')
-rw-r--r--scapy/scan_tcp.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/scapy/scan_tcp.py b/scapy/scan_tcp.py
new file mode 100644
index 0000000..390c2b2
--- /dev/null
+++ b/scapy/scan_tcp.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+
+import sys
+from scapy.all import *
+
+def scapy_scan(host,*ports):
+ for port in ports:
+ ans,unans = sr(IP(dst=host)/TCP(sport=RandShort(),dport=int(port)),verbose=0)
+ ans.summary(lambda s,r: r.sprintf("%IP.dst% \t %TCP.sport% \t %TCP.flags%"))
+
+try:
+ scapy_scan(sys.argv[1],*sys.argv[2:])
+except PermissionError:
+ print(f"{sys.argv[0]} nécessite les droits root")
+except IndexError:
+ print(f"{sys.argv[0]} un host et des ports à scanner")
+