Results 1 to 4 of 4

Thread: Basic Commands

  1. #1

    Basic Commands

    Table of Contents
    Basic commands for:





    Basic commands for the Opertating System (OS)
    **QUICK**
    Code:
    id; uname -a; lsb_release -a


    id (man page)
    Displays the user who executed the program.
    Code:
    root@kali:~# id
    uid=0(root) gid=0(root) groups=0(root)
    root@kali:~#


    uname -a (man page)
    Displays the kernel name, hostname, kernel release, kernel version, machine name, processor (if known), hardware (if known) and operating system.
    Code:
    root@kali:~# uname -a
    Linux kali 3.12-kali1-686-pae #1 SMP Debian 3.12.6-2kali1 (2014-01-06) i686 GNU/Linux
    root@kali:~#

    lsb_release -a (man page)
    Displays which version of Kali-Linux is currently installed
    Code:
    root@kali:~# lsb_release -a
    No LSB modules are available.
    Distributor ID:	Debian
    Description:	Debian GNU/Linux Kali Linux 1.0.6
    Release:	Kali Linux 1.0.6
    Codename:	n/a
    root@kali:~#
    Last edited by g0tmi1k; 2014-04-07 at 01:27 PM.
    This is a Kali-Linux support forum - not general IT/infosec help.

    Useful Commands: OS, Networking, Hardware, Wi-Fi
    Troubleshooting: Kali-Linux Installation, Repository, Wi-Fi Cards (Official Docs)
    Hardware: Recommended 802.11 Wireless Cards

    Search: https://www.kali.org/search/
    Documentation: http://docs.kali.org/ (Offline PDF version)
    Bugs Reporting & Tool Requests: https://bugs.kali.org/
    Kali Tool List, Versions & Man Pages: http://tools.kali.org/

  2. #2
    Basic commands for networking
    **QUICK**
    Code:
    ifconfig; route -n; cat /etc/resolv.conf; cat /etc/network/interfaces; cat /etc/hosts

    ifconfig (man page)
    Displays various bits of information about the NIC (e.g. IP addresses, subnet, MAC address etc).
    Note: ifconfig -a, will display information about ALL NICs (including the ones that are currently down).
    Code:
    root@kali:~# ifconfig
    eth0      Link encap:Ethernet  HWaddr 00:0b:29:9c:c9:b3  
              inet addr:192.168.1.23  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::20c:29ff:ff9b:c9a3/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:292216 errors:0 dropped:0 overruns:0 frame:0
              TX packets:135628 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:431730275 (411.7 MiB)  TX bytes:7398306 (7.0 MiB)
              Interrupt:19 Base address:0x2000 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:26 errors:0 dropped:0 overruns:0 frame:0
              TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:1648 (1.6 KiB)  TX bytes:1648 (1.6 KiB)
    
    root@kali:~#
    You can also alter the state of the NIC by place it in either 'down' or 'up' state, which disables or enables the NIC
    Code:
    root@kali ~$ ifconfig eth0 down
    root@kali ~$ ping -c 1 google.com
    ping: unknown host google.com
    root@kali ~$ ifconfig eth0 up
    root@kali ~$ ping -c 1 google.com
    PING google.com (62.252.173.153) 56(84) bytes of data.
    64 bytes from m409-mp1-cvx1c.lan.ntl.com (62.252.173.153): icmp_req=1 ttl=128 time=18.0 ms
    
    --- google.com ping statistics ---
    1 packets transmitted, 1 received, 0% packet loss, time 0ms
    rtt min/avg/max/mdev = 18.061/18.061/18.061/0.000 ms
    root@kali ~$

    route -n (man page)
    Displays the routing table (gateways information)
    Code:
    root@kali:~# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         192.168.1.2     0.0.0.0         UG    0      0        0 eth0
    192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
    root@kali:~#

    cat /etc/resolv.conf (man page)
    Displays the DNS information
    Code:
    root@kali:~# cat /etc/resolv.conf
    # Generated by NetworkManager
    domain localdomain
    search localdomain
    nameserver 192.168.1.2
    root@kali:~#

    cat /etc/network/interfaces (more information)
    Displays the network interface configuration
    Note: eth0 is setup to use DHCP.
    Code:
    root@kali:~# cat /etc/network/interfaces
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    root@kali:~#

    cat /etc/hosts (man page)
    Static values for hostname lookups
    Note: Editing these values, will NOT change your hostname (for that look into hostname & /etc/hostname).
    Code:
    root@kali:~# cat /etc/hosts
    127.0.0.1	localhost
    127.0.1.1	kali-offsec
    
    # The following lines are desirable for IPv6 capable hosts
    ::1     localhost ip6-localhost ip6-loopback
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    root@kali:~#
    Last edited by g0tmi1k; 2014-03-27 at 10:15 AM.
    This is a Kali-Linux support forum - not general IT/infosec help.

    Useful Commands: OS, Networking, Hardware, Wi-Fi
    Troubleshooting: Kali-Linux Installation, Repository, Wi-Fi Cards (Official Docs)
    Hardware: Recommended 802.11 Wireless Cards

    Search: https://www.kali.org/search/
    Documentation: http://docs.kali.org/ (Offline PDF version)
    Bugs Reporting & Tool Requests: https://bugs.kali.org/
    Kali Tool List, Versions & Man Pages: http://tools.kali.org/

  3. #3
    Basic commands for hardware
    **QUICK**
    Code:
     lspci; lsusb; dmesg; lsmod

    lspci (man page)
    List all PCI devices (e.g. Internal devices).
    Code:
    root@kali:~# lspci 
    00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
    00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
    00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
    00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
    00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
    00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
    00:0f.0 VGA compatible controller: VMware SVGA II Adapter
    00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
    00:11.0 PCI bridge: VMware PCI bridge (rev 02)
    00:15.0 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:15.1 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:15.2 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:15.3 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:15.4 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:15.5 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:15.6 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:15.7 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:16.0 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:16.1 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:16.2 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:16.3 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:16.4 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:16.5 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:16.6 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:16.7 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:17.0 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:17.1 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:17.2 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:17.3 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:17.4 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:17.5 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:17.6 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:17.7 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:18.0 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:18.1 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:18.2 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:18.3 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:18.4 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:18.5 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:18.6 PCI bridge: VMware PCI Express Root Port (rev 01)
    00:18.7 PCI bridge: VMware PCI Express Root Port (rev 01)
    02:00.0 USB controller: VMware USB1.1 UHCI Controller
    02:01.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)
    02:02.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 02)
    02:03.0 USB controller: VMware USB2 EHCI Controller
    02:05.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)
    root@kali:~#

    lsusb (man page)
    List all USB devices (e.g. External devices).
    Code:
    root@kali:~# lsusb 
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
    Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
    Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    root@kali:~#

    dmesg (man page)
    Displays the contents of the kernel buffer (Whats in the kernel log).
    Note: Warning, this may produce a very large output
    Code:
    root@kali:~# dmesg 
    [    0.000000] Initializing cgroup subsys cpuset
    [    0.000000] Initializing cgroup subsys cpu
    [    0.000000] Initializing cgroup subsys cpuacct
    [    0.000000] Linux version 3.12-kali1-686-pae (debian-kernel@lists.debian.org) (gcc version 4.7.2 (Debian 4.7.2-5) ) #1 SMP Debian 3.12.6-2kali1 (2014-01-06)
    [    0.000000] Disabled fast string operations
    ...snip...
    [    3.367400] EXT4-fs (sda1): re-mounted. Opts: (null)
    [    3.407412] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
    [    3.499360] loop: module loaded
    [    4.180582] Netfilter messages via NETLINK v0.30.
    [    4.350865] pcnet32 0000:02:01.0 eth0: link up
    [    5.224520] pcnet32 0000:02:05.0 eth1: link up
    [    7.826665] [drm] width 1024
    [    7.826704] [drm] height 768
    [    7.826716] [drm] bpp 32
    [    7.826771] [drm] Fifo max 0x00200000 min 0x00001000 cap 0x0000077f
    [    7.843755] [drm] width 1024
    [    7.843764] [drm] height 768
    [    7.843771] [drm] bpp 32
    [    7.843827] [drm] Fifo max 0x00200000 min 0x00001000 cap 0x0000077f
    [  187.769500] sda1: WRITE SAME failed. Manually zeroing.
    root@kali:~#

    lsmod (man page)
    Displays the status of modules in the Linux Kernel (e.g. what drivers have been loaded)
    Code:
    root@kali:~# lsmod 
    Module                  Size  Used by
    nfnetlink_log          17065  0 
    nfnetlink              12853  1 nfnetlink_log
    binfmt_misc            12733  1 
    loop                   21962  0 
    dm_crypt               22008  0 
    hid_generic            12369  0 
    usbhid                 39684  0 
    hid                    80998  2 hid_generic,usbhid
    vmw_balloon            12502  0 
    psmouse                76538  0 
    serio_raw              12737  0 
    coretemp               12734  0 
    evdev                  17172  4 
    parport_pc             25991  0 
    parport                35171  1 parport_pc
    processor              27662  0 
    battery                12949  0 
    ac                     12588  0 
    thermal_sys            22960  1 processor
    snd_ens1371            22679  2 
    snd_ac97_codec         96188  1 snd_ens1371
    snd_rawmidi            22278  1 snd_ens1371
    snd_seq_device         12980  1 snd_rawmidi
    snd_pcm                69436  2 snd_ac97_codec,snd_ens1371
    snd_page_alloc         12882  1 snd_pcm
    snd_timer              22002  1 snd_pcm
    vmwgfx                109623  1 
    snd                    50767  10 snd_ac97_codec,snd_timer,snd_pcm,snd_rawmidi,snd_ens1371,snd_seq_device
    soundcore              12890  1 snd
    button                 12824  0 
    ac97_bus               12462  1 snd_ac97_codec
    gameport               13316  1 snd_ens1371
    ttm                    55536  1 vmwgfx
    drm                   198264  3 ttm,vmwgfx
    i2c_piix4              12592  0 
    i2c_core               23371  2 drm,i2c_piix4
    shpchp                 30673  0 
    vmw_vmci               54642  0 
    ext4                  442562  1 
    crc16                  12327  1 ext4
    mbcache                12938  1 ext4
    jbd2                   73110  1 ext4
    dm_mod                 78673  1 dm_crypt
    sr_mod                 21563  0 
    cdrom                  34540  1 sr_mod
    sg                     25628  0 
    ata_generic            12450  0 
    sd_mod                 43598  3 
    crct10dif_generic      12517  1 
    crc_t10dif             12399  1 sd_mod
    crct10dif_common       12340  2 crct10dif_generic,crc_t10dif
    crc32_pclmul           12809  0 
    crc32c_intel           12659  0 
    aesni_intel            17934  0 
    aes_i586               16647  1 aesni_intel
    xts                    12583  1 aesni_intel
    lrw                    12645  1 aesni_intel
    gf128mul               12834  2 lrw,xts
    ablk_helper            12508  1 aesni_intel
    cryptd                 14160  1 ablk_helper
    floppy                 51966  0 
    ehci_pci               12432  0 
    uhci_hcd               26356  0 
    ehci_hcd               43677  1 ehci_pci
    pcnet32                34875  0 
    usbcore               137931  4 uhci_hcd,ehci_hcd,ehci_pci,usbhid
    mii                    12595  1 pcnet32
    usb_common             12408  1 usbcore
    ata_piix               29336  0 
    libata                153595  2 ata_generic,ata_piix
    mptspi                 21663  2 
    scsi_transport_spi     23201  1 mptspi
    mptscsih               22262  1 mptspi
    mptbase                68288  2 mptspi,mptscsih
    scsi_mod              151284  7 sg,scsi_transport_spi,libata,mptspi,sd_mod,sr_mod,mptscsih
    root@kali:~#
    Last edited by g0tmi1k; 2014-03-22 at 02:38 PM.
    This is a Kali-Linux support forum - not general IT/infosec help.

    Useful Commands: OS, Networking, Hardware, Wi-Fi
    Troubleshooting: Kali-Linux Installation, Repository, Wi-Fi Cards (Official Docs)
    Hardware: Recommended 802.11 Wireless Cards

    Search: https://www.kali.org/search/
    Documentation: http://docs.kali.org/ (Offline PDF version)
    Bugs Reporting & Tool Requests: https://bugs.kali.org/
    Kali Tool List, Versions & Man Pages: http://tools.kali.org/

  4. #4
    Basic commands for Wi-Fi troubleshooting
    **QUICK**
    Code:
    airmon-zc --verbose; rfkill list; iwconfig


    Please also see 'hardware'.




    airmon-zc --verbose
    A modified version of airmon-ng, which helps with troubleshooting and monitor mode.
    Code:
    root@kali ~$ airmon-zc --verbose
    
    Linux kali 3.12-kali1-686-pae #1 SMP Debian 3.12.6-2kali1 (2014-01-06) i686 GNU/Linux
    Detected VM using lscpu
    This appears to be a VMware Virtual Machine
    If your system supports VT-d, it may be possible to use PCI devices
    If your system does not support VT-d, you can only use USB wifi cards
    
    K indicates driver is from 3.12-kali1-686-pae
    V indicates driver comes directly from the vendor, almost certainly a bad thing
    S indicates driver comes from the staging tree, these drivers are meant for reference not actual use, BEWARE
    ? indicates we do not know where the driver comes from... report this
    
    
    X[PHY]Interface	Driver[Stack]-FirmwareRev	Chipset							Extended Info
    
    K[phy0]wlan0	rt73usb[mac80211]-1.7	Linksys WUSB54GC v1 802.11g Adapter [Ralink RT73]	
    
    root@kali ~$
    By using the "--verbose", airmon-zc provide a large amount of very useful information when trying to troubleshoot 802.11 NIC issues.


    rfkill (man page)
    Enables (and disables) wireless devices.
    Code:
    root@kali ~$ rfkill list
    2: phy2: Wireless LAN
    	Soft blocked: no
    	Hard blocked: no
    root@kali ~$

    iwconfig (man page)
    Displays & controls 802.11 NICs.
    Code:
    root@kali ~$ iwconfig
    wlan0     IEEE 802.11bg  ESSID:off/any  
              Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm   
              Retry  long limit:7   RTS thr:off   Fragment thr:off
              Encryption key:off
              Power Management:on
              
    root@kali ~$

    airmon-ng (man page)
    Automates turning wireless cards into monitor mode
    Code:
    root@kali ~$ airmon-ng
    
    
    Interface	Chipset		Driver
    
    wlan0		Ralink 2573 USB	rt73usb - [phy1]
    
    root@kali ~$
    Note: "airmon-zc --verbose" displays the same amount of information and more.
    Last edited by g0tmi1k; 2014-04-07 at 02:49 PM.
    This is a Kali-Linux support forum - not general IT/infosec help.

    Useful Commands: OS, Networking, Hardware, Wi-Fi
    Troubleshooting: Kali-Linux Installation, Repository, Wi-Fi Cards (Official Docs)
    Hardware: Recommended 802.11 Wireless Cards

    Search: https://www.kali.org/search/
    Documentation: http://docs.kali.org/ (Offline PDF version)
    Bugs Reporting & Tool Requests: https://bugs.kali.org/
    Kali Tool List, Versions & Man Pages: http://tools.kali.org/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •