随笔分类 -  Perl

摘要:Web日志审计与网络监控集合一身的平台功能介绍:1)Web日志审计监控目前支持的日志类型有: (1)APACHE (2)Nginx2)图形报表出色的报表数据提高用户感知,从曲线图以及展现的数据中能够体现出年、月、日的数据量。 根据个人需求,还可自定义操作日志数据。3)网络监控基于Web是否能够请求成功,是否可到达。 基于网络设备是否能ping通,是否可以到达。4)Web监控规则优势添加触发量统计,并能通过触发量改良规则。 利用专属的REGEX工具能够快速编写正则规则,不需要受到各种约束。 从本质上与别的SOC无区别,但是使用起来比其它的方便。 且该平台全部中文,可进行二次开发。5)采用轻量级框 阅读全文
posted @ 2013-12-04 09:44 墨迹哥's 阅读(419) 评论(0) 推荐(0)
摘要:分析了一下Tracert的实现脚本,自己思考了一下具体如何实现。其中在Linux下应该叫traceroute。这个模块相对介绍的比较模糊,CPAN上出的都是一些比较模糊的介绍,让人比较纠结。只能对参数进行测试,测出来的。先看下案例把:#!/usr/bin/perluse Net::Traceroute::PurePerl;my $tr = new Net::Traceroute::PurePerl( host => '163.com', debug => 0, query_timeout => 1, packetlen ... 阅读全文
posted @ 2013-11-22 09:31 墨迹哥's 阅读(485) 评论(0) 推荐(0)
摘要:#!/usr/bin/perluse strict;$|=1;# $Id: traceiface.pl,v 1.1 2007/02/04 22:58:04 jtk Exp $# traceiface - traceroute with extension to discover router egress hop address# TODO: IPv6 supportuse Net::Traceroute::PurePerl;use NetAddr::IP;use Getopt::Std;use Socket;use constant PROGRAM_NAME => 'trace 阅读全文
posted @ 2013-11-21 17:10 墨迹哥's 阅读(282) 评论(0) 推荐(0)
摘要:SOC的功能目前已经完成了,正常接收并处理日志。目前建立规则库中,发现如果一个个弄的话会很负责,所以准备写个完善的程序来做正则校验。提高效率的同时减轻工作量。具体的已经放入GIT仓库了。地址:https://github.com/smarttang/Log_regex_test.git有需求的可以关注下。 阅读全文
posted @ 2013-11-04 12:36 墨迹哥's 阅读(355) 评论(0) 推荐(0)
摘要:平台有个需求要导入信息到MYSQL..分析了下,写了个脚本,几分钟搞定。。。while(){ @tmp=split(/\t/,$_); @xieyi=split(/\//,$tmp[1]); if($xieyi[1] eq 'tcp'){ if($tmp[3]=~m/^\#(.*)/){ print "portname:$tmp[0] port_number:$xieyi[0] port_text:$1 \n"; } }}sub db_insert{ my $name=shift; my $text=shift; my $port=shift; m... 阅读全文
posted @ 2013-10-31 17:45 墨迹哥's 阅读(298) 评论(0) 推荐(0)
摘要:可能脚本会有Bug,我只是用来工作上用一下,具体有没有BUG没测。项目估计马上结束了。 这个入库的是MYSQL的。原理是先Ping,如果通的话,则加入队列,通过队列再进行SYN探测。#!/usr/bin/perluse threads;use DBI;use Thread::Queue;use Thread::Semaphore;use Net::Ping;use Term::ProgressBar;# create queuemy $q=new Thread::Queue;# read for check listmy @target=;my $se_max = Thread::Semaph 阅读全文
posted @ 2013-10-13 19:34 墨迹哥's 阅读(1030) 评论(0) 推荐(0)
摘要:坑爹的是不知道怎么报错。。头疼。。 #!/usr/bin/perl use strict; use DBI; use Net::Ping; my @oder=(); my $in=DBI->connect("DBI:mysql:database=port_scan;host=localhost","root","") or die "NO :$!"; if($in){ print "OK\n"; } my $p = Net::Ping->new("syn"); f 阅读全文
posted @ 2013-10-11 10:26 墨迹哥's 阅读(249) 评论(0) 推荐(0)
摘要:不知道为什么停不下来,坑爹。。#!/usr/bin/perluse threads;use Thread::Queue;use Thread::Semaphore;use Net::Ping;# create queuemy $q=new Thread::Queue;# read for check listmy @target=;my $se_max = Thread::Semaphore->new( 100 );foreach my $ip (@target){ chomp($ip); foreach my $port(1..65535){ $q->enqueue(" 阅读全文
posted @ 2013-10-10 15:47 墨迹哥's 阅读(322) 评论(0) 推荐(0)
摘要:一直研究SYN可行的扫描方案,想了一下,自己模拟写了一个,但是感觉特别不理想。还得修改,mark一下。 #!/usr/bin/perl use threads; use Thread::Queue; use Thread::Semaphore; use Net::Ping; # create queue my $q=new Thread::Queue; # read for check list my @target=; foreach my $ip (@target){ foreach my $port (1..6553... 阅读全文
posted @ 2013-10-10 14:59 墨迹哥's 阅读(191) 评论(0) 推荐(0)
摘要:还是在不断的改写做尝试。做了些小记录把。方便以后翻。。#!/usr/bin/perluse Coro;use AnyEvent::Socket;use AnyEvent::Ping::TCP;my @check_list;my @target=;foreach my $ip (@target){ foreach my $port (1..65535){ push @check_list,async{ $a=tcp_connect $ip => $port, sub { my $fh = shift ... 阅读全文
posted @ 2013-10-10 10:24 墨迹哥's 阅读(399) 评论(0) 推荐(0)
摘要:坑爹的Coro。。想要用协程比较坑爹,还要自己改写。瞬间就疯了。。没办法的情况下,研究了下它的模块代码,具体如下:sub tcp_ping_syn { my $host = shift; my $port = shift; my $timeout = shift || 5; if ((++$PingQueue{$host}{$port}{Requests}) > 1) { # Ping already underway... return; } my $cv = AnyEvent->condvar; my $... 阅读全文
posted @ 2013-10-10 09:46 墨迹哥's 阅读(424) 评论(0) 推荐(0)
摘要:蛮纠结的,本想着后天出差的时候可以用。结果还是不行,还是用多线程吧。原生的东西应该都是比较好的。:(#!/usr/bin/perluse Coro;#use Net::Ping;use AnyEvent::Ping::TCP;my @check_list;my @target=;foreach my $ip (@target){ foreach my $port (1..65535){ push @check_list,async{ nex($ip,$port); } };};foreach (@check_list){ $_->join;};s... 阅读全文
posted @ 2013-10-09 17:34 墨迹哥's 阅读(248) 评论(0) 推荐(0)
摘要:继续研究云总的代码时,发现很纠结的问题。再看代码,试着单月测试的方法研究,始终输出的是数组,感觉不会再爱了。。。。先把上午的活干完,晚上飞机走人了。。#!/usr/bin/perluse URI::URL;use Web::Scraper;use Data::Dumper;my $base_url="http://www.cnblogs.com/";my $host=URI::URL->new($base_url)->host;print "host:$host\n";$scraper=scraper{ process '//a 阅读全文
posted @ 2013-09-30 10:32 墨迹哥's 阅读(201) 评论(0) 推荐(0)
摘要:根据实际的逻辑,综合了各家所长,我决定手工测试下,是否能够写出满意的爬虫.对此还是写出来看看,一边写一边思考,今天写了一点,等回家继续想想.根据逻辑思考,我觉得应该使用队列,和BS算法做基础,还要做链接索引.其中最难的莫过于链接索引了,这个东西还是得思考下的.现在还没想好,等等再看吧.#!/usr/bin/perluse LWP::Simple;use HTML::LinkExtor;use threads;use threads::shared;use Thread::Queue;use Thread::Semaphore;use Bloom::Filter;$base_url=" 阅读全文
posted @ 2013-09-29 23:13 墨迹哥's 阅读(267) 评论(0) 推荐(0)
摘要:这几天忙着做项目和一些W3A的测试,没啥时间研究别的.今天趁着快放假,也给自己放放假吧.看了下云总写的Perl爬虫,发现有多处不懂.但是部分地方算是理解了,看来目标还是很遥远的.给代码加了下注释,不过太累的,准备睡觉了..写了部分,改天补全..凑合着看吧....#!/usr/bin/perluse strict;use warnings;use threads;use threads::shared;use Thread::Queue;use Thread::Semaphore; use Bloom::Filter;use URI::URL;use Web::Scraper;# 设置线程数量 阅读全文
posted @ 2013-09-29 22:07 墨迹哥's 阅读(449) 评论(0) 推荐(0)
摘要:今天研究了下,记录下来。#!/usr/bin/perl use Coro; use AnyEvent::HTTP; my @coro; foreach my $i (1..1000){ push @coro, async{ http_get 'http://www.baidu.com', cb => Coro::rouse_cb; print "开始并发$i...\n"; my @res = Coro::rouse_wait; print "$i返回结果$res[1]-... 阅读全文
posted @ 2013-09-27 17:33 墨迹哥's 阅读(623) 评论(0) 推荐(0)
摘要:use DBmodule;$db_s=new DBmodule;$db_key=$db_s->connect_db('w3a_system','localhost','root','ferbernet!@#!@!');$abk=$db_s->select_db($db_key,"select * from w3a_xser");%log_result=result($abk,'');if(%log_result){ print "匹配"; for}else{ pr 阅读全文
posted @ 2013-08-30 14:47 墨迹哥's 阅读(389) 评论(0) 推荐(0)
摘要:源文本:@font-face { font-family: 'Open Sans'; font-style: normal; font-weight: 300; src: local('Open Sans Light'), local('OpenSans-Light'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/DXI1ORHCpsQm3Vp6mXoaTYnF5uFdDttMLvmWuJdhhgs.ttf) format('truetype' 阅读全文
posted @ 2013-08-12 11:13 墨迹哥's 阅读(494) 评论(0) 推荐(0)
摘要:在CU上看到这个脚本,感觉挺好。具体没细的测试。回头自己可以试着修改,之前就想写个类似的,但是没有时间。#!/usr/bin/perl# Written by FinalBSD at 2008-11-20.# The netstat original written by C# is expensive to me, so this born.# As long as you retain this notice you# can do whatever you want with this stuff. # If we meet some day, and you think# this s 阅读全文
posted @ 2013-08-03 21:25 墨迹哥's 阅读(452) 评论(0) 推荐(0)
摘要:研究结果出来了,看了下仙子的案例,这个是最稳定最靠谱的了。Server端:#!/usr/bin/perluse IO::Socket;use IO::Select;# 如果需要打印到目前终端,需要加上$|++;# 创建一个监听my $socket=IO::Socket::INET->new(LocalAddr =>'192.168.31.60', LocalPort =>9981, Listen =>5, ... 阅读全文
posted @ 2013-08-02 11:58 墨迹哥's 阅读(816) 评论(0) 推荐(0)