LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Closed Thread
  Search this Thread
Old 04-07-2003, 10:55 PM   #1
doublefailure
Member
 
Registered: Mar 2002
Location: ma
Distribution: slackware
Posts: 747

Rep: Reputation: 30
i want to capture a certain packets..


hello

here's what i want to do and i need some starting points
thanks in advance

when i search google and google returns
i'd like to catch the packets and do something
and pass on the packets to the browser.

i 've got this answer from someone but i don't have any idea about iptables.

set up an iptables rule to forward the packets from google.com to the QUEUE target...and in your program, use libipq to bind to the netlink socket, and then read from that socket, your program will wake up when a packet arrives..you can then do whatever you need to do, and supply the verdict for what to do with the packet back to the kernel, possibly modifying the packet too

if someone can elaborate this, it'll be very helpful

thank you

Last edited by doublefailure; 04-08-2003 at 12:21 AM.
 
Old 04-08-2003, 06:43 AM   #2
doublefailure
Member
 
Registered: Mar 2002
Location: ma
Distribution: slackware
Posts: 747

Original Poster
Rep: Reputation: 30
well.

i found this site
http://www.linuxguruz.org/iptables/t...ut1/tut-6.html

but never be able to figure out how to compile and use it.


what am i supposed to do with this code? --;

excerpt
-------------
This is the lowest layer of hooking into the kernel stack

You can write your own kernel modules which hook directly into the IP stack (or others)

/* Rusty's Dumb netfilter hook example */
#include <linux/config.h>
#include <linux/module.h>
#include <linux/netfilter_ipv4.h>
#include <linux/ip.h>

/* The work comes in here from netfilter.c. */
static unsigned int
stupid_hook(unsigned int hook,
struct sk_buff **pskb,
const struct net_device *indev,
const struct net_device *outdev,
int (*okfn)(struct sk_buff *))
{
if ((*pskb)->len == 200)
return NF_DROP;

return NF_ACCEPT;
}

static struct nf_hook_ops stupid_ops
= { { NULL, NULL }, stupid_hook, PF_INET, NF_IP_POST_ROUTING, 0 };

static int __init init(void)
{
return nf_register_hook(&stupid_ops);
}

static void __exit fini(void)
{
nf_unregister_hook(&linuxmag_ops);
}

module_init(init);
module_exit(fini);
 
Old 04-08-2003, 07:05 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
That's module code IIRC. See http://www.tldp.org/HOWTO/Module-HOWTO/index.html

Can I go back to the start and ask what properties or content you want to mangle the packets for?
If you're doing really simple replacements in packets, you could use something like netsed, if you want to spy on http traffic @stake (L0pht) or zone-h.org have a proxy for that, or if it's just changes in the content you could use a rewriting proxy like Privoxy...
 
Old 04-08-2003, 05:28 PM   #4
doublefailure
Member
 
Registered: Mar 2002
Location: ma
Distribution: slackware
Posts: 747

Original Poster
Rep: Reputation: 30
thanks unSpawn

i want to do some analysis on the documents that Google returns.

so i wouldn't change the IP packet that go to my browser
but rather look at data(links) on the return page and grab pages that links point to and hopefully do some interesting things with the pages.


i haven't looked at the module howto.. i'm going to now
 
Old 04-08-2003, 05:38 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Sounds interesting. So we're talking HTTP here (layer 6), not TCP/IP (4)... Couldya hint at *what* you're looking for?
 
Old 04-09-2003, 12:01 AM   #6
doublefailure
Member
 
Registered: Mar 2002
Location: ma
Distribution: slackware
Posts: 747

Original Poster
Rep: Reputation: 30
i hope this turns out to be interesting =)
well it's simple..

when google returns 30 results(my default)
if i am after specific answer for a specific question.
i can just read first 1-3 returns.. no big deal.


if i'm after a rather long information.. like "machine learning tutorial"
i'd like to know which one is the easiest one i can read

how to sort out the difficulty will be hard but i'm just into it.. =)
 
Old 04-09-2003, 05:49 AM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Uh. Ok.
Kinda reminds me of "browser helpers", IIRC Alexa was one of them in them Wintendo yrs, that let you know if ppl recommend a site/page/doc.
IMO methods like weighing, ranking, recommendation schemes, even if they where based on browsing behaviour, personal profile and knowledge such seemed more restricting than helpfull to me. Especially when you're eager to get *off* trodden paths...
So hard it will be, yes :-]
 
Old 01-10-2012, 02:03 AM   #8
oracle89divi22
LQ Newbie
 
Registered: Dec 2011
Posts: 10

Rep: Reputation: Disabled
Smile

thanks seriously.... u guys made me do stuff....learn stuff...... i had been asking someone to help me coz i felt helpless coz i had nothing to start with not even a single example to start with i read several ebooks but nothing helped... but ur words brought me to realize that its me who wasnt serious enuf to help myself and thanks for all that you all helped i paved my way myself....and i have written my first netfilter code just becaue i was totally determined... go bless you all......thanks once again......

i know this is a technical thread and not emotional chit chat thread but could hold myself from thanking you and many others....:-) keep doing the good work of showing a candle so that someone can be as bright as star..... thanks

Last edited by oracle89divi22; 01-14-2012 at 09:20 AM.
 
Old 01-13-2012, 09:14 AM   #9
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by oracle89divi22 View Post
hey did you manage to read the packets at the end? i'm doing my main project and need to access packets from tcp/ip using netlink. can you mail me your code on divya.n116@gmail.com its really urgent...
i need to access the packets and send its data to the userspace....

thanks in advance
Wow, seriously???? You re-opened a NINE YEAR OLD THREAD, to ask someone to mail you code, because your project is behind, and say it's 'urgent'???

No, this isn't urgent for ANYONE here, the OP has moved on LONG ago, and no one here is going to email you. This is a community forum, not the place to come for free, personalized, one-on-one email tech support.
 
Old 01-14-2012, 09:36 AM   #10
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
A highjacking, necropost was modified to another post entirely. Since the original post by oracle89divi22 seemed related to another post about writing a root it, I'm closing this years old thread to let it die.
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
IV packets kyd Linux - Networking 1 07-30-2005 12:21 PM
packets sent VS packets received fsasya Linux - Networking 0 07-18-2004 07:11 PM
encapsulating TCP packets in UDP packets... yoshi95 Programming 3 06-03-2004 02:53 PM
anybody know what these packets are ? mr.moto Linux - Security 3 03-25-2003 03:17 AM
packets per second ixion Linux - Networking 1 01-28-2003 06:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration