lunes, 7 de junio de 2021

 

Wildcard Mask



wildcard mask is a mask of bits that indicates which parts of an IP address are available for examination. In the Cisco IOS,[1] they are used in several places, for example:

  • To indicate the size of a network or subnet for some routing protocols, such as OSPF.
  • To indicate what IP addresses should be permitted or denied in access control lists (ACLs).

A wildcard mask can be thought of as an inverted subnet mask. For example, a subnet mask of 255.255.255.0 (binary equivalent = 11111111.11111111.11111111.00000000) inverts to a wildcard mask of 0.0.0.255 (binary equivalent = 00000000.00000000.00000000.11111111).

A wild card mask is a matching rule.[2] The rule for a wildcard mask is:

  • 0 means that the equivalent bit must match
  • 1 means that the equivalent bit does not matter

Any wildcard bit-pattern can be masked for examination. For example, a wildcard mask of 0.0.0.254 (binary equivalent = 00000000.00000000.00000000.11111110) applied to IP address 10.10.10.2 (00001010.00001010.00001010.00000010) will match even-numbered IP addresses 10.10.10.0, 10.10.10.2, 10.10.10.4, 10.10.10.6 etc. Same mask applied to 10.10.10.1 (00001010.00001010.00001010.00000001) will match odd-numbered IP addresses 10.10.10.1, 10.10.10.3, 10.10.10.5 etc.

A network and wildcard mask combination of 1.1.1.1 0.0.0.0 would match an interface configured exactly with 1.1.1.1 only, and nothing else.

Wildcard masks are used in situations where subnet masks may not apply. For example, when two affected hosts fall in different subnets, the use of a wildcard mask will group them together.

List of wildcard masks
SlashNetmaskWildcard mask
/32255.255.255.2550.0.0.0
/31255.255.255.2540.0.0.1
/30255.255.255.2520.0.0.3
/29255.255.255.2480.0.0.7
/28255.255.255.2400.0.0.15
/27255.255.255.2240.0.0.31
/26255.255.255.1920.0.0.63
/25255.255.255.1280.0.0.127
/24255.255.255.00.0.0.255
/23255.255.254.00.0.1.255
/22255.255.252.00.0.3.255
/21255.255.248.00.0.7.255
/20255.255.240.00.0.15.255
/19255.255.224.00.0.31.255
/18255.255.192.00.0.63.255
/17255.255.128.00.0.127.255
/16255.255.0.00.0.255.255
/15255.254.0.00.1.255.255
/14255.252.0.00.3.255.255
/13255.248.0.00.7.255.255
/12255.240.0.00.15.255.255
/11255.224.0.00.31.255.255
/10255.192.0.00.63.255.255
/9255.128.0.00.127.255.255
/8255.0.0.00.255.255.255
/7254.0.0.01.255.255.255
/6252.0.0.03.255.255.255
/5248.0.0.07.255.255.255
/4240.0.0.015.255.255.255
/3224.0.0.031.255.255.255
/2192.0.0.063.255.255.255
/1128.0.0.0127.255.255.255
/00.0.0.0255.255.255.255

Reference: Wikipedia

jueves, 15 de abril de 2021

 

Deleting your WLAN profile by cmd


  1. Launch Command Prompt as ad administrator and run the following commands:
    • netsh wlan show profile
    • netsh wlan profile
      • Add the profile name of the network you wish to delete.
  2. If you want to delete all profile, then run this command: netsh wlan delete profile *
  3. Restart your computer and check if Windows 10 asks you to enter your Wi-Fi password.




lunes, 29 de marzo de 2021

 

Changing access permissions in Windows by cmd


1. You have to open the command prompt as a privileged user. That can be found under Start > "All Programs" > Windows system. Right-click on the "Command prompt" icon and select "Run-As".

2. Once prompted, enter username and password.

3. On the command line, you can use a comman called CACLS. 

Here's the full list of things that it can do:


Displays or modifies access control lists (ACLs) of files
CACLS filename [/T] [/E] [/C] [/G user:perm] [/R user [...]]
               [/P user:perm [...]] [/D user [...]]
   filename      Displays ACLs.
   /T            Changes ACLs of specified files in
                 the current directory and all subdirectories.
   /E            Edit ACL instead of replacing it.
   /C            Continue on access denied errors.
   /G user:perm  Grant specified user access rights.
                 Perm can be: R  Read
                              W  Write
                              C  Change (write)
                              F  Full control
   /R user       Revoke specified user's access rights (only valid with /E).
   /P user:perm  Replace specified user's access rights.
                 Perm can be: N  None
                              R  Read
                              W  Write
                              C  Change (write)
                              F  Full control
   /D user       Deny specified user access.
Wildcards can be used to specify more that one file in a command.
You can specify more than one user in a command.

Abbreviations:
   CI - Container Inherit.
        The ACE will be inherited by directories.
   OI - Object Inherit.
        The ACE will be inherited by files.
   IO - Inherit Only.
        The ACE does not apply to the current file/directory.


So if you want to add permissions to a folder called "MyFolder", located on C: drive for Everyone, do the following:

C:\cacls c:\MyFolder /e /p Everyone:F

Where /e is to preserve old permissions;
/p is to add new permissions;
Everyone is the user
f stands for Full Control (R Read, W Write, C Change (write), F Full control)

If you don't include /e, the permissions assigned will be the only permissions on the file/directory.


More examples:


If you want to add permissions to hosts file for a user, do the following:

C:\cacls C:\Windows\System32\Drivers\etc\hosts /e /p UserID:W

If you want to remove permissions to a file called "test.txt", located on desktop for Everyone, do the following:

C:\cacls C:\Users\UserdID\Desktop\test.txt /e /p Everyone:N