getFTPclient.pl
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:2k
源码类别:

通讯编程

开发平台:

Visual C++

  1. #!/usr/bin/perl -w
  2. #
  3. # Copyright (C) 2001 by USC/ISI
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms are permitted
  7. # provided that the above copyright notice and this paragraph are
  8. # duplicated in all such forms and that any documentation, advertising
  9. # materials, and other materials related to such distribution and use
  10. # acknowledge that the software was developed by the University of
  11. # Southern California, Information Sciences Institute.  The name of the
  12. # University may not be used to endorse or promote products derived from
  13. # this software without specific prior written permission.
  14. #
  15. # THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
  16. # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  17. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18. #
  19. # An perl script that seperate inbound and outbound traffic of ISI domain, 
  20. # used by SAMAN ModelGen
  21. #
  22. # This work is supported by DARPA through SAMAN Project
  23. # (http://www.isi.edu/saman/), administered by the Space and Naval
  24. # Warfare System Center San Diego under Contract No. N66001-00-C-8066
  25. #
  26. $ftp_port=21;
  27. $num_ftp=0;
  28. while (<>)  {
  29.         ($time1,$time2,$ip11,$ip12,$ip13,$ip14,$srcPort,$dummy1,$ip21,$ip22,$ip23,$ip24,$dstPort,$dummy2) = split(/[.:() ]/,$_);
  30. #        ($time1,$time2,$dummy0,$ip11,$ip12,$ip13,$ip14,$srcPort,$dummy1,$ip21,$ip22,$ip23,$ip24,$dstPort,$dummy2) = split(/[.:() ]/,$_);
  31. #        $dummy0="";
  32.         $dummy1="";
  33.         $dummy2="";
  34. $time1=0;
  35. $time2=0;
  36. $src=join(".",$ip11,$ip12,$ip13,$ip14);
  37. $dst=join(".",$ip21,$ip22,$ip23,$ip24);
  38.         if ($srcPort eq $ftp_port) {
  39.     $ftpc=$dst;
  40.         } elsif ($dstPort eq $ftp_port) {
  41.     $ftpc=$src;
  42. } else {
  43. print "Something is wrong!!n";
  44. }
  45. $found=0;
  46. foreach $j (0 .. $#ftpC) {
  47. if ($ftpc eq $ftpC[$j]) {
  48.       $found=1;
  49.    }
  50. }
  51. if ($found eq 0) {
  52. $ftpC[$num_ftp]=$ftpc;
  53. $num_ftp++;
  54. }
  55. }
  56. foreach $j (0 .. $#ftpC) {
  57. print "$ftpC[$j]n";
  58. }