Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Commit

Permalink
Added function to move the pcap file to a new folder
Browse files Browse the repository at this point in the history
  • Loading branch information
nex committed Dec 11, 2011
1 parent 24a887c commit 2625a71
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions processor.py
Expand Up @@ -21,6 +21,7 @@
import os
import sys
import time
import shutil
from datetime import datetime

from cuckoo.processing.config import AnalysisConfig
Expand Down Expand Up @@ -52,6 +53,30 @@ def get_dropped_files(dropped_path):

return dropped_files

def move_pcap(analysis_path):
"""
Create a new folder and move the PCAP file in it.
@param analysis_path: path to current analysis results directory
"""
pcap_file_path = os.path.join(analysis_path, "dump.pcap")
pcap_dir_path = os.path.join(analysis_path, "pcap/")

if os.path.exists(pcap_file_path):
if not os.path.exists(pcap_dir_path):
try:
os.mkdir(pcap_dir_path)
except OSError, why:
return False

try:
shutil.move(pcap_file_path, pcap_dir_path)
except IOError, why:
return False
else:
return False

return True

def main(analysis_path):
"""
Process the analysis results and generate reports.
Expand Down Expand Up @@ -96,6 +121,8 @@ def main(analysis_path):
# Reports analysis to reports generation modules.
ReportProcessor().report(results)

move_pcap(analysis_path)

if __name__ == "__main__":
if len(sys.argv) < 2:
print "Not enough args."
Expand Down

0 comments on commit 2625a71

Please sign in to comment.