Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject example #54

Open
korczis opened this issue Jul 1, 2016 · 4 comments
Open

Inject example #54

korczis opened this issue Jul 1, 2016 · 4 comments
Labels

Comments

@korczis
Copy link

korczis commented Jul 1, 2016

Please provide example how to inject packet.

PS: README.md says it is possible to use this library for packet injection but I found that pcap_inject is commented out. Is this intended?

@ebfull can you clarify this, please?

From src/raw.rs

// pub fn pcap_inject(arg1: *mut pcap_t, arg2: *const ::libc::c_void,
//                    arg3: size_t) -> ::libc::c_int;

@ryan-robeson
Copy link

Hey,

I just started looking into using this library for my own project yesterday, so I don't have an example for you, but pcap_sendpacket() (src/lib.rs) may do what you want.

From man pcap_inject:

pcap_sendpacket() is like pcap_inject(), but it returns 0 on success, rather than returning the number of bytes written. (pcap_inject() comes from OpenBSD; pcap_sendpacket() comes from WinPcap. Both are provided for compatibility.)

@korczis
Copy link
Author

korczis commented Jul 5, 2016

@ryan-robeson thanks for pointing me to this. I overlooked it for some reason. I will try it and update this issue as soon as possible but I am on vacation right now. Thanks a lot.

@aldanor
Copy link
Collaborator

aldanor commented Mar 10, 2017

Looks like this can be closed?

@stappersg
Copy link
Contributor

To me it looks that #154 provides some clues on packet injection.

@Wojtek242 Wojtek242 modified the milestone: Release 1.0.0 Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants