|
|
@@ -0,0 +1,25 @@
|
|
|
+#!/usr/bin/python3
|
|
|
+
|
|
|
+def parse_args():
|
|
|
+ import argparse
|
|
|
+ parser = argparse.ArgumentParser(
|
|
|
+ description='Extract features from pcap files.')
|
|
|
+ parser.add_argument('pcaps', metavar='pcaps', type=argparse.FileType('rb'),
|
|
|
+ nargs='+', help='pcap from which to extract features')
|
|
|
+ parser.add_argument('-o', '--outfile', type=argparse.FileType('wb'),
|
|
|
+ default="features.plo", help='Where to save the " \
|
|
|
+ "extracted features (default: features.plo)')
|
|
|
+ return parser.parse_args()
|
|
|
+
|
|
|
+def main():
|
|
|
+ args = parse_args()
|
|
|
+ from sample import Sample
|
|
|
+ out = [Sample(pcap) for pcap in args.pcaps[0:1]];
|
|
|
+ try:
|
|
|
+ import cPickle as pickle
|
|
|
+ except:
|
|
|
+ import pickle
|
|
|
+ pickle.dump(out, args.outfile)
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ main()
|