ITPub博客

首页 > IT基础架构 > 网络安全 > fuck_huawei_log.pl

fuck_huawei_log.pl

原创 网络安全 作者:wangzh3 时间:2005-11-26 09:38:51 0 删除 编辑

彩铃网关,各个地市的彩铃平台送话单到ftp服务器上,我写了个程序,取到这些话单,做两件事情,一是ftp到省计费中心的ftp服务器上等他们进行计费处理,二是自己入库进行统计。

最近计费中心发现他们huawei的平台有些话单文件反复出现,就提出质疑。他们说没有重传,那就是我的程序的问题了。好在我记了日志。日志的内容如下:

---------------------------------------------------------------

[2005-11-13 00:00:00] 自动ftp获取话单文件、入库并备份到话单服务器 Version 1.2
[2005-11-13 00:00:00] Copyright @2005 www.zte.com.cn
[2005-11-13 00:00:00] 正在链接至指定FTP服务器(192.168.1.15)...
[2005-11-13 00:00:00] 链接FTP服务器成功!
[2005-11-13 00:00:00] 开始获取话单文件
[2005-11-13 00:00:01] ********enter /crcdr/101/cdr*********
[2005-11-13 00:00:01] ********enter /crcdr/102/cdr*********
[2005-11-13 00:00:01] get cdr file :RING200510210138.752
[2005-11-13 00:00:01] get cdr file :RING200510250506.752
[2005-11-13 00:00:01] get cdr file :RING200510260530.752
[2005-11-13 00:00:01] get cdr file :RING200511122048.752
[2005-11-13 00:00:01] get cdr file :RING200511122049.752
[2005-11-13 00:00:01] ********enter /crcdr/103/cdr*********
[2005-11-13 00:00:01] get cdr file :RING200511128022.769
[2005-11-13 00:00:01] get cdr file :RING200511128023.769
[2005-11-13 00:00:01] ********enter /crcdr/104/cdr*********
[2005-11-13 00:00:01] get cdr file :RING200510261860.757
[2005-11-13 00:00:01] get cdr file :RING200510261861.757
[2005-11-13 00:00:01] get cdr file :RING200511022363.757
[2005-11-13 00:00:01] get cdr file :RING200511082831.757
[2005-11-13 00:00:01] get cdr file :RING200511082859.757
[2005-11-13 00:00:02] get cdr file :RING200511082861.757
[2005-11-13 00:00:02] get cdr file :RING200511092905.757
[2005-11-13 00:00:02] get cdr file :RING200511113058.757
[2005-11-13 00:00:02] get cdr file :RING200511113070.757
[2005-11-13 00:00:02] get cdr file :RING200511113076.757
[2005-11-13 00:00:02] get cdr file :RING200511123190.757
[2005-11-13 00:00:02] get cdr file :RING200511123191.757
[2005-11-13 00:00:02] ********enter /crcdr/105/cdr*********
[2005-11-13 00:00:02] ********enter /crcdr/106/cdr*********
[2005-11-13 00:00:02] ********enter /crcdr/107/cdr*********
[2005-11-13 00:00:02] get cdr file :RING200510314097.750
[2005-11-13 00:00:02] get cdr file :RING200511044302.750
[2005-11-13 00:00:02] get cdr file :RING200511124744.750
[2005-11-13 00:00:02] get cdr file :RING200511124745.750
[2005-11-13 00:00:02] ********enter /crcdr/108/cdr*********
[2005-11-13 00:00:02] ********enter /crcdr/109/cdr*********
[2005-11-13 00:00:03] ********enter /crcdr/110/cdr*********
[2005-11-13 00:00:03] ********enter /crcdr/111/cdr*********
[2005-11-13 00:00:03] ********enter /crcdr/112/cdr*********
[2005-11-13 00:00:03] get cdr file :RING200511123042.768
[2005-11-13 00:00:03] ********enter /crcdr/113/cdr*********
[2005-11-13 00:00:03] get cdr file :RING200511125880.759
[2005-11-13 00:00:03] get cdr file :RING200511125881.759
[2005-11-13 00:00:03] ********enter /crcdr/114/cdr*********
[2005-11-13 00:00:03] ********enter /crcdr/115/cdr*********
[2005-11-13 00:00:03] ********enter /crcdr/116/cdr*********
[2005-11-13 00:00:03] get cdr file :RING200511122607.754
[2005-11-13 00:00:03] ********enter /crcdr/117/cdr*********
[2005-11-13 00:00:03] ********enter /crcdr/118/cdr*********
[2005-11-13 00:00:03] get cdr file :RING200511123262.662
[2005-11-13 00:00:04] ********enter /crcdr/119/cdr*********
[2005-11-13 00:00:04] ********enter /crcdr/120/cdr*********
[2005-11-13 00:00:04] get cdr file :RING200511122687.663
[2005-11-13 00:00:04] ********enter /crcdr/121/cdr*********
[2005-11-13 00:00:04] ********enter /crcdr/200/cdr*********
[2005-11-13 00:00:04] ftp话单文件完毕
[2005-11-13 00:00:04] 退出ftp
[2005-11-13 00:00:04] 正在链接至指定备份FTP服务器(192.168.2.11)...
[2005-11-13 00:00:04] 在备份ftp服务器(192.168.2.11)上配置了备份目录/crgw/crcdr/gzjf
[2005-11-13 00:00:04] 在备份ftp服务器(192.168.2.11)上配置了备份目录/crgw/crcdr/crgw_bak
[2005-11-13 00:00:04] 登陆备份ftp服务器(192.168.2.11),开始备份话单文件
[2005-11-13 00:00:04] backup cdr file: RING200510210138.752
[2005-11-13 00:00:04] backup cdr file: RING200510250506.752
[2005-11-13 00:00:04] backup cdr file: RING200510260530.752
[2005-11-13 00:00:04] backup cdr file: RING200511122048.752
[2005-11-13 00:00:04] backup cdr file: RING200511122049.752
[2005-11-13 00:00:04] backup cdr file: RING200511128022.769
[2005-11-13 00:00:04] backup cdr file: RING200511128023.769
[2005-11-13 00:00:04] backup cdr file: RING200510261860.757
[2005-11-13 00:00:04] backup cdr file: RING200510261861.757
[2005-11-13 00:00:04] backup cdr file: RING200511022363.757
[2005-11-13 00:00:04] backup cdr file: RING200511082831.757
[2005-11-13 00:00:04] backup cdr file: RING200511082859.757
[2005-11-13 00:00:04] backup cdr file: RING200511082861.757
[2005-11-13 00:00:04] backup cdr file: RING200511092905.757
[2005-11-13 00:00:04] backup cdr file: RING200511113058.757
[2005-11-13 00:00:04] backup cdr file: RING200511113070.757
[2005-11-13 00:00:04] backup cdr file: RING200511113076.757
[2005-11-13 00:00:04] backup cdr file: RING200511123190.757
[2005-11-13 00:00:04] backup cdr file: RING200511123191.757
[2005-11-13 00:00:04] backup cdr file: RING200510314097.750
[2005-11-13 00:00:04] backup cdr file: RING200511044302.750
[2005-11-13 00:00:04] backup cdr file: RING200511124744.750
[2005-11-13 00:00:04] backup cdr file: RING200511124745.750
[2005-11-13 00:00:04] backup cdr file: RING200511123042.768
[2005-11-13 00:00:04] backup cdr file: RING200511125880.759
[2005-11-13 00:00:04] backup cdr file: RING200511125881.759
[2005-11-13 00:00:04] backup cdr file: RING200511122607.754
[2005-11-13 00:00:04] backup cdr file: RING200511123262.662
[2005-11-13 00:00:04] backup cdr file: RING200511122687.663
[2005-11-13 00:00:04] 把cdr话单备份到备份ftp服务器完毕
[2005-11-13 00:00:04] 退出备份ftp服务器
[2005-11-13 00:00:04] 开始转换话单文件
[2005-11-13 00:00:04] 处理话单文件完毕
[2005-11-13 00:00:04] 开始把话单文件入库
[2005-11-13 00:00:04] 配置的环境变量ORACLE_HOME:/home/oracle/OraHome1
[2005-11-13 00:00:04] 目标数据库的tnsname:crgw,
[2005-11-13 00:00:04] indb cdr file: sqlldr.RING200510210138.752
[2005-11-13 00:00:04] indb cdr file: sqlldr.RING200510250506.752
[2005-11-13 00:00:04] indb cdr file: sqlldr.RING200510260530.752
[2005-11-13 00:00:05] indb cdr file: sqlldr.RING200511122048.752
[2005-11-13 00:00:05] indb cdr file: sqlldr.RING200511122049.752
[2005-11-13 00:00:05] indb cdr file: sqlldr.RING200511128022.769
[2005-11-13 00:00:05] indb cdr file: sqlldr.RING200511128023.769
[2005-11-13 00:00:05] indb cdr file: sqlldr.RING200510261860.757
[2005-11-13 00:00:05] indb cdr file: sqlldr.RING200510261861.757
[2005-11-13 00:00:05] indb cdr file: sqlldr.RING200511022363.757
[2005-11-13 00:00:05] indb cdr file: sqlldr.RING200511082831.757
[2005-11-13 00:00:05] indb cdr file: sqlldr.RING200511082859.757
[2005-11-13 00:00:05] indb cdr file: sqlldr.RING200511082861.757
[2005-11-13 00:00:05] indb cdr file: sqlldr.RING200511092905.757
[2005-11-13 00:00:05] indb cdr file: sqlldr.RING200511113058.757
[2005-11-13 00:00:06] indb cdr file: sqlldr.RING200511113070.757
[2005-11-13 00:00:06] indb cdr file: sqlldr.RING200511113076.757
[2005-11-13 00:00:06] indb cdr file: sqlldr.RING200511123190.757
[2005-11-13 00:00:06] indb cdr file: sqlldr.RING200511123191.757
[2005-11-13 00:00:06] indb cdr file: sqlldr.RING200510314097.750
[2005-11-13 00:00:06] indb cdr file: sqlldr.RING200511044302.750
[2005-11-13 00:00:06] indb cdr file: sqlldr.RING200511124744.750
[2005-11-13 00:00:06] indb cdr file: sqlldr.RING200511124745.750
[2005-11-13 00:00:06] indb cdr file: sqlldr.RING200511123042.768
[2005-11-13 00:00:06] indb cdr file: sqlldr.RING200511125880.759
[2005-11-13 00:00:06] indb cdr file: sqlldr.RING200511125881.759
[2005-11-13 00:00:07] indb cdr file: sqlldr.RING200511122607.754
[2005-11-13 00:00:07] indb cdr file: sqlldr.RING200511123262.662
[2005-11-13 00:00:07] indb cdr file: sqlldr.RING200511122687.663
[2005-11-13 00:00:07] indb cdr file fail:sqlldr.RING200511122687.663
[2005-11-13 00:00:07] 话单文件入库完毕
[2005-11-13 00:00:07] 本次任务结束,^_^!

