Monday, December 11, 2017

#1 2017-11-25 09:22:34 am

lotr
Member
Registered: 2011-08-22
Posts: 80
Website

CIDR to subnetmask text converter

I can’t even get started on this script. yikes I hope someone can help me get started.

The files I personally need to be converted don’t use /32 for individual listings, instead just list the main ip address. Thus to make this a universal script for anybody to use it should use two approaches to cater for the suggested scenario.

1. Lines of the document that do not contain “/“ add “/255.255.255.255” to EOL is my thought of how to approach it.
2. All others would be replacements for their subnetmask equivalents such as:
“/32“ to “/255.255.255.255”
“/31“ to “/255.255.255.254”
“/30“ to “/255.255.255.252”
“/29“ to “/255.255.255.248”
“/28“ to “/255.255.255.240”
“/27“ to “/255.255.255.224”
etc.


The files needing conversion are between 1,800 up to half a million listings. Not a practical thing to do manually. big_smile
My particular purpose is for block-lists to block out net BOTs.

Model: MacPro 2008 (3,1)
AppleScript: 2.8.1 (183.1)
Browser: Firefox 57.0
Operating System: Mac OS X (10.11.6)


The shy can light the dull dark room rich with life when their eyes mirror their inner sunrise

Offline

 

#2 2017-11-27 03:56:37 pm

t.spoon
Member
From:: BFE, Massachusetts
Registered: 2013-01-13
Posts: 211

Re: CIDR to subnetmask text converter

I'm afraid I'm not fully understanding what the input and output files would look like, and if other people are having the same problem, that could be why you don't have any answers yet.

Could you give us an example or two of (truncated) input files and what the corresponding output file would look like?


Hackintosh built February, 2012 |  Mac OS Sierra
GIGABYTE GA-Z68X-UD3H-B3 | Core i5 2500k | 16 GB DDR3 | GIGABYTE Geforce 1050 TI 4GB
250 GB Samsung 850 EVO | 4 TB RAID
Dell Ultrasharp U3011 | Dell Ultrasharp 2007FPb

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)