29 June 2018

mount LVM2 dalam vmdk


verified vmdk has lvm partition (8E)
# vmware-mount -p .vmdk
Nr      Start       Size Type Id Sytem
-- ---------- ---------- ---- -- ------------------------
 1         63     401562 BIOS 83 Linux
 2     401625   10072755 BIOS 8E Unknown


mount vmdk
# vmware-mount -f .vmdk 
# ls 
flat


Get offset of lv partition
# fdisk -lu /mnt/ROOT/flat

You can do this from the extra functions menu.

Disk /mnt/ROOT/flat: 0 MB, 0 bytes
255 heads, 63 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x0006a266

         Device Boot      Start         End      Blocks   Id  System
/mnt/ROOT/flat1   *          63      401624      200781   83  Linux
/mnt/ROOT/flat2          401625    10474379     5036377+  8e  Linux LVM


Calculate the offset
offset = 401625 * 512      #   >> 205632000   [1 sectors is 512 bytes]

mount to loop device
# losetup -o 205632000 /dev/loop0 /flat


display info
# pvdisplay /dev/loop0
  --- Physical volume ---
  PV Name               /dev/loop0
  VG Name               VolGroup00
  PV Size               4,80 GB / not usable 22,34 MB
  Allocatable           yes
  PE Size (KByte)       32768
  Total PE              153
  Free PE               1
  Allocated PE          152
  PV UUID               MUKx5v-ukpq-fJis-GjpB-Z7dE-nIsI-Xr4bYd


# lvscan
  ACTIVE            '/dev/vg1/isos' [111,79 GB] inherit
  ACTIVE            '/dev/vg0/root' [10,00 GB] inherit
  ACTIVE            '/dev/vg0/swap' [8,00 GB] inherit
  ACTIVE            '/dev/vg0/home' [50,00 GB] inherit
  ACTIVE            '/dev/vg0/data' [164,41 GB] inherit
  inactive          '/dev/VolGroup00/LogVol00' [4,00 GB] inherit
  inactive          '/dev/VolGroup00/LogVol01' [768,00 MB] inherit


incase not active, need to activate the lv
# lvchange -ay /dev/VolGroup00/LogVol00

then, can mount
# mount /dev/VolGroup00/LogVol00


to deactivate lv
# lvchange -an /dev/VolGroup00/LogVol00

to release loop device
# losetup -d /dev/loop0


unmount vmware disk
# vmware-mount -d 



ref: https://xliska.wordpress.com/2010/09/29/access-lvm2-partition-on-vmware-virtual-disk/

20 June 2018

dnssec


 1- dnsclient send recursize query  request domain www.DLB.net

2- dns caching server send query ke root



3- dns caching tanya net zone



4- dns caching server tanya DLB zone



5- dns caching server hantar jawapan ke client.


ref:
https://www.youtube.com/watch?v=_8M_vuFcdZU

https://www.first.org/resources/papers/auckland2016/aucklandtc-20160221-edward_lewis-dns_root_zone_dnssec_operations.pdf

Tandatangan Digital



Digital Signing guna asymetric keys(private/public key)

Penghantar:
1- hantar dokumen asal dan digest yg telah diencryptkan.


Penerima:
2- hashkan dokumen utk hasilkan digest.
3- decryptkan(guna public key penghantar)  'encrypted digest'.
4- bandingkan 2 dan 3, jika sama, sah.


Teknologi Priviate/Public key:
- Jika encrypt guna PrivateKey, hanya PublicKey yg boleh decrypt.
- Jika encrypt guna PublicKey, hanya PrivateKey yg boleh decrypt.
(Hebatankan Matematik..)





ref: https://www.youtube.com/watch?v=_8M_vuFcdZU (3:31)

13 June 2018

tukar id teamviewer

1- tukar macc address network kad
2 tukar /etc/machine-id


ref: https://theitbros.com/reset-teamviewer-id/



additional
edit:
 Modify /etc/systemd/system/teamviewerd.service:
add:
  ExecStartPre= /sbin/ifconfig eth0 hw ether aa:bb:cc:dd:ee:ff


ref: https://askubuntu.com/questions/423314/how-to-change-teamviewer-id-after-cloning

07 June 2018

virtualenv guna python3

1- link python ke python3

update-alternatives --remove python /usr/bin/python2
update-alternatives --install /usr/bin/python python /usr/bin/python3 1

pastikan python --version paparkan python3


2-  link pip ke pip3

  -install
    apt-get install python3-pip
  which pip3

  - link kan
  ln -s /usr/bin/pip3 /usr/bin/pip
  pip -V


3- install virtualenv
  pip install virtualenv

  - setup virtual env for flask(eg)
    virtualenv --python=python3 flask_env

4- enter into flask_env
  source/flask_env/bin/activate

  - prompt will be change
   # (flask_env) mycert@my_dir:

5- nak keluar virt env
   deactivate




ref:
1- https://www.howtoforge.com/tutorial/how-to-install-django-1-10-on-ubuntu-16-04/
2- https://www.howtoforge.com/tutorial/how-to-install-django-on-ubuntu/

20 April 2018

copy file keluar dari router


- ls
Router# dir bootflash:
Directory of bootflash:/
1 -rw- 3173128 cat2948g-in-mz.120-7.W5.14.45
2 -rw- 3173364 cat2948g-in-mz.120-7.W5.14.46


- copy from bootflash to tftp server(default port 69)
Router# copy bootflash: tftp: 
Source filename []? cat2948g-in-mz.120-7.W5.14.46 
Address or name of remote host []? 171.10.0.111 
Destination filename [cat2948g-in-mz.120-7.W5.14.46]? yes

-trouble shoot.
 Need to tell router which interface should the packet use to going out.
 Router(config)#ip tftp source-interface gig0/0/0







ref:
1- https://www.cisco.com/c/en/us/support/docs/routers/12000-series-routers/15094-crashinfo.html
2- https://supportforums.cisco.com/t5/lan-switching-and-routing/error-opening-tftp-timed-out/td-p/2255647

27 March 2018

bunuh yg kebal

Not able to kill a task using kill -9




# ps aux|grep subl 

 root      3018  2.2  1.0 289008

 61872 ?        Ds   12:30   5:27 /opt/sublime_text/sublime_text 


The D in the STAT column means it's in an in "Uninterruptible sleep". That usually translates to something waiting for an IO command. These cannot be interrupted by kill.
You might be able to jimmy it back to life by unmounting your SSHFS mount.