GithubHelp home page GithubHelp logo

Comments (9)

ehsandeep avatar ehsandeep commented on June 24, 2024 1

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 ips.txt that belongs to CIDR range cidr.txt? also, do you prefer to get value printed or boolean flag to print true or false? let me know if this is what are you looking for, if not can you please share some examples.

from mapcidr.

Mzack9999 avatar Mzack9999 commented on June 24, 2024 1

On hold until #6 is merged (it adds in memory cidr support)

from mapcidr.

dogasantos avatar dogasantos commented on June 24, 2024

Hi !
Thanks for your response!

I have a prefix.txt file with 1372 lines, each one is a CIDR. Some large, some small.
I also have a list of single ips (/32) that I would like to check if they belong to any of those CIDR prefixes.
As result, I should have a filtered list of ips that are directly related with the ASN.

cat ips.txt | mapcidr -l cidr.txt

This seems to be very close, although it will require a bash loop for each cidr right?
Also, ips.txt also needs to contain CIDR (I've tested here and I got a [FTL] invalid CIDR address: 192.168.1.1 as example)

I've created a small snippet you can find here:
https://github.com/dogasantos/prefixcheck

Once again, thanks guys!

from mapcidr.

ehsandeep avatar ehsandeep commented on June 24, 2024

Hi @dogasantos,

Also, ips.txt also needs to contain CIDR (I've tested here and I got a [FTL] invalid CIDR address: 192.168.1.1 as example)

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
200.200.200.200
192.168.2.2
192.168.2.99
192.168.70.33
192.168.1.240
192.168.240.1
10.0.0.22
10.0.1.33
10.0.90.9
172.16.45.1
172.16.43.1
172.16.47.1
cat cidr.sample 

192.168.1.0/24
10.0.0.0/24
172.16.0.0/17
./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

from mapcidr.

dogasantos avatar dogasantos commented on June 24, 2024

Thank you @bauthard !
It would be fantastic!

from mapcidr.

ehsandeep avatar ehsandeep commented on June 24, 2024

@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

from mapcidr.

dogasantos avatar dogasantos commented on June 24, 2024

@ehsandeep
Fantastic!
Thanks for the update!

from mapcidr.

ehsandeep avatar ehsandeep commented on June 24, 2024

@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.

from mapcidr.

dogasantos avatar dogasantos commented on June 24, 2024

fantastic!
thank you @ehsandeep !!

from mapcidr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.