Using the Linux stat command to get information about a file.

The Linux stat command allows information to be shown about a file on your file-system. jason@darknet:~/Documents$ stat /bin/ls File: ‘/bin/ls’ Size: 118280 Blocks: 232 IO Block: 4096 regular file Device: 801h/2049d Inode: 10616940 Links: 1 Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2016-02-01 08:55:40.145487505 +1100 Modify: 2015-03-15 02:47:04.000000000 +1100 Change: 2016-01-19 … Read more

Get SSL information from a website using sslscan.

The sslscan command for the Kali Linux penetration testing distribution is very useful for gaining an insight into the SSL configuration of a web site. Here is example usage on healthcare.gov… root@darknet:~# sslscan healthcare.gov Version: 1.10.5-static OpenSSL 1.0.2e-dev xx XXX xxxx   Testing SSL server healthcare.gov on port 443   TLS renegotiation: Secure session renegotiation … Read more

How to use the ip command to bring down an interface on RHEL.

The ip command is a useful alternative to the ifconfig command and allows the user to manage network interfaces. This is a good way to use the command line to bring network interfaces up or down. In this example I am bringing the network interface down. [root@localhost jason]# ip link set eno16777736 down [root@localhost jason]# … Read more

Get the startup time of your Linux machine with systemd.

The systemd-analyze command will print the time taken for the system to boot up. This separates the time for the kernel and the userspace environment. root@darkstar:~# systemd-analyze Startup finished in 4.728s (kernel) + 28.339s (userspace) = 33.068sroot@darkstar:~# systemd-analyze Startup finished in 4.728s (kernel) + 28.339s (userspace) = 33.068s This command will get the date and … Read more

Download a Youtube video to mp3 with the Linux shell.

Firstly, install youtube-dl. jason@darkstar:~/Music$ sudo apt-get install youtube-dljason@darkstar:~/Music$ sudo apt-get install youtube-dl Then run this command with the Youtube video URL. jason@darkstar:~/Music$ youtube-dl -f bestaudio -x –audio-format mp3 –prefer-ffmpeg https://www.youtube.com/watch?v=UWFm2LIYNjg [youtube] UWFm2LIYNjg: Downloading webpage [youtube] UWFm2LIYNjg: Extracting video information [youtube] UWFm2LIYNjg: Downloading DASH manifest [download] Destination: Dune (1983) OST – Dune Prophecy (Long Version)-UWFm2LIYNjg.m4a [download] … Read more

Misc commands to get system information from a Linux box.

List all network interfaces on your Linux machine that are up. [jason@localhost ~]$ ip addr | grep UP 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP qlen 1000 3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN[jason@localhost ~]$ ip addr | grep UP 1: lo: … Read more

Very useful and informative Linux commands.

While running Linux, if you want to list the contents of a folder in a vertical list format, just use the ls command with these switches. jason@ubuntu:~$ ls -luh –color=yes total 48K drwxr-xr-x 2 jason jason 4.0K Dec 15 03:03 Desktop drwxr-xr-x 2 jason jason 4.0K Nov 29 17:00 Documents drwxr-xr-x 2 jason jason 4.0K … Read more

Some more obscure Linux commands that are very useful.

The logsave command will print the output of a command to a file. This will also add a timestamp to the logfile telling the system administrator when the command was run. logsave /var/log/partsize df –hlogsave /var/log/partsize df –h This is an example, the output of the command is also printed to STDOUT. jason@ubuntu:~$ logsave partsize … Read more

How to generate a random password using the command line.

The shuf command for Linux allows a command-line user to select a given number of random words from a wordlist. [jason@localhost ~]$ shuf -n 8 /usr/share/dict/words amphivasal thoracically U. bluet Dabih thioamid taxiing convictism[jason@localhost ~]$ shuf -n 8 /usr/share/dict/words amphivasal thoracically U. bluet Dabih thioamid taxiing convictism This can be used to generate a word … Read more

How to setup NTP on Ubuntu to set the system time automatically.

To install NTP on Linux and update the system time automatically from the Internet, firstly install the NTP client. jason@darkstar:~$ sudo apt-get install ntpjason@darkstar:~$ sudo apt-get install ntp Then install the ntpdate utility. sudo apt-get install ntpdatesudo apt-get install ntpdate Then you may synchronize the time on your machine with the Internet time server. jason@darkstar:~$ … Read more

More commands to get information about your network adapter.

There are a few commands available in Red Hat Linux to get information about your network adapter. Here are a couple. The ifstat command returns information about the network throughput of your adapter. [jason@darknet ~]$ ifstat #kernel Interface RX Pkts/Rate TX Pkts/Rate RX Data/Rate TX Data/Rate RX Errs/Drop TX Errs/Drop RX Over/Rate TX Coll/Rate lo … Read more

How to crack a SHA512 Linux password hash with oclHashcat on Linux.

Cracking a SHA512 Debian password hash with oclhashcat on Debian 8.0. I am using a Radeon HD6670 card and I created a user with the crappy password of “password”. Then I downloaded oclHashcat 1.37 and used this to crack the password using the GPU. This is the password hash in the /etc/shadow file. fred:$6$5l70Gupv$xBTxhCSexudn5jJ9hampIfTK0KIR3nqK1K1Rxye.OA5obtKArO7jgftjJtVSdp31MPxItEPmOuWhbgBvp0wqn.:16737:0:99999:7:::fred:$6$5l70Gupv$xBTxhCSexudn5jJ9hampIfTK0KIR3nqK1K1Rxye.OA5obtKArO7jgftjJtVSdp31MPxItEPmOuWhbgBvp0wqn.:16737:0:99999:7::: The … Read more

Adding a default route in Linux. How to define the default gateway.

Adding a default route in Linux is easy. The route command is the best way to do this. ~# route add default gw 172.18.31.1~# route add default gw 172.18.31.1 I used this command on a machine that previously had an IP address in the 192.168.0.xx range and the default gateway was 192.168.0.1. So I had … Read more

How to scan a network for responsive hosts using Kali Linux.

To scan a network for hosts using Kali Linux, the netdiscover command will come in handy. Just give it an IP address and it will find all hosts within that range. I am scanning for all hosts within the range of 172.29.59.1 to 172.29.59.254. root@kali:~/Documents# netdiscover -r 172.29.59.0/24   Currently scanning: Finished! | Screen View: … Read more

Enable copy and paste to and from a VMware Kali Linux instance.

Kali Linux runs very well in a VM, but having copy and paste to and from the Virtual Machine is very helpful. To get this working in VMware Pro 12, install these packages. Firstly, this one. root@kali:~# apt-get install open-vm-toolsroot@kali:~# apt-get install open-vm-tools Then this one. root@kali:~# apt-get install open-vm-tools-desktoproot@kali:~# apt-get install open-vm-tools-desktop Then copy … Read more