Changeset 735 for trunk

Show
Ignore:
Timestamp:
01/09/07 10:35:51 (2 years ago)
Author:
chengyu
Message:

auto-detection for file system type

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/mwfetcher/CHANGELOG

    r712 r735  
     1v0.1.1 
     2* Added auto detection for file system type, which will override "-t vfat" option. 
     3* Improved installation process. 
     4 
    15v0.1.0 
    26* Added aborting mechanism if 'fsck.vfat -y' failed when scans FAT32 file system. 
  • trunk/mwfetcher/install

    r712 r735  
    11#!/bin/bash 
     2 
     3install_path=${1:-"/usr/sbin/"} 
    24 
    35if [ $(whoami) != root ]; then 
     
    2325 
    2426if [ ! -e $HOME/.mwfetcher/config ]; then 
    25         /bin/cp -u ./src/config $HOME/.mwfetcher/ 
     27        /bin/cp ./src/config $HOME/.mwfetcher/ 
    2628fi 
    27 /bin/cp ./src/mwfetcher /usr/sbin/ 
    28 chmod 755 /usr/sbin/mwfetcher 
     29 
     30/bin/cp ./src/mwfetcher "$install_path" 
     31chmod 755 "$install_path/mwfetcher" 
  • trunk/mwfetcher/src/mwfetcher

    r712 r735  
    66# Copyright (C) 2006 Artemis: Chinese Honeynet Project 
    77# 
    8 # Version 0.1.0 
     8# Version 0.1.1 
    99#  
    1010# This program is free software; you can redistribute it and/or modify 
     
    2424############################################################################ 
    2525# 
    26 # Usage: mwfetcher [-m path] [-l path] [-s path] [-g file] [-f] [-M] [-t vfat] vmxfile submit-dir 
    27 #        mwfetcher [-M] [-c config-file] [-t vfat] -b 
    28 #        mwfetcher -i [-m path] [-s path] [-g file] [-M] [-t vfat] vmxfile 
     26# Usage: mwfetcher [-m path] [-l path] [-s path] [-g file] [-f] [-M] vmxfile submit-dir 
     27#        mwfetcher [-M] [-c config-file] -b 
     28#        mwfetcher -i [-m path] [-s path] [-g file] [-M] vmxfile 
    2929#        mwfetcher -v 
    3030#        mwfetcher -h 
     
    6060#Do not modify 
    6161fetch_dir=tools/Samples 
    62 version="0.1.0
     62version="0.1.1
    6363 
    6464# mount_vmdisk 
     
    8888        local vmdk_file=`ls -ct "$vmk_dir" | grep -m 1 .vmdk$ | sed '{s/-s00[0-9]//}'` 
    8989         
     90        set_fstype "$vmk_dir/$vmdk_file" 
     91 
    9092        echo "Mount Virtual machine disk: $vmk_dir/$vmdk_file" 
    9193        echo "mount point: $mount_dir" 
     
    115117        #mount /dev/nb0 "$mount_dir" 2>&1 > /dev/null 
    116118 
     119        #echo "Finished" 
     120} 
     121 
     122# set_fstype 
     123# Automatically set $fs_type 
     124# $1: virtual disk file path 
     125 
     126set_fstype() { 
     127        local vmdk_file="$1" 
     128 
     129        echo "Detect File System Type"   
     130 
     131        vmware-loop -P "$home_dir/partition_table" "$vmdk_file" 2>&1 > /dev/null 
     132 
     133        fs_info=`tail -n 1 "$home_dir/partition_table"` 
     134 
     135        if [ -n "$(echo $fs_info | grep FAT)" ]; then 
     136                fs_type="vfat" 
     137        elif [ -n "$(echo $fs_info | grep NTFS)" ]; then 
     138                fs_type="ntfs" 
     139        else 
     140                fs_type="other" 
     141        fi 
     142         
    117143        #echo "Finished" 
    118144} 
     
    312338 
    313339usage() { 
    314         echo "Usage: $PROGRAM [-m path] [-l path] [-s path] [-g file] [-f] [-M] [-t vfat] vmxfile submit-dir" 
    315         echo "       $PROGRAM [-M] [-c config-file] [-t vfat] -b" 
    316         echo "       $PROGRAM -i [-m path] [-s path] [-g file] [-M] [-t vfat] vmxfile" 
     340        echo "Usage: $PROGRAM [-m path] [-l path] [-s path] [-g file] [-f] [-M] vmxfile submit-dir" 
     341        echo "       $PROGRAM [-M] [-c config-file] -b" 
     342        echo "       $PROGRAM -i [-m path] [-s path] [-g file] [-M] vmxfile" 
    317343        echo "       $PROGRAM -v" 
    318344        echo "       $PROGRAM -h" 
     
    326352        echo -e "\t-b Use batch mode run through VM list in <config-file>." 
    327353        echo -e "\t-i Generate initial good file list for virtual machine <vmxfile>" 
    328         echo -e "\t-t Specify the file system type, currently only FAT file system needs to \n\t   be specified." 
    329354        echo -e "\t-v Version." 
    330355        echo -e "\t-h Show this message."