Skip to main content

Posts

Showing posts with the label Basic Network Tools

IOT – what is it about?

IOT –  an acronym for Internet of things.
What is IOT? What is it about? What does it do?
IOT composes of two components, Internet and things.
So, what are the things? Things are smart phone, Arduino, Beagle bone, Raspberry Pi, Smart TV’s, Refrigerators, air-condition system or basically any devices or appliances that are capable to be connected to the network or to the Internet.
If those thing, devices or appliances is not connected to the network or internet they are just on their own. They are just things of the people who owned them.
But once they are connected to the Internet and are controlled remotely, then it becomes an IOT the Internet of Things, since they are already part of a larger network. In which, some software or individuals can access to the things remotely.
IOT is a good thing but there will always be individuals who will abuse or do evil things. IOT devices or appliances should be safe and secure. But things are hackable and I guess it will just be a matter of time befo…

PowerShell validate list of email addresses

Validate list of email addresses in a text file and check which email is a valid email and which one has the incorrect format.
PowerShell code below can easily check or validate incorrect email, output will show true if valid email and false if the email is not valid.
To check list of valid emails PowerShell utilizes regex. This is useful to check typo errors when sending out mass email or a list of emails which has not yet been verified.

But of course, the code will not be able to check whether the emails are active or not.

#===============================
$reader = [System.IO.File]::OpenText("c:\all_emails.txt") #get-content can also be used
while($null -ne ($line = $reader.ReadLine())) {
    #$line     $regx="[a-z0-9!#\$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#\$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"
    [regex]::Match($line, $regx, "IgnoreCase ")  |  format-Table success, value -AutoSize }

#========…

PowerShell Test Port Forwarding

Port forwarding is necessary if the device is that needs to connect to the unsecured world of the Internet.
Of course, before opening port or doing any port forwarding make sure that security is in place. Firewall rules, software configuration are properly set, up-to-date anti-virus and other settings that needs to be done to secure the system.
PowerShell can test whether a remote port is open or a Port Forwarding rules on either on the Firewall or router is set correctly.
Here’s a one liner code, to check whether the Port is open or not.
Both one line code below does the same thing, check whether the Port is open or not.
1 . New-Object System.Net.Sockets.TCPClient -ArgumentList "Remote.Public.IP.Address", 3389
2. Test-NetConnection -Port 80 -InformationLevel Detailed

Replace the port number, with any port number to be tested.
If the connected property on the displayed output is true, then the port is open.

More details on the link below: https://technet.microsoft.com/en-us/lib…

Cisco block telnet and SSH access

Block telnet and SSH access to the Cisco router.

The user must have the privilege to change the settings or basically the admin user account.

Block all (telnet and ssh):

  line vty 0 4
  transport input none

sh startup-config (save config and will persist after reboot or shutdown)

sh running-config (config is save but will not persist after reboot or shutdown)

To enable or unblock:

line vty 0 4
 privilege level 15
 login local
 line vty 0 4
transport input telnet ssh

Before rolling out to production be sure to test it out or else you will leave a vulnerability in your network.

Cheers..till next time!

================================ Free Android Apps:
Click on links below to find out more:
Linux Android App cheat sheet: https://play.google.com/store/apps/details?id=com.LinuxMobileKit
Multiplication Table for early learnershttps://play.google.com/store/apps/details?id=com.TableMultiplication
Catholic Rosary Guide  for Android:
https://play.google.com/store/apps/details?id=com.myrosaryapp
http://quickbyte…

Set IP Address using Netsh and PowerShell

How to set IP Address of the remote computer using PowerShell?
How to set DNS IP Address of the remote computer using PowerShell?
How to set static IP and DNS address in local or remote computer via PowerShell?

Script below will set local IP or set remote IP Address using PowerShell with the help of Netsh command.

For the script to work Winrm or Windows Remote Management must be enabled either on the local PC or remote computer or server.
The script of course needs to run at an elevated mode with the proper rights or privileges or in simple words the script will work only if you have the administrator rights.

Here’s the script:
#===============================
$set_IP= { netshinterfaceipsetaddress"Wi-Fi"static192.168.1.107255.255.255.0192.168.1.254}
$set_DNS1= {netshinterfaceipadddns"Wi-Fi"8.8.8.8 }
$SET_DNS2= { netshinterfaceipadddns"Wi-Fi"4.2.2.2index=2  }
$show_ipconfig= { ipconfig/all }

Invoke-Command-ScriptBlock$set_IP-ComputerName. Invoke-Command-ScriptBl…

PowerShell get network adapter Speed

How to check network adapter speed installed on a computer using PowerShell?
Code snippet below will get the name of all the network adapter installed on a computer and also the speed.
To use the script on a remote computer supply the computer name and run the script with appropriate privileges to get the data on the remote computer.
#===========================
$computer_name="." $Net_adapter=gwmi-classWin32_NetworkAdapter-namespace"root\CIMV2" ` -computername$computer_name

foreach ($objItemin$Net_adapter) {
"Adapter is: "+$objItem.name +" -- "+"Adapter Speed is: "+[math]::truncate($objItem.speed/1MB) +" MB"
}
#===========================
Change the 1MB to 1GB if you need the output in GB.

Sample Output:
Adapter is: Teredo Tunneling Pseudo-Interface -- Adapter Speed is: 0 MB Adapter is: Microsoft ISATAP Adapter #3 -- Adapter Speed is: 0 MB Adapter is: VMware Virtual Ethernet Adapter for VMnet1 -- Adapter Speed is: 95 MB Adapter is:…

JunOS DHCP set MAC or static binding

How to set a static binding in JunOS? How to set a reservation of MAC address in DHCP? How to configure DHCP manual bindings? Different ways of asking on how to do but only one  specific goal, to assign an IP Address to a specific MAC or hardware. In JunOS SRX firewalls type this command: set system services dhcp static-binding 01:02:03:09:0A:0B fixed-address 192.168.1.1 IP Address of 192.168.1.1 will be assigned to a device with this MAC or hardware identifier of 01:02:03:09:0A:0B . See reference below for more details: http://www.juniper.net/documentation/en_US/junos12.1/topics/example/security-device-dhcp-server-configuring.html To do a reservation of MAC Address on Windows see below: Using Windows GUI see this link: https://technet.microsoft.com/en-us/library/dd759190.aspx The GUI instruction may change from version of the operating system but the logic on how to do it stays the same, you need to know the MAC address which will serve as an identifier so DHCP will know what IP Address will be …

Windows export firewall policy

Use netsh in Windows 7 to export firewall policy using command line.

Open an elevated command prompt and type the netshell command below.

netsh advfirewall export d:\myfirewall.txt


If everything works fine it will display "Ok."

It's exported using a filename with ".txt" extension, but the output is not readable using any text editor.

You can save the file to a USB drive as a backup or import the firewall policy to another computer.


To import the exported firewall policy use this command:

netsh advfirewall import d:\myfirewall.txt


Just replace the word export with "import" and specified the path location of the file.

A very simple way to export firewall policies.


If you want to dig further check out Technet link below:

https://technet.microsoft.com/en-us/library/cc770887%28v=ws.10%29.aspx

If you don't like doing it using command line, exporting firewall policy can also be done using GUI.

Open "Windows Firewall with Advance Security" and loo…