Solved

Need help with Script

Posted on 2014-02-19
6
286 Views
Last Modified: 2014-03-05
Greeting Experts,

I am new to scripting and needs some help creating either a “VB script” or “Batch file” that can be used as a template. The purpose of the script is to make some changes to the routing table on a small number of computers (located on factory floors) that have no need for internet access.
What I am looking to do is create a simple script (i.e. template) that our Domain Admins can make changes on the routing table (i.e. route delete & route Add). Meaning the only thing they would need to change is the IP address of each route based sub-net/mask for each of the locations… I would appreciate any help with this problem…


Example of the routing table looking to use in the script template

Route Delete 0.0.0.0
Route add 10.40.XX.XX mask 255.255.255.0 10.25.XX.XX
Route add 170.146.XX.XX mask 255.255.255.0 10.25.XX.XX
Route add 97.107.XX.XX mask 255.255.255.0 10.25.XX.XX
Route add 10.20.XX.XX mask 255.255.255.0 10.25.XX.XX
0
Comment
Question by:amstoots
  • 3
  • 2
6 Comments
 
LVL 35

Expert Comment

by:Kimputer
ID: 39870629
A batch file is the easiest way and the most readable and understandable.
Actually what you just typed is actually almost working (except for the XX's)
Just copy and paste it in notepad and save as a .bat file.
0
 

Author Comment

by:amstoots
ID: 39870654
OK.. that all I need to do.......I should have put this in the original question but didn't ... I looking to do it in stealth mode.... I have done some reading and found you can do something to the effect of following below.. (code below) . Am I on the right track...

Echo off 

Route Delete 0.0.0.0
Route add 10.40.XX.XX mask 255.255.255.0 10.25.XX.XX
Route add 170.146.XX.XX mask 255.255.255.0 10.25.XX.XX
Route add 97.107.XX.XX mask 255.255.255.0 10.25.XX.XX
Route add 10.20.XX.XX mask 255.255.255.0 10.25.XX.XX 

Echo off 

Open in new window

0
 
LVL 35

Expert Comment

by:Kimputer
ID: 39870670
Yes you are on the right track (but still replace the XX). And the last echo off is also not necessary.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 25

Accepted Solution

by:
Fred Marshall earned 500 total points
ID: 39870858
Here is a .bat file that should work.  Just change the variables to the addresses, masks that you want in each case: 1,2,3,4

NOTE: I added -p to make the routes persistent.  If you want them to disappear after a reboot then delete the -p entries.

This .bat file I believe requires that you run it under administrator privilieges.
One way to do that is to create a shortcut to the .bat file and then set the shortcut to run as administrator.

You have to change the file extension from .txt to .bat
route-add.txt
0
 

Author Comment

by:amstoots
ID: 39871440
Is there away to add a "Route Delete  XX.XX.XX.XX for the "-p" in the script in some way... I am just not sure how to work that.... ?
0
 

Author Closing Comment

by:amstoots
ID: 39907241
Thank you
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will help you understand what HashTables are and how to use them in PowerShell.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now