TSniff

Started by 0x0ptim0us, August 31, 2013, 09:22:36 AM

Previous topic - Next topic

0x0ptim0us

hi guys
tsniff an simple script for sniff network and support tcp,udp,icmp protocols (u can select protocol with -f switch) ...
tsniff have packet counter , for example (-c 3) , so tsniff sniff 3 packets and save it into pcap file, for analysis in other tools like wireshark ...

screen shot from usage and ... :



script :
#!/usr/bin/env python
#
# Author : Fardin Allahverdinazhand[0x0ptim0us]
# Mail : 0x0ptim0us@Gmail.Com
# Web : Turk-BH.ir
#
# Version 1.0 Beta


from time import sleep
from scapy.all import *
import os
import optparse

def main():
parse = optparse.OptionParser()
parse.add_option('-i' , '--iface', help="interface (defualt=eth0)", default="eth0")
parse.add_option('-f' , '--filter', help="sniff selected protocol (default=http)", default="http")
parse.add_option('-o' , '--output', help="name of output pcap file", default="tsniff.pcap")
parse.add_option('-c' , '--count', help="number of packets to sniff(default=30)", default=30)
opt, args =parse.parse_args()
print "Press Ctrl+C keys for stop ...\n"
try:
cc=int(opt.count)
pkts = sniff(iface=opt.iface, filter=opt.filter, count=cc, prn=lambda x: x.summary())
wrpcap(opt.output, pkts)
print "%s File Create Successfully."%(opt.output)
except(KeyboardInterrupt):
print "Ctrl + C , Detected ."
print "Error : Can't Create output file !"

if __name__ == "__main__":
main()



cheers!
working on websploit framework new version, database support and new modules, so take a long time ...

ZEROF

Thank you for sharing with us !  8)

Don't ask, read : http://wiki.backbox.org
or just run sudo rm -rf /*