TS UDP packet capture using Perl.

TS UDP packet capture using Perl.

am 25.03.2011 06:43:09 von Chandrashekar Bhat

--20cf303f6708dce548049f4812c6
Content-Type: text/plain; charset=ISO-8859-1

Hi All,

I am looking for something capturing UDP packet on a server. These are
MpegTS packets, which will have TS data, PAT/PMT and Video Audio PIDs.
I am able to check that packets are coming fine or not using tcpdump.


system(" tcpdump -v -i eth1 dst 227.1.1.0 > file.txt & ");
my $PID=`ps aux | grep 'tcpdump ' | grep -v grep | awk '{print
\$2}'`;
chomp($PID);
print "SLEEEPING FOR 5 seconds....\n";
sleep(5);
print "KILLING PROCESS ID ------->|$PID|\n";
system("kill -9 $PID");
my $LINES=`wc -l file.txt | awk '{ print \$1}'`;
chomp($LINES);
if($LINES > 5) {
print "SUCCESS..\n";
} else {
print "FAIL...UDP Packets are not coming\n";
}


above code works fine. But i am not able to look for packet with TS details.
After googling, i found that i need to use TS analyzer, that would be
difficult as TS analyzers are software without command line (as i need to
automate testing :( .. ).

Has anybody come across capturing TS UDP packets using Perl?
Any pointers will be helpful.

Thanks,
Shekar

--20cf303f6708dce548049f4812c6--

Re: TS UDP packet capture using Perl.

am 25.03.2011 07:58:35 von Ted Mittelstaedt

what about dvbsnoop that is command line?

Ted

On 3/24/2011 10:43 PM, Chandrashekar Bhat wrote:
> Hi All,
>
> I am looking for something capturing UDP packet on a server. These are
> MpegTS packets, which will have TS data, PAT/PMT and Video Audio PIDs.
> I am able to check that packets are coming fine or not using tcpdump.
>
>
> system(" tcpdump -v -i eth1 dst 227.1.1.0> file.txt& ");
> my $PID=`ps aux | grep 'tcpdump ' | grep -v grep | awk '{print
> \$2}'`;
> chomp($PID);
> print "SLEEEPING FOR 5 seconds....\n";
> sleep(5);
> print "KILLING PROCESS ID ------->|$PID|\n";
> system("kill -9 $PID");
> my $LINES=`wc -l file.txt | awk '{ print \$1}'`;
> chomp($LINES);
> if($LINES> 5) {
> print "SUCCESS..\n";
> } else {
> print "FAIL...UDP Packets are not coming\n";
> }
>

>
> above code works fine. But i am not able to look for packet with TS details.
> After googling, i found that i need to use TS analyzer, that would be
> difficult as TS analyzers are software without command line (as i need to
> automate testing :( .. ).
>
> Has anybody come across capturing TS UDP packets using Perl?
> Any pointers will be helpful.
>
> Thanks,
> Shekar
>


--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: TS UDP packet capture using Perl.

am 25.03.2011 08:16:53 von Chandrashekar Bhat

--bcaec51a70980da3c3049f4962c8
Content-Type: text/plain; charset=ISO-8859-1

Hi Ted,

Thank you for the reply. Will look into 'dvbsnoop'.

Thanks,
Shekar



On Fri, Mar 25, 2011 at 12:28 PM, Ted Mittelstaedt wrote:

> what about dvbsnoop that is command line?
>
> Ted
>
>
> On 3/24/2011 10:43 PM, Chandrashekar Bhat wrote:
>
>> Hi All,
>>
>> I am looking for something capturing UDP packet on a server. These are
>> MpegTS packets, which will have TS data, PAT/PMT and Video Audio PIDs.
>> I am able to check that packets are coming fine or not using tcpdump.
>>
>>
>> system(" tcpdump -v -i eth1 dst 227.1.1.0> file.txt& ");
>> my $PID=`ps aux | grep 'tcpdump ' | grep -v grep | awk '{print
>> \$2}'`;
>> chomp($PID);
>> print "SLEEEPING FOR 5 seconds....\n";
>> sleep(5);
>> print "KILLING PROCESS ID ------->|$PID|\n";
>> system("kill -9 $PID");
>> my $LINES=`wc -l file.txt | awk '{ print \$1}'`;
>> chomp($LINES);
>> if($LINES> 5) {
>> print "SUCCESS..\n";
>> } else {
>> print "FAIL...UDP Packets are not coming\n";
>> }
>>

>>
>> above code works fine. But i am not able to look for packet with TS
>> details.
>> After googling, i found that i need to use TS analyzer, that would be
>> difficult as TS analyzers are software without command line (as i need to
>> automate testing :( .. ).
>>
>> Has anybody come across capturing TS UDP packets using Perl?
>> Any pointers will be helpful.
>>
>> Thanks,
>> Shekar
>>
>>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
>

--bcaec51a70980da3c3049f4962c8--

Re: TS UDP packet capture using Perl.

am 25.03.2011 15:25:02 von Brad Lhotsky

Or, you could take a look at Net::Pcap which provides a native interface
for libpcap in Perl (the library behind tcpdump). There are
excellent examples included. You can even use NetPacket to decode and
analyze the packets! ;)

On Fri, Mar 25, 2011 at 12:46:53PM +0530, Chandrashekar Bhat wrote:
> Hi Ted,
>
> Thank you for the reply. Will look into 'dvbsnoop'.
>
> Thanks,
> Shekar
>
>
>
> On Fri, Mar 25, 2011 at 12:28 PM, Ted Mittelstaedt wrote:
>
> > what about dvbsnoop that is command line?
> >
> > Ted
> >
> >
> > On 3/24/2011 10:43 PM, Chandrashekar Bhat wrote:
> >
> >> Hi All,
> >>
> >> I am looking for something capturing UDP packet on a server. These are
> >> MpegTS packets, which will have TS data, PAT/PMT and Video Audio PIDs.
> >> I am able to check that packets are coming fine or not using tcpdump.
> >>
> >>
> >> system(" tcpdump -v -i eth1 dst 227.1.1.0> file.txt& ");
> >> my $PID=`ps aux | grep 'tcpdump ' | grep -v grep | awk '{print
> >> \$2}'`;
> >> chomp($PID);
> >> print "SLEEEPING FOR 5 seconds....\n";
> >> sleep(5);
> >> print "KILLING PROCESS ID ------->|$PID|\n";
> >> system("kill -9 $PID");
> >> my $LINES=`wc -l file.txt | awk '{ print \$1}'`;
> >> chomp($LINES);
> >> if($LINES> 5) {
> >> print "SUCCESS..\n";
> >> } else {
> >> print "FAIL...UDP Packets are not coming\n";
> >> }
> >>

> >>
> >> above code works fine. But i am not able to look for packet with TS
> >> details.
> >> After googling, i found that i need to use TS analyzer, that would be
> >> difficult as TS analyzers are software without command line (as i need to
> >> automate testing :( .. ).
> >>
> >> Has anybody come across capturing TS UDP packets using Perl?
> >> Any pointers will be helpful.
> >>
> >> Thanks,
> >> Shekar
> >>
> >>
> >
> > --
> > To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> > For additional commands, e-mail: beginners-help@perl.org
> > http://learn.perl.org/
> >
> >
> >

--
Brad Lhotsky

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/