Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Catching the command sent by an Internet Button

by Macphisto (Hermit)
on Jul 25, 2000 at 22:55 UTC ( #24318=perlquestion: print w/replies, xml ) Need Help??

Macphisto has asked for the wisdom of the Perl Monks concerning the following question:

Is it possible to catch the command ( kind of "rip" it -- I'm not sure on the terminology, please correct if wrong ) sent when you click on an internet button?
Ex: Catching the command sent when you click on the perl monks login...
  • Comment on Catching the command sent by an Internet Button

Replies are listed 'Best First'.
Re: Catching the command sent by an Internet Button
by chromatic (Archbishop) on Jul 25, 2000 at 23:12 UTC
    Yes, it's trivially easy if you use -- you do it the same way you would with any field:
    # the HTML <input type="submit" name="option" value="first option"> # the Perl use CGI; my $q = CGI->new(); my $option = $q->query('option');
RE: Catching the command sent by an Internet Button
by lhoward (Vicar) on Jul 25, 2000 at 23:11 UTC
    It sounds to me like you're talking about packet sniffing (based on your use of the word "rip"). Packet sniffing is capturing packets from the network and extracing their contents. If this isn't what you're after, then ignore the rest of my post...

    The Net::Pcap, Net::PcapUtils and NetPacket module provides this kind of functionality. However, they will only parse the network layers. You're gonna have to assemble the packets and parse the HTTP headers yourself.

    Here is some sample code that uses those modules to build a simple sniffer that dumps out all HTTP packets (port 80) to the screen. You must be root to run Pcap utilities since they have to open network interfaces in promiscuous mode.

    #!/usr/bin/perl -w use strict; use Net::PcapUtils; use NetPacket::Ethernet; use NetPacket::IP; use NetPacket::TCP; use Data::HexDump; Net::PcapUtils::loop(\&process_pkt, FILTER => 'port 80'); my $i=0; sub process_pkt { my ($user_data,$hdr,$pkt)=@_; my $eth=NetPacket::Ethernet->decode($pkt); if($eth->{type} == 2048){ my $ip=NetPacket::IP->decode($eth->{data}); if($ip->{proto} == 6){ my $tcp=NetPacket::TCP->decode($ip->{data}); print "\n\n$i $ip->{src_ip}($tcp->{src_port}) -> $ip->{dest_ip +}($tcp->{dest_port})\n"; print HexDump $ip->{data}; $i++; } } }
Re: Catching the command sent by an Internet Button
by Macphisto (Hermit) on Jul 25, 2000 at 23:38 UTC
    Ovid, then why isn't that posted anywhere? I'm getting nailed for an unwritten rule. If I had been told about it, I would have avoided such infractions. I have no problem curbing my language, but now it looks like someones going down the list of all my posts and negatively voting them. That's just malicious.

    UPDATE: Wrongo, Ovid, I swear to you I didn't vote you down, I took your post at face value and even edited my post that had the swearing in it.

    UPDATE: Ovid, you're a good guy. " If you shall cleave to my consent, when 'tis, It shall make honour for you. " Macbeth Act II Scene I

    The beatings will continue until morale raises.
Re: Catching the command sent by an Internet Button
by Macphisto (Hermit) on Jul 25, 2000 at 23:08 UTC
    If you're going to vote it down tell me why. You voting it down helps with NOTHING.
    The beatings will continue until morale raises.
      They are probably voting it down because they have no idea what you are trying to ask (it wasn't me - I'm out of votes for another 12 hours or so :) I don't think it is necessarily worth voting down, but you should probably edit the original post and make the question clearer. Using the chatterbox is also an excellent technique when you want to ask a question and are not sure how to phrase it. Don't worry so much about the negative votes - just clean it up a bit, perhaps give feedback to those ho have already answered it below, and it will rise up again. Negative votes on a post can be very disheartening, but it happens to all of us. (Except vroom of course)

Re: Catching the command sent by an Internet Button
by Macphisto (Hermit) on Jul 25, 2000 at 23:48 UTC
    To whomever went on a rampage voting down my most recent posts ( it seems a little odd that posts that have been there for weeks and nobody voted them all seemed to get voted down by one in the span of 3 minutes ), I hope you realize that you're just being a Nimrod. Use your votes how you like, but voting me down because you don't seem to like me is just a waste of both yours and my time. If you have something constructive to say, go ahead and say it, else wise I'll wait for you to knock this post down as well.

      Getting upset at how people vote will likely get you voted down further... People tend to dislike haveing their judgement called into question like that.
      Not that I've voted at all on this thread, I just started reading it, really this is an FYI for you, Macphisto.

        I wasn't commenting on their vote, I was commenting on their lack of explination. Voting me down without explaining why is just useless. It helps neither them, me, nor anyone who reads the thread.

        The beatings will continue until morale raises.
Re: Catching the command sent by an Internet Button
by Macphisto (Hermit) on Jul 25, 2000 at 23:16 UTC
    Thanks for the replies, I'm still waiting for my local bookstore to get the O'Reilly CGI Programming v.2 in. Thanks for replying with some substance instead of just voting my *** down. Gets to be a ***** when people just vote you down with no explination
    The beatings will continue until morale raises.
      Macphisto: well, if it makes you feel better, I just voted this last node down because of the profanity. I appreciate that you are here and are willing to participate in the community and to be honest, I don't have any problem with profanity. My concern is that Perlmonks doesn't turn into another /. Therefore, any post with profanity, insults, or comments in a similar vein I tend to vote down on the theory that this might discourage this tendency. Other than that, it's nothing personal.

      Update: This node just got voted down. I wonder who would have done that. Hmm...

      Update #2: Macphisto swears that it wasn't him and for what it's worth, I believe him. We must have some scoundrel lurking in the shadows. Come out, you vile beast, and show your loathesome face!

      Reminder to self: cut back on the caffeine.</font.

        Ovid marches in with vroom and a couple of Friars

        "There's your loathesome scoundrel, vroom!"

        "Let's get that mask off, and see who it REALLY is!"

        vroom yanks the ski mask from the bound monk...

        *gasp* "It's Mr. Ferguson, the server maid!"

        "That's right! And I would have gotten away with it, too, if it weren't for these meddling kids!"

        - email Ozymandias

        Note to self... take Ridalyn

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://24318]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2022-01-25 02:29 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (65 votes). Check out past polls.