---------------------------------------------------------------

上面是一次日志的情况,所以就要用服把生成的日志打包回来,我进行处理一下,就写了下面的程序。

[@more@]

#执行方法 程序的名称 日志文件1 日志文件2 ...

#程序执行后,在同一个路径下,生成一个文件,包含了所有取到的话单文件名称。之后可以入库进行统计或者在这个perl后面加一段,对话单文件进行统计。

use strict;
use warnings;
use File::Path;
use File::Basename;
use File::Spec::Win32;
use File::Find;
use File::Copy;
use Cwd;


open(RESULTFILE,">>log.txt");

my $file;
foreach $file(@ARGV){

open(RINGFILE,$file);

while()
{
if($_ =~ /get cdr file/ )
{
print RESULTFILE substr($_,36) ;
}
}
close(RINGFILE);
}
close(RESULTFILE);

最后的结果是huawei平台的文件在若干天内反复有很多记录,最多的400多次。

我最后给用服说,产生这个问题的可能性有两种

1、我那个程序只是取了话单文件,没有删除,所以再次取就重复了

2、是他们重传了

但是其他的平台其他的话单文件都是一样的流程,为什么就没有出现反复多次被处理呢?所以可能性只能有一个,就是他们重传了。

真他娘的恶心,和这帮狗屎人打交道。我觉得如果客户告诉我一个问题,我会先去查自己的东西有没有问题,没有我才能说,我不能一开始就肯定的告诉客户,我们的东西没有问题,是他们的东西有问题。所以,是一帮狗屎人,鄙视!

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/47869/viewspace-810726/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 寻找缺失的铃音
请登录后发表评论 登录
全部评论
  • 博文量
    301
  • 访问量
    10831786