Category Archives: Commands

PowerShell tips – part 007.

To create a list grid to show infos and output from powershell, you can send the output to the Out-GridView cmdlet:
Let’s make one example to show the output of : Get-WmiObject Win32_Processor .

The result is this:

Posted in All, Commands, Windows 10. Tagged with , , , .

Go – About goimport tool .

A Go developer know the code must be formatted with standard gofmt tool.
While gofmt attracks much attention, goimport is overlooked despite often being more useful.
Basically, goimport does everything that gofmt do.
First, you need to install into go using:

This will auto import Go packages using goimports tool.
While correcting, goimports removes unused imports and adds missing ones.
Additionally it groups and corrects imported packages.
You can used with vim and atom editors.
To setup vim editor to auto run goimports on save using vim-go, use this :

If you want to use the atom editor then you need to install the atom package named go-imports from abiosoft.
Use command palette cmd-shift-p, search for Go Imports: Process or using keybinding ctrl-shift-i.

Posted in All, Commands, Go. Tagged with , , , , .

Go – Using the go command .

After install go programming language from here, you will need to deal with the go command.
I’m not very good with golang , but I found some interesting issues for those who want to use go command with golang.
About go command can you read here and the go help output come with this help:

There are a few things you should know:

  • don’t use go list to see packages , use this command:go list all
  • take a look at install go on environment: go env
  • use help argument to get more help, like: go help gopath , go help env
  • see your go version  for  debug issues: go version
  • you can build your file (here called term_size.go) passing some gcflags : go build -gcflags=-m term_size.go
    # command-line-arguments
    .\term_size.go:13:25: inlining call to termbox.Size
    .\term_size.go:15:16: w escapes to heap
    .\term_size.go:15:16: h escapes to heap
    .\term_size.go:15:16: main ... argument does not escape
  • do not try this on Windows OS : go build -ldflags , first read more about: C:\Go\pkg\tool\windows_amd64\link.exe: -X flag requires argument of the form
  • the Windows shell doesn’t have single quoted strings:
    go list -f "{{ .TestGoFiles }}" archive/tar
    [reader_test.go strconv_test.go tar_test.go writer_test.go]
Posted in All, Commands, Go, Windows 10. Tagged with , , , , , .

Windows 10 – Search the registry with REG Query .

This old command REG QUERY help us to search the windows registry and use the output to see the integrity and check malware infection.
This is operation of the default REG command that performs operations on registry.
The help command show us:

First you need to know the registry vales are into registry database:

When you make a query then use that with arguments like the examples from help.
How can use this command tool? Let’s try some example:
1. show the integrity of Windows when booting:

2. test for mallware ( the rundll32.exe javascript infection):
– see the all rundll32.exe values

– if the next command has output then you can have an infected operating system with rundll32.exejavascript:… script:

Posted in All, Commands, Windows 10. Tagged with , , , , .

Linux – netstat command .

This tutorial come to show you how to use the netstat command with linux operating system.
To list out all the connections tcp, udp & unix on a system, we can use ‘a’ option with netstat command:

To list only the tcp connections our system, use ‘t’ options with netstat:

To list out only the udp connections on our system, we can use ‘u’ option with netstat:

To only list out Unix socket connections, we can use ‘x’ options:

To get list of all connections along with PID or process name, we can use ‘p’ option & it can be used in combination with any other netstat option:

To speed up our output, we can use ‘n’ option as it will perform any reverse lookup & produce output with only numbers (since no lookup is performed, our output will much faster):

To print only the listening ports , we will use ‘l’ option with netstat (it will not be used with ‘a’ as it prints all ports):

To print network statistics of each protocol like packet received or transmitted, we can use ‘s’ options with netstat:

To display only the statistics on network interfaces, use ‘i’ option:

To display multicast group information, we can use option ‘g’ ( that print the multicast group information for IPV4 & IPV6):

To print the network routing information, use ‘r’ option:

To get continuous output of netstat, use ‘c’ option:

To filter a single port connections, we can combine ‘grep’ command with netstat:

To use multiple commands with netstat.
Example: count the number of connections with CONNECTED value, we can further add ‘wc’ command with netstat and grep command:

Posted in All, Commands, Linux. Tagged with , , , , .