WHAT'S NEW?
Loading...

Cidr generation algorithm (when ips under provider's domain)

Intro

Today I want to share with you a way I found very useful to generate cidrs using the IPNetwork library from GitHub.

I like the approach I took in here as the idea is to hit the biggest subnets with most ips in use an then go down until the smallest subnets with less ips in. I create groups by the first two octets of the ips provided basically because providers always have a range of these ips.

Tests

In the following algorithm, I use a completely different approach which I've tested with different IP populations. In one of the test, I passed into the function 55 inconsistent ips (remember my limit is 50 cidrs) which using the original code above ends up returning very wide cidrs (/8, /16). With the new algorithm, I only get /32, which is 100% optimisation update. I know 5 are wasted but this scenario is not real under an Internet provider subnet environment.

In a second test, I passed again real production data. The result is very good as I get rid of all the the "/7" and the nine "/8" (161 millions of ips) and now I only get one "/16" (65k ips) as the worst cidr. This is also a huge improvement considering this is real data and I'm basically getting the same result.

The rest are real ranges but still small (21, 24, 28) and orphaned ips (32). Still room for improvement as we don't reach the AWS limit of 50 by 28 free slots.

Solution

Here some code

Results


By moving from the default approach of using IPNetwork.Supernet() method into this, I found out that the generation improved enormously. I moved from 184M available ips in my cidr domain to just 40k available ips. That a HUGE improvemnt right?

Conclusion

I definitely recommend this algorithm to generate cidrs based on ips assigned by a particular provider as these providers typically move in a certain range.

Amazon Web Services policies to modify security groups

Intro

In order for a feature in AWS to edit other feature's security groups we need to define a new policy within IAM option.

There are three different "Actions" we want to allow our feature tu use:
  • AuthorizeSecurityGroupIngress
  • RevokeSecurityGroupIngress
  • DescribeSecurityGroups
For the first two Actions we can define a "Resource" where the policy can only take place. For describing there's no resource level limitation. This way we limit the activity of our feature increasing security.

Code

First create a new policy with the name: CanDo_SecurityGroup

Within the policy paste the following piece of code:

As you can see in the snippet above, with the "Condition" module we can define our own restrictions. In this case our feature will only create or remove security groups with a particular tag value ("yourSecurityGroupTagValue").

Let's crack some stuff


Index


  • Intro
  • Video
  • Specifications
  • References

Intro


Today I bring you a video about a very special gadget. This is the Wifi Pineapple built in San Francisco (California) by the guys from Hack5. Very elegant machine to evaluate your own penetration tests.

Basically, what the Pineapple does is act as "man-in-the-middle" between wifi users and endpoints. It's able to automatically disconnect users and make them connect to Internet through you.



Specifications

There are two main Pineapple devices: Nano ($99) and Tetra ($199). Here some specifications for both:
WiFi Pineapple NANO

WiFi Pineapple NANO

The ultimate WiFi pentest companion, in your pocket.
  • 6th generation WiFi Pineapple software featuring PineAP, web interface and modules
  • Dual discrete 2.4 GHz b/g/n Atheros radios
  • Up to 400 mW per radio with included antennas
  • Integrated Power over USB Ethernet Plug
  • Memory expansion via Micro SD (up to 128 GB)
  • Optional mobile EDC Tactical case and battery
  • USB 2.0 Host accessory expansion port

WiFi Pineapple TETRA

WiFi Pineapple TETRA

The amplified, dual-band (2.4/5 GHz) powerhouse.
  • 6th generation WiFi Pineapple software featuring PineAP, web interface and modules
  • Dual discrete 2.4/5 GHz a/b/g/n Atheros 2:2 MIMO radios
  • 4 onboard Skybridge amplifiers
  • Up to 800 mW per radio with included antennas
  • Integrated Power over USB Ethernet Port
  • Integrated Power over USB Serial Port
  • Onboard NAND Flash (2 GB)
  • USB 2.0 Host and RJ45 Ethernet Ports

References


https://www.wifipineapple.com/
https://www.hak5.org