-
Notifications
You must be signed in to change notification settings - Fork 93
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
[request] check if a specific ipaddress belongs to a specific cidr. #4
Comments
Hi @dogasantos, Thank you for sharing feedback and insights on what you trying to do, just to make sure I get the idea that looks something like this:- cat ips.txt | mapcidr -l cidr.txt This will print only IPs from |
Hi ! I have a prefix.txt file with 1372 lines, each one is a CIDR. Some large, some small.
This seems to be very close, although it will require a bash loop for each cidr right? I've created a small snippet you can find here: Once again, thanks guys! |
Hi @dogasantos,
that's not supported yet, I was just sharing an example of how it will look like :D and thank you for sharing the project, I guess I got this right, so now we will discuss this and see if we can add support for this mapCIDR itself, for sure useful for cases like you mentioned. cat ips.sample
./prefixcheck cidr.sample ips.sample
# Takes input of CIDR and IPs and prints IPs belongs to known CIDR only.
10.0.0.22
192.168.1.240
172.16.45.1
172.16.49.240
172.16.47.1
172.16.43.1 |
Thank you @bauthard ! |
On hold until #6 is merged (it adds in memory cidr support) |
@dogasantos this support is added into mapCIDR dev branch with #8 Here is an example of how you can make use of this:- # Prints IP belongs to input CIDRs
./mapcidr -ips ip-list.txt -l cidrs.txt
# Prints IP belongs to input CIDRs
cat cidrs.txt | ./mapcidr -ips ip-list.txt |
@ehsandeep |
@dogasantos with the latest release, now we can look for both match and filter IPs from input and slight update in CLI flag as well, see https://github.com/projectdiscovery/mapcidr#match--filter-ips-from-cidr for the details. |
fantastic! |
Hi guys,
first of all, thanks for this tool. I found it VERY useful.
I'm trying to lear Go by translating my python scripts to go and also improving dumb steps on my recon process.
With this in mind, I've identified a small step that can be translated to a go tool.
Here is some context:
I'm matching a domain-based recon against a ASN-based recon in order to filter which hosts are "hosted" inside an org.
In order to do that, I'm using mapcidr to expand each ipv4 prefix and save into a (500mb) file. The next step is to loop every single ip address found by dnsx/massdns and save all matches into a separated file. That "match" is done using grep, which is dumb and terrible.
My snippet
My snippet will loop each ipaddr found by dnsx, loop the prefixes, expand a single prefix at a time (might store on a slice or list to be faster in reuse). Then it should look if a specific ipaddress belongs to that prefix, if we have a match, just save that IP on a slice to handle it later.
Why I'm coming to you
This is a very useful feature that poses a critical step on my recon process and I believe it might help a lot of people.
My snippet won't be elegant, won't be the best way to do this, as I'm just taking my firsts steps into golang.
As this might be a simple update, would it be possible to add this feature in the core of mapcidr at some point in the future?
If you guys feel this won't be useful nor interesting enough, I'll understand.
Ty!
The text was updated successfully, but these errors were encountered: