Arp populating scan script

I wrote a very simple “for” loop a week or two ago to ping everything on a network and populate the arp table so I could get a list of mac addresses. I found it today and wanted to improve it a bit, I found a script by DavidPostell ,on Superuser.com, and used his batch script to improve mine dramatically. Basically, with the code he wrote, I was able to quickly parse out the first 3 octets of my computers IP address, and use that instead of needing to edit the batch file for every network. Feel free to use this for whatever, it was just a fun short exercise me and I thought it might be useful if you wanted to get mac addresses. It saves some of the output to a file, but deletes the file after presenting it to you, but you can add a “rem” to the line that starts out “del pscan…”, or remove the line. Why did I spend time on this is a question for another day. While this was nearly a complete waste of time, I think a neat addition to this could be to print out all the numbers, then redraw the entire screen after each success or fail, and colorize the numbers, additionally redrawing with the ip-arp mappings as well as response time across the bottom, which would give it a really ncurses-ey type feel, but also be an enormous amount of resources for something whose goal is to simply fill an arp table.  Better would be to write it out to a json file and upload it to a server so I can use it in another project I’m working on.

 

pscan.bat

@echo off
setlocal
setlocal enabledelayedexpansion
for /f "usebackq tokens=*" %%a in (`ipconfig ^| findstr /i "ipv4"`) do (
for /f delims^=^:^ tokens^=2 %%b in ('echo %%a') do (
for /f "tokens=1-4 delims=." %%c in ("%%b") do (
set _o1=%%c
set _o2=%%d
set _o3=%%e
set _o4=%%f
set _3octet=!_o1:~1!.!_o2!.!_o3!.
echo scanning !_3octet!1-254 
for /l %%x in (1,1,254) do (
ping -n 1 %%c.%%d.%%e.%%x |findstr Reply |findstr bytes >>pscan.bat.output.txt
echo|set /p =...%%x
)
echo.
echo:
arp -a >>pscan.bat.output.txt
more pscan.bat.output.txt >nul 2>&1
del pscan.bat.output.txt >nul 2>&1
)
)
)
endlocal

Here is  a download for the batch file, it is renamed as .txt, so you will need to change that, but it should work if the formatting above is messed up.

pscan.bat


Securing Server 2012, 2016 Quick Links

I will be adding to this as time goes on to include basic usage instructions and more tools or methods, but these are a few links to help with setting up and locking down Server 2012/16.

Microsoft Compliance Manager – Technet – Application

NIST Server 2016 Security checklist (docs and more)

NIST Server 2012 Security Checklist (docs and more)

Microsoft Virtual Academy – AD and Server 12/16 videos

LOG-MD – (do logging better) – Tool

Active Directory docs from adSecurity

 

 

Should I Rent or buy equipment for my home network?

This is a common rant I make on social networking sites, so I figured I’d just make it here and use the article to drive traffic to my blog. This article is geared to people in the US. I personally highly favor Ubiquiti wireless gear, because it is insanely reliable, they didn’t pay me. Other companies offer similar equipment and support to Ubiquiti, I don’t use them, I’m not implying they are bad.

From every possible angle, it is better to purchase your own equipment instead of renting equipment from your ISP.

Why renting stinks…

Your ISP will be more than happy to rent you a Modem/Router/Wireless access point combo. It’s almost the same device you can buy on Amazon or a local big box store. The drawback is they “brand” it. They customize the software on the device. It basically does exactly the same thing, but with different menus. I think there is a logical fallacy with that, essentially, Arris, Motorola, and a few other, specialize in making modems and network gear. Your ISP specializes in selling you internet, TV, and phone service. Your ISP reprograms these devices from manufacturers. The manufacturers made something that worked, the ISP threw the software away and tried their best to do it themselves.

Reliability rented modems are WAY more likely to fail. I would guess it’s because of inefficient or poor programming, but I can say with confidence that Arris Modems from Arris usually do not have an issue until they get unplugged, then the issue is that the device is unplugged. The ISP modems are almost ALWAYS refurbished, and they typically fail at least once every 6 months, but generally more often.

Cost – Generally not a lot (~$10/mo) , but over a 2 year period is ~$240. In addition to set up fee (generally waived) and service call fees (generally $50/visit). Assuming in 2 years you have 2 service calls, that’s $340+ in a two year period. In a 5 year period its ~$840, assuming 1 service call a year, which based on my experience is common for most consumers, with no service calls over a 5 year period, its ~$600. So… $600-$840 over a 5 year period.

Energy – Dealing with some guy who barely speaks english is a hassle, waiting on hold is a hassle. I don’t think this requires any explanation.

Why buying your own is better

Reliability – Most Arris or Motorola modems that do not have customized software on them generally just work, and can be expected to do so for a VERY long time. I have some that have been in a closet, connected to the internet for 5+ years. They generally only need to be replaced when you upgrade to a bandwidth tier that current (old) modem does not support or it gets fried. by an electrical surge (a Battery like the one below can effectively prevent this).

Cost – based on my experience, I expect to get ~5 years out of any networking gear I purchase.
I will spend ~$40 on a standalone modem on Amazon.
I will spend ~$50 on a Router that works with my preferred AP on Amazon
I will spend ~$120 on each Wireless access point on amazon, Most people only need one.

Thats $210. That’s less than it costs to rent a less reliable device from your ISP for 2 years. I expect this equipment to last 5 years, and it most likely will. Because of the savings, I will also go ahead and purchase an APC Backup Battery, so when the power goes out I still get to surf the internet on my laptop.

Assuming 1 service call per year from a technician (maybe not my ISP because it’s not their gear) the cost goes up to $460, with the battery the cost over 5 years goes to ~$510. With your own equipment, I can say it is much less likely for failures to happen which require a  service call.

Lastly, when your gear fails, you only have to replace the part that broke, so the cost continues to go down over 10, 15, and even 20 years. You might say there are security implications, that’s why I choose ubiquiti devices. Other companies make comparable stuff, but I have ubiquiti gear in client locations that is pushing 7 and 8 years at this point, and it still get software updates and even without the updates, there have not been any known, reasonable vulnerabilities to the devices in that time.

I think in most cases the savings over a five year period is much more likely to be closer to the more optimistic end of a total cost of $210 dollars. With the benefit of a much, much more reliable network.

I’ll be updating this article over time.

Image licensed for reuse – Original here