Comments (12)
I've made a fix on branch issue41
. Plesase, could you test it?
from packetgen.
As said here, I cannot accept #42 for now. I have modified current PR to add OS X's loopback interface detection. Does it suit you?
from packetgen.
@picatz My last proposal is not good. Forget it...
from packetgen.
@picatz I don't known OS X. AF_PACKET is used to get MAC address from an array returned by NetworkInterface.addresses
. Is there no Ethernet on OS X ?
from packetgen.
I was also relatively confused last night when I made the issue.
However, upon some google'n I seem to have found the Socket constant I want to work with on OSX.
Socket
AF_LINK
Link layer interface. Works on osx, and macos stuff.
AF_PACKET
Direct link-layer access. Works on linux.
Example
[1] pry(main)> require 'socket'
=> true
[2] pry(main)> Socket::AF_LINK # works on macos
=> 18
[3] pry(main)> Socket::AF_PACKET # no dice!
NameError: uninitialized constant Socket::AF_PACKET
Did you mean? Socket::AF_CNT
from (pry):3:in `__pry__'
How to Fix
Maybe some sort of method to get the mac address if the other way fails, or a platform check?
def mac_addr
begin
Socket::AF_PACKET # linux
rescue
Socket::AF_LINK # macos
end
end
from packetgen.
The mac address checking worked! But, funny enough, the iface was also not being set properly!
I made a pull request #42 that works for me.
from packetgen.
Ah, I see. So I can see that it's now catching my lo0
loopback by default now.
But, I don't think this really gives me the desired results I'd want for the shell, right? Assumably, it would just load up and be read to rock and roll with my en0
( my default ) interface when I pull up pgconsole
.
In the original code, wasn't it looking originally for the first interface that wasn't lo
? So, wouldn't we want, like, the opposite of the match at first? Then, if that's gone horribly wrong, we use loopback as the default?
from packetgen.
@picatz good point, we don't want to use a loopback interface in the shell.
from packetgen.
@sdaubert Hopefully I did this right: efa5adc
Did the editing on the github website. Haven't done that before. So, I dunno. But, yeah. Works on my end!
from packetgen.
Also, I realized I have my debug line still in the pgconsole in those commits.
from packetgen.
@picatz yes, you can remove it by making a new commit ;-)
from packetgen.
Removed it: 34f7a49
from packetgen.
Related Issues (20)
- Check plugins with prepare-v3.0.0 branch
- How to get source ip of a captured packet faster? HOT 2
- Possible mistake in PacketGen::Header::DNS docs HOT 4
- How to get the queried domain name from an DNS request? HOT 3
- DNS spoofing attack not working? HOT 8
- Assigning a default value to a Types::String field set this field to a Ruby String HOT 1
- Force install on Ruby 3 HOT 3
- Adding HTTP Requests HOT 2
- PcapRub_Wrapper HOT 7
- capture packets from array of interfaces HOT 1
- Unable to activate interface HOT 2
- Packet#dup and Packet#clone do not set magic methods on headers
- Packet#add does not set CString fields
- Packet#add does not set IntString fields
- Remove deprecated methods HOT 1
- Move NetBIOS headers to SMB plugin HOT 1
- Move ESP and IKE headers to a new plugin HOT 1
- Packet#to_w calculates all calculatable fields before sending. HOT 2
- Simplify Header::Base::Bindings HOT 1
- Dot 11 Beacon Packet Not Working Properly HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from packetgen.