Recent Updates Page 20 Toggle Comment Threads | Keyboard Shortcuts

  • John Cartwright 1:48 PM on April 11, 2015 Permalink | Reply
    Tags: , , , ,   

    How to get the routing table of your network with Windows and Linux. 

    Showing the routing table in Linux is very useful when you are required to get information about a network.

    This is the output when retrieving the routing table in Windows 7.

    C:\Users\jason>route PRINT
    Interface List
     16...00 ff f0 18 9a f5 ......TAP-Windows Adapter V9
     13...00 13 46 3a 02 83 ......Realtek RTL8139/810x Family Fast Ethernet NIC #2
     12...6c f0 49 b5 e6 2a ......Realtek RTL8168D/8111D Family PCI-E Gigabit Ethernet NIC (NDIS 6.20)
     10...f8 1a 67 10 b1 63 ......Realtek RTL8139/810x Family Fast Ethernet NIC
     18...00 50 56 c0 00 01 ......VMware Virtual Ethernet Adapter for VMnet1
     20...00 50 56 c0 00 08 ......VMware Virtual Ethernet Adapter for VMnet8
      1...........................Software Loopback Interface 1
     11...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
     24...00 00 00 00 00 00 00 e0 Microsoft Direct Point-to-point Adapater
     14...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2
     15...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3
     17...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #4
     19...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #5
     23...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #7
    IPv4 Route Table
    Active Routes:
    Network Destination        Netmask          Gateway       Interface  Metric
           On-link    306
           On-link    306         On-link    306         On-link    276         On-link    276         On-link    276         On-link    276         On-link    276         On-link    276         On-link    276         On-link    276         On-link    276
           On-link    306
           On-link    276
           On-link    276
           On-link    276         On-link    306         On-link    276         On-link    276         On-link    276
    Persistent Routes:
    IPv6 Route Table
    Active Routes:
     If Metric Network Destination      Gateway
      1    306 ::1/128                  On-link
     10    276 fe80::/64                On-link
     18    276 fe80::/64                On-link
     20    276 fe80::/64                On-link
     20    276 fe80::35c9:fab0:c58:9537/128
     18    276 fe80::7d9a:395:2c12:eec5/128
     10    276 fe80::ac72:159e:fd1e:d216/128
      1    306 ff00::/8                 On-link
     10    276 ff00::/8                 On-link
     18    276 ff00::/8                 On-link
     20    276 ff00::/8                 On-link
    Persistent Routes:
     If Metric Network Destination      Gateway
      0 4294967295 ::/0                     2001:470:1f06:1b5::1

    And this is how it is done in Linux.

    [email protected]:~$ route -e -v
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
    default         UG        0 0          0 eth2   UG        0 0          0 tun1194        *      UH        0 0          0 tun1194
    link-local      *          U         0 0          0 eth2   *        U         0 0          0 eth2

    Linux shows a lot less information than Windows, but it is still pertinent information. This shows the gateway IP address of my router and the network mask. As well as the IP address of my VPN configuration.

  • John Cartwright 1:24 PM on April 9, 2015 Permalink | Reply
    Tags: , , , ,   

    Another way to get the IP address of your machine with the arp command. 

    This command will lookup the network adapter that you are using and return your network address.

    [email protected]:~$ arp -n | grep : | awk '{print $1}'

    This looks for the : character that is in the MAC address like this.

    [email protected]:~$ arp -n
    Address                  HWtype  HWaddress           Flags Mask            Iface                ether   c4:04:15:4d:44:24   C                     eth2

    And then it returns the first entry which is the IP address. Yet another cool trick to return a IP address for your network hardware.

    This command returns all IP addresses with accompanying broadcast addresses.

    [email protected]:~$ ip a | grep "brd"
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        link/ether 6c:f0:49:b5:e6:2a brd ff:ff:ff:ff:ff:ff
        link/ether 00:13:46:3a:02:83 brd ff:ff:ff:ff:ff:ff
        link/ether f8:1a:67:10:b1:63 brd ff:ff:ff:ff:ff:ff
        inet brd scope global eth2

    Or this one. This lists all interfaces that are connected with IP addresses.

    [email protected]:~$ ifconfig | grep 'inet addr:'
              inet addr:  Bcast:  Mask:
              inet addr:  Mask:
              inet addr:  P-t-P:  Mask:
  • John Cartwright 1:45 PM on April 7, 2015 Permalink | Reply
    Tags: , , , unp, unpacker   

    Universal archive unpacker script for Linux. Easily unpack any archive with the terminal. 

    The unp script for Linux is a script that will detect what the archive is and call the appropriate program to handle it. This is a very useful script for the command line user. In the example below I am unpacking a zip file.

    jason@eyjafjallajkull:~/Downloads$ unp 
      inflating: northwind.sql

    if the required programs are not installed, you will get this helpful error. This will tell you which packages to install to proceed.

    jason@eyjafjallajkull:~/Downloads$ unp fallujah1_2.7z 
    Error, following packages must be installed in order to proceed:
    p7zip or p7zip-full

    But, this is a very powerful script and well worth installing to take care of any strange archive format that you encounter on the Internet.

    Type sudo apt-get install unp to install this useful script.

  • John Cartwright 10:56 PM on March 30, 2015 Permalink | Reply
    Tags: , executable, ,   

    A good utility for finding all executables in a given path. 

    Finding all executables in a given path is easy if you use the lsx utility. Firstly install the required packages.

    [email protected]:~$ sudo apt-get install suckless-tools
    [sudo] password for jason: 
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Suggested packages:
      dwm stterm surf
    The following NEW packages will be installed:
    0 to upgrade, 1 to newly install, 0 to remove and 0 not to upgrade.
    Need to get 49.9 kB of archives.
    After this operation, 272 kB of additional disk space will be used.
    Get:1 vivid/universe suckless-tools amd64 40-1 [49.9 kB]
    Fetched 49.9 kB in 2s (24.5 kB/s)         
    Selecting previously unselected package suckless-tools.
    (Reading database ... 386755 files and directories currently installed.)
    Preparing to unpack .../suckless-tools_40-1_amd64.deb ...
    Unpacking suckless-tools (40-1) ...
    Processing triggers for man-db ( ...
    Setting up suckless-tools (40-1) ...

    Then, once this is installed, you may then use this utility to find all executables in a directory.

    jason@eyjafjallajkull:/usr/bin$ lsx /usr/local/bin

    This is a very useful command for finding executable files easily on your Linux filesystem.

  • John Cartwright 1:16 PM on March 24, 2015 Permalink | Reply
    Tags: , force, , ,   

    How to force a re-boot or shutdown if the traditional commands will not work. 

    If your machine has errors with the hard disk and your machine has booted with a read-only filesystem, these commands can force your machine to either shutdown or reboot.

    Forced re-boot.

    echo 1 > /proc/sys/kernel/sysrq
    echo b > /proc/sysrq-trigger

    Forced shutdown.

    echo 1 > /proc/sys/kernel/sysrq
    echo o > /proc/sysrq-trigger

    Execute these commands at a root prompt and they will work instantly. Communicating directly with the kernel this way allows you to shutdown gracefully even if traditional commands will not work at all.

    This is where I got these commands from:

  • John Cartwright 2:09 PM on March 23, 2015 Permalink | Reply
    Tags: dvwa, injection, , ,   

    How to do a SQL injection attack against Damn Vulnerable Web App. 

    Damn Vulnerable Web App is a PHP web application that is deliberately vulnerable. This is used to learn how to attack websites by exploiting various vulnerabilities in the software. In this example, I am showing you how to use a SQL injection to get information out of the database.

    Damn Vulnerable Web App SQL injection.

    Damn Vulnerable Web App SQL injection.

    This line of code will extract all passwords from the DVWA database.

    1' and 1=1 union select user, password from users#

    And this simple line will get information about the admin user.

    1' and 1=1 #

    This will list all users on the system.

    1' and 1=1 union select user, password from users#

    These commands are a good start if you are messing around with DVWA and help is needed when starting out with DVWA and SQL injection. Setting DVWA to a low security setting seems to be necessary to allow these attacks to work. But these strings do work very well indeed.

  • John Cartwright 8:58 PM on March 22, 2015 Permalink | Reply
    Tags: , , , ,   

    Compile a Linux kernel the Ubuntu way. 

  • John Cartwright 1:20 PM on March 22, 2015 Permalink | Reply
    Tags: , , , loopback   

    What is the loopback address of your network interface? 

    The loopback address of the network interface, usually, is the address used by the operating system to access the network interface itself.

    This is represented in IPv6 as 0:0:0:0:0:0:0:1:/128 or ::1/128 when compressed. This gives the computer user a way to ping a network interface and verify that it is actually working. The ping6 command on Linux is used to ping the IPv6 loopback address.

    ubuntu ~ $ ping6 ::1
    PING ::1(::1) 56 data bytes
    64 bytes from ::1: icmp_seq=1 ttl=64 time=0.015 ms
    64 bytes from ::1: icmp_seq=2 ttl=64 time=0.025 ms
    64 bytes from ::1: icmp_seq=3 ttl=64 time=0.029 ms
    64 bytes from ::1: icmp_seq=4 ttl=64 time=0.029 ms
    64 bytes from ::1: icmp_seq=5 ttl=64 time=0.030 ms
    --- ::1 ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 3998ms
    rtt min/avg/max/mdev = 0.015/0.025/0.030/0.007 ms

    In this example, I am pinging the loopback IP to test connectivity. This IP address is given a subnet mask and allows basic networking without connecting a network cable.

    Pinging with 32 bytes of data:
    Reply from bytes=32 time<1ms TTL=128
    Reply from bytes=32 time<1ms TTL=128
    Reply from bytes=32 time<1ms TTL=128
    Reply from bytes=32 time<1ms TTL=128
    Ping statistics for
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 0ms, Average = 0ms

    One use of this interface is connecting to a HTTP server running on the local machine by accessing the address in a web browser. This will bring up the HTML page served out by the Apache LAMP server. There are other IP addresses that are automatically assigned. These are Zeroconf addresses. These are in the range of to These are assigned when there is no DHCP server or static IP addresses assigned to networked computers on a LAN.

    Here is example output of the ifconfig command, I am getting information about the loopback address on an Ubuntu server machine.

    ubuntu ~ $ ifconfig lo
    lo        Link encap:Local Loopback
              inet addr:  Mask:
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:38214 errors:0 dropped:0 overruns:0 frame:0
              TX packets:38214 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:11412622 (11.4 MB)  TX bytes:11412622 (11.4 MB)

    This is the normal configuration for the loopback address on an Ubuntu machine.

    ubuntu ~ $ cat /etc/network/interfaces

    1. This file describes the network interfaces available on your system
    2. and how to activate them. For more information, see interfaces(5).
    1. The loopback network interface

    auto lo
    iface lo inet loopback

    The lo interface is configured with an automatically assigned IP address even though it is only allowed the IP address. But this is the normal configuration for a loopback address.

  • John Cartwright 3:14 PM on March 16, 2015 Permalink | Reply
    Tags: , , , ,   

    How to find files on the Linux filesystem. 

    The find command is very useful for locating files on your Linux filesystem. Below is an example of wildcards to locate files in the /boot directory.

    [email protected]:~$ sudo find /boot -name "vm*"

    Here I am searching the whole / filesystem for a set of files that end in *.log.

    [email protected]:~$ sudo find / -name "log"

    The whereis command allows the user to search for programs and it will return where the program is installed.

    ubuntu ~ $ whereis rm
    rm: /bin/rm /usr/share/man/man1/rm.1.gz

    To list all mounted filesystems on a Linux machine; use this command.

    ubuntu ~ $ findmnt
    TARGET                       SOURCE                                                 FSTYPE     OPTIONS
    /                            /dev/disk/by-uuid/ee515a1e-7735-4529-822f-4cc9e7632cd3 ext4       rw,relatime,discard,data=ordered
    ├─/sys                       sysfs                                                  sysfs      rw,nosuid,nodev,noexec,relatime
    │ ├─/sys/fs/cgroup                                                                  tmpfs      rw,relatime,size=4k,mode=755
    │ │ └─/sys/fs/cgroup/systemd systemd                                                cgroup     rw,nosuid,nodev,noexec,relatime,name=systemd
    │ ├─/sys/fs/fuse/connections                                                        fusectl    rw,relatime
    │ ├─/sys/kernel/debug                                                               debugfs    rw,relatime
    │ ├─/sys/kernel/security                                                            securityfs rw,relatime
    │ └─/sys/fs/pstore                                                                  pstore     rw,relatime
    ├─/proc                      proc                                                   proc       rw,nosuid,nodev,noexec,relatime
    ├─/dev                       udev                                                   devtmpfs   rw,relatime,size=503184k,nr_inodes=125796,mode=755
    │ └─/dev/pts                 devpts                                                 devpts     rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000
    └─/run                       tmpfs                                                  tmpfs      rw,nosuid,noexec,relatime,size=101632k,mode=755
      ├─/run/lock                                                                       tmpfs      rw,nosuid,nodev,noexec,relatime,size=5120k
      ├─/run/shm                                                                        tmpfs      rw,nosuid,nodev,relatime
      └─/run/user                                                                       tmpfs      rw,nosuid,nodev,noexec,relatime,size=102400k,mode=755

    This gives you a good picture of your filesystem. All mounted filesystems are printed in a tree format by default.

    Another command for searching your filesystem is the locate command. This can search your filesystem for various files.

    ubuntu ~ $ locate dmesg
  • John Cartwright 10:37 PM on March 14, 2015 Permalink | Reply
    Tags: , , nohup,   

    How to leave a command running when your SSH session is disconnected. 

    If you want to leave a command running if you are disconnected from your SSH session, then the nohup command can come in handy.

    This is a good example, this will run the nmap scan and then logout the user. When you re-connect, it will still be running.

    nohup sudo nmap -A -T2 -P0 -oN nmap-log.log &exit

    So, this is a good way to run a command over SSH that will take a long time. The -oN nmap-log.log parameter to nmap will output the scan results into a file named nmap-log.log for later perusal when you log back in. Otherwise, the penetration tester would have to wait for ages whilst a long nmap scan completed. This is a very useful Linux tip and well worth knowing when the user is accessing a machine like Amazon AWS over an Internet connection and the service is not always reliable.

    Very old CRT terminal.

    Very old CRT terminal.

  • John Cartwright 12:16 PM on March 12, 2015 Permalink | Reply
    Tags: foremost, forensic, ,   

    How to use foremost to recover deleted files on a USB thumb drive with Kali Linux. 

    Below is a snippet of output from my Kali Linux session. I am trying to recover files from a USB thumb drive and I am having some success.

    root@kali:/home/root/Desktop/files# foremost /dev/sdb1 -v -o /home/root/Desktop/files/
    Foremost version 1.5.7 by Jesse Kornblum, Kris Kendall, and Nick Mikus
    Audit File
    Foremost started at Thu Mar 12 11:12:06 2015
    Invocation: foremost /dev/sdb1 -v -o /home/root/Desktop/files/
    Output directory: /home/root/Desktop/files
    Configuration file: /etc/foremost.conf
    Processing: /dev/sdb1
    File: /dev/sdb1
    Start: Thu Mar 12 11:12:06 2015
    Length: 3 GB (3995140096 bytes)
    Num	 Name (bs=512)	       Size	 File Offset	 Comment 
    0:	00188665.gif 	      387 B 	   96596831 	  (16 x 16)
    1:	00188751.gif 	       51 B 	   96640709 	  (4 x 4)
    2:	00188751_1.gif 	       89 B 	   96640789 	  (23 x 21)
    3:	00188822.gif 	       49 B 	   96677335 	  (3 x 42)
    4:	00188919.gif 	       50 B 	   96726845 	  (2 x 2)
    5:	00189023.gif 	       43 B 	   96780061 	  (5 x 1)
    6:	00189104.gif 	      474 B 	   96821315 	  (23 x 21)
    7:	00189359.gif 	       43 B 	   96952013 	  (4 x 1)
    8:	00189570.gif 	       89 B 	   97059895 	  (20 x 21)

    At the end of the process you will get a count of all the files that were recovered.

    Finish: Thu Mar 12 12:08:52 2015
    jpg:= 7257
    gif:= 413
    bmp:= 3
    mov:= 1
    mp4:= 9
    htm:= 19
    zip:= 9
    rar:= 1
    exe:= 42
    png:= 1542

    The files are organised in the files/ directory, with subfolders for each file type. This really does work well when you are forensically examining a USB thumb drive you found. Never know what you might find. Works for hard disks as well. Just ensure the drive you are saving found files to has enough disk space to fit everything. And mounting the drive to be examined read-only would be a very good idea.

  • John Cartwright 10:01 AM on March 12, 2015 Permalink | Reply
    Tags: , , ,   

    How to use the runas command in Windows to elevate privileges. 

    The runas command in Windows allows a user to elevate their level of privileges to run a command as the Administrator user. The example below shows the usage of the runas command to open another cmd window as the Administrator user.

    C:\Users\mike\Documents\openvpn>runas /user:Scott\Dobbo cmd
    Enter the password for Scott\Dobbo:
    Attempting to start cmd as user "Scott\Dobbo" ...

    The /user parameter specifies the username you are using to elevate your user. Then a : and the computername\Username. This is a convenient way to elevate privileges. I just wish Windows had a command that is easy to remember as sudo or su. Maybe Powershell has an easy to use alternative. But this does work. You will need to type the actual username of the Administrator user and not administrator as that does not seem to work for me.

  • John Cartwright 10:45 PM on March 9, 2015 Permalink | Reply
    Tags: , , , lag,   

    Information about satellite packet routing as it relates to the Internet. 

    This paper I found, PDF relates to the routing of network packets through a satellite connection. This might be very interesting to a student of networking who is interested in satellite networking and the unavoidable latency issues that come with such a connection. With a 250ms latency, this would add on to any existing latency that existed, for example an online game and could make it unplayable. Even 350ms ping in a First Person Shooter game can be the difference between playing or missing out if everyone else has 30ms ping. And rubber banding is another annoying aspect. It is very annoying to see AI enemies that seem to teleport short distances when walking around. This makes them very frustrating to hit. But getting back to the satellites, this is a useful networking technology of course, but the latency cannot be avoided. This is just something you have to work with.

    Below is a Youtube video showing an Internet speed test using satellite Internet. This shows that despite the latency, users of this service can get very fast speeds.

  • John Cartwright 1:46 PM on March 4, 2015 Permalink | Reply
    Tags: , , , ,   

    How to crack Linux passwords using john the ripper. 

    Firstly, for the purposes of this exercise, we are creating a new user with a simple password. I used a user named “vaas” and gave him the simple password “password”. Then run this command to create the file that john the ripper will be using.

    [email protected]:~$ sudo unshadow /etc/passwd /etc/shadow > pass.out

    Now run the john the ripper to get the passwords.

    [email protected]:~$ sudo john --wordlist=/usr/share/john/password.lst pass.out
    Loaded 3 password hashes with 3 different salts (crypt, generic crypt(3) [?/64])
    Press 'q' or Ctrl-C to abort, almost any other key for status
    password         (vaas)
    1g 0:00:00:20 100% 0.04952g/s 175.6p/s 356.0c/s 356.0C/s !@#$%..sss
    Use the "--show" option to display all of the cracked passwords reliably
    Session completed

    Now we have cracked the users password.

    [email protected]:~$ sudo john --show pass.out
    1 password hash cracked, 2 left

    This will only work if the users password is in the wordlist. To crack realistic passwords, you would require a massive wordlist to hold all possible passwords.

  • John Cartwright 2:55 PM on March 2, 2015 Permalink | Reply
    Tags: , autoremove, ,   

    How to remove unneeded packages on your Ubuntu Linux system. 

    I wanted to update my Ubuntu 14.04 server and I saw this output. I needed to remove these unwanted packages on my system.

    [email protected]:~$ sudo apt-get upgrade
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Calculating upgrade... Done
    The following packages were automatically installed and are no longer required:
      libdigest-hmac-perl libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libfontenc1
      libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libice6
      libio-socket-inet6-perl libllvm3.4 libnet-dns-perl libnet-ip-perl
      libpciaccess0 libsm6 libsocket6-perl libtcl8.6 libtk8.6 libtxc-dxtn-s2tc0
      libutempter0 libx11-xcb1 libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
      libxcb-present0 libxcb-shape0 libxcb-sync1 libxcomposite1 libxdamage1
      libxfixes3 libxft2 libxi6 libxinerama1 libxmu6 libxrandr2 libxrender1
      libxshmfence1 libxss1 libxt6 libxtst6 libxv1 libxxf86dga1 libxxf86vm1 tcl
      tcl8.6 tk tk8.6 x11-common x11-utils xbitmaps xterm
    Use 'apt-get autoremove' to remove them.
    The following packages have been kept back:
      linux-headers-generic linux-headers-virtual linux-image-virtual
    0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

    I ran the sudo apt-get autoremove command and this removed all of the unwanted packages.

    [email protected]:~$ sudo apt-get autoremove
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following packages will be REMOVED:
      libdigest-hmac-perl libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libfontenc1
      libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libice6
      libio-socket-inet6-perl libllvm3.4 libnet-dns-perl libnet-ip-perl
      libpciaccess0 libsm6 libsocket6-perl libtcl8.6 libtk8.6 libtxc-dxtn-s2tc0
      libutempter0 libx11-xcb1 libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
      libxcb-present0 libxcb-shape0 libxcb-sync1 libxcomposite1 libxdamage1
      libxfixes3 libxft2 libxi6 libxinerama1 libxmu6 libxrandr2 libxrender1
      libxshmfence1 libxss1 libxt6 libxtst6 libxv1 libxxf86dga1 libxxf86vm1 tcl
      tcl8.6 tk tk8.6 x11-common x11-utils xbitmaps xterm
    0 upgraded, 0 newly installed, 52 to remove and 4 not upgraded.
    After this operation, 75.1 MB disk space will be freed.
    Do you want to continue? [Y/n] y
    (Reading database ... 55458 files and directories currently installed.)
    Removing libnet-dns-perl (0.68-1.2build1) ...
    Removing libdigest-hmac-perl (1.03+dfsg-1) ...
    Removing libgl1-mesa-dri:amd64 (10.1.3-0ubuntu0.3) ...
    Removing libdrm-intel1:amd64 (2.4.56-1~ubuntu2) ...
    Removing libdrm-nouveau2:amd64 (2.4.56-1~ubuntu2) ...
    Removing libdrm-radeon1:amd64 (2.4.56-1~ubuntu2) ...
    Removing x11-utils (7.7+1) ...
    Removing libfontenc1:amd64 (1:1.1.2-1) ...
    Removing libgl1-mesa-glx:amd64 (10.1.3-0ubuntu0.3) ...
    Removing libglapi-mesa:amd64 (10.1.3-0ubuntu0.3) ...
    Removing xterm (297-1ubuntu1) ...
    Removing libxaw7:amd64 (2:1.0.12-1) ...
    Removing libxmu6:amd64 (2:1.1.1-1) ...
    Removing libxt6:amd64 (1:1.1.4-1) ...
    Removing libio-socket-inet6-perl (2.71-1) ...
    Removing libllvm3.4:amd64 (1:3.4-1ubuntu3) ...
    Removing libnet-ip-perl (1.26-1) ...
    Removing libpciaccess0:amd64 (0.13.2-1) ...
    Removing libsm6:amd64 (2:1.2.1-2) ...
    Removing libsocket6-perl (0.25-1) ...
    Removing tk (8.6.0+6ubuntu3) ...
    Removing tk8.6 (8.6.1-3ubuntu2) ...
    Removing tcl (8.6.0+6ubuntu3) ...
    Removing tcl8.6 (8.6.1-4ubuntu1) ...
    Removing libtk8.6:amd64 (8.6.1-3ubuntu2) ...
    Removing libtxc-dxtn-s2tc0:amd64 (0~git20131104-1.1) ...
    Removing libutempter0 (1.1.5-4build1) ...
    Removing libx11-xcb1:amd64 (2:1.6.2-1ubuntu2) ...
    Removing libxcb-dri2-0:amd64 (1.10-2ubuntu1) ...
    Removing libxcb-dri3-0:amd64 (1.10-2ubuntu1) ...
    Removing libxcb-glx0:amd64 (1.10-2ubuntu1) ...
    Removing libxcb-present0:amd64 (1.10-2ubuntu1) ...
    Removing libxcb-shape0:amd64 (1.10-2ubuntu1) ...
    Removing libxcb-sync1:amd64 (1.10-2ubuntu1) ...
    Removing libxcomposite1:amd64 (1:0.4.4-1) ...
    Removing libxdamage1:amd64 (1:1.1.4-1ubuntu1) ...
    Removing libxfixes3:amd64 (1:5.0.1-1ubuntu1) ...
    Removing libxft2:amd64 (2.3.1-2) ...
    Removing libxi6:amd64 (2: ...
    Removing libxinerama1:amd64 (2:1.1.3-1) ...
    Removing libxrandr2:amd64 (2:1.4.2-1) ...
    Removing libxrender1:amd64 (1:0.9.8-1) ...
    Removing libxshmfence1:amd64 (1.1-2) ...
    Removing libxss1:amd64 (1:1.2.2-1) ...
    Removing libxtst6:amd64 (2:1.2.2-1) ...
    Removing libxv1:amd64 (2:1.0.10-1) ...
    Removing libxxf86dga1:amd64 (2:1.1.4-1) ...
    Removing libxxf86vm1:amd64 (1:1.1.3-1) ...
    Removing xbitmaps (1.1.1-2) ...
    Removing libice6:amd64 (2:1.0.8-2) ...
    Removing libtcl8.6:amd64 (8.6.1-4ubuntu1) ...
    Removing x11-common (1:7.7+1ubuntu8.1) ...
    Processing triggers for man-db ( ...
    Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
    Processing triggers for mime-support (3.54ubuntu1.1) ...
  • John Cartwright 12:33 PM on March 2, 2015 Permalink | Reply
    Tags: , , jpg,   

    How to convert a jpg image to ASCII using the Linux command line. 

    The jp2a package for Ubuntu will convert a jpeg image into an ascii text representation. This is useful for creating useful ascii images to post on the Internet. Install it by typing: sudo apt-get install jp2a and then convert an image this way.

    ~$ jp2a myimage.jpg

    This will output ascii text to the terminal. A very good trick to show off your Linux terminal with.

    jp2a converting a jpg to ascii.

    jp2a converting a jpg to ascii.

  • John Cartwright 3:35 PM on February 25, 2015 Permalink | Reply
    Tags: , , ,   

    How to set a hostname on a Cisco 2950 switch with the terminal. 

    To set a new hostname on a Cisco router, switch to privileged exec mode by typing enable at the prompt.

    Enter configuration mode by entering this command.

    eng_floor_2#configure terminal

    Then set the hostname by typing this command.

    eng_floor_2(config)#hostname eng_floor_2

    Now the proper hostname has been set on the switch.

    eng_floor_2#show running-config 
    Building configuration...
    Current configuration : 982 bytes
    version 12.1
    no service timestamps log datetime msec
    no service timestamps debug datetime msec
    no service password-encryption
    hostname eng_floor_2

    This is the best way to label each switch. This way, you will know exactly which one you are managing with the command line whether this is with a console cable or a telnet/ssh connection.

  • John Cartwright 2:34 PM on February 23, 2015 Permalink | Reply
    Tags: , , , , wipe   

    How to erase the configuration of a Cisco 2950 switch with Putty. 

    I am assuming that you already know how to access your switch and you do not need any help with this. Log into the switch using Putty and wait until the prompt appears awaiting commands.

    % Please answer 'yes' or 'no'.
    Would you like to enter the initial configuration dialog? [yes/no]: no
    Press RETURN to get started!
    00:02:00: %LINK-5-CHANGED: Interface Vlan1, changed state to administratively down
    00:02:01: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to down

    Type this command to enable the prompt that we need.



    Then type this command to erase the configuration on the switch.

    erase startup-config

    This is the result of this command. This is removing all of the configuration changes made to the Cisco router configuration.

    Switch#erase startup-config
    Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
    Erase of nvram: complete

    And now we run the reload command to reinstall a vanilla Cisco IOS configuration.

    Proceed with reload? [confirm]
    00:03:17: %SYS-5-RELOAD: Reload requested
    C2950 Boot Loader (C2950-HBOOT-M) Version 12.1(11r)EA1, RELEASE SOFTWARE (fc1)
    Compiled Mon 22-Jul-02 17:18 by antonino
    WS-C2950-24 starting...
    Base ethernet MAC Address: 00:0e:84:d8:b3:40
    Xmodem file system is available.
    Initializing Flash...
    flashfs[0]: 77 files, 3 directories
    flashfs[0]: 0 orphaned files, 0 orphaned directories
    flashfs[0]: Total bytes: 7741440
    flashfs[0]: Bytes used: 5258240
    flashfs[0]: Bytes available: 2483200
    flashfs[0]: flashfs fsck took 7 seconds.
    ...done initializing flash.
    Boot Sector Filesystem (bs:) installed, fsid: 3
    Parameter Block Filesystem (pb:) installed, fsid: 4
    Loading "flash:/c2950-i6q4l2-mz.121-14.EA1a.bin"...########################################################################         ###########################################################################################################################         #################################################################################################################
    File "flash:/c2950-i6q4l2-mz.121-14.EA1a.bin" uncompressed and installed, entry point: 0x80010000
                  Restricted Rights Legend
    Use, duplication, or disclosure by the Government is
    subject to restrictions as set forth in subparagraph
    (c) of the Commercial Computer Software - Restricted
    Rights clause at FAR sec. 52.227-19 and subparagraph
    (c) (1) (ii) of the Rights in Technical Data and Computer
    Software clause at DFARS sec. 252.227-7013.
               cisco Systems, Inc.
               170 West Tasman Drive
               San Jose, California 95134-1706
    Cisco Internetwork Operating System Software
    IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(14)EA1a, RELEASE SOFTWARE (fc1)
    Copyright (c) 1986-2003 by cisco Systems, Inc.
    Compiled Tue 02-Sep-03 03:33 by antonino
    Image text-base: 0x80010000, data-base: 0x805C0000
    Initializing flashfs...
    flashfs[1]: 77 files, 3 directories
    flashfs[1]: 0 orphaned files, 0 orphaned directories
    flashfs[1]: Total bytes: 7741440
    flashfs[1]: Bytes used: 5258240
    flashfs[1]: Bytes available: 2483200
    flashfs[1]: flashfs fsck took 7 seconds.
    flashfs[1]: Initialization complete.
    Done initializing flashfs.
    POST: System Board Test : Passed
    POST: Ethernet Controller Test : Passed
    ASIC Initialization Passed
    cisco WS-C2950-24 (RC32300) processor (revision M0) with 20710K bytes of memory.
    Processor board ID FOC0751S0PK
    Last reset from system-reset
    Running Standard Image
    24 FastEthernet/IEEE 802.3 interface(s)
    32K bytes of flash-simulated non-volatile configuration memory.
    Base ethernet MAC Address: 00:0E:84:D8:B3:40
    Motherboard assembly number: 73-5781-12
    Power supply part number: 34-0965-01
    Motherboard serial number: FOC07510SXT
    Power supply serial number: DAB0745FFSW
    Model revision number: M0
    Motherboard revision number: B0
    Model number: WS-C2950-24
    System serial number: FOC0751S0PK
             --- System Configuration Dialog ---
    Would you like to enter the initial configuration dialog? [yes/no]: n

    Now you may enter any changes you wish to make to create your VLAN and routing setups with a fresh vanilla switch setup. This is very easy to do and an essential part of learning Cisco CCNA certifications.

    Here is how to view the vlan configuration.

    Switch>show vlan
    VLAN Name                             Status    Ports
    ---- -------------------------------- --------- -------------------------------
    1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                    Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                    Fa0/9, Fa0/10, Fa0/11, Fa0/12
                                                    Fa0/13, Fa0/14, Fa0/15, Fa0/16
                                                    Fa0/17, Fa0/18, Fa0/19, Fa0/20
                                                    Fa0/21, Fa0/22, Fa0/23, Fa0/24
    1002 fddi-default                     act/unsup
    1003 token-ring-default               act/unsup
    1004 fddinet-default                  act/unsup
    1005 trnet-default                    act/unsup
    VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
    ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
    1    enet  100001     1500  -      -      -        -    -        0      0
    1002 fddi  101002     1500  -      -      -        -    -        0      0
    1003 tr    101003     1500  -      -      -        -    -        0      0
    1004 fdnet 101004     1500  -      -      -        ieee -        0      0
    1005 trnet 101005     1500  -      -      -        ibm  -        0      0
    Remote SPAN VLANs
    Primary Secondary Type              Ports
    ------- --------- ----------------- ------------------------------------------
  • John Cartwright 6:28 PM on February 22, 2015 Permalink | Reply
    Tags: , , ,   

    How to find the Ubuntu version using the command line terminal. 

    The lsb_release -a command will print the Ubuntu version to the terminal. This is how you find out information about your Ubuntu installation.

    [email protected]:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 14.04.2 LTS
    Release:        14.04
    Codename:       trusty

    Use this command to view the support status for your distribution.

    [email protected]:~$ ubuntu-support-status
    Support status summary of 'ip-172-31-20-16':
    You have 443 packages (97.1%) supported until May 2019 (5y)
    You have 7 packages (1.5%) supported until February 2015 (9m)
    You have 3 packages (0.7%) supported until November 2015 (9m)
    You have 0 packages (0.0%) that can not/no-longer be downloaded
    You have 3 packages (0.7%) that are unsupported
    Run with --show-unsupported, --show-supported or --show-all to see more details

    Use the --show-all parameter to show more information.

    [email protected]:~$ ubuntu-support-status --show-all
    Support status summary of 'ip-172-31-20-16':
    You have 3 packages (0.7%) supported until November 2015 (9m)
    You have 443 packages (97.1%) supported until May 2019 (5y)
    You have 7 packages (1.5%) supported until February 2015 (9m)
    You have 0 packages (0.0%) that can not/no-longer be downloaded
    You have 3 packages (0.7%) that are unsupported
    No longer downloadable:
    dos2unix mc mc-data
    Supported until November 2015 (9m):
    linux-headers-3.13.0-44 linux-headers-3.13.0-44-generic
    Supported until May 2019 (5y):
    accountsservice acpid adduser apparmor apport apport-symptoms apt
    apt-transport-https apt-utils apt-xapian-index aptitude
    aptitude-common at base-files base-passwd bash bash-completion bc
    bind9-host bsdmainutils bsdutils busybox-initramfs busybox-static
    byobu bzip2 ca-certificates cloud-guest-utils cloud-init
    command-not-found command-not-found-data console-setup coreutils cpio
    cron cryptsetup cryptsetup-bin curl dash dbus debconf debconf-i18n
    debianutils dh-python diffutils dmidecode dmsetup dnsutils dosfstools
    dpkg e2fslibs e2fsprogs eatmydata ed eject ethtool file findutils
    fonts-ubuntu-font-family-console friendly-recovery ftp fuse gawk
    gcc-4.8-base gcc-4.9-base gdisk geoip-database gettext-base
    gir1.2-glib-2.0 gnupg gpgv grep groff-base grub-common
    grub-gfxpayload-lists grub-pc grub-pc-bin grub2-common gzip hdparm
    hostname ifupdown info init-system-helpers initramfs-tools
    initramfs-tools-bin initscripts insserv install-info iproute2
    iptables iputils-ping iputils-tracepath irqbalance isc-dhcp-client
    isc-dhcp-common iso-codes kbd keyboard-configuration klibc-utils kmod
    krb5-locales landscape-client landscape-common
    language-selector-common laptop-detect less libaccountsservice0
    libacl1 libapparmor-perl libapparmor1 libapt-inst1.5 libapt-pkg4.12
    libarchive-extract-perl libasn1-8-heimdal libasprintf0c2 libattr1
    libaudit-common libaudit1 libbind9-90 libblkid1
    libboost-iostreams1.54.0 libbsd0 libbz2-1.0 libc-bin libc6 libcap-ng0
    libcap2 libcap2-bin libcgmanager0 libck-connector0
    libclass-accessor-perl libcomerr2 libcryptsetup4 libcurl3
    libcurl3-gnutls libcwidget3 libdb5.3 libdbus-1-3 libdbus-glib-1-2
    libdebconfclient0 libdevmapper1.02.1 libdns100 libdrm2 libdumbnet1
    libedit2 libelf1 libept1.4.12 libestr0 libevent-2.0-5 libexpat1
    libffi6 libfreetype6 libfribidi0 libfuse2 libgc1c2 libgcc1 libgck-1-0
    libgcr-3-common libgcr-base-3-1 libgcrypt11 libgdbm3 libgeoip1
    libgirepository-1.0-1 libglib2.0-0 libglib2.0-data
    libgnutls-openssl27 libgnutls26 libgpg-error0 libgpm2
    libgssapi-krb5-2 libgssapi3-heimdal libhcrypto4-heimdal
    libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal libicu52
    libidn11 libio-string-perl libisc95 libisccc90 libisccfg90 libjson-c2
    libjson0 libk5crypto3 libkeyutils1 libklibc libkmod2
    libkrb5-26-heimdal libkrb5-3 libkrb5support0 libldap-2.4-2
    liblocale-gettext-perl liblockfile-bin liblockfile1
    liblog-message-simple-perl liblwres90 liblzma5 liblzo2-2 libmagic1
    libmodule-pluggable-perl libmount1 libmpdec2 libncurses5 libncursesw5
    libnewt0.52 libnfnetlink0 libnih-dbus1 libnih1 libnuma1 libp11-kit0
    libpam-cap libpam-modules libpam-modules-bin libpam-runtime
    libpam-systemd libpam0g libparse-debianchangelog-perl
    libparted0debian1 libpcap0.8 libpci3 libpcre3 libpipeline1
    libpkcs11-helper1 libplymouth2 libpng12-0 libpod-latex-perl
    libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0
    libpopt0 libprocps3 libpython-stdlib libpython2.7
    libpython2.7-minimal libpython2.7-stdlib libpython3-stdlib
    libpython3.4-minimal libpython3.4-stdlib libreadline6
    libroken18-heimdal librtmp0 libsasl2-2 libsasl2-modules
    libsasl2-modules-db libselinux1 libsemanage-common libsemanage1
    libsepol1 libsigc++-2.0-0c2a libsigsegv2 libslang2 libsqlite3-0
    libss2 libssl1.0.0 libstdc++6 libsub-name-perl libsystemd-daemon0
    libsystemd-login0 libtasn1-6 libterm-ui-perl libtext-charwidth-perl
    libtext-iconv-perl libtext-soundex-perl libtext-wrapi18n-perl
    libtimedate-perl libtinfo5 libudev1 libusb-0.1-4 libusb-1.0-0
    libustr-1.0-1 libuuid1 libwind0-heimdal libwrap0 libx11-6 libx11-data
    libxapian22 libxau6 libxcb1 libxdmcp6 libxext6 libxml2 libxmuu1
    libxtables10 libyaml-0-2 linux-headers-generic linux-headers-virtual
    linux-image-virtual linux-virtual locales lockfile-progs login
    logrotate lsb-base lsb-release lshw lsof ltrace makedev man-db
    manpages mawk mime-support mlocate module-init-tools mount mountall
    mtr-tiny multiarch-support nano ncurses-base ncurses-bin ncurses-term
    net-tools netbase netcat-openbsd ntfs-3g ntpdate open-vm-tools
    openssh-client openssh-server openssh-sftp-server openssl openvpn
    os-prober parted passwd patch pciutils perl perl-base perl-modules
    plymouth plymouth-theme-ubuntu-text policykit-1 popularity-contest
    powermgmt-base ppp pppconfig pppoeconf procps psmisc python
    python-apt python-apt-common python-chardet python-cheetah
    python-configobj python-debian python-gdbm python-json-pointer
    python-jsonpatch python-minimal python-oauth python-openssl
    python-pam python-pkg-resources python-prettytable python-pycurl
    python-requests python-serial python-six python-twisted-bin
    python-twisted-core python-twisted-names python-twisted-web
    python-urllib3 python-xapian python-yaml python-zope.interface
    python2.7 python2.7-minimal python3 python3-apport python3-apt
    python3-commandnotfound python3-dbus python3-distupgrade python3-gdbm
    python3-gi python3-minimal python3-newt python3-problem-report
    python3-pycurl python3-software-properties python3-update-manager
    python3.4 python3.4-minimal readline-common resolvconf rsync rsyslog
    run-one screen sed sensible-utils sgml-base shared-mime-info
    software-properties-common ssh-import-id strace sudo systemd-services
    systemd-shim sysv-rc sysvinit-utils tar tasksel tasksel-data tcpd
    tcpdump telnet time tmux tzdata ubuntu-keyring ubuntu-minimal
    ubuntu-release-upgrader-core ubuntu-standard ucf udev ufw
    unattended-upgrades unzip update-manager-core update-notifier-common
    upstart ureadahead usbutils util-linux uuid-runtime vim vim-common
    vim-runtime vim-tiny w3m wget whiptail xauth xkb-data xml-core
    xz-utils zerofree zlib1g
    Supported until February 2015 (9m):
    grub-legacy-ec2 lib32gcc1 lib32stdc++6 libc6-i386 libssh2-1
    overlayroot pollinate

    With these useful commands you may easily keep track of the status of your Ubuntu installation.

  • John Cartwright 12:30 AM on January 31, 2015 Permalink | Reply
    Tags: , , ,   

    How to list all recently logged in users on your Linux system. And other useful Linux tricks. 

    The sudo lastb command will list all recently logged in users on your Linux system. This is a useful tool on a server.

    [email protected]:~$ sudo lastb
    jason    :0           :0               Thu Jan  8 12:41 - 12:41  (00:00)    
    jason    :0           :0               Mon Jan  5 11:42 - 11:42  (00:00)    
    jason    :0           :0               Mon Jan  5 11:42 - 11:42  (00:00)    
    btmp begins Mon Jan  5 11:42:03 2015

    The lastlog command will list all of the users on your system, and will show the last login time if they have logged in before.

    List free space on the / partition. Use the df -Hla / command to show the available space on the partition.

    [email protected]:~$ df -Hla /
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sdb3       235G   76G  160G  33% /

    How to list just the space taken up by a directory and it`s contents. Use the du -ackh DIRNAME | tail -n 1 command.

    [email protected]:~$ du -ackh Desktop/ | tail -n 1
    118M	total

    This will show the amount of space that the directory contents take up on the disk.

    How to list all installed CPU`s in your Linux machine. Use the lscpu command to list all hardware CPU`s installed in your Linux machine.

    [email protected]:~$ lscpu
    Architecture:          x86_64
    CPU op-mode(s):        32-bit, 64-bit
    Byte Order:            Little Endian
    CPU(s):                4
    On-line CPU(s) list:   0-3
    Thread(s) per core:    2
    Core(s) per socket:    2
    Socket(s):             1
    NUMA node(s):          1
    Vendor ID:             GenuineIntel
    CPU family:            6
    Model:                 37
    Model name:            Intel(R) Core(TM) i3 CPU         530  @ 2.93GHz
    Stepping:              2
    CPU MHz:               1197.000
    CPU max MHz:           2926.0000
    CPU min MHz:           1197.0000
    BogoMIPS:              5866.27
    Virtualisation:        VT-x
    L1d cache:             32K
    L1i cache:             32K
    L2 cache:              256K
    L3 cache:              4096K
    NUMA node0 CPU(s):     0-3

    Use printf in bash.

    [email protected]:~$ printf '%s %s\n' "Hello" $LOGNAME
    Hello jason

    How to get the temperature of your hard disk drive with the Linux command line.

    The hddtemp command will display the temperature of a hard disk drive as long as it has a supported temperature sensor.

    [email protected]:~$ sudo hddtemp /dev/sdb
    /dev/sdb: ST3500418AS: 33°C

    Also use the sensors command to read the temperatures of your hardware with the Linux command line. This is how to view the temperature of your video card under Linux.

    [email protected]:~$ sensors
    Adapter: ISA adapter
    Core 0:       +47.0°C  (high = +89.0°C, crit = +105.0°C)
    Core 2:       +45.0°C  (high = +89.0°C, crit = +105.0°C)
    Adapter: PCI adapter
    temp1:        +35.5°C  (crit = +120.0°C, hyst = +90.0°C)
    • RoseHosting Admin 6:21 AM on February 4, 2015 Permalink | Reply

      Nice tips, thanks. Note that you don’t have to pipe the output of du to tail just to get the total size. du has proper arguments for this and you can achieve the same using du -csxh /tmp/ 2>/dev/null

      Thanks again.

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc