This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import inspect | |
import scapy.all | |
import scapy.main | |
import scapy.contrib.nfs | |
def main (): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--iface') | |
args = parser.parse_args() | |
scapy.all.load_contrib('nfs') | |
a = scapy.all.sniff(filter='tcp port 2049 or udp port 2049', iface=args.iface, prn=lambda x: x.show(), lfilter=nfs_filter) | |
a.summary() | |
for each in a: | |
print(each) | |
def nfs_filter (p): | |
for thing_name in dir(scapy.contrib.nfs): | |
thing = getattr(scapy.contrib.nfs, thing_name) | |
if inspect.isclass(thing) and issubclass(thing, scapy.all.Packet): | |
if thing in p: | |
print(thing) | |
return True | |
else: | |
return False | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment